github.com/evanw/esbuild@v0.21.4/internal/bundler_tests/snapshots/snapshots_loader.txt (about) 1 TestAutoDetectMimeTypeFromExtension 2 ---------- /out.js ---------- 3 // test.svg 4 var require_test = __commonJS({ 5 "test.svg"(exports, module) { 6 module.exports = "data:image/svg+xml;base64,YQBigGP/ZA=="; 7 } 8 }); 9 10 // entry.js 11 console.log(require_test()); 12 13 ================================================================================ 14 TestEmptyLoaderCSS 15 ---------- entry.css.map ---------- 16 { 17 "version": 3, 18 "sources": ["entry.css"], 19 "sourcesContent": ["\n\t\t\t\t@import 'a.empty';\n\t\t\t\ta { background: url(b.empty) }\n\t\t\t"], 20 "mappings": ";AAEI;AAAI,cAAY;AAAa;", 21 "names": [] 22 } 23 24 ---------- entry.css ---------- 25 /* entry.css */ 26 a { 27 background: url(); 28 } 29 ---------- metafile.json ---------- 30 { 31 "inputs": { 32 "a.empty": { 33 "bytes": 0, 34 "imports": [] 35 }, 36 "b.empty": { 37 "bytes": 0, 38 "imports": [] 39 }, 40 "entry.css": { 41 "bytes": 62, 42 "imports": [ 43 { 44 "path": "a.empty", 45 "kind": "import-rule", 46 "original": "a.empty" 47 }, 48 { 49 "path": "b.empty", 50 "kind": "url-token", 51 "original": "b.empty" 52 } 53 ] 54 } 55 }, 56 "outputs": { 57 "entry.css.map": { 58 "imports": [], 59 "exports": [], 60 "inputs": {}, 61 "bytes": 203 62 }, 63 "entry.css": { 64 "imports": [ 65 { 66 "path": "", 67 "kind": "url-token", 68 "external": true 69 } 70 ], 71 "entryPoint": "entry.css", 72 "inputs": { 73 "entry.css": { 74 "bytesInOutput": 27 75 } 76 }, 77 "bytes": 43 78 } 79 } 80 } 81 82 ================================================================================ 83 TestEmptyLoaderJS 84 ---------- entry.js.map ---------- 85 { 86 "version": 3, 87 "sources": ["entry.js"], 88 "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"], 89 "mappings": ";;;;;;;;;;;;;AAEI,SAAoB;AACpB,eAAgB;AAEhB,QAAQ,IAAI,IAAI,SAAAA,SAAK,MAAK;", 90 "names": ["def"] 91 } 92 93 ---------- entry.js ---------- 94 // b.empty 95 var require_b = __commonJS({ 96 "b.empty"() { 97 } 98 }); 99 100 // c.empty 101 var require_c = __commonJS({ 102 "c.empty"() { 103 } 104 }); 105 106 // entry.js 107 var ns = __toESM(require_b()); 108 var import_c = __toESM(require_c()); 109 console.log(ns, import_c.default, void 0); 110 ---------- metafile.json ---------- 111 { 112 "inputs": { 113 "a.empty": { 114 "bytes": 0, 115 "imports": [] 116 }, 117 "b.empty": { 118 "bytes": 0, 119 "imports": [] 120 }, 121 "c.empty": { 122 "bytes": 0, 123 "imports": [] 124 }, 125 "d.empty": { 126 "bytes": 0, 127 "imports": [] 128 }, 129 "entry.js": { 130 "bytes": 165, 131 "imports": [ 132 { 133 "path": "a.empty", 134 "kind": "import-statement", 135 "original": "./a.empty" 136 }, 137 { 138 "path": "b.empty", 139 "kind": "import-statement", 140 "original": "./b.empty" 141 }, 142 { 143 "path": "c.empty", 144 "kind": "import-statement", 145 "original": "./c.empty" 146 }, 147 { 148 "path": "d.empty", 149 "kind": "import-statement", 150 "original": "./d.empty" 151 } 152 ], 153 "format": "esm" 154 } 155 }, 156 "outputs": { 157 "entry.js.map": { 158 "imports": [], 159 "exports": [], 160 "inputs": {}, 161 "bytes": 377 162 }, 163 "entry.js": { 164 "imports": [], 165 "exports": [], 166 "entryPoint": "entry.js", 167 "inputs": { 168 "b.empty": { 169 "bytesInOutput": 53 170 }, 171 "c.empty": { 172 "bytesInOutput": 53 173 }, 174 "entry.js": { 175 "bytesInOutput": 111 176 } 177 }, 178 "bytes": 253 179 } 180 } 181 } 182 183 ================================================================================ 184 TestExtensionlessLoaderCSS 185 ---------- entry.css ---------- 186 /* what */ 187 .foo { 188 color: red; 189 } 190 191 /* entry.css */ 192 193 ================================================================================ 194 TestExtensionlessLoaderJS 195 ---------- entry.js ---------- 196 // what 197 foo(); 198 199 ================================================================================ 200 TestJSXAutomaticNoNameCollision 201 ---------- /out.js ---------- 202 var import_react = require("react"); 203 var import_react2 = require("@remix-run/react"); 204 const x = /* @__PURE__ */ (0, import_react.createElement)(import_react2.Link, { ...y, key: z }); 205 206 ================================================================================ 207 TestJSXPreserveCapitalLetter 208 ---------- /out.js ---------- 209 // foo.js 210 var MustStartWithUpperCaseLetter = class { 211 }; 212 213 // entry.jsx 214 console.log(<MustStartWithUpperCaseLetter />); 215 216 ================================================================================ 217 TestJSXPreserveCapitalLetterMinify 218 ---------- /out.js ---------- 219 // foo.js 220 var Y = class { 221 }; 222 223 // entry.jsx 224 console.log(<Y tag-must-start-with-capital-letter />); 225 226 ================================================================================ 227 TestJSXPreserveCapitalLetterMinifyNested 228 ---------- /out.js ---------- 229 // entry.jsx 230 x = () => { 231 class Y { 232 } 233 return <Y tag-must-start-with-capital-letter />; 234 }; 235 236 ================================================================================ 237 TestJSXSyntaxInJSWithJSXLoader 238 ---------- /out.js ---------- 239 // entry.js 240 console.log(/* @__PURE__ */ React.createElement("div", null)); 241 242 ================================================================================ 243 TestLoaderBase64CommonJSAndES6 244 ---------- /out.js ---------- 245 // x.b64 246 var require_x = __commonJS({ 247 "x.b64"(exports, module) { 248 module.exports = "eA=="; 249 } 250 }); 251 252 // y.b64 253 var y_default = "eQ=="; 254 255 // entry.js 256 var x_b64 = require_x(); 257 console.log(x_b64, y_default); 258 259 ================================================================================ 260 TestLoaderBundleWithImportAttributes 261 ---------- /out.js ---------- 262 // data.json 263 var data_default = { works: true }; 264 265 // data.json with { type: 'json' } 266 var data_default2 = { works: true }; 267 268 // entry.js 269 console.log(data_default === data_default, data_default !== data_default2); 270 271 ================================================================================ 272 TestLoaderCopyEntryPointAdvanced 273 ---------- /out/xyz-DYPYXS7B.copy ---------- 274 more stuff 275 ---------- /out/js/input/path.js ---------- 276 // project/entry.js 277 import xyz from "../../xyz-DYPYXS7B.copy"; 278 console.log(xyz); 279 280 ---------- /out/copy/input/path.copy ---------- 281 some stuff 282 ================================================================================ 283 TestLoaderCopyExplicitOutputFile 284 ---------- /out/this.worked ---------- 285 some stuff 286 ================================================================================ 287 TestLoaderCopyStartsWithDotAbsPath 288 ---------- /out/.htaccess ---------- 289 some stuff 290 ---------- /out/entry.js ---------- 291 // project/src/entry.js 292 some.stuff(); 293 294 ---------- /out/.js ---------- 295 // project/src/.ts 296 foo; 297 298 ================================================================================ 299 TestLoaderCopyStartsWithDotRelPath 300 ---------- /out/.htaccess ---------- 301 some stuff 302 ---------- /out/entry.js ---------- 303 // entry.js 304 some.stuff(); 305 306 ---------- /out/.js ---------- 307 // .ts 308 foo; 309 310 ================================================================================ 311 TestLoaderCopyUseIndex 312 ---------- /out/index.copy ---------- 313 some stuff 314 ================================================================================ 315 TestLoaderCopyWithBundleEntryPoint 316 ---------- /out/assets/some.file ---------- 317 stuff 318 ---------- /out/src/entry.js ---------- 319 // Users/user/project/src/entry.js 320 import x from "../assets/some.file"; 321 console.log(x); 322 323 ---------- /out/src/entry.css ---------- 324 /* Users/user/project/src/entry.css */ 325 body { 326 background: url("../assets/some.file"); 327 } 328 329 ================================================================================ 330 TestLoaderCopyWithBundleFromCSS 331 ---------- /out/some-BYATPJRB.file ---------- 332 stuff 333 ---------- /out/src/entry.css ---------- 334 /* Users/user/project/src/entry.css */ 335 body { 336 background: url("../some-BYATPJRB.file"); 337 } 338 339 ================================================================================ 340 TestLoaderCopyWithBundleFromJS 341 ---------- /out/some-BYATPJRB.file ---------- 342 stuff 343 ---------- /out/src/entry.js ---------- 344 // Users/user/project/src/entry.js 345 import x from "../some-BYATPJRB.file"; 346 console.log(x); 347 348 ================================================================================ 349 TestLoaderCopyWithFormat 350 ---------- /out/src/entry.js ---------- 351 (() => { 352 console.log("entry"); 353 })(); 354 355 ---------- /out/assets/some.file ---------- 356 stuff 357 ================================================================================ 358 TestLoaderCopyWithInjectedFileBundle 359 ---------- /out/inject-IFR6YGWW.js ---------- 360 console.log('in inject.js') 361 ---------- /out/entry.js ---------- 362 // src/entry.ts 363 import "./inject-IFR6YGWW.js"; 364 console.log("in entry.ts"); 365 366 ================================================================================ 367 TestLoaderCopyWithTransform 368 ---------- /out/src/entry.js ---------- 369 console.log("entry"); 370 371 ---------- /out/assets/some.file ---------- 372 stuff 373 ================================================================================ 374 TestLoaderDataURLApplicationJSON 375 ---------- /out/entry.js ---------- 376 // <data:application/json,"%31%32%33"> 377 var json_31_32_33_default = "123"; 378 379 // <data:application/json;base64,eyJ3b3JrcyI6dHJ1ZX0=> 380 var json_base64_eyJ3b3JrcyI6dHJ1ZX0_default = { works: true }; 381 382 // <data:application/json;charset=UTF-8,%31%32%33> 383 var json_charset_UTF_8_31_32_33_default = 123; 384 385 // <data:application/json;charset=UTF-8;base64,eyJ3b3JrcyI6dHJ1ZX0=> 386 var json_charset_UTF_8_base64_eyJ3b3JrcyI6dHJ1ZX0_default = { works: true }; 387 388 // entry.js 389 console.log([ 390 json_31_32_33_default, 391 json_base64_eyJ3b3JrcyI6dHJ1ZX0_default, 392 json_charset_UTF_8_31_32_33_default, 393 json_charset_UTF_8_base64_eyJ3b3JrcyI6dHJ1ZX0_default 394 ]); 395 396 ================================================================================ 397 TestLoaderDataURLBase64InvalidUTF8 398 ---------- /out.js ---------- 399 // binary.txt 400 var binary_default = "data:text/plain;charset=utf-8;base64,/w=="; 401 402 // entry.js 403 console.log(binary_default); 404 405 ================================================================================ 406 TestLoaderDataURLBase64VsPercentEncoding 407 ---------- /out.js ---------- 408 // shouldUsePercent_1.txt 409 var shouldUsePercent_1_default = "data:text/plain;charset=utf-8,%0A%0A%0A"; 410 411 // shouldUsePercent_2.txt 412 var shouldUsePercent_2_default = "data:text/plain;charset=utf-8,%0A%0A%0A%0A"; 413 414 // shouldUseBase64_1.txt 415 var shouldUseBase64_1_default = "data:text/plain;charset=utf-8;base64,CgoKCgo="; 416 417 // shouldUseBase64_2.txt 418 var shouldUseBase64_2_default = "data:text/plain;charset=utf-8;base64,CgoKCgoK"; 419 420 // entry.js 421 console.log( 422 shouldUsePercent_1_default, 423 shouldUsePercent_2_default, 424 shouldUseBase64_1_default, 425 shouldUseBase64_2_default 426 ); 427 428 ================================================================================ 429 TestLoaderDataURLCommonJSAndES6 430 ---------- /out.js ---------- 431 // x.txt 432 var require_x = __commonJS({ 433 "x.txt"(exports, module) { 434 module.exports = "data:text/plain;charset=utf-8,x"; 435 } 436 }); 437 438 // y.txt 439 var y_default = "data:text/plain;charset=utf-8,y"; 440 441 // entry.js 442 var x_url = require_x(); 443 console.log(x_url, y_default); 444 445 ================================================================================ 446 TestLoaderDataURLEscapePercents 447 ---------- /out.js ---------- 448 // percents.txt 449 var percents_default = "data:text/plain;charset=utf-8,%0A%, %3, %2533, %25333%0A%, %e, %25ee, %25eee%0A%, %E, %25EE, %25EEE%0A"; 450 451 // entry.js 452 console.log(percents_default); 453 454 ================================================================================ 455 TestLoaderDataURLExtensionBasedMIME 456 ---------- /out/entry.js ---------- 457 // example.css 458 var example_default = "data:text/css;charset=utf-8,css"; 459 460 // example.eot 461 var example_default2 = "data:application/vnd.ms-fontobject,eot"; 462 463 // example.gif 464 var example_default3 = "data:image/gif,gif"; 465 466 // example.htm 467 var example_default4 = "data:text/html;charset=utf-8,htm"; 468 469 // example.html 470 var example_default5 = "data:text/html;charset=utf-8,html"; 471 472 // example.jpeg 473 var example_default6 = "data:image/jpeg,jpeg"; 474 475 // example.jpg 476 var example_default7 = "data:image/jpeg,jpg"; 477 478 // example.js 479 var example_default8 = "data:text/javascript;charset=utf-8,js"; 480 481 // example.json 482 var example_default9 = "data:application/json;charset=utf-8,json"; 483 484 // example.mjs 485 var example_default10 = "data:text/javascript;charset=utf-8,mjs"; 486 487 // example.otf 488 var example_default11 = "data:font/otf,otf"; 489 490 // example.pdf 491 var example_default12 = "data:application/pdf,pdf"; 492 493 // example.png 494 var example_default13 = "data:image/png,png"; 495 496 // example.sfnt 497 var example_default14 = "data:font/sfnt,sfnt"; 498 499 // example.svg 500 var example_default15 = "data:image/svg+xml,svg"; 501 502 // example.ttf 503 var example_default16 = "data:font/ttf,ttf"; 504 505 // example.wasm 506 var example_default17 = "data:application/wasm,wasm"; 507 508 // example.webp 509 var example_default18 = "data:image/webp,webp"; 510 511 // example.woff 512 var example_default19 = "data:font/woff,woff"; 513 514 // example.woff2 515 var example_default20 = "data:font/woff2,woff2"; 516 517 // example.xml 518 var example_default21 = "data:text/xml;charset=utf-8,xml"; 519 export { 520 example_default as css, 521 example_default2 as eot, 522 example_default3 as gif, 523 example_default4 as htm, 524 example_default5 as html, 525 example_default6 as jpeg, 526 example_default7 as jpg, 527 example_default8 as js, 528 example_default9 as json, 529 example_default10 as mjs, 530 example_default11 as otf, 531 example_default12 as pdf, 532 example_default13 as png, 533 example_default14 as sfnt, 534 example_default15 as svg, 535 example_default16 as ttf, 536 example_default17 as wasm, 537 example_default18 as webp, 538 example_default19 as woff, 539 example_default20 as woff2, 540 example_default21 as xml 541 }; 542 543 ================================================================================ 544 TestLoaderDataURLTextCSS 545 ---------- /out/entry.css ---------- 546 /* <data:text/css,body{color:%72%65%64}> */ 547 body { 548 color: red; 549 } 550 551 /* <data:text/css;base64,Ym9keXtiYWNrZ3JvdW5kOmJsdWV9> */ 552 body { 553 background: blue; 554 } 555 556 /* <data:text/css;charset=UTF-8,body{color:%72%65%64}> */ 557 body { 558 color: red; 559 } 560 561 /* <data:text/css;charset=UTF-8;base64,Ym9keXtiYWNrZ3JvdW5kOmJsdWV9> */ 562 body { 563 background: blue; 564 } 565 566 /* entry.css */ 567 568 ================================================================================ 569 TestLoaderDataURLTextJavaScript 570 ---------- /out/entry.js ---------- 571 // <data:text/javascript,console.log('%31%32%33')> 572 console.log("123"); 573 574 // <data:text/javascript;base64,Y29uc29sZS5sb2coMjM0KQ==> 575 console.log(234); 576 577 // <data:text/javascript;charset=UTF-8,console.log(%31%32%33)> 578 console.log(123); 579 580 // <data:text/javascript;charset=UTF-8;base64,Y29uc29sZS5sb2coMjM0KQ...> 581 console.log(234); 582 583 ================================================================================ 584 TestLoaderDataURLTextJavaScriptPlusCharacter 585 ---------- /out/entry.js ---------- 586 // <data:text/javascript,console.log(1+2)> 587 console.log(1 + 2); 588 589 ================================================================================ 590 TestLoaderDataURLUnknownMIME 591 ---------- /out/entry.js ---------- 592 // entry.js 593 import a from "data:some/thing;what,someData%31%32%33"; 594 import b from "data:other/thing;stuff;base64,c29tZURhdGEyMzQ="; 595 console.log(a, b); 596 597 ================================================================================ 598 TestLoaderFile 599 ---------- /out/test-IPILGNO5.svg ---------- 600 <svg></svg> 601 ---------- /out/entry.js ---------- 602 // test.svg 603 var require_test = __commonJS({ 604 "test.svg"(exports, module) { 605 module.exports = "./test-IPILGNO5.svg"; 606 } 607 }); 608 609 // entry.js 610 console.log(require_test()); 611 612 ================================================================================ 613 TestLoaderFileCommonJSAndES6 614 ---------- /y-YE5AYNFB.txt ---------- 615 y 616 ---------- /x-LSAMBFUD.txt ---------- 617 x 618 ---------- /out.js ---------- 619 // x.txt 620 var require_x = __commonJS({ 621 "x.txt"(exports, module) { 622 module.exports = "./x-LSAMBFUD.txt"; 623 } 624 }); 625 626 // y.txt 627 var y_default = "./y-YE5AYNFB.txt"; 628 629 // entry.js 630 var x_url = require_x(); 631 console.log(x_url, y_default); 632 633 ================================================================================ 634 TestLoaderFileExtPathAssetNamesJS 635 ---------- /out/png/image-LSAMBFUD.png ---------- 636 x 637 ---------- /out/txt/file-YE5AYNFB.txt ---------- 638 y 639 ---------- /out/entries/entry.js ---------- 640 // src/images/image.png 641 var image_default = "../png/image-LSAMBFUD.png"; 642 643 // src/uploads/file.txt 644 var file_default = "../txt/file-YE5AYNFB.txt"; 645 646 // src/entries/entry.js 647 console.log(image_default, file_default); 648 649 ================================================================================ 650 TestLoaderFileMultipleNoCollision 651 ---------- /dist/test-J7OMUXO3.txt ---------- 652 test 653 ---------- /dist/out.js ---------- 654 // a/test.txt 655 var require_test = __commonJS({ 656 "a/test.txt"(exports, module) { 657 module.exports = "./test-J7OMUXO3.txt"; 658 } 659 }); 660 661 // b/test.txt 662 var require_test2 = __commonJS({ 663 "b/test.txt"(exports, module) { 664 module.exports = "./test-J7OMUXO3.txt"; 665 } 666 }); 667 668 // entry.js 669 console.log( 670 require_test(), 671 require_test2() 672 ); 673 674 ================================================================================ 675 TestLoaderFileOneSourceTwoDifferentOutputPathsCSS 676 ---------- /out/common-LSAMBFUD.png ---------- 677 x 678 ---------- /out/entries/entry.css ---------- 679 /* src/shared/common.css */ 680 div { 681 background: url("../common-LSAMBFUD.png"); 682 } 683 684 /* src/entries/entry.css */ 685 686 ---------- /out/entries/other/entry.css ---------- 687 /* src/shared/common.css */ 688 div { 689 background: url("../../common-LSAMBFUD.png"); 690 } 691 692 /* src/entries/other/entry.css */ 693 694 ================================================================================ 695 TestLoaderFileOneSourceTwoDifferentOutputPathsJS 696 ---------- /out/common-LSAMBFUD.png ---------- 697 x 698 ---------- /out/entries/entry.js ---------- 699 // src/shared/common.png 700 var common_default = "../common-LSAMBFUD.png"; 701 702 // src/shared/common.js 703 console.log(common_default); 704 705 ---------- /out/entries/other/entry.js ---------- 706 // src/shared/common.png 707 var common_default = "../../common-LSAMBFUD.png"; 708 709 // src/shared/common.js 710 console.log(common_default); 711 712 ================================================================================ 713 TestLoaderFilePublicPathAssetNamesCSS 714 ---------- /out/images/image-LSAMBFUD.png ---------- 715 x 716 ---------- /out/entries/entry.css ---------- 717 /* src/entries/entry.css */ 718 div { 719 background: url("https://example.com/images/image-LSAMBFUD.png"); 720 } 721 722 ================================================================================ 723 TestLoaderFilePublicPathAssetNamesJS 724 ---------- /out/images/image-LSAMBFUD.png ---------- 725 x 726 ---------- /out/entries/entry.js ---------- 727 // src/images/image.png 728 var image_default = "https://example.com/images/image-LSAMBFUD.png"; 729 730 // src/entries/entry.js 731 console.log(image_default); 732 733 ================================================================================ 734 TestLoaderFilePublicPathCSS 735 ---------- /out/image-LSAMBFUD.png ---------- 736 x 737 ---------- /out/entries/entry.css ---------- 738 /* src/entries/entry.css */ 739 div { 740 background: url("https://example.com/image-LSAMBFUD.png"); 741 } 742 743 ================================================================================ 744 TestLoaderFilePublicPathJS 745 ---------- /out/image-LSAMBFUD.png ---------- 746 x 747 ---------- /out/entries/entry.js ---------- 748 // src/images/image.png 749 var image_default = "https://example.com/image-LSAMBFUD.png"; 750 751 // src/entries/entry.js 752 console.log(image_default); 753 754 ================================================================================ 755 TestLoaderFileRelativePathAssetNamesCSS 756 ---------- /out/images/image-LSAMBFUD.png ---------- 757 x 758 ---------- /out/entries/entry.css ---------- 759 /* src/entries/entry.css */ 760 div { 761 background: url("../images/image-LSAMBFUD.png"); 762 } 763 764 ================================================================================ 765 TestLoaderFileRelativePathAssetNamesJS 766 ---------- /out/images/image-LSAMBFUD.png ---------- 767 x 768 ---------- /out/entries/entry.js ---------- 769 // src/images/image.png 770 var image_default = "../images/image-LSAMBFUD.png"; 771 772 // src/entries/entry.js 773 console.log(image_default); 774 775 ================================================================================ 776 TestLoaderFileRelativePathCSS 777 ---------- /out/image-LSAMBFUD.png ---------- 778 x 779 ---------- /out/entries/entry.css ---------- 780 /* src/entries/entry.css */ 781 div { 782 background: url("../image-LSAMBFUD.png"); 783 } 784 785 ================================================================================ 786 TestLoaderFileRelativePathJS 787 ---------- /out/image-LSAMBFUD.png ---------- 788 x 789 ---------- /out/entries/entry.js ---------- 790 // src/images/image.png 791 var image_default = "../image-LSAMBFUD.png"; 792 793 // src/entries/entry.js 794 console.log(image_default); 795 796 ================================================================================ 797 TestLoaderFileWithQueryParameter 798 ---------- /out/file-UEHVHXRQ.txt ---------- 799 This is some text 800 ---------- /out/entry.js ---------- 801 // file.txt?foo 802 var file_default = "./file-UEHVHXRQ.txt?foo"; 803 804 // file.txt?bar 805 var file_default2 = "./file-UEHVHXRQ.txt?bar"; 806 807 // entry.js 808 console.log(file_default, file_default2); 809 810 ================================================================================ 811 TestLoaderFromExtensionWithQueryParameter 812 ---------- /out/entry.js ---------- 813 // file.abc?query.xyz 814 var file_default = "This should not be base64 encoded"; 815 816 // entry.js 817 console.log(file_default); 818 819 ================================================================================ 820 TestLoaderJSONCommonJSAndES6 821 ---------- /out.js ---------- 822 // x.json 823 var require_x = __commonJS({ 824 "x.json"(exports, module) { 825 module.exports = { x: true }; 826 } 827 }); 828 829 // y.json 830 var y_default = { y1: true, y2: false }; 831 832 // z.json 833 var small = "some small text"; 834 var if2 = "test keyword imports"; 835 836 // entry.js 837 var x_json = require_x(); 838 console.log(x_json, y_default, small, if2); 839 840 ================================================================================ 841 TestLoaderJSONInvalidIdentifierES6 842 ---------- /out.js ---------- 843 // test.json 844 var invalid_identifier = true; 845 846 // test2.json 847 var test2_exports = {}; 848 __export(test2_exports, { 849 default: () => test2_default, 850 "invalid-identifier": () => invalid_identifier2 851 }); 852 var invalid_identifier2 = true; 853 var test2_default = { "invalid-identifier": invalid_identifier2 }; 854 855 // entry.js 856 console.log(invalid_identifier, test2_exports); 857 858 ================================================================================ 859 TestLoaderJSONNoBundle 860 ---------- /out.js ---------- 861 module.exports = { test: 123, "invalid-identifier": true }; 862 863 ================================================================================ 864 TestLoaderJSONNoBundleCommonJS 865 ---------- /out.js ---------- 866 module.exports = { test: 123, "invalid-identifier": true }; 867 868 ================================================================================ 869 TestLoaderJSONNoBundleES6 870 ---------- /out.js ---------- 871 var test = 123; 872 var test_default = { test, "invalid-identifier": true }; 873 export { 874 test_default as default, 875 test 876 }; 877 878 ================================================================================ 879 TestLoaderJSONNoBundleES6ArbitraryModuleNamespaceNames 880 ---------- /out.js ---------- 881 var test = 123; 882 var invalid_identifier = true; 883 var test_default = { test, "invalid-identifier": invalid_identifier }; 884 export { 885 test_default as default, 886 invalid_identifier as "invalid-identifier", 887 test 888 }; 889 890 ================================================================================ 891 TestLoaderJSONNoBundleIIFE 892 ---------- /out.js ---------- 893 (() => { 894 var require_test = __commonJS({ 895 "test.json"(exports, module) { 896 module.exports = { test: 123, "invalid-identifier": true }; 897 } 898 }); 899 require_test(); 900 })(); 901 902 ================================================================================ 903 TestLoaderJSONPrototype 904 ---------- /out.js ---------- 905 // data.json 906 var data_default = { 907 "": "The property below should be converted to a computed property:", 908 ["__proto__"]: { foo: "bar" } 909 }; 910 911 // entry.js 912 console.log(data_default); 913 914 ================================================================================ 915 TestLoaderJSONPrototypeES5 916 ---------- /out.js ---------- 917 // data.json 918 var data_default = { 919 "": "The property below should NOT be converted to a computed property for ES5:", 920 __proto__: { foo: "bar" } 921 }; 922 923 // entry.js 924 console.log(data_default); 925 926 ================================================================================ 927 TestLoaderJSONSharedWithMultipleEntriesIssue413 928 ---------- /out/a.js ---------- 929 // data.json 930 var data_default = { test: 123 }; 931 932 // a.js 933 console.log("a:", data_default); 934 935 ---------- /out/b.js ---------- 936 // data.json 937 var data_default = { test: 123 }; 938 939 // b.js 940 console.log("b:", data_default); 941 942 ================================================================================ 943 TestLoaderTextCommonJSAndES6 944 ---------- /out.js ---------- 945 // x.txt 946 var require_x = __commonJS({ 947 "x.txt"(exports, module) { 948 module.exports = "x"; 949 } 950 }); 951 952 // y.txt 953 var y_default = "y"; 954 955 // entry.js 956 var x_txt = require_x(); 957 console.log(x_txt, y_default); 958 959 ================================================================================ 960 TestRequireCustomExtensionBase64 961 ---------- /out.js ---------- 962 // test.custom 963 var require_test = __commonJS({ 964 "test.custom"(exports, module) { 965 module.exports = "YQBigGP/ZA=="; 966 } 967 }); 968 969 // entry.js 970 console.log(require_test()); 971 972 ================================================================================ 973 TestRequireCustomExtensionDataURL 974 ---------- /out.js ---------- 975 // test.custom 976 var require_test = __commonJS({ 977 "test.custom"(exports, module) { 978 module.exports = "data:application/octet-stream;base64,YQBigGP/ZA=="; 979 } 980 }); 981 982 // entry.js 983 console.log(require_test()); 984 985 ================================================================================ 986 TestRequireCustomExtensionPreferLongest 987 ---------- /out.js ---------- 988 // test.txt 989 var require_test = __commonJS({ 990 "test.txt"(exports, module) { 991 module.exports = "test.txt"; 992 } 993 }); 994 995 // test.base64.txt 996 var require_test_base64 = __commonJS({ 997 "test.base64.txt"(exports, module) { 998 module.exports = "dGVzdC5iYXNlNjQudHh0"; 999 } 1000 }); 1001 1002 // entry.js 1003 console.log(require_test(), require_test_base64()); 1004 1005 ================================================================================ 1006 TestRequireCustomExtensionString 1007 ---------- /out.js ---------- 1008 // test.custom 1009 var require_test = __commonJS({ 1010 "test.custom"(exports, module) { 1011 module.exports = "#include <stdio.h>"; 1012 } 1013 }); 1014 1015 // entry.js 1016 console.log(require_test()); 1017 1018 ================================================================================ 1019 TestWithTypeJSONOverrideLoader 1020 ---------- entry.js ---------- 1021 // foo.js 1022 var foo_default = { "this is json not js": true }; 1023 1024 // entry.js 1025 console.log(foo_default);