chore: update dependencies to rollup 4 and remove unneeded dependencies
This commit is contained in:
parent
e46f668ac8
commit
c4878caef3
25
package.json
25
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rollup-plugin-html-entry2",
|
||||
"version": "0.0.6",
|
||||
"version": "0.0.7",
|
||||
"description": "Teaches rollup how to deal with HTML, allows to use HTML-files as entry-points.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@ -47,7 +47,7 @@
|
||||
"template"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"rollup": "^3.0.0"
|
||||
"rollup": "^4.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"rollup": {
|
||||
@ -81,12 +81,10 @@
|
||||
"lint-staged": "^13.3.0",
|
||||
"nyc": "^15.1.0",
|
||||
"postcss": "^8.4.31",
|
||||
"rollup": "^3.29.4",
|
||||
"rollup": "^4.12.0",
|
||||
"rollup-plugin-delete": "^2.0.0",
|
||||
"rollup-plugin-livereload": "^2.0.5",
|
||||
"rollup-plugin-postcss": "^4.0.2",
|
||||
"tslib": "^2.6.2",
|
||||
"tsx": "^4.4.0",
|
||||
"typescript": "^5.3.2",
|
||||
"puppeteer": "^21.5.2",
|
||||
"mime": "^4.0.0",
|
||||
@ -101,22 +99,5 @@
|
||||
"jest": {
|
||||
"preset":"ts-jest/presets/default-esm",
|
||||
"setupFiles": ["./test/setup.js"]
|
||||
},
|
||||
"ava": {
|
||||
"workerThreads": false,
|
||||
"files": [
|
||||
"!**/fixtures/**",
|
||||
"!**/util/**",
|
||||
"!**/helpers/**",
|
||||
"!**/recipes/**",
|
||||
"!**/types.ts"
|
||||
],
|
||||
"extensions": {
|
||||
"ts": "module",
|
||||
"js": true
|
||||
},
|
||||
"nodeArguments": [
|
||||
"--experimental-vm-modules"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
815
pnpm-lock.yaml
generated
815
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
10
src/index.ts
10
src/index.ts
@ -99,7 +99,8 @@ export default function html(opts: RollupHtmlOptions = {}): Plugin {
|
||||
*
|
||||
*
|
||||
* Rework by testing a stripped down version with JS imports?
|
||||
* - the logic in load should be moved to a transform, properly use rollups ability to specify the plugin should run 'pre' other hooks and see if that allows us to intercept before a commonjs or some other tool horribly transpiles our code
|
||||
* - the logic in load should be moved to a transform, properly use rollups ability to specify the plugin should
|
||||
* run 'pre' other hooks and see if that allows us to intercept before a commonjs or some other tool horribly transpiles our code
|
||||
* - we might need to know which output is being used to properly extract the html back from the result? (in case of not being included in a JS file)
|
||||
*/
|
||||
return {
|
||||
@ -113,9 +114,9 @@ export default function html(opts: RollupHtmlOptions = {}): Plugin {
|
||||
},
|
||||
|
||||
resolveId: {
|
||||
async handler(specifier: string,
|
||||
importer: string | undefined,
|
||||
options: { assertions: Record<string, string> }){
|
||||
async handler(specifier,
|
||||
importer,
|
||||
options){
|
||||
if(virtualSources.has(specifier)) return specifier;
|
||||
if(!filter(specifier)) return;
|
||||
|
||||
@ -206,6 +207,7 @@ export default function html(opts: RollupHtmlOptions = {}): Plugin {
|
||||
virtualSources.set(sourceId, source);
|
||||
}
|
||||
const resolved = await this.resolve(sourceId, id, {
|
||||
skipSelf: false, // defaults to true since rollup 4, and for virtual files this is problematic
|
||||
isEntry: type==='entryChunk',
|
||||
});
|
||||
if(!resolved){
|
||||
|
||||
@ -4,9 +4,9 @@ exports[`basic inline-script 1`] = `
|
||||
[
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "script.body.script.js-e3b82208.js.map",
|
||||
"fileName": "script.body.script.js.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"script.body.script.js-e3b82208.js","sources":["../batman.js","../script.html.body.script.js"],"sourcesContent":["export const b = ()=>'batman';\\nconsole.log(b());\\n","\\n import {b} from \\"./batman.js\\";\\n document.body.appendChild(\\n document.createTextNode(\`Inline script including \${b()}\`)\\n );\\n "],"names":[],"mappings":"AAAO,MAAM,CAAC,GAAG,IAAI,QAAQ,CAAC;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;ACCJ,QAAQ,CAAC,IAAI,CAAC,WAAW;AACrC,gBAAgB,QAAQ,CAAC,cAAc,CAAC,CAAC,wBAAwB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACzE,aAAa"}",
|
||||
"source": "{"version":3,"file":"script.body.script.js.js","sources":["../batman.js","../script.html.body.script.js"],"sourcesContent":["export const b = ()=>'batman';\\nconsole.log(b());\\n","\\n import {b} from \\"./batman.js\\";\\n document.body.appendChild(\\n document.createTextNode(\`Inline script including \${b()}\`)\\n );\\n "],"names":[],"mappings":"AAAO,MAAM,CAAC,GAAG,IAAI,QAAQ,CAAC;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;ACCJ,QAAQ,CAAC,IAAI,CAAC,WAAW;AACrC,gBAAgB,QAAQ,CAAC,cAAc,CAAC,CAAC,wBAAwB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACzE,aAAa"}",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
@ -21,7 +21,7 @@ console.log(b());
|
||||
document.body.appendChild(
|
||||
document.createTextNode(\`Inline script including \${b()}\`)
|
||||
);
|
||||
//# sourceMappingURL=script.body.script.js-e3b82208.js.map
|
||||
//# sourceMappingURL=script.body.script.js.js.map
|
||||
</script>
|
||||
|
||||
|
||||
@ -37,11 +37,11 @@ exports[`basic simple 1`] = `
|
||||
console.log(b());
|
||||
|
||||
export { b };
|
||||
//# sourceMappingURL=batman-c7fa228c.js.map
|
||||
//# sourceMappingURL=batman.js.map
|
||||
",
|
||||
"fileName": "batman-c7fa228c.js",
|
||||
"fileName": "batman.js",
|
||||
"map": SourceMap {
|
||||
"file": "batman-c7fa228c.js",
|
||||
"file": "batman.js",
|
||||
"mappings": "AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;",
|
||||
"names": [],
|
||||
"sources": [
|
||||
@ -58,9 +58,9 @@ console.log(b());
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "batman-c7fa228c.js.map",
|
||||
"fileName": "batman.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"batman-c7fa228c.js","sources":["../batman.js"],"sourcesContent":["export const b = ()=>'batman';\\nconsole.log(b());\\n"],"names":[],"mappings":"AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;"}",
|
||||
"source": "{"version":3,"file":"batman.js","sources":["../batman.js"],"sourcesContent":["export const b = ()=>'batman';\\nconsole.log(b());\\n"],"names":[],"mappings":"AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;"}",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
@ -69,7 +69,7 @@ console.log(b());
|
||||
"source": "<html><head>
|
||||
</head>
|
||||
<body>
|
||||
<script src="batman-c7fa228c.js" type="module"></script>
|
||||
<script src="batman.js" type="module"></script>
|
||||
|
||||
|
||||
</body></html>",
|
||||
|
||||
@ -7,12 +7,6 @@ import {debugPrintOutput, getCode} from "../util/index.ts";
|
||||
|
||||
import html from "../../src/index.ts";
|
||||
|
||||
const output = {
|
||||
dir: 'output', // Output all files
|
||||
format: 'es', // iifi and cjs should be added to tests
|
||||
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
|
||||
};
|
||||
|
||||
import {fileURLToPath} from "node:url";
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
process.chdir(join(__dirname, 'fixtures'));
|
||||
@ -25,7 +19,7 @@ describe("basic", ()=> {
|
||||
html({}),
|
||||
]
|
||||
});
|
||||
const code = await getCode(bundle, output);
|
||||
const code = await getCode(bundle);
|
||||
await bundle.close();
|
||||
debugPrintOutput('simple', code);
|
||||
expect(code).toMatchSnapshot();
|
||||
@ -38,7 +32,7 @@ describe("basic", ()=> {
|
||||
html({}),
|
||||
]
|
||||
});
|
||||
const code = await getCode(bundle, output);
|
||||
const code = await getCode(bundle);
|
||||
await bundle.close();
|
||||
debugPrintOutput('inline-script', code);
|
||||
expect(code).toMatchSnapshot();
|
||||
|
||||
@ -2,160 +2,6 @@
|
||||
|
||||
exports[`evaluated-web-bundle 1`] = `
|
||||
{
|
||||
"code": [
|
||||
{
|
||||
"code": "async function app({root}){
|
||||
|
||||
const states = ['started', 'tick', 'ended'];
|
||||
|
||||
for(let state of states){
|
||||
const text = \`App \${state}\`;
|
||||
console.log(\`Test my sourcemap: \${text}\`);
|
||||
root.innerHTML = \`<div style="align-self: center"><b>\${text}</b></div>\`;
|
||||
await new Promise((resolve,reject)=>
|
||||
setTimeout(()=>resolve(), 10)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export { app };
|
||||
//# sourceMappingURL=app.js.map
|
||||
",
|
||||
"fileName": "app.js",
|
||||
"map": SourceMap {
|
||||
"file": "app.js",
|
||||
"mappings": "AAAO,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;AACjC;AACA,IAAI,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAChD;AACA,IAAI,IAAI,IAAI,KAAK,IAAI,MAAM,CAAC;AAC5B,QAAQ,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AACpC,QAAQ,OAAO,CAAC,GAAG,CAAC,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAClD,QAAQ,IAAI,CAAC,SAAS,GAAG,CAAC,mCAAmC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAChF,QAAQ,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM;AACzC,YAAY,UAAU,CAAC,IAAI,OAAO,EAAE,EAAE,EAAE,CAAC;AACzC,SAAS,CAAC;AACV,KAAK;AACL;;;;",
|
||||
"names": [],
|
||||
"sources": [
|
||||
"../app.mjs",
|
||||
],
|
||||
"sourcesContent": [
|
||||
"export async function app({root}){
|
||||
|
||||
const states = ['started', 'tick', 'ended'];
|
||||
|
||||
for(let state of states){
|
||||
const text = \`App \${state}\`;
|
||||
console.log(\`Test my sourcemap: \${text}\`);
|
||||
root.innerHTML = \`<div style="align-self: center"><b>\${text}</b></div>\`;
|
||||
await new Promise((resolve,reject)=>
|
||||
setTimeout(()=>resolve(), 10)
|
||||
);
|
||||
}
|
||||
}
|
||||
",
|
||||
],
|
||||
"version": 3,
|
||||
},
|
||||
"source": undefined,
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "app.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"app.js","sources":["../app.mjs"],"sourcesContent":["export async function app({root}){\\n\\n const states = ['started', 'tick', 'ended'];\\n\\n for(let state of states){\\n const text = \`App \${state}\`;\\n console.log(\`Test my sourcemap: \${text}\`);\\n root.innerHTML = \`<div style=\\"align-self: center\\"><b>\${text}</b></div>\`;\\n await new Promise((resolve,reject)=>\\n setTimeout(()=>resolve(), 10)\\n );\\n }\\n}\\n"],"names":[],"mappings":"AAAO,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;AACjC;AACA,IAAI,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAChD;AACA,IAAI,IAAI,IAAI,KAAK,IAAI,MAAM,CAAC;AAC5B,QAAQ,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AACpC,QAAQ,OAAO,CAAC,GAAG,CAAC,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAClD,QAAQ,IAAI,CAAC,SAAS,GAAG,CAAC,mCAAmC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAChF,QAAQ,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM;AACzC,YAAY,UAAU,CAAC,IAAI,OAAO,EAAE,EAAE,EAAE,CAAC;AACzC,SAAS,CAAC;AACV,KAAK;AACL;;;;"}",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "index.html",
|
||||
"map": undefined,
|
||||
"source": "<!DOCTYPE html><html lang="en"><head>
|
||||
<meta charset="UTF-8">
|
||||
<title>
|
||||
Test bundle!
|
||||
</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="icon" href="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20512%20512%22%3E%20%20%20%20%3Ctitle%3EHTML5%20Logo%3C%2Ftitle%3E%20%20%20%20%3Cpath%20d%3D%22M108.4%200h23v22.8h21.2V0h23v69h-23V46h-21v23h-23.2M206%2023h-20.3V0h63.7v23H229v46h-23M259.5%200h24.1l14.8%2024.3L313.2%200h24.1v69h-23V34.8l-16.1%2024.8l-16.1-24.8v34.2h-22.6M348.7%200h23v46.2h32.6V69h-55.6%22%2F%3E%20%20%20%20%3Cpath%20fill%3D%22%23e44d26%22%20d%3D%22M107.6%20471l-33-370.4h362.8l-33%20370.2L255.7%20512%22%2F%3E%20%20%20%20%3Cpath%20fill%3D%22%23f16529%22%20d%3D%22M256%20480.5V131H404.3L376%20447%22%2F%3E%20%20%20%20%3Cpath%20fill%3D%22%23ebebeb%22%20d%3D%22M142%20176.3h114v45.4h-64.2l4.2%2046.5h60v45.3H154.4M156.4%20336.3H202l3.2%2036.3%2050.8%2013.6v47.4l-93.2-26%22%2F%3E%20%20%20%20%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M369.6%20176.3H255.8v45.4h109.6M361.3%20268.2H255.8v45.4h56l-5.3%2059-50.7%2013.6v47.2l93-25.8%22%2F%3E%3C%2Fsvg%3E">
|
||||
|
||||
<title>I'm cool!</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root">Here the app should load!</div>
|
||||
<script src="index.js" type="module"></script>
|
||||
|
||||
|
||||
</body></html>",
|
||||
},
|
||||
{
|
||||
"code": "// Dynamically loads libraries and bootstraps the application
|
||||
(async ()=>{
|
||||
// Add a loader here if any
|
||||
const root = document.getElementById('root');
|
||||
if(root) root.innerHTML= \`<div style="align-self: center">My app has loaded!!</div>\`;
|
||||
|
||||
try {
|
||||
// Load app
|
||||
const [
|
||||
appModule,
|
||||
] = await Promise.all([
|
||||
import('./app.js'),
|
||||
]);
|
||||
|
||||
console.log("Bootstrapped, ready to go!");
|
||||
|
||||
// Wait for DOM to be ready
|
||||
if(document.readyState === 'loading') {
|
||||
await new Promise((resolve)=>document.addEventListener('DOMContentLoaded', resolve));
|
||||
}
|
||||
|
||||
// Start the app!
|
||||
await appModule.app({root});
|
||||
}catch(err){
|
||||
console.error(err);
|
||||
}
|
||||
})();
|
||||
//# sourceMappingURL=index.js.map
|
||||
",
|
||||
"fileName": "index.js",
|
||||
"map": SourceMap {
|
||||
"file": "index.js",
|
||||
"mappings": "AAAA;AACA,CAAC,UAAU;AACX;AACA,IAAI,MAAM,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAC;AAChD,IAAI,GAAG,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,yDAAyD,CAAC,CAAC;AACzF;AACA,IAAI,IAAI;AACR;AACA,QAAQ,MAAM;AACd,YAAY,SAAS;AACrB,SAAS,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;AAC9B,YAAY,OAAO,UAAW,CAAC;AAC/B,SAAS,CAAC,CAAC;AACX;AACA,QAAQ,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAClD;AACA;AACA,QAAQ,GAAG,QAAQ,CAAC,UAAU,KAAK,SAAS,EAAE;AAC9C,YAAY,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,CAAC;AACjG,SAAS;AACT;AACA;AACA,QAAQ,MAAM,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACpC,KAAK,MAAM,GAAG,CAAC;AACf,QAAQ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC3B,KAAK;AACL,CAAC",
|
||||
"names": [],
|
||||
"sources": [
|
||||
"../index.mjs",
|
||||
],
|
||||
"sourcesContent": [
|
||||
"// Dynamically loads libraries and bootstraps the application
|
||||
(async ()=>{
|
||||
// Add a loader here if any
|
||||
const root = document.getElementById('root')
|
||||
if(root) root.innerHTML= \`<div style="align-self: center">My app has loaded!!</div>\`;
|
||||
|
||||
try {
|
||||
// Load app
|
||||
const [
|
||||
appModule,
|
||||
] = await Promise.all([
|
||||
import("./app.mjs"),
|
||||
]);
|
||||
|
||||
console.log("Bootstrapped, ready to go!");
|
||||
|
||||
// Wait for DOM to be ready
|
||||
if(document.readyState === 'loading') {
|
||||
await new Promise((resolve)=>document.addEventListener('DOMContentLoaded', resolve));
|
||||
}
|
||||
|
||||
// Start the app!
|
||||
await appModule.app({root});
|
||||
}catch(err){
|
||||
console.error(err);
|
||||
}
|
||||
})()
|
||||
",
|
||||
],
|
||||
"version": 3,
|
||||
},
|
||||
"source": undefined,
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "index.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"index.js","sources":["../index.mjs"],"sourcesContent":["// Dynamically loads libraries and bootstraps the application\\n(async ()=>{\\n // Add a loader here if any\\n const root = document.getElementById('root')\\n if(root) root.innerHTML= \`<div style=\\"align-self: center\\">My app has loaded!!</div>\`;\\n\\n try {\\n // Load app\\n const [\\n appModule,\\n ] = await Promise.all([\\n import(\\"./app.mjs\\"),\\n ]);\\n\\n console.log(\\"Bootstrapped, ready to go!\\");\\n\\n // Wait for DOM to be ready\\n if(document.readyState === 'loading') {\\n await new Promise((resolve)=>document.addEventListener('DOMContentLoaded', resolve));\\n }\\n\\n // Start the app!\\n await appModule.app({root});\\n }catch(err){\\n console.error(err);\\n }\\n})()\\n"],"names":[],"mappings":"AAAA;AACA,CAAC,UAAU;AACX;AACA,IAAI,MAAM,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAC;AAChD,IAAI,GAAG,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,yDAAyD,CAAC,CAAC;AACzF;AACA,IAAI,IAAI;AACR;AACA,QAAQ,MAAM;AACd,YAAY,SAAS;AACrB,SAAS,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;AAC9B,YAAY,OAAO,UAAW,CAAC;AAC/B,SAAS,CAAC,CAAC;AACX;AACA,QAAQ,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAClD;AACA;AACA,QAAQ,GAAG,QAAQ,CAAC,UAAU,KAAK,SAAS,EAAE;AAC9C,YAAY,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,GAAG,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,CAAC;AACjG,SAAS;AACT;AACA;AACA,QAAQ,MAAM,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACpC,KAAK,MAAM,GAAG,CAAC;AACf,QAAQ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC3B,KAAK;AACL,CAAC"}",
|
||||
},
|
||||
],
|
||||
"console": [
|
||||
"[log] Bootstrapped, ready to go!",
|
||||
"[log] Test my sourcemap: App started",
|
||||
|
||||
@ -22,11 +22,11 @@ function render(){
|
||||
}
|
||||
|
||||
export { render };
|
||||
//# sourceMappingURL=index-3d1ca61b.js.map
|
||||
//# sourceMappingURL=index.js.map
|
||||
",
|
||||
"fileName": "index-3d1ca61b.js",
|
||||
"fileName": "index.js",
|
||||
"map": SourceMap {
|
||||
"file": "index-3d1ca61b.js",
|
||||
"file": "index.js",
|
||||
"mappings": "AAAA,aAAe;;ACAf,MAAA,IAAA,GAAA,CAAA;AACA,+BAA+B,EAAwD,MAAA,CAAA;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa,CAAA;;ACRN,SAAS,MAAM,EAAE;AACxB,IAAI,OAAO,IAAI,CAAC;AAChB;;;;",
|
||||
"names": [],
|
||||
"sources": [
|
||||
@ -61,9 +61,9 @@ export function render(){
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "index-3d1ca61b.js.map",
|
||||
"fileName": "index.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"index-3d1ca61b.js","sources":["../icon.svg","../index.html","../index.js"],"sourcesContent":["export default \\"data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2032%2032%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%20%20%3Cpath%20style%3D%22fill%3Anone%3Bstroke%3A%2300ff0d%3Bstroke-width%3A5%3Bstroke-linecap%3Asquare%3Bstroke-linejoin%3Amiter%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A1%22%20d%3D%22M4.1%2014.72%2016%2026.31%2028.38%205.09%22%2F%3E%3C%2Fsvg%3E\\"","<html>\\n <head>\\n <link rel=\\"icon\\" href=\\"./icon.svg\\">\\n <!-- TODO: support for css imports are yet to be added (as simple assets or through a preprocessor-->\\n<!-- <link rel=\\"stylesheet\\" href=\\"./joker.css\\">-->\\n </head>\\n <body>\\n <!-- TODO: this shouldn't have been commented out, but our plugin fails if it is included (which shoudn't happen!!) -->\\n <!--<script src=\\"./batman.js\\" type=\\"module\\"></script>-->\\n </body>\\n</html>\\n","import html from \\"./index.html\\"\\n\\nexport function render(){\\n return html;\\n}\\n"],"names":[],"mappings":"AAAA,aAAe;;ACAf,MAAA,IAAA,GAAA,CAAA;AACA,+BAA+B,EAAwD,MAAA,CAAA;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa,CAAA;;ACRN,SAAS,MAAM,EAAE;AACxB,IAAI,OAAO,IAAI,CAAC;AAChB;;;;"}",
|
||||
"source": "{"version":3,"file":"index.js","sources":["../icon.svg","../index.html","../index.js"],"sourcesContent":["export default \\"data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2032%2032%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%20%20%3Cpath%20style%3D%22fill%3Anone%3Bstroke%3A%2300ff0d%3Bstroke-width%3A5%3Bstroke-linecap%3Asquare%3Bstroke-linejoin%3Amiter%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A1%22%20d%3D%22M4.1%2014.72%2016%2026.31%2028.38%205.09%22%2F%3E%3C%2Fsvg%3E\\"","<html>\\n <head>\\n <link rel=\\"icon\\" href=\\"./icon.svg\\">\\n <!-- TODO: support for css imports are yet to be added (as simple assets or through a preprocessor-->\\n<!-- <link rel=\\"stylesheet\\" href=\\"./joker.css\\">-->\\n </head>\\n <body>\\n <!-- TODO: this shouldn't have been commented out, but our plugin fails if it is included (which shoudn't happen!!) -->\\n <!--<script src=\\"./batman.js\\" type=\\"module\\"></script>-->\\n </body>\\n</html>\\n","import html from \\"./index.html\\"\\n\\nexport function render(){\\n return html;\\n}\\n"],"names":[],"mappings":"AAAA,aAAe;;ACAf,MAAA,IAAA,GAAA,CAAA;AACA,+BAA+B,EAAwD,MAAA,CAAA;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa,CAAA;;ACRN,SAAS,MAAM,EAAE;AACxB,IAAI,OAAO,IAAI,CAAC;AAChB;;;;"}",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
@ -8,11 +8,6 @@ import {debugPrintOutput, getCode} from "../util/index.ts";
|
||||
import html from "../../src/index.ts";
|
||||
import handlebars from "handlebars";
|
||||
|
||||
const output = {
|
||||
dir: 'output', // Output all files
|
||||
format: 'es', // iifi and cjs should be added to tests
|
||||
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
|
||||
};
|
||||
|
||||
import {fileURLToPath} from "node:url";
|
||||
import urlPlugin from "@rollup/plugin-url";
|
||||
@ -39,7 +34,7 @@ test('js-import', async () => {
|
||||
}),
|
||||
]
|
||||
});
|
||||
const code = await getCode(bundle, output);
|
||||
const code = await getCode(bundle);
|
||||
debugPrintOutput('js-import',code);
|
||||
expect(code).toMatchSnapshot();
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -11,11 +11,11 @@ const test = ()=>{
|
||||
console.log(test());
|
||||
|
||||
export { test };
|
||||
//# sourceMappingURL=batman-1a5fc364.js.map
|
||||
//# sourceMappingURL=batman.js.map
|
||||
",
|
||||
"fileName": "batman-1a5fc364.js",
|
||||
"fileName": "batman.js",
|
||||
"map": SourceMap {
|
||||
"file": "batman-1a5fc364.js",
|
||||
"file": "batman.js",
|
||||
"mappings": ";;AAAY,MAAC,IAAI,GAAG,IAAI;AACxB,IAAI,OAAO,CAAC,eAAe,EAAE,8CAA8C,CAAC,iEAAiE,CAAC,CAAC;AAC/I,EAAC;AACD,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;;;;",
|
||||
"names": [],
|
||||
"sources": [
|
||||
@ -34,9 +34,9 @@ console.log(test());
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "batman-1a5fc364.js.map",
|
||||
"fileName": "batman.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"batman-1a5fc364.js","sources":["../batman.js"],"sourcesContent":["export const test = ()=>{\\n return \`I'm \\"annoying\\" \${\\"in case we need to test \\\\\`string\\\\\` escaping.\\"}. Hence this files \\\\'tries\\\\' to include all allowed forms of 'it'\`;\\n}\\nconsole.log(test());\\n"],"names":[],"mappings":";;AAAY,MAAC,IAAI,GAAG,IAAI;AACxB,IAAI,OAAO,CAAC,eAAe,EAAE,8CAA8C,CAAC,iEAAiE,CAAC,CAAC;AAC/I,EAAC;AACD,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;;;;"}",
|
||||
"source": "{"version":3,"file":"batman.js","sources":["../batman.js"],"sourcesContent":["export const test = ()=>{\\n return \`I'm \\"annoying\\" \${\\"in case we need to test \\\\\`string\\\\\` escaping.\\"}. Hence this files \\\\'tries\\\\' to include all allowed forms of 'it'\`;\\n}\\nconsole.log(test());\\n"],"names":[],"mappings":";;AAAY,MAAC,IAAI,GAAG,IAAI;AACxB,IAAI,OAAO,CAAC,eAAe,EAAE,8CAA8C,CAAC,iEAAiE,CAAC,CAAC;AAC/I,EAAC;AACD,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;;;;"}",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
@ -45,7 +45,7 @@ console.log(test());
|
||||
"source": "<html><head>
|
||||
</head>
|
||||
<body>
|
||||
<script src="batman-1a5fc364.js" type="module"></script>
|
||||
<script src="batman.js" type="module"></script>
|
||||
|
||||
|
||||
</body></html>",
|
||||
|
||||
@ -7,12 +7,6 @@ import {debugPrintOutput, getCode} from "../util/index.ts";
|
||||
|
||||
import html from "../../src/index.ts";
|
||||
|
||||
const output = {
|
||||
dir: 'output', // Output all files
|
||||
format: 'es', // iifi and cjs should be added to tests
|
||||
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
|
||||
};
|
||||
|
||||
import {fileURLToPath} from "node:url";
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
process.chdir(join(__dirname, 'fixtures'));
|
||||
@ -29,7 +23,7 @@ test('live-reload', async () => {
|
||||
})
|
||||
]
|
||||
});
|
||||
const code = await getCode(bundle, output);
|
||||
const code = await getCode(bundle);
|
||||
await bundle.close();// Make sure live-reload closes itself
|
||||
debugPrintOutput('live-reload',code);
|
||||
expect(code).toMatchSnapshot();
|
||||
|
||||
@ -7,11 +7,11 @@ exports[`multi-entry 1`] = `
|
||||
console.log(b());
|
||||
|
||||
export { b };
|
||||
//# sourceMappingURL=batman-c7fa228c.js.map
|
||||
//# sourceMappingURL=batman.js.map
|
||||
",
|
||||
"fileName": "admin/batman-c7fa228c.js",
|
||||
"fileName": "admin/batman.js",
|
||||
"map": SourceMap {
|
||||
"file": "batman-c7fa228c.js",
|
||||
"file": "batman.js",
|
||||
"mappings": "AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;",
|
||||
"names": [],
|
||||
"sources": [
|
||||
@ -28,15 +28,15 @@ console.log(b());
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "admin/batman-c7fa228c.js.map",
|
||||
"fileName": "admin/batman.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"batman-c7fa228c.js","sources":["../../admin/batman.js"],"sourcesContent":["export const b = ()=>'batman';\\nconsole.log(b());\\n"],"names":[],"mappings":"AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;"}",
|
||||
"source": "{"version":3,"file":"batman.js","sources":["../../admin/batman.js"],"sourcesContent":["export const b = ()=>'batman';\\nconsole.log(b());\\n"],"names":[],"mappings":"AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;"}",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "admin/index.body.script0.js-15dfaff3.js.map",
|
||||
"fileName": "admin/index.body.script0.js.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"index.body.script0.js-15dfaff3.js","sources":["../../app/admin-deps.js","../../admin/index.html.body.script0.js"],"sourcesContent":["export function adminDeps(){\\n return \\"robin!\\";\\n}\\n","\\n import {bootstrap} from \\"../app/app.js\\"\\n import {adminDeps} from \\"../app/admin-deps.js\\";\\n bootstrap(document.getElementById('root'), adminDeps());\\n "],"names":[],"mappings":";;AAAO,SAAS,SAAS,EAAE;AAC3B,IAAI,OAAO,QAAQ,CAAC;AACpB;;ACCY,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC"}",
|
||||
"source": "{"version":3,"file":"index.body.script0.js.js","sources":["../../app/admin-deps.js","../../admin/index.html.body.script0.js"],"sourcesContent":["export function adminDeps(){\\n return \\"robin!\\";\\n}\\n","\\n import {bootstrap} from \\"../app/app.js\\"\\n import {adminDeps} from \\"../app/admin-deps.js\\";\\n bootstrap(document.getElementById('root'), adminDeps());\\n "],"names":[],"mappings":";;AAAO,SAAS,SAAS,EAAE;AAC3B,IAAI,OAAO,QAAQ,CAAC;AACpB;;ACCY,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC"}",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
@ -46,16 +46,16 @@ console.log(b());
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module">import { b as bootstrap } from '../app-01141b67.js';
|
||||
<script type="module">import { b as bootstrap } from '../app.js';
|
||||
|
||||
function adminDeps(){
|
||||
return "robin!";
|
||||
}
|
||||
|
||||
bootstrap(document.getElementById('root'), adminDeps());
|
||||
//# sourceMappingURL=index.body.script0.js-15dfaff3.js.map
|
||||
//# sourceMappingURL=index.body.script0.js.js.map
|
||||
</script>
|
||||
<script src="batman-c7fa228c.js" type="module"></script>
|
||||
<script src="batman.js" type="module"></script>
|
||||
|
||||
|
||||
</body></html>",
|
||||
@ -69,11 +69,11 @@ bootstrap(document.getElementById('root'), adminDeps());
|
||||
};
|
||||
|
||||
export { bootstrap as b };
|
||||
//# sourceMappingURL=app-01141b67.js.map
|
||||
//# sourceMappingURL=app.js.map
|
||||
",
|
||||
"fileName": "app-01141b67.js",
|
||||
"fileName": "app.js",
|
||||
"map": SourceMap {
|
||||
"file": "app-01141b67.js",
|
||||
"file": "app.js",
|
||||
"mappings": "AAAY,MAAC,SAAS,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,EAAE,GAAG;AACzC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC;AACpB,4BAA4B,EAAE,8CAA8C,CAAC;AAC7E,mBAAmB,EAAE,IAAI,CAAC;AAC1B,IAAI,CAAC,CAAC;AACN;;;;",
|
||||
"names": [],
|
||||
"sources": [
|
||||
@ -94,15 +94,15 @@ export { bootstrap as b };
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "app-01141b67.js.map",
|
||||
"fileName": "app.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"app-01141b67.js","sources":["../app/app.js"],"sourcesContent":["export const bootstrap = (el,deps = [])=>{\\n el.innerHtml = \`\\n <div>I'm \\"annoying\\" \${\\"in case we need to test \\\\\`string\\\\\` escaping.\\"}. Hence this file \\\\'tries\\\\' to include all allowed forms of 'it'</div>\\n <div>Deps: \${deps}</div>\\n \`;\\n}\\n"],"names":[],"mappings":"AAAY,MAAC,SAAS,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,EAAE,GAAG;AACzC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC;AACpB,4BAA4B,EAAE,8CAA8C,CAAC;AAC7E,mBAAmB,EAAE,IAAI,CAAC;AAC1B,IAAI,CAAC,CAAC;AACN;;;;"}",
|
||||
"source": "{"version":3,"file":"app.js","sources":["../app/app.js"],"sourcesContent":["export const bootstrap = (el,deps = [])=>{\\n el.innerHtml = \`\\n <div>I'm \\"annoying\\" \${\\"in case we need to test \\\\\`string\\\\\` escaping.\\"}. Hence this file \\\\'tries\\\\' to include all allowed forms of 'it'</div>\\n <div>Deps: \${deps}</div>\\n \`;\\n}\\n"],"names":[],"mappings":"AAAY,MAAC,SAAS,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,EAAE,GAAG;AACzC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC;AACpB,4BAA4B,EAAE,8CAA8C,CAAC;AAC7E,mBAAmB,EAAE,IAAI,CAAC;AAC1B,IAAI,CAAC,CAAC;AACN;;;;"}",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "index.body.script.js-45303f0f.js.map",
|
||||
"fileName": "index.body.script.js.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"index.body.script.js-45303f0f.js","sources":["../index.html.body.script.js"],"sourcesContent":["\\n import {bootstrap} from \\"./app/app.js\\"\\n bootstrap(document.getElementById('root'), \\"<none>\\");\\n "],"names":[],"mappings":";;AAEY,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC"}",
|
||||
"source": "{"version":3,"file":"index.body.script.js.js","sources":["../index.html.body.script.js"],"sourcesContent":["\\n import {bootstrap} from \\"./app/app.js\\"\\n bootstrap(document.getElementById('root'), \\"<none>\\");\\n "],"names":[],"mappings":";;AAEY,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC"}",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
@ -112,10 +112,10 @@ export { bootstrap as b };
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module">import { b as bootstrap } from './app-01141b67.js';
|
||||
<script type="module">import { b as bootstrap } from './app.js';
|
||||
|
||||
bootstrap(document.getElementById('root'), "<none>");
|
||||
//# sourceMappingURL=index.body.script.js-45303f0f.js.map
|
||||
//# sourceMappingURL=index.body.script.js.js.map
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -6,12 +6,6 @@ import {debugPrintOutput, getCode} from "../util/index.ts";
|
||||
|
||||
import html from "../../src/index.ts";
|
||||
|
||||
const output = {
|
||||
dir: 'output', // Output all files
|
||||
format: 'es', // iifi and cjs should be added to tests
|
||||
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
|
||||
};
|
||||
|
||||
import {fileURLToPath} from "node:url";
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
process.chdir(join(__dirname, 'fixtures'));
|
||||
@ -28,7 +22,7 @@ test('multi-entry', async () => {
|
||||
}),
|
||||
]
|
||||
});
|
||||
const code = await getCode(bundle, output);
|
||||
const code = await getCode(bundle);
|
||||
debugPrintOutput('multi-entry',code);
|
||||
expect(code).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@ -1,68 +1,3 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`rewrite-url 1`] = `
|
||||
[
|
||||
{
|
||||
"code": "const bootstrap = (el,deps = [])=>{
|
||||
el.innerHtml = \`
|
||||
<div>load the app</div>
|
||||
\`;
|
||||
};
|
||||
|
||||
export { bootstrap };
|
||||
//# sourceMappingURL=app-88ed8fd6.js.map
|
||||
",
|
||||
"fileName": "admin/app-88ed8fd6.js",
|
||||
"map": SourceMap {
|
||||
"file": "app-88ed8fd6.js",
|
||||
"mappings": "AAAY,MAAC,SAAS,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,EAAE,GAAG;AACzC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC;AACpB;AACA,IAAI,CAAC,CAAC;AACN;;;;",
|
||||
"names": [],
|
||||
"sources": [
|
||||
"../../admin/app.js",
|
||||
],
|
||||
"sourcesContent": [
|
||||
"export const bootstrap = (el,deps = [])=>{
|
||||
el.innerHtml = \`
|
||||
<div>load the app</div>
|
||||
\`;
|
||||
}
|
||||
",
|
||||
],
|
||||
"version": 3,
|
||||
},
|
||||
"source": undefined,
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "admin/app-88ed8fd6.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"app-88ed8fd6.js","sources":["../../admin/app.js"],"sourcesContent":["export const bootstrap = (el,deps = [])=>{\\n el.innerHtml = \`\\n <div>load the app</div>\\n \`;\\n}\\n"],"names":[],"mappings":"AAAY,MAAC,SAAS,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,EAAE,GAAG;AACzC,IAAI,EAAE,CAAC,SAAS,GAAG,CAAC;AACpB;AACA,IAAI,CAAC,CAAC;AACN;;;;"}",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "admin/index.html",
|
||||
"map": undefined,
|
||||
"source": "<html><head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="/admin/app-88ed8fd6.js" type="module"></script>
|
||||
|
||||
|
||||
</body></html>",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "index.html",
|
||||
"map": undefined,
|
||||
"source": "<html><head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="/admin/app-88ed8fd6.js" type="module"></script>
|
||||
|
||||
|
||||
</body></html>",
|
||||
},
|
||||
]
|
||||
`;
|
||||
exports[`rewrite-url 1`] = `undefined`;
|
||||
|
||||
@ -7,11 +7,11 @@ exports[`handlebars 1`] = `
|
||||
console.log(b());
|
||||
|
||||
export { b };
|
||||
//# sourceMappingURL=batman-c7fa228c.js.map
|
||||
//# sourceMappingURL=batman.js.map
|
||||
",
|
||||
"fileName": "batman-c7fa228c.js",
|
||||
"fileName": "batman.js",
|
||||
"map": SourceMap {
|
||||
"file": "batman-c7fa228c.js",
|
||||
"file": "batman.js",
|
||||
"mappings": "AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;",
|
||||
"names": [],
|
||||
"sources": [
|
||||
@ -28,9 +28,9 @@ console.log(b());
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "batman-c7fa228c.js.map",
|
||||
"fileName": "batman.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"batman-c7fa228c.js","sources":["../batman.js"],"sourcesContent":["export const b = ()=>'batman';\\nconsole.log(b());\\n"],"names":[],"mappings":"AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;"}",
|
||||
"source": "{"version":3,"file":"batman.js","sources":["../batman.js"],"sourcesContent":["export const b = ()=>'batman';\\nconsole.log(b());\\n"],"names":[],"mappings":"AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;"}",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
@ -40,7 +40,7 @@ console.log(b());
|
||||
<meta data-test="a">
|
||||
</head>
|
||||
<body>
|
||||
<script src="batman-c7fa228c.js" type="module"></script>
|
||||
<script src="batman.js" type="module"></script>
|
||||
|
||||
|
||||
</body></html>",
|
||||
|
||||
@ -8,12 +8,6 @@ import {debugPrintOutput, getCode} from "../util/index.ts";
|
||||
import html from "../../src/index.ts";
|
||||
import handlebars from "handlebars";
|
||||
|
||||
const output = {
|
||||
dir: 'output', // Output all files
|
||||
format: 'es', // iifi and cjs should be added to tests
|
||||
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
|
||||
};
|
||||
|
||||
import {fileURLToPath} from "node:url";
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
process.chdir(join(__dirname, 'fixtures'));
|
||||
@ -29,7 +23,7 @@ test('handlebars', async () => {
|
||||
})
|
||||
]
|
||||
});
|
||||
const code = await getCode(bundle, output);
|
||||
const code = await getCode(bundle);
|
||||
debugPrintOutput('handlebars',code);
|
||||
expect(code).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@ -7,11 +7,11 @@ exports[`url-plugin copied-assets 1`] = `
|
||||
console.log(b());
|
||||
|
||||
export { b };
|
||||
//# sourceMappingURL=batman-c7fa228c.js.map
|
||||
//# sourceMappingURL=batman.js.map
|
||||
",
|
||||
"fileName": "batman-c7fa228c.js",
|
||||
"fileName": "batman.js",
|
||||
"map": SourceMap {
|
||||
"file": "batman-c7fa228c.js",
|
||||
"file": "batman.js",
|
||||
"mappings": "AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;",
|
||||
"names": [],
|
||||
"sources": [
|
||||
@ -28,9 +28,9 @@ console.log(b());
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "batman-c7fa228c.js.map",
|
||||
"fileName": "batman.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"batman-c7fa228c.js","sources":["../batman.js"],"sourcesContent":["export const b = ()=>'batman';\\nconsole.log(b());\\n"],"names":[],"mappings":"AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;"}",
|
||||
"source": "{"version":3,"file":"batman.js","sources":["../batman.js"],"sourcesContent":["export const b = ()=>'batman';\\nconsole.log(b());\\n"],"names":[],"mappings":"AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;"}",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
@ -40,7 +40,7 @@ console.log(b());
|
||||
<link rel="icon" href="fb585fdb6db313c9.svg">
|
||||
</head>
|
||||
<body>
|
||||
<script src="batman-c7fa228c.js" type="module"></script>
|
||||
<script src="batman.js" type="module"></script>
|
||||
|
||||
|
||||
</body></html>",
|
||||
@ -55,11 +55,11 @@ exports[`url-plugin inlined-assets 1`] = `
|
||||
console.log(b());
|
||||
|
||||
export { b };
|
||||
//# sourceMappingURL=batman-c7fa228c.js.map
|
||||
//# sourceMappingURL=batman.js.map
|
||||
",
|
||||
"fileName": "batman-c7fa228c.js",
|
||||
"fileName": "batman.js",
|
||||
"map": SourceMap {
|
||||
"file": "batman-c7fa228c.js",
|
||||
"file": "batman.js",
|
||||
"mappings": "AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;",
|
||||
"names": [],
|
||||
"sources": [
|
||||
@ -76,9 +76,9 @@ console.log(b());
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
"fileName": "batman-c7fa228c.js.map",
|
||||
"fileName": "batman.js.map",
|
||||
"map": undefined,
|
||||
"source": "{"version":3,"file":"batman-c7fa228c.js","sources":["../batman.js"],"sourcesContent":["export const b = ()=>'batman';\\nconsole.log(b());\\n"],"names":[],"mappings":"AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;"}",
|
||||
"source": "{"version":3,"file":"batman.js","sources":["../batman.js"],"sourcesContent":["export const b = ()=>'batman';\\nconsole.log(b());\\n"],"names":[],"mappings":"AAAY,MAAC,CAAC,GAAG,IAAI,SAAS;AAC9B,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;;;;"}",
|
||||
},
|
||||
{
|
||||
"code": undefined,
|
||||
@ -88,7 +88,7 @@ console.log(b());
|
||||
<link rel="icon" href="data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2032%2032%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%20%20%3Cpath%20style%3D%22fill%3Anone%3Bstroke%3A%2300ff0d%3Bstroke-width%3A5%3Bstroke-linecap%3Asquare%3Bstroke-linejoin%3Amiter%3Bstroke-dasharray%3Anone%3Bstroke-opacity%3A1%22%20d%3D%22M4.1%2014.72%2016%2026.31%2028.38%205.09%22%2F%3E%3C%2Fsvg%3E">
|
||||
</head>
|
||||
<body>
|
||||
<script src="batman-c7fa228c.js" type="module"></script>
|
||||
<script src="batman.js" type="module"></script>
|
||||
|
||||
|
||||
</body></html>",
|
||||
|
||||
@ -8,11 +8,6 @@ import {debugPrintOutput, getCode} from "../util/index.ts";
|
||||
|
||||
import html from "../../src/index.ts";
|
||||
|
||||
const output = {
|
||||
dir: 'output', // Output all files
|
||||
format: 'es', // iifi and cjs should be added to tests
|
||||
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
|
||||
};
|
||||
|
||||
import {fileURLToPath} from "node:url";
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
@ -38,7 +33,7 @@ describe("url-plugin", ()=>{
|
||||
}),
|
||||
],
|
||||
});
|
||||
const code = await getCode(bundle, output);
|
||||
const code = await getCode(bundle);
|
||||
debugPrintOutput('copied-assets',code);
|
||||
expect(code).toMatchSnapshot();
|
||||
});
|
||||
@ -56,7 +51,7 @@ describe("url-plugin", ()=>{
|
||||
}),
|
||||
]
|
||||
});
|
||||
const code = await getCode(bundle, output);
|
||||
const code = await getCode(bundle);
|
||||
debugPrintOutput('inlined-assets',code);
|
||||
expect(code).toMatchSnapshot();
|
||||
});
|
||||
|
||||
@ -2,8 +2,8 @@ import {Plugin, InputPluginOption, RollupOptions, OutputOptions, RollupOutput} f
|
||||
import {TestOptions as BrowserTestOptions, TestOutput as PuppeteerTestOutput} from "./puppeteer-run-test.js";
|
||||
import { rollup } from "rollup";
|
||||
import serveTest, {LogCallback} from "./serve-test.ts";
|
||||
import type {ExecutionContext} from "ava";
|
||||
import {getCode, TestOutput} from "./code-output.ts";
|
||||
import {defaultOutput} from "./default-output.ts";
|
||||
|
||||
export interface OutputFilterOptions {
|
||||
html?: boolean
|
||||
@ -56,17 +56,11 @@ export async function runBrowserTest(
|
||||
});
|
||||
|
||||
// TODO make configurable?
|
||||
const generated = await bundle.generate({
|
||||
dir: 'output', // Output all files
|
||||
format: 'es', // iifi and cjs should be added to tests
|
||||
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
|
||||
chunkFileNames: '[name].js',
|
||||
entryFileNames: '[name].mjs',
|
||||
assetFileNames: '[name].[extname]',
|
||||
});
|
||||
|
||||
if(output){
|
||||
testOutput.code = await getCode(bundle, output);
|
||||
testOutput.code = await getCode(bundle);
|
||||
}else{
|
||||
const generated = await bundle.generate(defaultOutput);
|
||||
}
|
||||
await bundle.close();
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import type {RollupBuild, OutputOptions, OutputAsset, OutputChunk, SourceMap} from "rollup";
|
||||
import {defaultOutput} from "./default-output.ts";
|
||||
|
||||
export interface TestOutput{
|
||||
code: string,
|
||||
@ -7,7 +8,7 @@ export interface TestOutput{
|
||||
map: any
|
||||
}
|
||||
|
||||
export const getCode = async (bundle: RollupBuild, outputOptions: OutputOptions): Promise<TestOutput[]> => {
|
||||
export const getCode = async (bundle: RollupBuild, outputOptions: OutputOptions = defaultOutput): Promise<TestOutput[]> => {
|
||||
const { output } = await bundle.generate(outputOptions || { format: 'cjs', exports: 'auto' });
|
||||
|
||||
return output.sort((a,b)=> {
|
||||
|
||||
11
test/util/default-output.ts
Normal file
11
test/util/default-output.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import type {OutputOptions} from "rollup";
|
||||
|
||||
export const defaultOutput : OutputOptions = {
|
||||
dir: 'output', // Output all files
|
||||
format: 'es', // iifi and cjs should be added to tests
|
||||
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
|
||||
// Prevent hashes from being added (and screw up the snapshots)
|
||||
chunkFileNames: '[name].js',
|
||||
entryFileNames: '[name].js',
|
||||
assetFileNames: '[name].[extname]',
|
||||
};
|
||||
@ -28,9 +28,6 @@ import type {
|
||||
} from 'http'
|
||||
import type { ServerOptions } from 'https'
|
||||
|
||||
import test, {ExecutionContext} from "ava";
|
||||
import {createReadStream} from "fs";
|
||||
|
||||
|
||||
type TypeMap = {
|
||||
[key: string]: string[];
|
||||
|
||||
@ -8,18 +8,10 @@ import {writeFile} from "node:fs/promises";
|
||||
|
||||
import html from "../../src/index.ts";
|
||||
|
||||
const output = {
|
||||
dir: 'output', // Output all files
|
||||
format: 'es', // iifi and cjs should be added to tests
|
||||
sourcemap: true,// Test if #sourcemapUrl is not accidentally included in the html-output
|
||||
// Prevent hashes from being added (and screw up the snapshots)
|
||||
chunkFileNames: '[name].js',
|
||||
entryFileNames: '[name].[extname]',
|
||||
assetFileNames: '[name].[extname]',
|
||||
};
|
||||
|
||||
import {fileURLToPath} from "node:url";
|
||||
import {pathToFileURL} from "url";
|
||||
import {defaultOutput} from "../util/default-output.ts";
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
process.chdir(join(__dirname, 'fixtures'));
|
||||
|
||||
@ -35,9 +27,10 @@ test('watch', async () => {
|
||||
const path = resolve(__dirname, 'fixtures/watched-file.js');
|
||||
await writeFile(path, origContent, {encoding: 'utf-8'});
|
||||
|
||||
const output = defaultOutput;
|
||||
const watcher = rollup.watch({
|
||||
input: 'index.html',
|
||||
output,
|
||||
output: output,
|
||||
plugins: [
|
||||
html({
|
||||
}),
|
||||
@ -53,7 +46,7 @@ test('watch', async () => {
|
||||
// Just wait on the watch mode to pick up on the changes
|
||||
},
|
||||
async (bundle)=>{
|
||||
const code = await getCode(bundle, output);
|
||||
const code = await getCode(bundle);
|
||||
debugPrintOutput('watch',code);
|
||||
|
||||
// Reset the source file
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user