mirror of
https://github.com/hanzoai/esbuild.git
synced 2026-10-30 14:46:14 +00:00
1262 lines
32 KiB
Plaintext
1262 lines
32 KiB
Plaintext
TestAutoDetectMimeTypeFromExtension
|
|
---------- /out.js ----------
|
|
// test.svg
|
|
var require_test = __commonJS({
|
|
"test.svg"(exports, module) {
|
|
module.exports = "data:image/svg+xml;base64,YQBigGP/ZA==";
|
|
}
|
|
});
|
|
|
|
// entry.js
|
|
console.log(require_test());
|
|
|
|
================================================================================
|
|
TestEmptyLoaderCSS
|
|
---------- /out.js.map ----------
|
|
{
|
|
"version": 3,
|
|
"sources": ["entry.css"],
|
|
"sourcesContent": ["\n\t\t\t\t@import 'a.empty';\n\t\t\t\ta { background: url(b.empty) }\n\t\t\t"],
|
|
"mappings": ";AAEI;AAAI,cAAY;AAAa;",
|
|
"names": []
|
|
}
|
|
|
|
---------- /out.js ----------
|
|
/* entry.css */
|
|
a {
|
|
background: url();
|
|
}
|
|
---------- metafile.json ----------
|
|
{
|
|
"inputs": {
|
|
"a.empty": {
|
|
"bytes": 0,
|
|
"imports": []
|
|
},
|
|
"b.empty": {
|
|
"bytes": 0,
|
|
"imports": []
|
|
},
|
|
"entry.css": {
|
|
"bytes": 62,
|
|
"imports": [
|
|
{
|
|
"path": "a.empty",
|
|
"kind": "import-rule",
|
|
"original": "a.empty"
|
|
},
|
|
{
|
|
"path": "b.empty",
|
|
"kind": "url-token",
|
|
"original": "b.empty"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"outputs": {
|
|
"out.js.map": {
|
|
"imports": [],
|
|
"exports": [],
|
|
"inputs": {},
|
|
"bytes": 203
|
|
},
|
|
"out.js": {
|
|
"imports": [
|
|
{
|
|
"path": "",
|
|
"kind": "url-token",
|
|
"external": true
|
|
}
|
|
],
|
|
"entryPoint": "entry.css",
|
|
"inputs": {
|
|
"entry.css": {
|
|
"bytesInOutput": 27
|
|
}
|
|
},
|
|
"bytes": 43
|
|
}
|
|
}
|
|
}
|
|
|
|
================================================================================
|
|
TestEmptyLoaderJS
|
|
---------- /out.js.map ----------
|
|
{
|
|
"version": 3,
|
|
"sources": ["entry.js"],
|
|
"sourcesContent": ["\n\t\t\t\timport './a.empty'\n\t\t\t\timport * as ns from './b.empty'\n\t\t\t\timport def from './c.empty'\n\t\t\t\timport { named } from './d.empty'\n\t\t\t\tconsole.log(ns, def, named)\n\t\t\t"],
|
|
"mappings": ";;;;;;;;;;;;;AAEI,SAAoB;AACpB,eAAgB;AAEhB,QAAQ,IAAI,IAAI,SAAAA,SAAK,MAAK;",
|
|
"names": ["def"]
|
|
}
|
|
|
|
---------- /out.js ----------
|
|
// b.empty
|
|
var require_b = __commonJS({
|
|
"b.empty"() {
|
|
}
|
|
});
|
|
|
|
// c.empty
|
|
var require_c = __commonJS({
|
|
"c.empty"() {
|
|
}
|
|
});
|
|
|
|
// entry.js
|
|
var ns = __toESM(require_b());
|
|
var import_c = __toESM(require_c());
|
|
console.log(ns, import_c.default, void 0);
|
|
---------- metafile.json ----------
|
|
{
|
|
"inputs": {
|
|
"a.empty": {
|
|
"bytes": 0,
|
|
"imports": []
|
|
},
|
|
"b.empty": {
|
|
"bytes": 0,
|
|
"imports": []
|
|
},
|
|
"c.empty": {
|
|
"bytes": 0,
|
|
"imports": []
|
|
},
|
|
"d.empty": {
|
|
"bytes": 0,
|
|
"imports": []
|
|
},
|
|
"entry.js": {
|
|
"bytes": 165,
|
|
"imports": [
|
|
{
|
|
"path": "a.empty",
|
|
"kind": "import-statement",
|
|
"original": "./a.empty"
|
|
},
|
|
{
|
|
"path": "b.empty",
|
|
"kind": "import-statement",
|
|
"original": "./b.empty"
|
|
},
|
|
{
|
|
"path": "c.empty",
|
|
"kind": "import-statement",
|
|
"original": "./c.empty"
|
|
},
|
|
{
|
|
"path": "d.empty",
|
|
"kind": "import-statement",
|
|
"original": "./d.empty"
|
|
}
|
|
],
|
|
"format": "esm"
|
|
}
|
|
},
|
|
"outputs": {
|
|
"out.js.map": {
|
|
"imports": [],
|
|
"exports": [],
|
|
"inputs": {},
|
|
"bytes": 377
|
|
},
|
|
"out.js": {
|
|
"imports": [],
|
|
"exports": [],
|
|
"entryPoint": "entry.js",
|
|
"inputs": {
|
|
"b.empty": {
|
|
"bytesInOutput": 53
|
|
},
|
|
"c.empty": {
|
|
"bytesInOutput": 53
|
|
},
|
|
"entry.js": {
|
|
"bytesInOutput": 111
|
|
}
|
|
},
|
|
"bytes": 253
|
|
}
|
|
}
|
|
}
|
|
|
|
================================================================================
|
|
TestExtensionlessLoaderCSS
|
|
---------- /out.js ----------
|
|
/* what */
|
|
.foo {
|
|
color: red;
|
|
}
|
|
|
|
/* entry.css */
|
|
|
|
================================================================================
|
|
TestExtensionlessLoaderJS
|
|
---------- /out.js ----------
|
|
// what
|
|
foo();
|
|
|
|
================================================================================
|
|
TestJSXAutomaticNoNameCollision
|
|
---------- /out.js ----------
|
|
var import_react = require("react");
|
|
var import_react2 = require("@remix-run/react");
|
|
const x = /* @__PURE__ */ (0, import_react.createElement)(import_react2.Link, { ...y, key: z });
|
|
|
|
================================================================================
|
|
TestJSXPreserveCapitalLetter
|
|
---------- /out.js ----------
|
|
// foo.js
|
|
var MustStartWithUpperCaseLetter = class {
|
|
};
|
|
|
|
// entry.jsx
|
|
console.log(<MustStartWithUpperCaseLetter />);
|
|
|
|
================================================================================
|
|
TestJSXPreserveCapitalLetterMinify
|
|
---------- /out.js ----------
|
|
// foo.js
|
|
var Y = class {
|
|
};
|
|
|
|
// entry.jsx
|
|
console.log(<Y tag-must-start-with-capital-letter />);
|
|
|
|
================================================================================
|
|
TestJSXPreserveCapitalLetterMinifyNested
|
|
---------- /out.js ----------
|
|
// entry.jsx
|
|
x = () => {
|
|
class Y {
|
|
}
|
|
return <Y tag-must-start-with-capital-letter />;
|
|
};
|
|
|
|
================================================================================
|
|
TestJSXSyntaxInJSWithJSXLoader
|
|
---------- /out.js ----------
|
|
// entry.js
|
|
console.log(/* @__PURE__ */ React.createElement("div", null));
|
|
|
|
================================================================================
|
|
TestLoaderBase64CommonJSAndES6
|
|
---------- /out.js ----------
|
|
// x.b64
|
|
var require_x = __commonJS({
|
|
"x.b64"(exports, module) {
|
|
module.exports = "eA==";
|
|
}
|
|
});
|
|
|
|
// y.b64
|
|
var y_default = "eQ==";
|
|
|
|
// entry.js
|
|
var x_b64 = require_x();
|
|
console.log(x_b64, y_default);
|
|
|
|
================================================================================
|
|
TestLoaderBundleWithImportAttributes
|
|
---------- /out.js ----------
|
|
// data.json
|
|
var data_default = { works: true };
|
|
|
|
// data.json with { type: 'json' }
|
|
var data_default2 = { works: true };
|
|
|
|
// entry.js
|
|
console.log(data_default === data_default, data_default !== data_default2);
|
|
|
|
================================================================================
|
|
TestLoaderBundleWithUnknownImportAttributesAndCopyLoader
|
|
---------- /foo-AKINYSFH.thing ----------
|
|
...
|
|
---------- /bar-AXZXSLHF.thing ----------
|
|
,,,
|
|
---------- /out.js ----------
|
|
// entry.js
|
|
import foo from "./foo-AKINYSFH.thing" with { type: "whatever" };
|
|
import bar from "./bar-AXZXSLHF.thing" with { whatever: "true" };
|
|
console.log(foo, bar);
|
|
|
|
================================================================================
|
|
TestLoaderCopyEntryPointAdvanced
|
|
---------- /out/xyz-DYPYXS7B.copy ----------
|
|
more stuff
|
|
---------- /out/js/input/path.js ----------
|
|
// project/entry.js
|
|
import xyz from "../../xyz-DYPYXS7B.copy";
|
|
console.log(xyz);
|
|
|
|
---------- /out/copy/input/path.copy ----------
|
|
some stuff
|
|
================================================================================
|
|
TestLoaderCopyExplicitOutputFile
|
|
---------- /out/this.worked ----------
|
|
some stuff
|
|
================================================================================
|
|
TestLoaderCopyStartsWithDotAbsPath
|
|
---------- /out/.htaccess ----------
|
|
some stuff
|
|
---------- /out/entry.js ----------
|
|
// project/src/entry.js
|
|
some.stuff();
|
|
|
|
---------- /out/.js ----------
|
|
// project/src/.ts
|
|
foo;
|
|
|
|
================================================================================
|
|
TestLoaderCopyStartsWithDotRelPath
|
|
---------- /out/.htaccess ----------
|
|
some stuff
|
|
---------- /out/entry.js ----------
|
|
// entry.js
|
|
some.stuff();
|
|
|
|
---------- /out/.js ----------
|
|
// .ts
|
|
foo;
|
|
|
|
================================================================================
|
|
TestLoaderCopyUseIndex
|
|
---------- /out/index.copy ----------
|
|
some stuff
|
|
================================================================================
|
|
TestLoaderCopyWithBundleEntryPoint
|
|
---------- /out/assets/some.file ----------
|
|
stuff
|
|
---------- /out/src/entry.js ----------
|
|
// Users/user/project/src/entry.js
|
|
import x from "../assets/some.file";
|
|
console.log(x);
|
|
|
|
---------- /out/src/entry.css ----------
|
|
/* Users/user/project/src/entry.css */
|
|
body {
|
|
background: url("../assets/some.file");
|
|
}
|
|
---------- metafile.json ----------
|
|
{
|
|
"inputs": {
|
|
"Users/user/project/assets/some.file": {
|
|
"bytes": 5,
|
|
"imports": []
|
|
},
|
|
"Users/user/project/src/entry.js": {
|
|
"bytes": 63,
|
|
"imports": [
|
|
{
|
|
"path": "Users/user/project/assets/some.file",
|
|
"kind": "import-statement",
|
|
"original": "../assets/some.file"
|
|
}
|
|
],
|
|
"format": "esm"
|
|
},
|
|
"Users/user/project/src/entry.css": {
|
|
"bytes": 64,
|
|
"imports": [
|
|
{
|
|
"path": "Users/user/project/assets/some.file",
|
|
"kind": "url-token",
|
|
"original": "../assets/some.file"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"outputs": {
|
|
"out/assets/some.file": {
|
|
"imports": [],
|
|
"exports": [],
|
|
"entryPoint": "Users/user/project/assets/some.file",
|
|
"inputs": {
|
|
"Users/user/project/assets/some.file": {
|
|
"bytesInOutput": 5
|
|
}
|
|
},
|
|
"bytes": 5
|
|
},
|
|
"out/src/entry.js": {
|
|
"imports": [
|
|
{
|
|
"path": "out/assets/some.file",
|
|
"kind": "import-statement"
|
|
}
|
|
],
|
|
"exports": [],
|
|
"entryPoint": "Users/user/project/src/entry.js",
|
|
"inputs": {
|
|
"Users/user/project/src/entry.js": {
|
|
"bytesInOutput": 53
|
|
}
|
|
},
|
|
"bytes": 88
|
|
},
|
|
"out/src/entry.css": {
|
|
"imports": [
|
|
{
|
|
"path": "out/assets/some.file",
|
|
"kind": "url-token"
|
|
}
|
|
],
|
|
"entryPoint": "Users/user/project/src/entry.css",
|
|
"inputs": {
|
|
"Users/user/project/src/entry.css": {
|
|
"bytesInOutput": 51
|
|
}
|
|
},
|
|
"bytes": 90
|
|
}
|
|
}
|
|
}
|
|
|
|
================================================================================
|
|
TestLoaderCopyWithBundleFromCSS
|
|
---------- /out/some-BYATPJRB.file ----------
|
|
stuff
|
|
---------- /out/src/entry.css ----------
|
|
/* Users/user/project/src/entry.css */
|
|
body {
|
|
background: url("../some-BYATPJRB.file");
|
|
}
|
|
|
|
================================================================================
|
|
TestLoaderCopyWithBundleFromJS
|
|
---------- /out/some-BYATPJRB.file ----------
|
|
stuff
|
|
---------- /out/src/entry.js ----------
|
|
// Users/user/project/src/entry.js
|
|
import x from "../some-BYATPJRB.file";
|
|
console.log(x);
|
|
|
|
================================================================================
|
|
TestLoaderCopyWithFormat
|
|
---------- /out/src/entry.js ----------
|
|
(() => {
|
|
console.log("entry");
|
|
})();
|
|
|
|
---------- /out/assets/some.file ----------
|
|
stuff
|
|
================================================================================
|
|
TestLoaderCopyWithInjectedFileBundle
|
|
---------- /out/inject-IFR6YGWW.js ----------
|
|
console.log('in inject.js')
|
|
---------- /out/entry.js ----------
|
|
// src/entry.ts
|
|
import "./inject-IFR6YGWW.js";
|
|
console.log("in entry.ts");
|
|
|
|
================================================================================
|
|
TestLoaderCopyWithTransform
|
|
---------- /out/src/entry.js ----------
|
|
console.log("entry");
|
|
|
|
---------- /out/assets/some.file ----------
|
|
stuff
|
|
================================================================================
|
|
TestLoaderDataURLApplicationJSON
|
|
---------- /out/entry.js ----------
|
|
// <data:application/json,"%31%32%33">
|
|
var json_31_32_33_default = "123";
|
|
|
|
// <data:application/json;base64,eyJ3b3JrcyI6dHJ1ZX0=>
|
|
var json_base64_eyJ3b3JrcyI6dHJ1ZX0_default = { works: true };
|
|
|
|
// <data:application/json;charset=UTF-8,%31%32%33>
|
|
var json_charset_UTF_8_31_32_33_default = 123;
|
|
|
|
// <data:application/json;charset=UTF-8;base64,eyJ3b3JrcyI6dHJ1ZX0=>
|
|
var json_charset_UTF_8_base64_eyJ3b3JrcyI6dHJ1ZX0_default = { works: true };
|
|
|
|
// entry.js
|
|
console.log([
|
|
json_31_32_33_default,
|
|
json_base64_eyJ3b3JrcyI6dHJ1ZX0_default,
|
|
json_charset_UTF_8_31_32_33_default,
|
|
json_charset_UTF_8_base64_eyJ3b3JrcyI6dHJ1ZX0_default
|
|
]);
|
|
|
|
================================================================================
|
|
TestLoaderDataURLBase64InvalidUTF8
|
|
---------- /out.js ----------
|
|
// binary.txt
|
|
var binary_default = "data:text/plain;charset=utf-8;base64,/w==";
|
|
|
|
// entry.js
|
|
console.log(binary_default);
|
|
|
|
================================================================================
|
|
TestLoaderDataURLBase64VsPercentEncoding
|
|
---------- /out.js ----------
|
|
// shouldUsePercent_1.txt
|
|
var shouldUsePercent_1_default = "data:text/plain;charset=utf-8,%0A%0A%0A";
|
|
|
|
// shouldUsePercent_2.txt
|
|
var shouldUsePercent_2_default = "data:text/plain;charset=utf-8,%0A%0A%0A%0A";
|
|
|
|
// shouldUseBase64_1.txt
|
|
var shouldUseBase64_1_default = "data:text/plain;charset=utf-8;base64,CgoKCgo=";
|
|
|
|
// shouldUseBase64_2.txt
|
|
var shouldUseBase64_2_default = "data:text/plain;charset=utf-8;base64,CgoKCgoK";
|
|
|
|
// entry.js
|
|
console.log(
|
|
shouldUsePercent_1_default,
|
|
shouldUsePercent_2_default,
|
|
shouldUseBase64_1_default,
|
|
shouldUseBase64_2_default
|
|
);
|
|
|
|
================================================================================
|
|
TestLoaderDataURLCommonJSAndES6
|
|
---------- /out.js ----------
|
|
// x.txt
|
|
var require_x = __commonJS({
|
|
"x.txt"(exports, module) {
|
|
module.exports = "data:text/plain;charset=utf-8,x";
|
|
}
|
|
});
|
|
|
|
// y.txt
|
|
var y_default = "data:text/plain;charset=utf-8,y";
|
|
|
|
// entry.js
|
|
var x_url = require_x();
|
|
console.log(x_url, y_default);
|
|
|
|
================================================================================
|
|
TestLoaderDataURLEscapePercents
|
|
---------- /out.js ----------
|
|
// percents.txt
|
|
var percents_default = "data:text/plain;charset=utf-8,%0A%, %3, %2533, %25333%0A%, %e, %25ee, %25eee%0A%, %E, %25EE, %25EEE%0A";
|
|
|
|
// entry.js
|
|
console.log(percents_default);
|
|
|
|
================================================================================
|
|
TestLoaderDataURLExtensionBasedMIME
|
|
---------- /out/entry.js ----------
|
|
// example.css
|
|
var example_default = "data:text/css;charset=utf-8,css";
|
|
|
|
// example.eot
|
|
var example_default2 = "data:application/vnd.ms-fontobject,eot";
|
|
|
|
// example.gif
|
|
var example_default3 = "data:image/gif,gif";
|
|
|
|
// example.htm
|
|
var example_default4 = "data:text/html;charset=utf-8,htm";
|
|
|
|
// example.html
|
|
var example_default5 = "data:text/html;charset=utf-8,html";
|
|
|
|
// example.jpeg
|
|
var example_default6 = "data:image/jpeg,jpeg";
|
|
|
|
// example.jpg
|
|
var example_default7 = "data:image/jpeg,jpg";
|
|
|
|
// example.js
|
|
var example_default8 = "data:text/javascript;charset=utf-8,js";
|
|
|
|
// example.json
|
|
var example_default9 = "data:application/json;charset=utf-8,json";
|
|
|
|
// example.mjs
|
|
var example_default10 = "data:text/javascript;charset=utf-8,mjs";
|
|
|
|
// example.otf
|
|
var example_default11 = "data:font/otf,otf";
|
|
|
|
// example.pdf
|
|
var example_default12 = "data:application/pdf,pdf";
|
|
|
|
// example.png
|
|
var example_default13 = "data:image/png,png";
|
|
|
|
// example.sfnt
|
|
var example_default14 = "data:font/sfnt,sfnt";
|
|
|
|
// example.svg
|
|
var example_default15 = "data:image/svg+xml,svg";
|
|
|
|
// example.ttf
|
|
var example_default16 = "data:font/ttf,ttf";
|
|
|
|
// example.wasm
|
|
var example_default17 = "data:application/wasm,wasm";
|
|
|
|
// example.webp
|
|
var example_default18 = "data:image/webp,webp";
|
|
|
|
// example.woff
|
|
var example_default19 = "data:font/woff,woff";
|
|
|
|
// example.woff2
|
|
var example_default20 = "data:font/woff2,woff2";
|
|
|
|
// example.xml
|
|
var example_default21 = "data:text/xml;charset=utf-8,xml";
|
|
export {
|
|
example_default as css,
|
|
example_default2 as eot,
|
|
example_default3 as gif,
|
|
example_default4 as htm,
|
|
example_default5 as html,
|
|
example_default6 as jpeg,
|
|
example_default7 as jpg,
|
|
example_default8 as js,
|
|
example_default9 as json,
|
|
example_default10 as mjs,
|
|
example_default11 as otf,
|
|
example_default12 as pdf,
|
|
example_default13 as png,
|
|
example_default14 as sfnt,
|
|
example_default15 as svg,
|
|
example_default16 as ttf,
|
|
example_default17 as wasm,
|
|
example_default18 as webp,
|
|
example_default19 as woff,
|
|
example_default20 as woff2,
|
|
example_default21 as xml
|
|
};
|
|
|
|
================================================================================
|
|
TestLoaderDataURLHashSuffixIssue4370
|
|
---------- /out/icons.css ----------
|
|
/* icons.css */
|
|
.triangle {
|
|
width: 10px;
|
|
height: 10px;
|
|
background: currentColor;
|
|
clip-path: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="x"><path d="M0 0H10V10Z"/></clipPath></defs></svg>#x');
|
|
}
|
|
|
|
================================================================================
|
|
TestLoaderDataURLTextCSS
|
|
---------- /out/entry.css ----------
|
|
/* <data:text/css,body{color:%72%65%64}> */
|
|
body {
|
|
color: red;
|
|
}
|
|
|
|
/* <data:text/css;base64,Ym9keXtiYWNrZ3JvdW5kOmJsdWV9> */
|
|
body {
|
|
background: blue;
|
|
}
|
|
|
|
/* <data:text/css;charset=UTF-8,body{color:%72%65%64}> */
|
|
body {
|
|
color: red;
|
|
}
|
|
|
|
/* <data:text/css;charset=UTF-8;base64,Ym9keXtiYWNrZ3JvdW5kOmJsdWV9> */
|
|
body {
|
|
background: blue;
|
|
}
|
|
|
|
/* entry.css */
|
|
|
|
================================================================================
|
|
TestLoaderDataURLTextJavaScript
|
|
---------- /out/entry.js ----------
|
|
// <data:text/javascript,console.log('%31%32%33')>
|
|
console.log("123");
|
|
|
|
// <data:text/javascript;base64,Y29uc29sZS5sb2coMjM0KQ==>
|
|
console.log(234);
|
|
|
|
// <data:text/javascript;charset=UTF-8,console.log(%31%32%33)>
|
|
console.log(123);
|
|
|
|
// <data:text/javascript;charset=UTF-8;base64,Y29uc29sZS5sb2coMjM0KQ...>
|
|
console.log(234);
|
|
|
|
================================================================================
|
|
TestLoaderDataURLTextJavaScriptPlusCharacter
|
|
---------- /out/entry.js ----------
|
|
// <data:text/javascript,console.log(1+2)>
|
|
console.log(1 + 2);
|
|
|
|
================================================================================
|
|
TestLoaderDataURLUnknownMIME
|
|
---------- /out/entry.js ----------
|
|
// entry.js
|
|
import a from "data:some/thing;what,someData%31%32%33";
|
|
import b from "data:other/thing;stuff;base64,c29tZURhdGEyMzQ=";
|
|
console.log(a, b);
|
|
|
|
================================================================================
|
|
TestLoaderFile
|
|
---------- /out/test-IPILGNO5.svg ----------
|
|
<svg></svg>
|
|
---------- /out/entry.js ----------
|
|
// test.svg
|
|
var require_test = __commonJS({
|
|
"test.svg"(exports, module) {
|
|
module.exports = "./test-IPILGNO5.svg";
|
|
}
|
|
});
|
|
|
|
// entry.js
|
|
console.log(require_test());
|
|
|
|
================================================================================
|
|
TestLoaderFileCommonJSAndES6
|
|
---------- /y-YE5AYNFB.txt ----------
|
|
y
|
|
---------- /x-LSAMBFUD.txt ----------
|
|
x
|
|
---------- /out.js ----------
|
|
// x.txt
|
|
var require_x = __commonJS({
|
|
"x.txt"(exports, module) {
|
|
module.exports = "./x-LSAMBFUD.txt";
|
|
}
|
|
});
|
|
|
|
// y.txt
|
|
var y_default = "./y-YE5AYNFB.txt";
|
|
|
|
// entry.js
|
|
var x_url = require_x();
|
|
console.log(x_url, y_default);
|
|
|
|
================================================================================
|
|
TestLoaderFileExtPathAssetNamesJS
|
|
---------- /out/png/image-LSAMBFUD.png ----------
|
|
x
|
|
---------- /out/txt/file-YE5AYNFB.txt ----------
|
|
y
|
|
---------- /out/entries/entry.js ----------
|
|
// src/images/image.png
|
|
var image_default = "../png/image-LSAMBFUD.png";
|
|
|
|
// src/uploads/file.txt
|
|
var file_default = "../txt/file-YE5AYNFB.txt";
|
|
|
|
// src/entries/entry.js
|
|
console.log(image_default, file_default);
|
|
|
|
================================================================================
|
|
TestLoaderFileMultipleNoCollision
|
|
---------- /dist/test-J7OMUXO3.txt ----------
|
|
test
|
|
---------- /dist/out.js ----------
|
|
// a/test.txt
|
|
var require_test = __commonJS({
|
|
"a/test.txt"(exports, module) {
|
|
module.exports = "./test-J7OMUXO3.txt";
|
|
}
|
|
});
|
|
|
|
// b/test.txt
|
|
var require_test2 = __commonJS({
|
|
"b/test.txt"(exports, module) {
|
|
module.exports = "./test-J7OMUXO3.txt";
|
|
}
|
|
});
|
|
|
|
// entry.js
|
|
console.log(
|
|
require_test(),
|
|
require_test2()
|
|
);
|
|
|
|
================================================================================
|
|
TestLoaderFileOneSourceTwoDifferentOutputPathsCSS
|
|
---------- /out/common-LSAMBFUD.png ----------
|
|
x
|
|
---------- /out/entries/entry.css ----------
|
|
/* src/shared/common.css */
|
|
div {
|
|
background: url("../common-LSAMBFUD.png");
|
|
}
|
|
|
|
/* src/entries/entry.css */
|
|
|
|
---------- /out/entries/other/entry.css ----------
|
|
/* src/shared/common.css */
|
|
div {
|
|
background: url("../../common-LSAMBFUD.png");
|
|
}
|
|
|
|
/* src/entries/other/entry.css */
|
|
|
|
================================================================================
|
|
TestLoaderFileOneSourceTwoDifferentOutputPathsJS
|
|
---------- /out/common-LSAMBFUD.png ----------
|
|
x
|
|
---------- /out/entries/entry.js ----------
|
|
// src/shared/common.png
|
|
var common_default = "../common-LSAMBFUD.png";
|
|
|
|
// src/shared/common.js
|
|
console.log(common_default);
|
|
|
|
---------- /out/entries/other/entry.js ----------
|
|
// src/shared/common.png
|
|
var common_default = "../../common-LSAMBFUD.png";
|
|
|
|
// src/shared/common.js
|
|
console.log(common_default);
|
|
|
|
================================================================================
|
|
TestLoaderFilePublicPathAssetNamesCSS
|
|
---------- /out/images/image-LSAMBFUD.png ----------
|
|
x
|
|
---------- /out/entries/entry.css ----------
|
|
/* src/entries/entry.css */
|
|
div {
|
|
background: url("https://example.com/images/image-LSAMBFUD.png");
|
|
}
|
|
|
|
================================================================================
|
|
TestLoaderFilePublicPathAssetNamesJS
|
|
---------- /out/images/image-LSAMBFUD.png ----------
|
|
x
|
|
---------- /out/entries/entry.js ----------
|
|
// src/images/image.png
|
|
var image_default = "https://example.com/images/image-LSAMBFUD.png";
|
|
|
|
// src/entries/entry.js
|
|
console.log(image_default);
|
|
|
|
================================================================================
|
|
TestLoaderFilePublicPathCSS
|
|
---------- /out/image-LSAMBFUD.png ----------
|
|
x
|
|
---------- /out/entries/entry.css ----------
|
|
/* src/entries/entry.css */
|
|
div {
|
|
background: url("https://example.com/image-LSAMBFUD.png");
|
|
}
|
|
|
|
================================================================================
|
|
TestLoaderFilePublicPathJS
|
|
---------- /out/image-LSAMBFUD.png ----------
|
|
x
|
|
---------- /out/entries/entry.js ----------
|
|
// src/images/image.png
|
|
var image_default = "https://example.com/image-LSAMBFUD.png";
|
|
|
|
// src/entries/entry.js
|
|
console.log(image_default);
|
|
|
|
================================================================================
|
|
TestLoaderFileRelativePathAssetNamesCSS
|
|
---------- /out/images/image-LSAMBFUD.png ----------
|
|
x
|
|
---------- /out/entries/entry.css ----------
|
|
/* src/entries/entry.css */
|
|
div {
|
|
background: url("../images/image-LSAMBFUD.png");
|
|
}
|
|
|
|
================================================================================
|
|
TestLoaderFileRelativePathAssetNamesJS
|
|
---------- /out/images/image-LSAMBFUD.png ----------
|
|
x
|
|
---------- /out/entries/entry.js ----------
|
|
// src/images/image.png
|
|
var image_default = "../images/image-LSAMBFUD.png";
|
|
|
|
// src/entries/entry.js
|
|
console.log(image_default);
|
|
|
|
================================================================================
|
|
TestLoaderFileRelativePathCSS
|
|
---------- /out/image-LSAMBFUD.png ----------
|
|
x
|
|
---------- /out/entries/entry.css ----------
|
|
/* src/entries/entry.css */
|
|
div {
|
|
background: url("../image-LSAMBFUD.png");
|
|
}
|
|
|
|
================================================================================
|
|
TestLoaderFileRelativePathJS
|
|
---------- /out/image-LSAMBFUD.png ----------
|
|
x
|
|
---------- /out/entries/entry.js ----------
|
|
// src/images/image.png
|
|
var image_default = "../image-LSAMBFUD.png";
|
|
|
|
// src/entries/entry.js
|
|
console.log(image_default);
|
|
|
|
================================================================================
|
|
TestLoaderFileWithQueryParameter
|
|
---------- /out/file-UEHVHXRQ.txt ----------
|
|
This is some text
|
|
---------- /out/entry.js ----------
|
|
// file.txt?foo
|
|
var file_default = "./file-UEHVHXRQ.txt?foo";
|
|
|
|
// file.txt?bar
|
|
var file_default2 = "./file-UEHVHXRQ.txt?bar";
|
|
|
|
// entry.js
|
|
console.log(file_default, file_default2);
|
|
|
|
================================================================================
|
|
TestLoaderFromExtensionWithQueryParameter
|
|
---------- /out/entry.js ----------
|
|
// file.abc?query.xyz
|
|
var file_default = "This should not be base64 encoded";
|
|
|
|
// entry.js
|
|
console.log(file_default);
|
|
|
|
================================================================================
|
|
TestLoaderInlineSourceMapAbsolutePathIssue4075Unix
|
|
---------- /out/entry.css.map ----------
|
|
{
|
|
"version": 3,
|
|
"sources": ["src/styles1.scss", "src/styles2.scss"],
|
|
"sourcesContent": ["/* You can add global styles to this file, and also import other style files */\n* {\n content: \"foo\"\n}\n", "/* You can add global styles to this file, and also import other style files */\n* {\n content: \"bar\"\n}\n"],
|
|
"mappings": ";AACA;AACE,WAAS;;;;ACDX;AACE,WAAS;;",
|
|
"names": []
|
|
}
|
|
|
|
---------- /out/entry.css ----------
|
|
/* home/user/project/src/styles1.css */
|
|
* {
|
|
content: "foo";
|
|
}
|
|
|
|
/* home/user/project/src/styles2.css */
|
|
* {
|
|
content: "bar";
|
|
}
|
|
|
|
/* home/user/project/src/entry.css */
|
|
/*# sourceMappingURL=entry.css.map */
|
|
|
|
================================================================================
|
|
TestLoaderInlineSourceMapAbsolutePathIssue4075Windows
|
|
---------- /out/entry.css.map ----------
|
|
{
|
|
"version": 3,
|
|
"sources": ["src/styles1.scss", "src/styles2.scss"],
|
|
"sourcesContent": ["/* You can add global styles to this file, and also import other style files */\n* {\n content: \"foo\"\n}\n", "/* You can add global styles to this file, and also import other style files */\n* {\n content: \"bar\"\n}\n"],
|
|
"mappings": ";AACA;AACE,WAAS;;;;ACDX;AACE,WAAS;;",
|
|
"names": []
|
|
}
|
|
|
|
---------- /out/entry.css ----------
|
|
/* home/user/project/src/styles1.css */
|
|
* {
|
|
content: "foo";
|
|
}
|
|
|
|
/* home/user/project/src/styles2.css */
|
|
* {
|
|
content: "bar";
|
|
}
|
|
|
|
/* home/user/project/src/entry.css */
|
|
/*# sourceMappingURL=entry.css.map */
|
|
|
|
================================================================================
|
|
TestLoaderJSONCommonJSAndES6
|
|
---------- /out.js ----------
|
|
// x.json
|
|
var require_x = __commonJS({
|
|
"x.json"(exports, module) {
|
|
module.exports = { x: true };
|
|
}
|
|
});
|
|
|
|
// y.json
|
|
var y_default = { y1: true, y2: false };
|
|
|
|
// z.json
|
|
var small = "some small text";
|
|
var if2 = "test keyword imports";
|
|
|
|
// entry.js
|
|
var x_json = require_x();
|
|
console.log(x_json, y_default, small, if2);
|
|
|
|
================================================================================
|
|
TestLoaderJSONInvalidIdentifierES6
|
|
---------- /out.js ----------
|
|
// test.json
|
|
var invalid_identifier = true;
|
|
|
|
// test2.json
|
|
var test2_exports = {};
|
|
__export(test2_exports, {
|
|
default: () => test2_default,
|
|
"invalid-identifier": () => invalid_identifier2
|
|
});
|
|
var invalid_identifier2 = true;
|
|
var test2_default = { "invalid-identifier": invalid_identifier2 };
|
|
|
|
// entry.js
|
|
console.log(invalid_identifier, test2_exports);
|
|
|
|
================================================================================
|
|
TestLoaderJSONNoBundle
|
|
---------- /out.js ----------
|
|
module.exports = { test: 123, "invalid-identifier": true };
|
|
|
|
================================================================================
|
|
TestLoaderJSONNoBundleCommonJS
|
|
---------- /out.js ----------
|
|
module.exports = { test: 123, "invalid-identifier": true };
|
|
|
|
================================================================================
|
|
TestLoaderJSONNoBundleES6
|
|
---------- /out.js ----------
|
|
var test = 123;
|
|
var test_default = { test, "invalid-identifier": true };
|
|
export {
|
|
test_default as default,
|
|
test
|
|
};
|
|
|
|
================================================================================
|
|
TestLoaderJSONNoBundleES6ArbitraryModuleNamespaceNames
|
|
---------- /out.js ----------
|
|
var test = 123;
|
|
var invalid_identifier = true;
|
|
var test_default = { test, "invalid-identifier": invalid_identifier };
|
|
export {
|
|
test_default as default,
|
|
invalid_identifier as "invalid-identifier",
|
|
test
|
|
};
|
|
|
|
================================================================================
|
|
TestLoaderJSONNoBundleIIFE
|
|
---------- /out.js ----------
|
|
(() => {
|
|
var require_test = __commonJS({
|
|
"test.json"(exports, module) {
|
|
module.exports = { test: 123, "invalid-identifier": true };
|
|
}
|
|
});
|
|
require_test();
|
|
})();
|
|
|
|
================================================================================
|
|
TestLoaderJSONPrototype
|
|
---------- /out.js ----------
|
|
// data.json
|
|
var data_default = {
|
|
"": "The property below should be converted to a computed property:",
|
|
["__proto__"]: { foo: "bar" }
|
|
};
|
|
|
|
// entry.js
|
|
console.log(data_default);
|
|
|
|
================================================================================
|
|
TestLoaderJSONPrototypeES5
|
|
---------- /out.js ----------
|
|
// data.json
|
|
var data_default = {
|
|
"": "The property below should NOT be converted to a computed property for ES5:",
|
|
__proto__: { foo: "bar" }
|
|
};
|
|
|
|
// entry.js
|
|
console.log(data_default);
|
|
|
|
================================================================================
|
|
TestLoaderJSONSharedWithMultipleEntriesIssue413
|
|
---------- /out/a.js ----------
|
|
// data.json
|
|
var data_default = { test: 123 };
|
|
|
|
// a.js
|
|
console.log("a:", data_default);
|
|
|
|
---------- /out/b.js ----------
|
|
// data.json
|
|
var data_default = { test: 123 };
|
|
|
|
// b.js
|
|
console.log("b:", data_default);
|
|
|
|
================================================================================
|
|
TestLoaderTextCommonJSAndES6
|
|
---------- /out.js ----------
|
|
// x.txt
|
|
var require_x = __commonJS({
|
|
"x.txt"(exports, module) {
|
|
module.exports = "x";
|
|
}
|
|
});
|
|
|
|
// y.txt
|
|
var y_default = "y";
|
|
|
|
// entry.js
|
|
var x_txt = require_x();
|
|
console.log(x_txt, y_default);
|
|
|
|
================================================================================
|
|
TestLoaderTextUTF8BOM
|
|
---------- /out.js ----------
|
|
// data1.txt
|
|
var data1_default = "text";
|
|
|
|
// data2.txt
|
|
var data2_default = "text\uFEFF";
|
|
|
|
// entry.js
|
|
console.log(data1_default, data2_default);
|
|
|
|
================================================================================
|
|
TestRequireCustomExtensionBase64
|
|
---------- /out.js ----------
|
|
// test.custom
|
|
var require_test = __commonJS({
|
|
"test.custom"(exports, module) {
|
|
module.exports = "YQBigGP/ZA==";
|
|
}
|
|
});
|
|
|
|
// entry.js
|
|
console.log(require_test());
|
|
|
|
================================================================================
|
|
TestRequireCustomExtensionDataURL
|
|
---------- /out.js ----------
|
|
// test.custom
|
|
var require_test = __commonJS({
|
|
"test.custom"(exports, module) {
|
|
module.exports = "data:application/octet-stream;base64,YQBigGP/ZA==";
|
|
}
|
|
});
|
|
|
|
// entry.js
|
|
console.log(require_test());
|
|
|
|
================================================================================
|
|
TestRequireCustomExtensionPreferLongest
|
|
---------- /out.js ----------
|
|
// test.txt
|
|
var require_test = __commonJS({
|
|
"test.txt"(exports, module) {
|
|
module.exports = "test.txt";
|
|
}
|
|
});
|
|
|
|
// test.base64.txt
|
|
var require_test_base64 = __commonJS({
|
|
"test.base64.txt"(exports, module) {
|
|
module.exports = "dGVzdC5iYXNlNjQudHh0";
|
|
}
|
|
});
|
|
|
|
// entry.js
|
|
console.log(require_test(), require_test_base64());
|
|
|
|
================================================================================
|
|
TestRequireCustomExtensionString
|
|
---------- /out.js ----------
|
|
// test.custom
|
|
var require_test = __commonJS({
|
|
"test.custom"(exports, module) {
|
|
module.exports = "#include <stdio.h>";
|
|
}
|
|
});
|
|
|
|
// entry.js
|
|
console.log(require_test());
|
|
|
|
================================================================================
|
|
TestWithTypeBytesOverrideLoader
|
|
---------- /out.js ----------
|
|
// foo.js
|
|
var foo_default = Uint8Array.fromBase64("ZXhwb3J0IGRlZmF1bHQgJ2pzJw==");
|
|
|
|
// entry.js
|
|
console.log(foo_default);
|
|
|
|
================================================================================
|
|
TestWithTypeBytesOverrideLoaderGlob
|
|
---------- /out.js ----------
|
|
// foo.js
|
|
var require_foo = __commonJS({
|
|
"foo.js"(exports, module) {
|
|
module.exports = Uint8Array.fromBase64("ZXhwb3J0IGRlZmF1bHQgJ2pzJw==");
|
|
}
|
|
});
|
|
|
|
// import("./foo*") in entry.js
|
|
var globImport_foo = __glob({
|
|
"./foo.js": () => Promise.resolve().then(() => __toESM(require_foo()))
|
|
});
|
|
|
|
// entry.js
|
|
globImport_foo("./foo" + bar).then(console.log);
|
|
|
|
================================================================================
|
|
TestWithTypeJSONOverrideLoader
|
|
---------- /out.js ----------
|
|
// foo.js
|
|
var foo_default = { "this is json not js": true };
|
|
|
|
// entry.js
|
|
console.log(foo_default);
|
|
|
|
================================================================================
|
|
TestWithTypeJSONOverrideLoaderGlob
|
|
---------- /out.js ----------
|
|
// foo.js
|
|
var foo_exports = {};
|
|
__export(foo_exports, {
|
|
default: () => foo_default
|
|
});
|
|
var foo_default;
|
|
var init_foo = __esm({
|
|
"foo.js"() {
|
|
foo_default = { "this is json not js": true };
|
|
}
|
|
});
|
|
|
|
// import("./foo*") in entry.js
|
|
var globImport_foo = __glob({
|
|
"./foo.js": () => Promise.resolve().then(() => (init_foo(), foo_exports))
|
|
});
|
|
|
|
// entry.js
|
|
globImport_foo("./foo" + bar).then(console.log);
|
|
|
|
================================================================================
|
|
TestWithTypeTextOverrideLoader
|
|
---------- /out.js ----------
|
|
// foo.js
|
|
var foo_default = "export default 'js'";
|
|
|
|
// entry.js
|
|
console.log(foo_default);
|
|
|
|
================================================================================
|
|
TestWithTypeTextOverrideLoaderGlob
|
|
---------- /out.js ----------
|
|
// foo.js
|
|
var require_foo = __commonJS({
|
|
"foo.js"(exports, module) {
|
|
module.exports = "export default 'js'";
|
|
}
|
|
});
|
|
|
|
// import("./foo*") in entry.js
|
|
var globImport_foo = __glob({
|
|
"./foo.js": () => Promise.resolve().then(() => __toESM(require_foo()))
|
|
});
|
|
|
|
// entry.js
|
|
globImport_foo("./foo" + bar).then(console.log);
|