github.com/evanw/esbuild@v0.21.4/internal/bundler_tests/snapshots/snapshots_default.txt (about) 1 TestAmbiguousReexportMsg 2 ---------- /out/entry.js ---------- 3 // a.js 4 var a = 1; 5 6 // b.js 7 var b = 3; 8 9 // c.js 10 var c = 4; 11 export { 12 a, 13 b, 14 c 15 }; 16 17 ================================================================================ 18 TestArgumentDefaultValueScopeNoBundle 19 ---------- /out.js ---------- 20 export function a(o = foo) { 21 var r; 22 return o; 23 } 24 export class b { 25 fn(r = foo) { 26 var f; 27 return r; 28 } 29 } 30 export let c = [ 31 function(o = foo) { 32 var r; 33 return o; 34 }, 35 (o = foo) => { 36 var r; 37 return o; 38 }, 39 { fn(o = foo) { 40 var r; 41 return o; 42 } }, 43 class { 44 fn(o = foo) { 45 var r; 46 return o; 47 } 48 } 49 ]; 50 51 ================================================================================ 52 TestArgumentsSpecialCaseNoBundle 53 ---------- /out.js ---------- 54 /* @__PURE__ */ (() => { 55 var r; 56 function t(n = arguments) { 57 return arguments; 58 } 59 (function(n = arguments) { 60 return arguments; 61 }); 62 ({ foo(n = arguments) { 63 return arguments; 64 } }); 65 class u { 66 foo(e = arguments) { 67 return arguments; 68 } 69 } 70 (class { 71 foo(n = arguments) { 72 return arguments; 73 } 74 }); 75 function t(n = arguments) { 76 var arguments; 77 return arguments; 78 } 79 (function(n = arguments) { 80 var arguments; 81 return arguments; 82 }); 83 ({ foo(n = arguments) { 84 var arguments; 85 return arguments; 86 } }); 87 (n) => r; 88 () => r; 89 async () => r; 90 (n = r) => r; 91 async (n = r) => r; 92 (n) => r; 93 () => r; 94 async () => r; 95 (n = r) => r; 96 async (n = r) => r; 97 (n) => { 98 return r; 99 }; 100 () => { 101 return r; 102 }; 103 async () => { 104 return r; 105 }; 106 (n = r) => { 107 return r; 108 }; 109 async (n = r) => { 110 return r; 111 }; 112 (n) => { 113 return r; 114 }; 115 () => { 116 return r; 117 }; 118 async () => { 119 return r; 120 }; 121 (n = r) => { 122 return r; 123 }; 124 async (n = r) => { 125 return r; 126 }; 127 })(); 128 129 ================================================================================ 130 TestArrowFnScope 131 ---------- /out.js ---------- 132 // entry.js 133 tests = { 134 0: (s = (e) => s + e, t) => s + t, 135 1: (s, t = (e) => t + e) => t + s, 136 2: (s = (a = (c) => s + a + c, b) => s + a + b, t, e) => s + t + e, 137 3: (s, t, e = (a, b = (c) => e + b + c) => e + b + a) => e + s + t, 138 4: (x = (s) => x + s, y, x + y), 139 5: (y, x = (s) => x + s, x + y), 140 6: (x = (s = (e) => x + s + e, t) => x + s + t, y, z, x + y + z), 141 7: (y, z, x = (s, t = (e) => x + t + e) => x + t + s, x + y + z) 142 }; 143 144 ================================================================================ 145 TestAutoExternal 146 ---------- /out/entry.js ---------- 147 // entry.js 148 import "http://example.com/code.js"; 149 import "https://example.com/code.js"; 150 import "//example.com/code.js"; 151 import "data:application/javascript;base64,ZXhwb3J0IGRlZmF1bHQgMTIz"; 152 153 ================================================================================ 154 TestAutoExternalNode 155 ---------- /out/entry.js ---------- 156 // entry.js 157 import fs from "node:fs/promises"; 158 import "node:what-is-this"; 159 fs.readFile(); 160 161 ================================================================================ 162 TestAvoidTDZ 163 ---------- /out.js ---------- 164 // entry.js 165 var Foo = class _Foo { 166 static foo = new _Foo(); 167 }; 168 var foo = Foo.foo; 169 console.log(foo); 170 var Bar = class { 171 }; 172 var bar = 123; 173 export { 174 Bar, 175 bar 176 }; 177 178 ================================================================================ 179 TestAvoidTDZNoBundle 180 ---------- /out.js ---------- 181 class Foo { 182 static foo = new Foo(); 183 } 184 let foo = Foo.foo; 185 console.log(foo); 186 export class Bar { 187 } 188 export let bar = 123; 189 190 ================================================================================ 191 TestAwaitImportInsideTry 192 ---------- /out.js ---------- 193 // entry.js 194 async function main(name) { 195 try { 196 return await import(name); 197 } catch { 198 } 199 } 200 main("fs"); 201 202 ================================================================================ 203 TestBuiltInNodeModulePrecedence 204 ---------- /out/entry.js ---------- 205 // node_modules/fs/abc.js 206 var require_abc = __commonJS({ 207 "node_modules/fs/abc.js"() { 208 console.log("include this"); 209 } 210 }); 211 212 // node_modules/fs/index.js 213 var require_fs = __commonJS({ 214 "node_modules/fs/index.js"() { 215 console.log("include this too"); 216 } 217 }); 218 219 // entry.js 220 console.log([ 221 // These are node core modules 222 require("fs"), 223 require("fs/promises"), 224 require("node:foo"), 225 // These are not node core modules 226 require_abc(), 227 require_fs() 228 ]); 229 230 ================================================================================ 231 TestBundlingFilesOutsideOfOutbase 232 ---------- /out/_.._/_.._/_.._/src/entry.js ---------- 233 // src/entry.js 234 console.log("test"); 235 236 ================================================================================ 237 TestCallImportNamespaceWarning 238 ---------- /out/js.js ---------- 239 import * as a from "a"; 240 import { b } from "b"; 241 import c from "c"; 242 a(); 243 b(); 244 c(); 245 new a(); 246 new b(); 247 new c(); 248 249 ---------- /out/ts.js ---------- 250 import * as a from "a"; 251 import { b } from "b"; 252 import c from "c"; 253 a(); 254 b(); 255 c(); 256 new a(); 257 new b(); 258 new c(); 259 260 ---------- /out/jsx-components.js ---------- 261 import * as A from "a"; 262 import { B } from "b"; 263 import C from "c"; 264 /* @__PURE__ */ React.createElement(A, null); 265 /* @__PURE__ */ React.createElement(B, null); 266 /* @__PURE__ */ React.createElement(C, null); 267 268 ---------- /out/jsx-a.js ---------- 269 import * as a from "a"; 270 /* @__PURE__ */ a("div", null); 271 272 ---------- /out/jsx-b.js ---------- 273 import { b } from "b"; 274 /* @__PURE__ */ b("div", null); 275 276 ---------- /out/jsx-c.js ---------- 277 import c from "c"; 278 /* @__PURE__ */ c("div", null); 279 280 ================================================================================ 281 TestCharFreqIgnoreComments 282 ---------- /out/a.js ---------- 283 // a.js 284 function u(e, t, n, r) { 285 return "the argument names must be the same"; 286 } 287 export { 288 u as default 289 }; 290 291 ---------- /out/b.js ---------- 292 // b.js 293 function u(e, t, n, r) { 294 return "the argument names must be the same"; 295 } 296 export { 297 u as default 298 }; 299 300 ================================================================================ 301 TestCommentPreservation 302 ---------- /out/entry.js ---------- 303 console.log( 304 import( 305 /* before */ 306 foo 307 ), 308 import( 309 /* before */ 310 "foo" 311 ), 312 import( 313 foo 314 /* after */ 315 ), 316 import( 317 "foo" 318 /* after */ 319 ) 320 ); 321 console.log( 322 import( 323 "foo", 324 /* before */ 325 { assert: { type: "json" } } 326 ), 327 import("foo", { 328 /* before */ 329 assert: { type: "json" } 330 }), 331 import("foo", { 332 assert: 333 /* before */ 334 { type: "json" } 335 }), 336 import("foo", { assert: { 337 /* before */ 338 type: "json" 339 } }), 340 import("foo", { assert: { 341 type: 342 /* before */ 343 "json" 344 } }), 345 import("foo", { assert: { 346 type: "json" 347 /* before */ 348 } }), 349 import("foo", { 350 assert: { type: "json" } 351 /* before */ 352 }), 353 import( 354 "foo", 355 { assert: { type: "json" } } 356 /* before */ 357 ) 358 ); 359 console.log( 360 require( 361 /* before */ 362 foo 363 ), 364 require( 365 /* before */ 366 "foo" 367 ), 368 require( 369 foo 370 /* after */ 371 ), 372 require( 373 "foo" 374 /* after */ 375 ) 376 ); 377 console.log( 378 require.resolve( 379 /* before */ 380 foo 381 ), 382 require.resolve( 383 /* before */ 384 "foo" 385 ), 386 require.resolve( 387 foo 388 /* after */ 389 ), 390 require.resolve( 391 "foo" 392 /* after */ 393 ) 394 ); 395 let [ 396 /* foo */ 397 ] = [ 398 /* bar */ 399 ]; 400 let [ 401 // foo 402 ] = [ 403 // bar 404 ]; 405 let [ 406 /*before*/ 407 ...s 408 ] = [ 409 /*before*/ 410 ...s 411 ]; 412 let [.../*before*/ 413 s2] = [.../*before*/ 414 s2]; 415 let { 416 /* foo */ 417 } = { 418 /* bar */ 419 }; 420 let { 421 // foo 422 } = { 423 // bar 424 }; 425 let { 426 /*before*/ 427 ...s3 428 } = { 429 /*before*/ 430 ...s3 431 }; 432 let { .../*before*/ 433 s4 } = { .../*before*/ 434 s4 }; 435 let [ 436 /* before */ 437 x 438 ] = [ 439 /* before */ 440 x 441 ]; 442 let [ 443 /* before */ 444 x2 445 /* after */ 446 ] = [ 447 /* before */ 448 x2 449 /* after */ 450 ]; 451 let [ 452 // before 453 x3 454 // after 455 ] = [ 456 // before 457 x3 458 // after 459 ]; 460 let { 461 /* before */ 462 y 463 } = { 464 /* before */ 465 y 466 }; 467 let { 468 /* before */ 469 y2 470 /* after */ 471 } = { 472 /* before */ 473 y2 474 /* after */ 475 }; 476 let { 477 // before 478 y3 479 // after 480 } = { 481 // before 482 y3 483 // after 484 }; 485 let { 486 /* before */ 487 [y4]: y4 488 } = { 489 /* before */ 490 [y4]: y4 491 }; 492 let { [ 493 /* before */ 494 y5 495 ]: y5 } = { [ 496 /* before */ 497 y5 498 ]: y5 }; 499 let { [ 500 y6 501 /* after */ 502 ]: y6 } = { [ 503 y6 504 /* after */ 505 ]: y6 }; 506 foo[ 507 /* before */ 508 x 509 ] = foo[ 510 /* before */ 511 x 512 ]; 513 foo[ 514 x 515 /* after */ 516 ] = foo[ 517 x 518 /* after */ 519 ]; 520 console.log( 521 // before 522 foo, 523 /* comment before */ 524 bar 525 // comment after 526 ); 527 console.log([ 528 // before 529 foo, 530 /* comment before */ 531 bar 532 // comment after 533 ]); 534 console.log({ 535 // before 536 foo, 537 /* comment before */ 538 bar 539 // comment after 540 }); 541 console.log(class { 542 // before 543 foo; 544 /* comment before */ 545 bar; 546 // comment after 547 }); 548 console.log( 549 () => { 550 return ( 551 /* foo */ 552 null 553 ); 554 }, 555 () => { 556 throw ( 557 /* foo */ 558 null 559 ); 560 }, 561 () => { 562 return ( 563 /* foo */ 564 null + 1 565 ); 566 }, 567 () => { 568 throw ( 569 /* foo */ 570 null + 1 571 ); 572 }, 573 () => { 574 return ( 575 // foo 576 null + 1 577 ); 578 }, 579 () => { 580 throw ( 581 // foo 582 null + 1 583 ); 584 } 585 ); 586 console.log( 587 /*a*/ 588 a ? ( 589 /*b*/ 590 b 591 ) : ( 592 /*c*/ 593 c 594 ), 595 a ? b : c 596 ); 597 for ( 598 /*foo*/ 599 a; 600 ; 601 ) ; 602 for ( 603 ; 604 /*foo*/ 605 a; 606 ) ; 607 for ( 608 ; 609 ; 610 /*foo*/ 611 a 612 ) ; 613 for ( 614 /*foo*/ 615 a in b 616 ) ; 617 for ( 618 a in 619 /*foo*/ 620 b 621 ) ; 622 for ( 623 /*foo*/ 624 a of b 625 ) ; 626 for ( 627 a of 628 /*foo*/ 629 b 630 ) ; 631 if ( 632 /*foo*/ 633 a 634 ) ; 635 with ( 636 /*foo*/ 637 a 638 ) ; 639 while ( 640 /*foo*/ 641 a 642 ) ; 643 do { 644 } while ( 645 /*foo*/ 646 a 647 ); 648 switch ( 649 /*foo*/ 650 a 651 ) { 652 } 653 654 ================================================================================ 655 TestCommentPreservationImportAssertions 656 ---------- /out/entry.js ---------- 657 // entry.jsx 658 import "foo" assert { type: "json" }; 659 import "foo" assert { type: "json" }; 660 import "foo" assert { 661 /* before */ 662 type: "json" 663 }; 664 import "foo" assert { 665 type: 666 /* before */ 667 "json" 668 }; 669 import "foo" assert { 670 type: "json" 671 /* before */ 672 }; 673 674 ================================================================================ 675 TestCommentPreservationPreserveJSX 676 ---------- /out/entry.js ---------- 677 // entry.jsx 678 console.log( 679 <div x={ 680 /*before*/ 681 x 682 } />, 683 <div x={ 684 /*before*/ 685 "y" 686 } />, 687 <div x={ 688 /*before*/ 689 true 690 } />, 691 <div { 692 /*before*/ 693 ...x 694 } />, 695 <div>{ 696 /*before*/ 697 x 698 }</div>, 699 <>{ 700 /*before*/ 701 x 702 }</>, 703 // Comments on absent AST nodes 704 <div>before{}after</div>, 705 <div>before{ 706 /* comment 1 */ 707 /* comment 2 */ 708 }after</div>, 709 <div>before{ 710 // comment 1 711 // comment 2 712 }after</div>, 713 <>before{}after</>, 714 <>before{ 715 /* comment 1 */ 716 /* comment 2 */ 717 }after</>, 718 <>before{ 719 // comment 1 720 // comment 2 721 }after</> 722 ); 723 724 ================================================================================ 725 TestCommentPreservationTransformJSX 726 ---------- /out/entry.js ---------- 727 // entry.jsx 728 console.log( 729 /* @__PURE__ */ React.createElement("div", { x: ( 730 /*before*/ 731 x 732 ) }), 733 /* @__PURE__ */ React.createElement("div", { x: ( 734 /*before*/ 735 "y" 736 ) }), 737 /* @__PURE__ */ React.createElement("div", { x: ( 738 /*before*/ 739 true 740 ) }), 741 /* @__PURE__ */ React.createElement("div", { 742 /*before*/ 743 ...x 744 }), 745 /* @__PURE__ */ React.createElement( 746 "div", 747 null, 748 /*before*/ 749 x 750 ), 751 /* @__PURE__ */ React.createElement( 752 React.Fragment, 753 null, 754 /*before*/ 755 x 756 ), 757 // Comments on absent AST nodes 758 /* @__PURE__ */ React.createElement("div", null, "before", "after"), 759 /* @__PURE__ */ React.createElement("div", null, "before", "after"), 760 /* @__PURE__ */ React.createElement("div", null, "before", "after"), 761 /* @__PURE__ */ React.createElement(React.Fragment, null, "before", "after"), 762 /* @__PURE__ */ React.createElement(React.Fragment, null, "before", "after"), 763 /* @__PURE__ */ React.createElement(React.Fragment, null, "before", "after") 764 ); 765 766 ================================================================================ 767 TestCommonJSFromES6 768 ---------- /out.js ---------- 769 // foo.js 770 var foo_exports = {}; 771 __export(foo_exports, { 772 foo: () => foo 773 }); 774 function foo() { 775 return "foo"; 776 } 777 var init_foo = __esm({ 778 "foo.js"() { 779 } 780 }); 781 782 // bar.js 783 var bar_exports = {}; 784 __export(bar_exports, { 785 bar: () => bar 786 }); 787 function bar() { 788 return "bar"; 789 } 790 var init_bar = __esm({ 791 "bar.js"() { 792 } 793 }); 794 795 // entry.js 796 var { foo: foo2 } = (init_foo(), __toCommonJS(foo_exports)); 797 console.log(foo2(), bar2()); 798 var { bar: bar2 } = (init_bar(), __toCommonJS(bar_exports)); 799 800 ================================================================================ 801 TestConditionalImport 802 ---------- /out/a.js ---------- 803 // import.js 804 var require_import = __commonJS({ 805 "import.js"(exports) { 806 exports.foo = 213; 807 } 808 }); 809 810 // a.js 811 x ? import("a") : y ? Promise.resolve().then(() => __toESM(require_import())) : import("c"); 812 813 ---------- /out/b.js ---------- 814 // import.js 815 var require_import = __commonJS({ 816 "import.js"(exports) { 817 exports.foo = 213; 818 } 819 }); 820 821 // b.js 822 x ? y ? import("a") : Promise.resolve().then(() => __toESM(require_import())) : import(c); 823 824 ================================================================================ 825 TestConditionalRequire 826 ---------- /out.js ---------- 827 // b.js 828 var require_b = __commonJS({ 829 "b.js"(exports) { 830 exports.foo = 213; 831 } 832 }); 833 834 // a.js 835 x ? __require("a") : y ? require_b() : __require("c"); 836 x ? y ? __require("a") : require_b() : __require(c); 837 838 ================================================================================ 839 TestConditionalRequireResolve 840 ---------- /out.js ---------- 841 // a.js 842 x ? require.resolve("a") : y ? require.resolve("b") : require.resolve("c"); 843 x ? y ? require.resolve("a") : require.resolve("b") : require.resolve(c); 844 845 ================================================================================ 846 TestConstWithLet 847 ---------- /out.js ---------- 848 // entry.js 849 console.log(1); 850 console.log(2); 851 unknownFn(3); 852 for (let c = x; ; ) console.log(c); 853 for (let d in x) console.log(d); 854 for (let e of x) console.log(e); 855 856 ================================================================================ 857 TestConstWithLetNoBundle 858 ---------- /out.js ---------- 859 const a = 1; 860 console.log(1), console.log(2), unknownFn(3); 861 for (const c = x; ; ) console.log(c); 862 for (const d in x) console.log(d); 863 for (const e of x) console.log(e); 864 865 ================================================================================ 866 TestConstWithLetNoMangle 867 ---------- /out.js ---------- 868 // entry.js 869 var a = 1; 870 console.log(a); 871 if (true) { 872 const b = 2; 873 console.log(b); 874 } 875 for (const c = x; ; ) console.log(c); 876 for (const d in x) console.log(d); 877 for (const e of x) console.log(e); 878 879 ================================================================================ 880 TestDecoratorPrintingCJS 881 ---------- /out.js ---------- 882 // entry.js 883 var import_somewhere = require("somewhere"); 884 _ = class { 885 #bar; 886 classes = [ 887 class { 888 @import_somewhere.imported @((0, import_somewhere.imported)()) imported; 889 }, 890 class { 891 @unbound @unbound() unbound; 892 }, 893 class { 894 @(123) @(123()) constant; 895 }, 896 class { 897 @(void 0) @((void 0)()) undef; 898 }, 899 class { 900 @(element[access]) indexed; 901 }, 902 class { 903 @foo.#bar private; 904 }, 905 class { 906 @(foo["ヿ"]) unicode; 907 }, 908 class { 909 @(() => { 910 }) arrow; 911 } 912 ]; 913 }; 914 915 ================================================================================ 916 TestDecoratorPrintingESM 917 ---------- /out.js ---------- 918 // entry.js 919 import { imported } from "somewhere"; 920 _ = class { 921 #bar; 922 classes = [ 923 class { 924 @imported @imported() imported; 925 }, 926 class { 927 @unbound @unbound() unbound; 928 }, 929 class { 930 @(123) @(123()) constant; 931 }, 932 class { 933 @(void 0) @((void 0)()) undef; 934 }, 935 class { 936 @(element[access]) indexed; 937 }, 938 class { 939 @foo.#bar private; 940 }, 941 class { 942 @(foo["ヿ"]) unicode; 943 }, 944 class { 945 @(() => { 946 }) arrow; 947 } 948 ]; 949 }; 950 951 ================================================================================ 952 TestDefineAssignWarning 953 ---------- /out/read.js ---------- 954 // read.js 955 console.log( 956 [null, null, null], 957 [ident, ident, ident], 958 [dot.chain, dot.chain, dot.chain] 959 ); 960 961 ---------- /out/write.js ---------- 962 // write.js 963 console.log( 964 [a = 0, b.c = 0, b["c"] = 0], 965 [ident = 0, ident = 0, ident = 0], 966 [dot.chain = 0, dot.chain = 0, dot.chain = 0] 967 ); 968 969 ================================================================================ 970 TestDefineImportMeta 971 ---------- /out.js ---------- 972 // entry.js 973 console.log( 974 // These should be fully substituted 975 1, 976 2, 977 3, 978 // Should just substitute "import.meta.foo" 979 2 .baz, 980 // This should not be substituted 981 1 .bar 982 ); 983 984 ================================================================================ 985 TestDefineImportMetaES5 986 ---------- /out/replaced.js ---------- 987 // replaced.js 988 console.log(1); 989 990 ---------- /out/kept.js ---------- 991 // kept.js 992 var import_meta = {}; 993 console.log(import_meta.y); 994 995 ---------- /out/dead-code.js ---------- 996 997 ================================================================================ 998 TestDefineInfiniteLoopIssue2407 999 ---------- /out.js ---------- 1000 // entry.js 1001 b.c(); 1002 y(); 1003 1004 ================================================================================ 1005 TestDefineOptionalChain 1006 ---------- /out.js ---------- 1007 // entry.js 1008 console.log([ 1009 1, 1010 1, 1011 1 1012 ], [ 1013 1, 1014 1, 1015 1 1016 ], [ 1017 a[b][c], 1018 a?.[b][c], 1019 a[b]?.[c] 1020 ]); 1021 1022 ================================================================================ 1023 TestDefineOptionalChainLowered 1024 ---------- /out.js ---------- 1025 // entry.js 1026 var _a; 1027 console.log([ 1028 1, 1029 1, 1030 1 1031 ], [ 1032 1, 1033 1, 1034 1 1035 ], [ 1036 a[b][c], 1037 a == null ? void 0 : a[b][c], 1038 (_a = a[b]) == null ? void 0 : _a[c] 1039 ]); 1040 1041 ================================================================================ 1042 TestDefineOptionalChainPanicIssue3551 1043 ---------- /out/id-define.js ---------- 1044 // id-define.js 1045 1?.y.z; 1046 (1?.y).z; 1047 1?.y["z"]; 1048 (1?.y)["z"]; 1049 1?.y(); 1050 (1?.y)(); 1051 1?.y.z(); 1052 (1?.y).z(); 1053 1?.y["z"](); 1054 (1?.y)["z"](); 1055 delete 1?.y.z; 1056 delete (1?.y).z; 1057 delete 1?.y["z"]; 1058 delete (1?.y)["z"]; 1059 1060 ---------- /out/dot-define.js ---------- 1061 // dot-define.js 1062 1 .c; 1063 1 .c; 1064 1["c"]; 1065 1["c"]; 1066 1(); 1067 1(); 1068 1 .c(); 1069 1 .c(); 1070 1["c"](); 1071 1["c"](); 1072 delete 1 .c; 1073 delete 1 .c; 1074 delete 1["c"]; 1075 delete 1["c"]; 1076 1077 ================================================================================ 1078 TestDefineThis 1079 ---------- /out.js ---------- 1080 // entry.js 1081 ok( 1082 // These should be fully substituted 1083 1, 1084 2, 1085 3, 1086 // Should just substitute "this.foo" 1087 2 .baz, 1088 // This should not be substituted 1089 1 .bar 1090 ); 1091 (() => { 1092 ok( 1093 1, 1094 2, 1095 3, 1096 2 .baz, 1097 1 .bar 1098 ); 1099 })(); 1100 (function() { 1101 doNotSubstitute( 1102 this, 1103 this.foo, 1104 this.foo.bar, 1105 this.foo.baz, 1106 this.bar 1107 ); 1108 })(); 1109 1110 ================================================================================ 1111 TestDirectEvalTaintingNoBundle 1112 ---------- /out.js ---------- 1113 function test1() { 1114 function add(n, t) { 1115 return n + t; 1116 } 1117 eval("add(1, 2)"); 1118 } 1119 function test2() { 1120 function n(t, e) { 1121 return t + e; 1122 } 1123 (0, eval)("add(1, 2)"); 1124 } 1125 function test3() { 1126 function n(t, e) { 1127 return t + e; 1128 } 1129 } 1130 function test4(eval) { 1131 function add(n, t) { 1132 return n + t; 1133 } 1134 eval("add(1, 2)"); 1135 } 1136 function test5() { 1137 function containsDirectEval() { 1138 eval(); 1139 } 1140 if (true) { 1141 var shouldNotBeRenamed; 1142 } 1143 } 1144 1145 ================================================================================ 1146 TestDotImport 1147 ---------- /out.js ---------- 1148 // index.js 1149 var require_index = __commonJS({ 1150 "index.js"(exports) { 1151 exports.x = 123; 1152 } 1153 }); 1154 1155 // entry.js 1156 var import__ = __toESM(require_index()); 1157 console.log(import__.x); 1158 1159 ================================================================================ 1160 TestDuplicateEntryPoint 1161 ---------- /out.js/entry.js ---------- 1162 // entry.js 1163 console.log(123); 1164 1165 ================================================================================ 1166 TestDuplicatePropertyWarning 1167 ---------- /out/entry.js ---------- 1168 // outside-node-modules/index.jsx 1169 console.log({ a: 1, a: 2 }, /* @__PURE__ */ React.createElement("div", { a2: true, a2: 3 })); 1170 1171 // node_modules/inside-node-modules/index.jsx 1172 console.log({ c: 1, c: 2 }, /* @__PURE__ */ React.createElement("div", { c2: true, c2: 3 })); 1173 1174 ================================================================================ 1175 TestDynamicImportWithExpressionCJS 1176 ---------- /out.js ---------- 1177 import("foo"); 1178 import(foo()); 1179 1180 ================================================================================ 1181 TestDynamicImportWithTemplateIIFE 1182 ---------- /out.js ---------- 1183 (() => { 1184 // b.js 1185 var require_b = __commonJS({ 1186 "b.js"(exports) { 1187 exports.x = 123; 1188 } 1189 }); 1190 1191 // a.js 1192 Promise.resolve().then(() => __toESM(require_b())).then((ns) => console.log(ns)); 1193 Promise.resolve().then(() => __toESM(require_b())).then((ns) => console.log(ns)); 1194 })(); 1195 1196 ================================================================================ 1197 TestES6FromCommonJS 1198 ---------- /out.js ---------- 1199 // foo.js 1200 var require_foo = __commonJS({ 1201 "foo.js"(exports) { 1202 exports.foo = function() { 1203 return "foo"; 1204 }; 1205 } 1206 }); 1207 1208 // bar.js 1209 var require_bar = __commonJS({ 1210 "bar.js"(exports) { 1211 exports.bar = function() { 1212 return "bar"; 1213 }; 1214 } 1215 }); 1216 1217 // entry.js 1218 var import_foo = __toESM(require_foo()); 1219 var import_bar = __toESM(require_bar()); 1220 console.log((0, import_foo.foo)(), (0, import_bar.bar)()); 1221 1222 ================================================================================ 1223 TestEmptyExportClauseBundleAsCommonJSIssue910 1224 ---------- /out.js ---------- 1225 // types.mjs 1226 var types_exports = {}; 1227 var init_types = __esm({ 1228 "types.mjs"() { 1229 } 1230 }); 1231 1232 // entry.js 1233 console.log((init_types(), __toCommonJS(types_exports))); 1234 1235 ================================================================================ 1236 TestEntryNamesChunkNamesExtPlaceholder 1237 ---------- /out/main/js/entry1-4X3SO762.js ---------- 1238 import "../../common/js/chunk-XHGYOYUR.js"; 1239 1240 // src/entries/entry1.js 1241 console.log("entry1"); 1242 1243 ---------- /out/main/js/entry2-URQRHZS5.js ---------- 1244 import "../../common/js/chunk-XHGYOYUR.js"; 1245 1246 // src/entries/entry2.js 1247 console.log("entry2"); 1248 1249 ---------- /out/common/js/chunk-XHGYOYUR.js ---------- 1250 // src/lib/shared.js 1251 console.log("shared"); 1252 1253 ---------- /out/main/css/entry1-3JZGIUSL.css ---------- 1254 /* src/entries/entry1.css */ 1255 a:after { 1256 content: "entry1"; 1257 } 1258 1259 ---------- /out/main/css/entry2-NXZBPPIA.css ---------- 1260 /* src/entries/entry2.css */ 1261 a:after { 1262 content: "entry2"; 1263 } 1264 1265 ================================================================================ 1266 TestEntryNamesNoSlashAfterDir 1267 ---------- /out/app1-main.js ---------- 1268 console.log(1); 1269 1270 ---------- /out/app2-main.js ---------- 1271 console.log(2); 1272 1273 ---------- /out/-customPath.js ---------- 1274 console.log(3); 1275 1276 ================================================================================ 1277 TestEntryNamesNonPortableCharacter 1278 ---------- /out/entry1-_.js ---------- 1279 console.log(1); 1280 1281 ---------- /out/entry2-*.js ---------- 1282 console.log(2); 1283 1284 ================================================================================ 1285 TestExportChain 1286 ---------- /out.js ---------- 1287 // bar.js 1288 var c = 123; 1289 export { 1290 c as a 1291 }; 1292 1293 ================================================================================ 1294 TestExportFSNode 1295 ---------- /out.js ---------- 1296 // entry.js 1297 import * as fs from "fs"; 1298 import { readFileSync } from "fs"; 1299 export { 1300 fs, 1301 readFileSync 1302 }; 1303 1304 ================================================================================ 1305 TestExportFSNodeInCommonJSModule 1306 ---------- /out.js ---------- 1307 // entry.js 1308 import * as fs from "fs"; 1309 import { readFileSync } from "fs"; 1310 var require_entry = __commonJS({ 1311 "entry.js"(exports) { 1312 exports.fs = fs; 1313 exports.readFileSync = readFileSync; 1314 exports.foo = 123; 1315 } 1316 }); 1317 export default require_entry(); 1318 1319 ================================================================================ 1320 TestExportFormsCommonJS 1321 ---------- /out.js ---------- 1322 // a.js 1323 var abc; 1324 var init_a = __esm({ 1325 "a.js"() { 1326 abc = void 0; 1327 } 1328 }); 1329 1330 // b.js 1331 var b_exports = {}; 1332 __export(b_exports, { 1333 xyz: () => xyz 1334 }); 1335 var xyz; 1336 var init_b = __esm({ 1337 "b.js"() { 1338 xyz = null; 1339 } 1340 }); 1341 1342 // commonjs.js 1343 var commonjs_exports = {}; 1344 __export(commonjs_exports, { 1345 C: () => Class, 1346 Class: () => Class, 1347 Fn: () => Fn, 1348 abc: () => abc, 1349 b: () => b_exports, 1350 c: () => c, 1351 default: () => commonjs_default, 1352 l: () => l, 1353 v: () => v 1354 }); 1355 function Fn() { 1356 } 1357 var commonjs_default, v, l, c, Class; 1358 var init_commonjs = __esm({ 1359 "commonjs.js"() { 1360 init_a(); 1361 init_b(); 1362 commonjs_default = 123; 1363 v = 234; 1364 l = 234; 1365 c = 234; 1366 Class = class { 1367 }; 1368 } 1369 }); 1370 1371 // c.js 1372 var c_exports = {}; 1373 __export(c_exports, { 1374 default: () => c_default 1375 }); 1376 var c_default; 1377 var init_c = __esm({ 1378 "c.js"() { 1379 c_default = class { 1380 }; 1381 } 1382 }); 1383 1384 // d.js 1385 var d_exports = {}; 1386 __export(d_exports, { 1387 default: () => Foo 1388 }); 1389 var Foo; 1390 var init_d = __esm({ 1391 "d.js"() { 1392 Foo = class { 1393 }; 1394 Foo.prop = 123; 1395 } 1396 }); 1397 1398 // e.js 1399 var e_exports = {}; 1400 __export(e_exports, { 1401 default: () => e_default 1402 }); 1403 function e_default() { 1404 } 1405 var init_e = __esm({ 1406 "e.js"() { 1407 } 1408 }); 1409 1410 // f.js 1411 var f_exports = {}; 1412 __export(f_exports, { 1413 default: () => foo 1414 }); 1415 function foo() { 1416 } 1417 var init_f = __esm({ 1418 "f.js"() { 1419 foo.prop = 123; 1420 } 1421 }); 1422 1423 // g.js 1424 var g_exports = {}; 1425 __export(g_exports, { 1426 default: () => g_default 1427 }); 1428 async function g_default() { 1429 } 1430 var init_g = __esm({ 1431 "g.js"() { 1432 } 1433 }); 1434 1435 // h.js 1436 var h_exports = {}; 1437 __export(h_exports, { 1438 default: () => foo2 1439 }); 1440 async function foo2() { 1441 } 1442 var init_h = __esm({ 1443 "h.js"() { 1444 foo2.prop = 123; 1445 } 1446 }); 1447 1448 // entry.js 1449 init_commonjs(); 1450 init_c(); 1451 init_d(); 1452 init_e(); 1453 init_f(); 1454 init_g(); 1455 init_h(); 1456 1457 ================================================================================ 1458 TestExportFormsES6 1459 ---------- /out.js ---------- 1460 // a.js 1461 var abc = void 0; 1462 1463 // b.js 1464 var b_exports = {}; 1465 __export(b_exports, { 1466 xyz: () => xyz 1467 }); 1468 var xyz = null; 1469 1470 // entry.js 1471 var entry_default = 123; 1472 var v = 234; 1473 var l = 234; 1474 var c = 234; 1475 function Fn() { 1476 } 1477 var Class = class { 1478 }; 1479 export { 1480 Class as C, 1481 Class, 1482 Fn, 1483 abc, 1484 b_exports as b, 1485 c, 1486 entry_default as default, 1487 l, 1488 v 1489 }; 1490 1491 ================================================================================ 1492 TestExportFormsIIFE 1493 ---------- /out.js ---------- 1494 var globalName = (() => { 1495 // entry.js 1496 var entry_exports = {}; 1497 __export(entry_exports, { 1498 C: () => Class, 1499 Class: () => Class, 1500 Fn: () => Fn, 1501 abc: () => abc, 1502 b: () => b_exports, 1503 c: () => c, 1504 default: () => entry_default, 1505 l: () => l, 1506 v: () => v 1507 }); 1508 1509 // a.js 1510 var abc = void 0; 1511 1512 // b.js 1513 var b_exports = {}; 1514 __export(b_exports, { 1515 xyz: () => xyz 1516 }); 1517 var xyz = null; 1518 1519 // entry.js 1520 var entry_default = 123; 1521 var v = 234; 1522 var l = 234; 1523 var c = 234; 1524 function Fn() { 1525 } 1526 var Class = class { 1527 }; 1528 return __toCommonJS(entry_exports); 1529 })(); 1530 1531 ================================================================================ 1532 TestExportFormsWithMinifyIdentifiersAndNoBundle 1533 ---------- /out/a.js ---------- 1534 export default 123; 1535 export var varName = 234; 1536 export let letName = 234; 1537 export const constName = 234; 1538 function s() { 1539 } 1540 class t { 1541 } 1542 export { Class as Cls, s as Fn2, t as Cls2 }; 1543 export function Func() { 1544 } 1545 export class Class { 1546 } 1547 export * from "./a"; 1548 export * as fromB from "./b"; 1549 1550 ---------- /out/b.js ---------- 1551 export default function() { 1552 } 1553 1554 ---------- /out/c.js ---------- 1555 export default function o() { 1556 } 1557 1558 ---------- /out/d.js ---------- 1559 export default class { 1560 } 1561 1562 ---------- /out/e.js ---------- 1563 export default class o { 1564 } 1565 1566 ================================================================================ 1567 TestExportWildcardFSNodeCommonJS 1568 ---------- /out.js ---------- 1569 // entry.js 1570 var entry_exports = {}; 1571 __export(entry_exports, { 1572 foo: () => foo 1573 }); 1574 module.exports = __toCommonJS(entry_exports); 1575 __reExport(entry_exports, require("fs"), module.exports); 1576 1577 // internal.js 1578 var foo = 123; 1579 1580 // entry.js 1581 __reExport(entry_exports, require("./external"), module.exports); 1582 // Annotate the CommonJS export names for ESM import in node: 1583 0 && (module.exports = { 1584 foo, 1585 ...require("fs"), 1586 ...require("./external") 1587 }); 1588 1589 ================================================================================ 1590 TestExportWildcardFSNodeES6 1591 ---------- /out.js ---------- 1592 // entry.js 1593 export * from "fs"; 1594 1595 // internal.js 1596 var foo = 123; 1597 1598 // entry.js 1599 export * from "./external"; 1600 export { 1601 foo 1602 }; 1603 1604 ================================================================================ 1605 TestExportsAndModuleFormatCommonJS 1606 ---------- /out.js ---------- 1607 // foo/test.js 1608 var test_exports = {}; 1609 __export(test_exports, { 1610 foo: () => foo 1611 }); 1612 var foo = 123; 1613 1614 // bar/test.js 1615 var test_exports2 = {}; 1616 __export(test_exports2, { 1617 bar: () => bar 1618 }); 1619 var bar = 123; 1620 1621 // entry.js 1622 console.log(exports, module.exports, test_exports, test_exports2); 1623 1624 ================================================================================ 1625 TestExternalES6ConvertedToCommonJS 1626 ---------- /out.js ---------- 1627 // a.js 1628 var a_exports = {}; 1629 __export(a_exports, { 1630 ns: () => ns 1631 }); 1632 import * as ns from "x"; 1633 var init_a = __esm({ 1634 "a.js"() { 1635 } 1636 }); 1637 1638 // b.js 1639 var b_exports = {}; 1640 __export(b_exports, { 1641 ns: () => ns2 1642 }); 1643 import * as ns2 from "x"; 1644 var init_b = __esm({ 1645 "b.js"() { 1646 } 1647 }); 1648 1649 // c.js 1650 var c_exports = {}; 1651 __export(c_exports, { 1652 ns: () => ns3 1653 }); 1654 import * as ns3 from "x"; 1655 var init_c = __esm({ 1656 "c.js"() { 1657 } 1658 }); 1659 1660 // d.js 1661 var d_exports = {}; 1662 __export(d_exports, { 1663 ns: () => ns4 1664 }); 1665 import { ns as ns4 } from "x"; 1666 var init_d = __esm({ 1667 "d.js"() { 1668 } 1669 }); 1670 1671 // e.js 1672 var e_exports = {}; 1673 import * as x_star from "x"; 1674 var init_e = __esm({ 1675 "e.js"() { 1676 __reExport(e_exports, x_star); 1677 } 1678 }); 1679 1680 // entry.js 1681 init_a(); 1682 init_b(); 1683 init_c(); 1684 init_d(); 1685 init_e(); 1686 1687 ================================================================================ 1688 TestExternalModuleExclusionPackage 1689 ---------- /out.js ---------- 1690 // index.js 1691 import { S3 } from "aws-sdk"; 1692 import { DocumentClient } from "aws-sdk/clients/dynamodb"; 1693 var s3 = new S3(); 1694 var dynamodb = new DocumentClient(); 1695 export { 1696 dynamodb, 1697 s3 1698 }; 1699 1700 ================================================================================ 1701 TestExternalModuleExclusionRelativePath 1702 ---------- /Users/user/project/out/index.js ---------- 1703 // Users/user/project/src/nested/folder/test.js 1704 import foo from "../src/nested/folder/foo.js"; 1705 import out from "./in-out-dir.js"; 1706 import sha256 from "../src/sha256.min.js"; 1707 import config from "/api/config?a=1&b=2"; 1708 console.log(foo, out, sha256, config); 1709 1710 ================================================================================ 1711 TestExternalPackages 1712 ---------- /out.js ---------- 1713 // project/entry.js 1714 import "pkg1"; 1715 1716 // project/file.js 1717 console.log("file"); 1718 1719 // project/node_modules/pkg2/index.js 1720 console.log("pkg2"); 1721 1722 // project/libs/pkg3.js 1723 console.log("pkg3"); 1724 1725 ================================================================================ 1726 TestExternalWildcardDoesNotMatchEntryPoint 1727 ---------- /out.js ---------- 1728 // entry.js 1729 import "foo"; 1730 1731 ================================================================================ 1732 TestFalseRequire 1733 ---------- /out.js ---------- 1734 // entry.js 1735 ((require2) => require2("/test.txt"))(); 1736 1737 ================================================================================ 1738 TestHashbangBannerUseStrictOrder 1739 ---------- /out.js ---------- 1740 #! in file 1741 #! from banner 1742 "use strict"; 1743 (() => { 1744 // entry.js 1745 foo(); 1746 })(); 1747 1748 ================================================================================ 1749 TestHashbangBundle 1750 ---------- /out.js ---------- 1751 #!/usr/bin/env a 1752 1753 // code.js 1754 var code = 0; 1755 1756 // entry.js 1757 process.exit(code); 1758 1759 ================================================================================ 1760 TestHashbangNoBundle 1761 ---------- /out.js ---------- 1762 #!/usr/bin/env node 1763 process.exit(0); 1764 1765 ================================================================================ 1766 TestIIFE_ES5 1767 ---------- /out.js ---------- 1768 (function() { 1769 // entry.js 1770 console.log("test"); 1771 })(); 1772 1773 ================================================================================ 1774 TestImportAbsPathAsDir 1775 ---------- /out/entry.js ---------- 1776 // Users/user/project/node_modules/pkg/index.js 1777 var pkg_default = 123; 1778 1779 // Users/user/project/entry.js 1780 console.log(pkg_default); 1781 1782 ================================================================================ 1783 TestImportAbsPathAsFile 1784 ---------- /out/entry.js ---------- 1785 // Users/user/project/node_modules/pkg/index.js 1786 var pkg_default = 123; 1787 1788 // Users/user/project/entry.js 1789 console.log(pkg_default); 1790 1791 ================================================================================ 1792 TestImportAbsPathWithQueryParameter 1793 ---------- /out/entry.js ---------- 1794 // Users/user/project/file.txt?foo 1795 var file_default = "This is some text"; 1796 1797 // Users/user/project/file.txt#bar 1798 var file_default2 = "This is some text"; 1799 1800 // Users/user/project/entry.js 1801 console.log(file_default, file_default2); 1802 1803 ================================================================================ 1804 TestImportFSNodeCommonJS 1805 ---------- /out.js ---------- 1806 // entry.js 1807 var fs = __toESM(require("fs")); 1808 var import_fs = __toESM(require("fs")); 1809 var import_fs2 = require("fs"); 1810 console.log(fs, import_fs2.readFileSync, import_fs.default); 1811 1812 ================================================================================ 1813 TestImportFSNodeES6 1814 ---------- /out.js ---------- 1815 // entry.js 1816 import * as fs from "fs"; 1817 import defaultValue from "fs"; 1818 import { readFileSync } from "fs"; 1819 console.log(fs, readFileSync, defaultValue); 1820 1821 ================================================================================ 1822 TestImportFormsWithMinifyIdentifiersAndNoBundle 1823 ---------- /out.js ---------- 1824 import "foo"; 1825 import {} from "foo"; 1826 import * as o from "foo"; 1827 import { a as r, b as m } from "foo"; 1828 import t from "foo"; 1829 import f, * as i from "foo"; 1830 import p, { a2 as s, b as n } from "foo"; 1831 const a = [ 1832 import("foo"), 1833 function() { 1834 return import("foo"); 1835 } 1836 ]; 1837 console.log(o, r, m, t, f, i, p, s, n, a); 1838 1839 ================================================================================ 1840 TestImportFormsWithNoBundle 1841 ---------- /out.js ---------- 1842 import "foo"; 1843 import {} from "foo"; 1844 import * as ns from "foo"; 1845 import { a, b as c } from "foo"; 1846 import def from "foo"; 1847 import def2, * as ns2 from "foo"; 1848 import def3, { a2, b as c3 } from "foo"; 1849 const imp = [ 1850 import("foo"), 1851 function nested() { 1852 return import("foo"); 1853 } 1854 ]; 1855 console.log(ns, a, c, def, def2, ns2, def3, a2, c3, imp); 1856 1857 ================================================================================ 1858 TestImportMetaCommonJS 1859 ---------- /out.js ---------- 1860 // entry.js 1861 var import_meta = {}; 1862 console.log(import_meta.url, import_meta.path); 1863 1864 ================================================================================ 1865 TestImportMetaES6 1866 ---------- /out.js ---------- 1867 // entry.js 1868 console.log(import.meta.url, import.meta.path); 1869 1870 ================================================================================ 1871 TestImportMetaNoBundle 1872 ---------- /out.js ---------- 1873 console.log(import.meta.url, import.meta.path); 1874 1875 ================================================================================ 1876 TestImportMissingCommonJS 1877 ---------- /out.js ---------- 1878 // foo.js 1879 var require_foo = __commonJS({ 1880 "foo.js"(exports) { 1881 exports.x = 123; 1882 } 1883 }); 1884 1885 // entry.js 1886 var import_foo = __toESM(require_foo()); 1887 console.log((0, import_foo.default)(import_foo.x, import_foo.y)); 1888 1889 ================================================================================ 1890 TestImportMissingNeitherES6NorCommonJS 1891 ---------- /out/named.js ---------- 1892 // foo.js 1893 var require_foo = __commonJS({ 1894 "foo.js"() { 1895 console.log("no exports here"); 1896 } 1897 }); 1898 1899 // named.js 1900 var import_foo = __toESM(require_foo()); 1901 console.log((0, import_foo.default)(void 0, void 0)); 1902 1903 ---------- /out/star.js ---------- 1904 // foo.js 1905 var require_foo = __commonJS({ 1906 "foo.js"() { 1907 console.log("no exports here"); 1908 } 1909 }); 1910 1911 // star.js 1912 var ns = __toESM(require_foo()); 1913 console.log(ns.default(void 0, void 0)); 1914 1915 ---------- /out/star-capture.js ---------- 1916 // foo.js 1917 var require_foo = __commonJS({ 1918 "foo.js"() { 1919 console.log("no exports here"); 1920 } 1921 }); 1922 1923 // star-capture.js 1924 var ns = __toESM(require_foo()); 1925 console.log(ns); 1926 1927 ---------- /out/bare.js ---------- 1928 // foo.js 1929 console.log("no exports here"); 1930 1931 ---------- /out/require.js ---------- 1932 // foo.js 1933 var require_foo = __commonJS({ 1934 "foo.js"() { 1935 console.log("no exports here"); 1936 } 1937 }); 1938 1939 // require.js 1940 console.log(require_foo()); 1941 1942 ---------- /out/import.js ---------- 1943 // foo.js 1944 var require_foo = __commonJS({ 1945 "foo.js"() { 1946 console.log("no exports here"); 1947 } 1948 }); 1949 1950 // import.js 1951 console.log(Promise.resolve().then(() => __toESM(require_foo()))); 1952 1953 ================================================================================ 1954 TestImportNamespaceThisValue 1955 ---------- /out/a.js ---------- 1956 // a.js 1957 var ns = __toESM(require("external")); 1958 console.log(ns[foo](), new ns[foo]()); 1959 1960 ---------- /out/b.js ---------- 1961 // b.js 1962 var ns = __toESM(require("external")); 1963 console.log(ns.foo(), new ns.foo()); 1964 1965 ---------- /out/c.js ---------- 1966 // c.js 1967 var import_external = __toESM(require("external")); 1968 console.log((0, import_external.default)(), (0, import_external.foo)()); 1969 console.log(new import_external.default(), new import_external.foo()); 1970 1971 ================================================================================ 1972 TestImportReExportES6Issue149 1973 ---------- /out.js ---------- 1974 // import.js 1975 import { h, render } from "preact"; 1976 var p = "p"; 1977 1978 // in2.jsx 1979 var Internal = () => /* @__PURE__ */ h(p, null, " Test 2 "); 1980 1981 // app.jsx 1982 var App = () => /* @__PURE__ */ h(p, null, " ", /* @__PURE__ */ h(Internal, null), " T "); 1983 render(/* @__PURE__ */ h(App, null), document.getElementById("app")); 1984 1985 ================================================================================ 1986 TestImportThenCatch 1987 ---------- /out.js ---------- 1988 // entry.js 1989 import(name).then(pass, fail); 1990 import(name).then(pass).catch(fail); 1991 import(name).catch(fail); 1992 1993 ================================================================================ 1994 TestImportWithHashInPath 1995 ---------- /out/entry.js ---------- 1996 // file#foo.txt 1997 var file_foo_default = "foo"; 1998 1999 // file#bar.txt 2000 var file_bar_default = "bar"; 2001 2002 // entry.js 2003 console.log(file_foo_default, file_bar_default); 2004 2005 ================================================================================ 2006 TestImportWithHashParameter 2007 ---------- /out/entry.js ---------- 2008 // file.txt#foo 2009 var file_default = "This is some text"; 2010 2011 // file.txt#bar 2012 var file_default2 = "This is some text"; 2013 2014 // entry.js 2015 console.log(file_default, file_default2); 2016 2017 ================================================================================ 2018 TestImportWithQueryParameter 2019 ---------- /out/entry.js ---------- 2020 // file.txt?foo 2021 var file_default = "This is some text"; 2022 2023 // file.txt?bar 2024 var file_default2 = "This is some text"; 2025 2026 // entry.js 2027 console.log(file_default, file_default2); 2028 2029 ================================================================================ 2030 TestIndirectRequireMessage 2031 ---------- /out/array.js ---------- 2032 2033 ---------- /out/assign.js ---------- 2034 // assign.js 2035 __require = x; 2036 2037 ---------- /out/dot.js ---------- 2038 // dot.js 2039 var x = __require.cache; 2040 2041 ---------- /out/ident.js ---------- 2042 2043 ---------- /out/index.js ---------- 2044 // index.js 2045 var x = __require[cache]; 2046 2047 ================================================================================ 2048 TestInject 2049 ---------- /out.js ---------- 2050 // inject.js 2051 var obj = {}; 2052 var sideEffects = console.log("side effects"); 2053 2054 // node_modules/unused/index.js 2055 console.log("This is unused but still has side effects"); 2056 2057 // replacement.js 2058 var replace = { 2059 test() { 2060 } 2061 }; 2062 var replace2 = { 2063 test() { 2064 } 2065 }; 2066 2067 // re-export.js 2068 var import_external_pkg = require("external-pkg"); 2069 var import_external_pkg2 = require("external-pkg2"); 2070 2071 // entry.js 2072 var sideEffects2 = console.log("this should be renamed"); 2073 var collide = 123; 2074 console.log(obj.prop); 2075 console.log("defined"); 2076 console.log("should be used"); 2077 console.log("should be used"); 2078 console.log(replace.test); 2079 console.log(replace2.test); 2080 console.log(collide); 2081 console.log(import_external_pkg.re_export); 2082 console.log(re_export2); 2083 2084 ================================================================================ 2085 TestInjectDuplicate 2086 ---------- /out.js ---------- 2087 // inject.js 2088 console.log("injected"); 2089 2090 ================================================================================ 2091 TestInjectImportMeta 2092 ---------- /out.js ---------- 2093 // inject.js 2094 var foo = 1; 2095 var bar = 2; 2096 var baz = 3; 2097 2098 // entry.js 2099 console.log( 2100 // These should be fully substituted 2101 foo, 2102 bar, 2103 baz, 2104 // Should just substitute "import.meta.foo" 2105 bar.baz, 2106 // This should not be substituted 2107 foo.bar 2108 ); 2109 2110 ================================================================================ 2111 TestInjectImportOrder 2112 ---------- /out.js ---------- 2113 // inject-1.js 2114 import "first"; 2115 console.log("first"); 2116 2117 // inject-2.js 2118 import "second"; 2119 console.log("second"); 2120 2121 // entry.ts 2122 import "third"; 2123 console.log("third"); 2124 2125 ================================================================================ 2126 TestInjectImportTS 2127 ---------- /out.js ---------- 2128 console.log("must be present"); 2129 console.log("here"); 2130 2131 ================================================================================ 2132 TestInjectJSX 2133 ---------- /out.js ---------- 2134 // inject.js 2135 function el() { 2136 } 2137 function frag() { 2138 } 2139 2140 // entry.jsx 2141 console.log(/* @__PURE__ */ el(frag, null, /* @__PURE__ */ el("div", null))); 2142 2143 ================================================================================ 2144 TestInjectJSXDotNames 2145 ---------- /out.js ---------- 2146 // inject.js 2147 function el() { 2148 } 2149 function frag() { 2150 } 2151 2152 // entry.jsx 2153 console.log(/* @__PURE__ */ el(frag, null, /* @__PURE__ */ el("div", null))); 2154 2155 ================================================================================ 2156 TestInjectNoBundle 2157 ---------- /out.js ---------- 2158 var obj2 = {}; 2159 var sideEffects2 = console.log("this should be renamed"); 2160 console.log("This is unused but still has side effects"); 2161 var replace2 = { 2162 test() { 2163 } 2164 }; 2165 var replaceDot = { 2166 test() { 2167 } 2168 }; 2169 import { re_export as re_export2 } from "external-pkg"; 2170 import { "reexpo.rt" as reexpo_rt } from "external-pkg2"; 2171 let sideEffects = console.log("side effects"); 2172 let collide = 123; 2173 console.log(obj2.prop); 2174 console.log("defined"); 2175 console.log("should be used"); 2176 console.log("should be used"); 2177 console.log(replace2.test); 2178 console.log(replaceDot.test); 2179 console.log(collide); 2180 console.log(re_export2); 2181 console.log(reexpo_rt); 2182 2183 ================================================================================ 2184 TestInjectWithDefine 2185 ---------- /out.js ---------- 2186 // inject.js 2187 var second = "success (identifier)"; 2188 var second2 = "success (dot name)"; 2189 2190 // entry.js 2191 console.log( 2192 // define wins over inject 2193 true, 2194 true, 2195 // define forwards to inject 2196 second === "success (identifier)", 2197 second2 === "success (dot name)" 2198 ); 2199 2200 ================================================================================ 2201 TestInjectWithStringExportNameBundle 2202 ---------- /out.js ---------- 2203 // inject.js 2204 var old = console.log; 2205 var fn = (...args) => old.apply(console, ["log:"].concat(args)); 2206 2207 // entry.js 2208 fn(test); 2209 fn(test); 2210 fn(test); 2211 2212 ================================================================================ 2213 TestInjectWithStringExportNameNoBundle 2214 ---------- /out.js ---------- 2215 var old = console.log; 2216 var fn = (...args) => old.apply(console, ["log:"].concat(args)); 2217 fn(test); 2218 2219 ================================================================================ 2220 TestJSXAutomaticImportsCommonJS 2221 ---------- /out.js ---------- 2222 // custom-react.js 2223 var require_custom_react = __commonJS({ 2224 "custom-react.js"(exports, module) { 2225 module.exports = {}; 2226 } 2227 }); 2228 2229 // entry.jsx 2230 var import_custom_react = __toESM(require_custom_react()); 2231 import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime"; 2232 console.log(/* @__PURE__ */ jsx2("div", { jsx: import_custom_react.jsx }), /* @__PURE__ */ jsx2(Fragment2, { children: /* @__PURE__ */ jsx2(import_custom_react.Fragment, {}) })); 2233 2234 ================================================================================ 2235 TestJSXAutomaticImportsES6 2236 ---------- /out.js ---------- 2237 // custom-react.js 2238 function jsx() { 2239 } 2240 function Fragment() { 2241 } 2242 2243 // entry.jsx 2244 import { Fragment as Fragment2, jsx as jsx2 } from "react/jsx-runtime"; 2245 console.log(/* @__PURE__ */ jsx2("div", { jsx }), /* @__PURE__ */ jsx2(Fragment2, { children: /* @__PURE__ */ jsx2(Fragment, {}) })); 2246 2247 ================================================================================ 2248 TestJSXConstantFragments 2249 ---------- /out.js ---------- 2250 // default.jsx 2251 console.log(/* @__PURE__ */ React.createElement("]", null)); 2252 2253 // null.jsx 2254 console.log(/* @__PURE__ */ React.createElement(null, null)); 2255 2256 // boolean.jsx 2257 console.log(/* @__PURE__ */ React.createElement(true, null)); 2258 2259 // number.jsx 2260 console.log(/* @__PURE__ */ React.createElement(123, null)); 2261 2262 // string-single-empty.jsx 2263 console.log(/* @__PURE__ */ React.createElement("", null)); 2264 2265 // string-double-empty.jsx 2266 console.log(/* @__PURE__ */ React.createElement("", null)); 2267 2268 // string-single-punctuation.jsx 2269 console.log(/* @__PURE__ */ React.createElement("[", null)); 2270 2271 // string-double-punctuation.jsx 2272 console.log(/* @__PURE__ */ React.createElement("[", null)); 2273 2274 // string-template.jsx 2275 console.log(/* @__PURE__ */ React.createElement("]", null)); 2276 2277 ================================================================================ 2278 TestJSXDevSelfEdgeCases 2279 ---------- /out/class-this.js ---------- 2280 // class-this.jsx 2281 import { jsxDEV } from "react/jsx-dev-runtime"; 2282 var Foo = class { 2283 foo() { 2284 return /* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2285 fileName: "class-this.jsx", 2286 lineNumber: 1, 2287 columnNumber: 35 2288 }, this); 2289 } 2290 }; 2291 export { 2292 Foo 2293 }; 2294 2295 ---------- /out/derived-constructor-arg.js ---------- 2296 // derived-constructor-arg.jsx 2297 import { jsxDEV } from "react/jsx-dev-runtime"; 2298 var Foo = class extends Object { 2299 constructor(foo = /* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2300 fileName: "derived-constructor-arg.jsx", 2301 lineNumber: 1, 2302 columnNumber: 53 2303 })) { 2304 super(); 2305 } 2306 }; 2307 export { 2308 Foo 2309 }; 2310 2311 ---------- /out/derived-constructor-field.js ---------- 2312 // derived-constructor-field.tsx 2313 import { jsxDEV } from "react/jsx-dev-runtime"; 2314 var Foo = class extends Object { 2315 constructor() { 2316 super(...arguments); 2317 this.foo = /* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2318 fileName: "derived-constructor-field.tsx", 2319 lineNumber: 1, 2320 columnNumber: 41 2321 }, this); 2322 } 2323 }; 2324 export { 2325 Foo 2326 }; 2327 2328 ---------- /out/derived-constructor.js ---------- 2329 // derived-constructor.jsx 2330 import { jsxDEV } from "react/jsx-dev-runtime"; 2331 var Foo = class extends Object { 2332 constructor() { 2333 super(/* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2334 fileName: "derived-constructor.jsx", 2335 lineNumber: 1, 2336 columnNumber: 57 2337 })); 2338 this.foo = /* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2339 fileName: "derived-constructor.jsx", 2340 lineNumber: 1, 2341 columnNumber: 77 2342 }); 2343 } 2344 }; 2345 export { 2346 Foo 2347 }; 2348 2349 ---------- /out/function-this.js ---------- 2350 // function-this.jsx 2351 import { jsxDEV } from "react/jsx-dev-runtime"; 2352 function Foo() { 2353 return /* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2354 fileName: "function-this.jsx", 2355 lineNumber: 1, 2356 columnNumber: 32 2357 }, this); 2358 } 2359 export { 2360 Foo 2361 }; 2362 2363 ---------- /out/normal-constructor-arg.js ---------- 2364 // normal-constructor-arg.jsx 2365 import { jsxDEV } from "react/jsx-dev-runtime"; 2366 var Foo = class { 2367 constructor(foo = /* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2368 fileName: "normal-constructor-arg.jsx", 2369 lineNumber: 1, 2370 columnNumber: 38 2371 }, this)) { 2372 } 2373 }; 2374 export { 2375 Foo 2376 }; 2377 2378 ---------- /out/normal-constructor-field.js ---------- 2379 // normal-constructor-field.tsx 2380 import { jsxDEV } from "react/jsx-dev-runtime"; 2381 var Foo = class { 2382 constructor() { 2383 this.foo = /* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2384 fileName: "normal-constructor-field.tsx", 2385 lineNumber: 1, 2386 columnNumber: 26 2387 }, this); 2388 } 2389 }; 2390 export { 2391 Foo 2392 }; 2393 2394 ---------- /out/normal-constructor.js ---------- 2395 // normal-constructor.jsx 2396 import { jsxDEV } from "react/jsx-dev-runtime"; 2397 var Foo = class { 2398 constructor() { 2399 this.foo = /* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2400 fileName: "normal-constructor.jsx", 2401 lineNumber: 1, 2402 columnNumber: 47 2403 }, this); 2404 } 2405 }; 2406 export { 2407 Foo 2408 }; 2409 2410 ---------- /out/static-field.js ---------- 2411 // static-field.jsx 2412 import { jsxDEV } from "react/jsx-dev-runtime"; 2413 var _Foo = class _Foo { 2414 }; 2415 __publicField(_Foo, "foo", /* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2416 fileName: "static-field.jsx", 2417 lineNumber: 1, 2418 columnNumber: 33 2419 }, _Foo)); 2420 var Foo = _Foo; 2421 export { 2422 Foo 2423 }; 2424 2425 ---------- /out/top-level-this-cjs.js ---------- 2426 // top-level-this-cjs.jsx 2427 import { jsxDEV } from "react/jsx-dev-runtime"; 2428 var require_top_level_this_cjs = __commonJS({ 2429 "top-level-this-cjs.jsx"(exports) { 2430 exports.foo = /* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2431 fileName: "top-level-this-cjs.jsx", 2432 lineNumber: 1, 2433 columnNumber: 15 2434 }); 2435 } 2436 }); 2437 export default require_top_level_this_cjs(); 2438 2439 ---------- /out/top-level-this-esm.js ---------- 2440 // top-level-this-esm.jsx 2441 import { jsxDEV } from "react/jsx-dev-runtime"; 2442 var foo = /* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2443 fileName: "top-level-this-esm.jsx", 2444 lineNumber: 1, 2445 columnNumber: 18 2446 }); 2447 if (Foo) { 2448 foo = /* @__PURE__ */ jsxDEV(Foo, { children: "nested top-level this" }, void 0, false, { 2449 fileName: "top-level-this-esm.jsx", 2450 lineNumber: 1, 2451 columnNumber: 43 2452 }); 2453 } 2454 export { 2455 foo 2456 }; 2457 2458 ---------- /out/tsconfig.js ---------- 2459 // tsconfig.json 2460 var compilerOptions = { useDefineForClassFields: false }; 2461 var tsconfig_default = { compilerOptions }; 2462 export { 2463 compilerOptions, 2464 tsconfig_default as default 2465 }; 2466 2467 ---------- /out/typescript-enum.js ---------- 2468 // typescript-enum.tsx 2469 import { jsxDEV } from "react/jsx-dev-runtime"; 2470 var Foo = /* @__PURE__ */ ((Foo2) => { 2471 Foo2[Foo2["foo"] = /* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2472 fileName: "typescript-enum.tsx", 2473 lineNumber: 1, 2474 columnNumber: 25 2475 })] = "foo"; 2476 return Foo2; 2477 })(Foo || {}); 2478 export { 2479 Foo 2480 }; 2481 2482 ---------- /out/typescript-namespace.js ---------- 2483 // typescript-namespace.tsx 2484 import { jsxDEV } from "react/jsx-dev-runtime"; 2485 var Foo; 2486 ((Foo2) => { 2487 Foo2.foo = /* @__PURE__ */ jsxDEV("div", {}, void 0, false, { 2488 fileName: "typescript-namespace.tsx", 2489 lineNumber: 1, 2490 columnNumber: 41 2491 }); 2492 })(Foo || (Foo = {})); 2493 export { 2494 Foo 2495 }; 2496 2497 ================================================================================ 2498 TestJSXImportMetaProperty 2499 ---------- /out/factory.js ---------- 2500 // factory.jsx 2501 var import_meta = {}; 2502 console.log([ 2503 /* @__PURE__ */ import_meta.factory("x", null), 2504 /* @__PURE__ */ import_meta.factory("x", null) 2505 ]); 2506 f = function() { 2507 console.log([ 2508 /* @__PURE__ */ import_meta.factory("y", null), 2509 /* @__PURE__ */ import_meta.factory("y", null) 2510 ]); 2511 }; 2512 2513 ---------- /out/fragment.js ---------- 2514 // fragment.jsx 2515 var import_meta = {}; 2516 console.log([ 2517 /* @__PURE__ */ import_meta.factory(import_meta.fragment, null, "x"), 2518 /* @__PURE__ */ import_meta.factory(import_meta.fragment, null, "x") 2519 ]), f = function() { 2520 console.log([ 2521 /* @__PURE__ */ import_meta.factory(import_meta.fragment, null, "y"), 2522 /* @__PURE__ */ import_meta.factory(import_meta.fragment, null, "y") 2523 ]); 2524 }; 2525 2526 ================================================================================ 2527 TestJSXImportMetaValue 2528 ---------- /out/factory.js ---------- 2529 // factory.jsx 2530 var import_meta = {}; 2531 console.log([ 2532 /* @__PURE__ */ import_meta("x", null), 2533 /* @__PURE__ */ import_meta("x", null) 2534 ]); 2535 f = function() { 2536 console.log([ 2537 /* @__PURE__ */ import_meta("y", null), 2538 /* @__PURE__ */ import_meta("y", null) 2539 ]); 2540 }; 2541 2542 ---------- /out/fragment.js ---------- 2543 // fragment.jsx 2544 var import_meta = {}; 2545 console.log([ 2546 /* @__PURE__ */ import_meta(import_meta, null, "x"), 2547 /* @__PURE__ */ import_meta(import_meta, null, "x") 2548 ]), f = function() { 2549 console.log([ 2550 /* @__PURE__ */ import_meta(import_meta, null, "y"), 2551 /* @__PURE__ */ import_meta(import_meta, null, "y") 2552 ]); 2553 }; 2554 2555 ================================================================================ 2556 TestJSXImportsCommonJS 2557 ---------- /out.js ---------- 2558 // custom-react.js 2559 var require_custom_react = __commonJS({ 2560 "custom-react.js"(exports, module) { 2561 module.exports = {}; 2562 } 2563 }); 2564 2565 // entry.jsx 2566 var import_custom_react = __toESM(require_custom_react()); 2567 console.log(/* @__PURE__ */ (0, import_custom_react.elem)("div", null), /* @__PURE__ */ (0, import_custom_react.elem)(import_custom_react.frag, null, "fragment")); 2568 2569 ================================================================================ 2570 TestJSXImportsES6 2571 ---------- /out.js ---------- 2572 // custom-react.js 2573 function elem() { 2574 } 2575 function frag() { 2576 } 2577 2578 // entry.jsx 2579 console.log(/* @__PURE__ */ elem("div", null), /* @__PURE__ */ elem(frag, null, "fragment")); 2580 2581 ================================================================================ 2582 TestJSXThisPropertyCommonJS 2583 ---------- /out/factory.js ---------- 2584 // factory.jsx 2585 var require_factory = __commonJS({ 2586 "factory.jsx"(exports) { 2587 console.log([ 2588 /* @__PURE__ */ exports.factory("x", null), 2589 /* @__PURE__ */ exports.factory("x", null) 2590 ]); 2591 f = function() { 2592 console.log([ 2593 /* @__PURE__ */ this.factory("y", null), 2594 /* @__PURE__ */ this.factory("y", null) 2595 ]); 2596 }; 2597 } 2598 }); 2599 export default require_factory(); 2600 2601 ---------- /out/fragment.js ---------- 2602 // fragment.jsx 2603 var require_fragment = __commonJS({ 2604 "fragment.jsx"(exports) { 2605 console.log([ 2606 /* @__PURE__ */ exports.factory(exports.fragment, null, "x"), 2607 /* @__PURE__ */ exports.factory(exports.fragment, null, "x") 2608 ]), f = function() { 2609 console.log([ 2610 /* @__PURE__ */ this.factory(this.fragment, null, "y"), 2611 /* @__PURE__ */ this.factory(this.fragment, null, "y") 2612 ]); 2613 }; 2614 } 2615 }); 2616 export default require_fragment(); 2617 2618 ================================================================================ 2619 TestJSXThisPropertyESM 2620 ---------- /out/factory.js ---------- 2621 // factory.jsx 2622 console.log([ 2623 /* @__PURE__ */ (void 0).factory("x", null), 2624 /* @__PURE__ */ (void 0).factory("x", null) 2625 ]); 2626 f = function() { 2627 console.log([ 2628 /* @__PURE__ */ this.factory("y", null), 2629 /* @__PURE__ */ this.factory("y", null) 2630 ]); 2631 }; 2632 2633 ---------- /out/fragment.js ---------- 2634 // fragment.jsx 2635 console.log([ 2636 /* @__PURE__ */ (void 0).factory((void 0).fragment, null, "x"), 2637 /* @__PURE__ */ (void 0).factory((void 0).fragment, null, "x") 2638 ]), f = function() { 2639 console.log([ 2640 /* @__PURE__ */ this.factory(this.fragment, null, "y"), 2641 /* @__PURE__ */ this.factory(this.fragment, null, "y") 2642 ]); 2643 }; 2644 2645 ================================================================================ 2646 TestJSXThisValueCommonJS 2647 ---------- /out/factory.js ---------- 2648 // factory.jsx 2649 var require_factory = __commonJS({ 2650 "factory.jsx"(exports) { 2651 console.log([ 2652 /* @__PURE__ */ exports("x", null), 2653 /* @__PURE__ */ exports("x", null) 2654 ]); 2655 f = function() { 2656 console.log([ 2657 /* @__PURE__ */ this("y", null), 2658 /* @__PURE__ */ this("y", null) 2659 ]); 2660 }; 2661 } 2662 }); 2663 export default require_factory(); 2664 2665 ---------- /out/fragment.js ---------- 2666 // fragment.jsx 2667 var require_fragment = __commonJS({ 2668 "fragment.jsx"(exports) { 2669 console.log([ 2670 /* @__PURE__ */ exports(exports, null, "x"), 2671 /* @__PURE__ */ exports(exports, null, "x") 2672 ]), f = function() { 2673 console.log([ 2674 /* @__PURE__ */ this(this, null, "y"), 2675 /* @__PURE__ */ this(this, null, "y") 2676 ]); 2677 }; 2678 } 2679 }); 2680 export default require_fragment(); 2681 2682 ================================================================================ 2683 TestJSXThisValueESM 2684 ---------- /out/factory.js ---------- 2685 // factory.jsx 2686 console.log([ 2687 /* @__PURE__ */ (void 0)("x", null), 2688 /* @__PURE__ */ (void 0)("x", null) 2689 ]); 2690 f = function() { 2691 console.log([ 2692 /* @__PURE__ */ this("y", null), 2693 /* @__PURE__ */ this("y", null) 2694 ]); 2695 }; 2696 2697 ---------- /out/fragment.js ---------- 2698 // fragment.jsx 2699 console.log([ 2700 /* @__PURE__ */ (void 0)(void 0, null, "x"), 2701 /* @__PURE__ */ (void 0)(void 0, null, "x") 2702 ]), f = function() { 2703 console.log([ 2704 /* @__PURE__ */ this(this, null, "y"), 2705 /* @__PURE__ */ this(this, null, "y") 2706 ]); 2707 }; 2708 2709 ================================================================================ 2710 TestKeepNamesAllForms 2711 ---------- /out/keep.js ---------- 2712 function fn() { 2713 } 2714 __name(fn, "fn"); 2715 function foo(fn2 = function() { 2716 }) { 2717 } 2718 __name(foo, "foo"); 2719 var fn = /* @__PURE__ */ __name(function() { 2720 }, "fn"); 2721 var obj = { "f n": /* @__PURE__ */ __name(function() { 2722 }, "f n") }; 2723 class Foo0 { 2724 static { 2725 __name(this, "Foo0"); 2726 } 2727 "f n" = /* @__PURE__ */ __name(function() { 2728 }, "f n"); 2729 } 2730 class Foo1 { 2731 static { 2732 __name(this, "Foo1"); 2733 } 2734 static "f n" = /* @__PURE__ */ __name(function() { 2735 }, "f n"); 2736 } 2737 class Foo2 { 2738 static { 2739 __name(this, "Foo2"); 2740 } 2741 accessor "f n" = /* @__PURE__ */ __name(function() { 2742 }, "f n"); 2743 } 2744 class Foo3 { 2745 static { 2746 __name(this, "Foo3"); 2747 } 2748 static accessor "f n" = /* @__PURE__ */ __name(function() { 2749 }, "f n"); 2750 } 2751 class Foo4 { 2752 static { 2753 __name(this, "Foo4"); 2754 } 2755 #fn = /* @__PURE__ */ __name(function() { 2756 }, "#fn"); 2757 } 2758 class Foo5 { 2759 static { 2760 __name(this, "Foo5"); 2761 } 2762 static #fn = /* @__PURE__ */ __name(function() { 2763 }, "#fn"); 2764 } 2765 class Foo6 { 2766 static { 2767 __name(this, "Foo6"); 2768 } 2769 accessor #fn = /* @__PURE__ */ __name(function() { 2770 }, "#fn"); 2771 } 2772 class Foo7 { 2773 static { 2774 __name(this, "Foo7"); 2775 } 2776 static accessor #fn = /* @__PURE__ */ __name(function() { 2777 }, "#fn"); 2778 } 2779 fn = /* @__PURE__ */ __name(function() { 2780 }, "fn"); 2781 fn ||= /* @__PURE__ */ __name(function() { 2782 }, "fn"); 2783 fn &&= /* @__PURE__ */ __name(function() { 2784 }, "fn"); 2785 fn ??= /* @__PURE__ */ __name(function() { 2786 }, "fn"); 2787 var [fn = /* @__PURE__ */ __name(function() { 2788 }, "fn")] = []; 2789 var { fn = /* @__PURE__ */ __name(function() { 2790 }, "fn") } = {}; 2791 for (var [fn = /* @__PURE__ */ __name(function() { 2792 }, "fn")] = []; ; ) ; 2793 for (var { fn = /* @__PURE__ */ __name(function() { 2794 }, "fn") } = {}; ; ) ; 2795 for (var [fn = /* @__PURE__ */ __name(function() { 2796 }, "fn")] in obj) ; 2797 for (var { fn = /* @__PURE__ */ __name(function() { 2798 }, "fn") } in obj) ; 2799 for (var [fn = /* @__PURE__ */ __name(function() { 2800 }, "fn")] of obj) ; 2801 for (var { fn = /* @__PURE__ */ __name(function() { 2802 }, "fn") } of obj) ; 2803 function foo([fn2 = /* @__PURE__ */ __name(function() { 2804 }, "fn")]) { 2805 } 2806 __name(foo, "foo"); 2807 function foo({ fn: fn2 = /* @__PURE__ */ __name(function() { 2808 }, "fn") }) { 2809 } 2810 __name(foo, "foo"); 2811 [fn = /* @__PURE__ */ __name(function() { 2812 }, "fn")] = []; 2813 ({ fn = /* @__PURE__ */ __name(function() { 2814 }, "fn") } = {}); 2815 2816 ---------- /out/do-not-keep.js ---------- 2817 class Foo0 { 2818 static { 2819 __name(this, "Foo0"); 2820 } 2821 fn() { 2822 } 2823 } 2824 class Foo1 { 2825 static { 2826 __name(this, "Foo1"); 2827 } 2828 *fn() { 2829 } 2830 } 2831 class Foo2 { 2832 static { 2833 __name(this, "Foo2"); 2834 } 2835 get fn() { 2836 } 2837 } 2838 class Foo3 { 2839 static { 2840 __name(this, "Foo3"); 2841 } 2842 set fn(_) { 2843 } 2844 } 2845 class Foo4 { 2846 static { 2847 __name(this, "Foo4"); 2848 } 2849 async fn() { 2850 } 2851 } 2852 class Foo5 { 2853 static { 2854 __name(this, "Foo5"); 2855 } 2856 static fn() { 2857 } 2858 } 2859 class Foo6 { 2860 static { 2861 __name(this, "Foo6"); 2862 } 2863 static *fn() { 2864 } 2865 } 2866 class Foo7 { 2867 static { 2868 __name(this, "Foo7"); 2869 } 2870 static get fn() { 2871 } 2872 } 2873 class Foo8 { 2874 static { 2875 __name(this, "Foo8"); 2876 } 2877 static set fn(_) { 2878 } 2879 } 2880 class Foo9 { 2881 static { 2882 __name(this, "Foo9"); 2883 } 2884 static async fn() { 2885 } 2886 } 2887 class Bar0 { 2888 static { 2889 __name(this, "Bar0"); 2890 } 2891 #fn() { 2892 } 2893 } 2894 class Bar1 { 2895 static { 2896 __name(this, "Bar1"); 2897 } 2898 *#fn() { 2899 } 2900 } 2901 class Bar2 { 2902 static { 2903 __name(this, "Bar2"); 2904 } 2905 get #fn() { 2906 } 2907 } 2908 class Bar3 { 2909 static { 2910 __name(this, "Bar3"); 2911 } 2912 set #fn(_) { 2913 } 2914 } 2915 class Bar4 { 2916 static { 2917 __name(this, "Bar4"); 2918 } 2919 async #fn() { 2920 } 2921 } 2922 class Bar5 { 2923 static { 2924 __name(this, "Bar5"); 2925 } 2926 static #fn() { 2927 } 2928 } 2929 class Bar6 { 2930 static { 2931 __name(this, "Bar6"); 2932 } 2933 static *#fn() { 2934 } 2935 } 2936 class Bar7 { 2937 static { 2938 __name(this, "Bar7"); 2939 } 2940 static get #fn() { 2941 } 2942 } 2943 class Bar8 { 2944 static { 2945 __name(this, "Bar8"); 2946 } 2947 static set #fn(_) { 2948 } 2949 } 2950 class Bar9 { 2951 static { 2952 __name(this, "Bar9"); 2953 } 2954 static async #fn(_) { 2955 } 2956 } 2957 const Baz0 = { fn() { 2958 } }; 2959 const Baz1 = { *fn() { 2960 } }; 2961 const Baz2 = { get fn() { 2962 } }; 2963 const Baz3 = { set fn(_) { 2964 } }; 2965 const Baz4 = { async fn() { 2966 } }; 2967 2968 ================================================================================ 2969 TestKeepNamesClassStaticName 2970 ---------- /out.js ---------- 2971 class A { 2972 static { 2973 __name(this, "A"); 2974 } 2975 static foo; 2976 } 2977 class B { 2978 static name; 2979 } 2980 class C { 2981 static name() { 2982 } 2983 } 2984 class D { 2985 static get name() { 2986 } 2987 } 2988 class E { 2989 static set name(x) { 2990 } 2991 } 2992 class F { 2993 static ["name"] = 0; 2994 } 2995 let a = class a3 { 2996 static { 2997 __name(this, "a"); 2998 } 2999 static foo; 3000 }; 3001 let b = class b3 { 3002 static name; 3003 }; 3004 let c = class c3 { 3005 static name() { 3006 } 3007 }; 3008 let d = class d3 { 3009 static get name() { 3010 } 3011 }; 3012 let e = class e3 { 3013 static set name(x) { 3014 } 3015 }; 3016 let f = class f3 { 3017 static ["name"] = 0; 3018 }; 3019 let a2 = class { 3020 static { 3021 __name(this, "a2"); 3022 } 3023 static foo; 3024 }; 3025 let b2 = class { 3026 static name; 3027 }; 3028 let c2 = class { 3029 static name() { 3030 } 3031 }; 3032 let d2 = class { 3033 static get name() { 3034 } 3035 }; 3036 let e2 = class { 3037 static set name(x) { 3038 } 3039 }; 3040 let f2 = class { 3041 static ["name"] = 0; 3042 }; 3043 3044 ================================================================================ 3045 TestKeepNamesTreeShaking 3046 ---------- /out.js ---------- 3047 // entry.js 3048 function fnStmtKeep() { 3049 } 3050 __name(fnStmtKeep, "fnStmtKeep"); 3051 x = fnStmtKeep; 3052 var fnExprKeep = /* @__PURE__ */ __name(function() { 3053 }, "keep"); 3054 x = fnExprKeep; 3055 var clsStmtKeep = class { 3056 static { 3057 __name(this, "clsStmtKeep"); 3058 } 3059 }; 3060 new clsStmtKeep(); 3061 var clsExprKeep = class { 3062 static { 3063 __name(this, "keep"); 3064 } 3065 }; 3066 new clsExprKeep(); 3067 3068 ================================================================================ 3069 TestLegalCommentsAvoidSlashTagEndOfFile 3070 ---------- /out/entry.js ---------- 3071 // entry.js 3072 var x; 3073 export { 3074 x 3075 }; 3076 //! <script>foo<\/script> 3077 3078 ---------- /out/entry.css ---------- 3079 /* entry.css */ 3080 x { 3081 y: z; 3082 } 3083 /*! <style>foo<\/style> */ 3084 3085 ================================================================================ 3086 TestLegalCommentsAvoidSlashTagExternal 3087 ---------- /out/entry.js.LEGAL.txt ---------- 3088 //! <script>foo</script> 3089 3090 ---------- /out/entry.js ---------- 3091 // entry.js 3092 var x; 3093 export { 3094 x 3095 }; 3096 3097 ---------- /out/entry.css.LEGAL.txt ---------- 3098 /*! <style>foo</style> */ 3099 3100 ---------- /out/entry.css ---------- 3101 /* entry.css */ 3102 x { 3103 y: z; 3104 } 3105 3106 ================================================================================ 3107 TestLegalCommentsAvoidSlashTagInline 3108 ---------- /out/entry.js ---------- 3109 // entry.js 3110 //! <script>foo<\/script> 3111 var x; 3112 export { 3113 x 3114 }; 3115 3116 ---------- /out/entry.css ---------- 3117 /* entry.css */ 3118 /*! <style>foo<\/style> */ 3119 x { 3120 y: z; 3121 } 3122 3123 ================================================================================ 3124 TestLegalCommentsEndOfFile 3125 ---------- /out/entry.js ---------- 3126 // a.js 3127 console.log("in a"); 3128 3129 // b.js 3130 console.log("in b"); 3131 3132 // c.js 3133 console.log("in c"); 3134 //! Copyright notice 1 3135 //! Copyright notice 2 3136 3137 ---------- /out/entry.css ---------- 3138 /* a.css */ 3139 a { 3140 zoom: 2; 3141 } 3142 3143 /* b.css */ 3144 b { 3145 zoom: 2; 3146 } 3147 3148 /* c.css */ 3149 c { 3150 zoom: 2; 3151 } 3152 3153 /* entry.css */ 3154 /*! Copyright notice 1 */ 3155 /*! Copyright notice 2 */ 3156 3157 ================================================================================ 3158 TestLegalCommentsEscapeSlashScriptAndStyleEndOfFile 3159 ---------- /out/entry.js ---------- 3160 x;a; 3161 /*! <\/script> */ 3162 /*! Bundled license information: 3163 3164 js-pkg/index.js: 3165 (*! <\/script> *) 3166 */ 3167 3168 ---------- /out/entry.css ---------- 3169 x{y:z}a{b:c} 3170 /*! <\/style> */ 3171 /*! Bundled license information: 3172 3173 css-pkg/index.css: 3174 (*! <\/style> *) 3175 */ 3176 3177 ================================================================================ 3178 TestLegalCommentsEscapeSlashScriptAndStyleExternal 3179 ---------- /out/entry.js.LEGAL.txt ---------- 3180 /*! </script> */ 3181 3182 Bundled license information: 3183 3184 js-pkg/index.js: 3185 /*! </script> */ 3186 3187 ---------- /out/entry.js ---------- 3188 x;a; 3189 3190 ---------- /out/entry.css.LEGAL.txt ---------- 3191 /*! </style> */ 3192 3193 Bundled license information: 3194 3195 css-pkg/index.css: 3196 /*! </style> */ 3197 3198 ---------- /out/entry.css ---------- 3199 x{y:z}a{b:c} 3200 3201 ================================================================================ 3202 TestLegalCommentsExternal 3203 ---------- /out/entry.js.LEGAL.txt ---------- 3204 //! Copyright notice 1 3205 //! Copyright notice 2 3206 3207 ---------- /out/entry.js ---------- 3208 // a.js 3209 console.log("in a"); 3210 3211 // b.js 3212 console.log("in b"); 3213 3214 // c.js 3215 console.log("in c"); 3216 3217 ---------- /out/entry.css.LEGAL.txt ---------- 3218 /*! Copyright notice 1 */ 3219 /*! Copyright notice 2 */ 3220 3221 ---------- /out/entry.css ---------- 3222 /* a.css */ 3223 a { 3224 zoom: 2; 3225 } 3226 3227 /* b.css */ 3228 b { 3229 zoom: 2; 3230 } 3231 3232 /* c.css */ 3233 c { 3234 zoom: 2; 3235 } 3236 3237 /* entry.css */ 3238 3239 ================================================================================ 3240 TestLegalCommentsInline 3241 ---------- /out/entry.js ---------- 3242 // a.js 3243 console.log("in a"); 3244 //! Copyright notice 1 3245 3246 // b.js 3247 console.log("in b"); 3248 //! Copyright notice 1 3249 3250 // c.js 3251 console.log("in c"); 3252 //! Copyright notice 2 3253 3254 ---------- /out/entry.css ---------- 3255 /* a.css */ 3256 a { 3257 zoom: 2; 3258 } 3259 /*! Copyright notice 1 */ 3260 3261 /* b.css */ 3262 b { 3263 zoom: 2; 3264 } 3265 /*! Copyright notice 1 */ 3266 3267 /* c.css */ 3268 c { 3269 zoom: 2; 3270 } 3271 /*! Copyright notice 2 */ 3272 3273 /* entry.css */ 3274 3275 ================================================================================ 3276 TestLegalCommentsLinked 3277 ---------- /out/entry.js.LEGAL.txt ---------- 3278 //! Copyright notice 1 3279 //! Copyright notice 2 3280 3281 ---------- /out/entry.js ---------- 3282 // a.js 3283 console.log("in a"); 3284 3285 // b.js 3286 console.log("in b"); 3287 3288 // c.js 3289 console.log("in c"); 3290 /*! For license information please see entry.js.LEGAL.txt */ 3291 3292 ---------- /out/entry.css.LEGAL.txt ---------- 3293 /*! Copyright notice 1 */ 3294 /*! Copyright notice 2 */ 3295 3296 ---------- /out/entry.css ---------- 3297 /* a.css */ 3298 a { 3299 zoom: 2; 3300 } 3301 3302 /* b.css */ 3303 b { 3304 zoom: 2; 3305 } 3306 3307 /* c.css */ 3308 c { 3309 zoom: 2; 3310 } 3311 3312 /* entry.css */ 3313 /*! For license information please see entry.css.LEGAL.txt */ 3314 3315 ================================================================================ 3316 TestLegalCommentsManyEndOfFile 3317 ---------- /out/entry.js ---------- 3318 console.log("in a");console.log("in b");function foo(){console.log("in c");}foo();function bar(){console.log("some-other-pkg")}bar(); 3319 //! Copyright notice 1 3320 //! Duplicate comment 3321 /* 3322 * @license 3323 * Copyright notice 2 3324 */ 3325 // @preserve This is another comment 3326 /*! Bundled license information: 3327 3328 some-other-pkg/js/index.js: 3329 (* 3330 * @preserve 3331 * (c) Evil Software Corp 3332 *) 3333 (*! Duplicate third-party comment *) 3334 3335 some-pkg/js/index.js: 3336 (*! (c) Good Software Corp *) 3337 (*! Duplicate third-party comment *) 3338 */ 3339 3340 ---------- /out/entry.css ---------- 3341 a{zoom:2}b{zoom:2}c{zoom:2}.some-other-pkg{zoom:2} 3342 /*! Copyright notice 1 */ 3343 /*! Duplicate comment */ 3344 /* 3345 * @license 3346 * Copyright notice 2 3347 */ 3348 /* @preserve This is another comment */ 3349 /*! Bundled license information: 3350 3351 some-other-pkg/css/index.css: 3352 (*! Duplicate third-party comment *) 3353 (** @preserve 3354 * (c) Evil Software Corp 3355 *) 3356 3357 some-pkg/css/index.css: 3358 (*! (c) Good Software Corp *) 3359 (*! Duplicate third-party comment *) 3360 */ 3361 3362 ================================================================================ 3363 TestLegalCommentsManyLinked 3364 ---------- /out/entry.js.LEGAL.txt ---------- 3365 //! Copyright notice 1 3366 /* 3367 * @license 3368 * Copyright notice 2 3369 */ 3370 // @preserve This is another comment 3371 3372 Bundled license information: 3373 3374 some-other-pkg/js/index.js: 3375 /* 3376 * @preserve 3377 * (c) Evil Software Corp 3378 */ 3379 3380 some-pkg/js/index.js: 3381 //! (c) Good Software Corp 3382 3383 ---------- /out/entry.js ---------- 3384 console.log("in a");console.log("in b");function foo(){console.log("in c");}foo();function bar(){console.log("some-other-pkg")}bar(); 3385 /*! For license information please see entry.js.LEGAL.txt */ 3386 3387 ---------- /out/entry.css.LEGAL.txt ---------- 3388 /*! Copyright notice 1 */ 3389 /* 3390 * @license 3391 * Copyright notice 2 3392 */ 3393 /* @preserve This is another comment */ 3394 3395 Bundled license information: 3396 3397 some-other-pkg/css/index.css: 3398 /** @preserve 3399 * (c) Evil Software Corp 3400 */ 3401 3402 some-pkg/css/index.css: 3403 /*! (c) Good Software Corp */ 3404 3405 ---------- /out/entry.css ---------- 3406 a{zoom:2}b{zoom:2}c{zoom:2}.some-other-pkg{zoom:2} 3407 /*! For license information please see entry.css.LEGAL.txt */ 3408 3409 ================================================================================ 3410 TestLegalCommentsModifyIndent 3411 ---------- /out/entry.js ---------- 3412 // entry.js 3413 var entry_default = () => { 3414 /** 3415 * @preserve 3416 */ 3417 }; 3418 export { 3419 entry_default as default 3420 }; 3421 3422 ---------- /out/entry.css ---------- 3423 /* entry.css */ 3424 @media (x: y) { 3425 /** 3426 * @preserve 3427 */ 3428 z { 3429 zoom: 2; 3430 } 3431 } 3432 3433 ================================================================================ 3434 TestLegalCommentsNoEscapeSlashScriptEndOfFile 3435 ---------- /out/entry.js ---------- 3436 x;a; 3437 /*! </script> */ 3438 /*! Bundled license information: 3439 3440 js-pkg/index.js: 3441 (*! </script> *) 3442 */ 3443 3444 ---------- /out/entry.css ---------- 3445 x{y:z}a{b:c} 3446 /*! <\/style> */ 3447 /*! Bundled license information: 3448 3449 css-pkg/index.css: 3450 (*! <\/style> *) 3451 */ 3452 3453 ================================================================================ 3454 TestLegalCommentsNoEscapeSlashStyleEndOfFile 3455 ---------- /out/entry.js ---------- 3456 x;a; 3457 /*! <\/script> */ 3458 /*! Bundled license information: 3459 3460 js-pkg/index.js: 3461 (*! <\/script> *) 3462 */ 3463 3464 ---------- /out/entry.css ---------- 3465 x{y:z}a{b:c} 3466 /*! </style> */ 3467 /*! Bundled license information: 3468 3469 css-pkg/index.css: 3470 (*! </style> *) 3471 */ 3472 3473 ================================================================================ 3474 TestLegalCommentsNone 3475 ---------- /out/entry.js ---------- 3476 // a.js 3477 console.log("in a"); 3478 3479 // b.js 3480 console.log("in b"); 3481 3482 // c.js 3483 console.log("in c"); 3484 3485 ---------- /out/entry.css ---------- 3486 /* a.css */ 3487 a { 3488 zoom: 2; 3489 } 3490 3491 /* b.css */ 3492 b { 3493 zoom: 2; 3494 } 3495 3496 /* c.css */ 3497 c { 3498 zoom: 2; 3499 } 3500 3501 /* entry.css */ 3502 3503 ================================================================================ 3504 TestLineLimitMinified 3505 ---------- /out/script.js ---------- 3506 export const SignUpForm=props=>{ 3507 return React.createElement("p",{ 3508 class:"signup"},React.createElement( 3509 "label",null,"Username: ",React. 3510 createElement("input",{class:"us\ 3511 ername",type:"text"})),React.createElement( 3512 "label",null,"Password: ",React. 3513 createElement("input",{class:"pa\ 3514 ssword",type:"password"})),React. 3515 createElement("div",{class:"prim\ 3516 ary disabled"},props.buttonText), 3517 React.createElement("small",null, 3518 "By signing up, you are agreeing\ 3519 to our ",React.createElement("a", 3520 {href:"/tos/"},"terms of service"), 3521 "."))}; 3522 3523 ---------- /out/style.css ---------- 3524 body.light-mode.new-user-segment:not(.logged-in) 3525 .signup,body.light-mode.new-user-segment:not(.logged-in) 3526 .login{font:10px/12px "Font 1","\ 3527 Font 2","Font 3","Font 4",sans-serif; 3528 user-select:none;color:var(--fg, 3529 rgba(11, 22, 33, 0.5));background:url("\ 3530 data:image/svg+xml;base64,PHN2Zy\ 3531 B3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMC\ 3532 IgeG1sbnM9Imh0dHA6Ly93d3cudzMub3\ 3533 JnLzIwMDAvc3ZnIj4KICA8Y2lyY2xlIG\ 3534 N4PSIxMDAiIGN5PSIxMDAiIHI9IjEwMC\ 3535 IgZmlsbD0iI0ZGQ0YwMCIvPgogIDxwYX\ 3536 RoIGQ9Ik00Ny41IDUyLjVMOTUgMTAwbC\ 3537 00Ny41IDQ3LjVtNjAtOTVMMTU1IDEwMG\ 3538 wtNDcuNSA0Ny41IiBmaWxsPSJub25lIi\ 3539 BzdHJva2U9IiMxOTE5MTkiIHN0cm9rZS\ 3540 13aWR0aD0iMjQiLz4KPC9zdmc+Cg==")} 3541 3542 ================================================================================ 3543 TestLineLimitNotMinified 3544 ---------- /out/x-TZ25B4WH.file ---------- 3545 ...file... 3546 ---------- /out/x-UF3O47Y3.copy ---------- 3547 ...copy... 3548 ---------- /out/script.js ---------- 3549 // x.file 3550 var x_default = "./x-TZ25B4WH.file"; 3551 3552 // script.jsx 3553 import copyURL from "./x-UF3O47Y3.copy"; 3554 3555 // x.data 3556 var x_default2 = "data:text/plai\ 3557 n;charset=utf-8,...lots of long \ 3558 data...lots of long data..."; 3559 3560 // script.jsx 3561 var SignUpForm = (props) => { 3562 return /* @__PURE__ */ React.createElement( 3563 "p", { class: "signup" }, /* @__PURE__ */ React. 3564 createElement("label", null, "\ 3565 Username: ", /* @__PURE__ */ React. 3566 createElement("input", { class: "\ 3567 username", type: "text" })), /* @__PURE__ */ React. 3568 createElement("label", null, "\ 3569 Password: ", /* @__PURE__ */ React. 3570 createElement("input", { class: "\ 3571 password", type: "password" })), 3572 /* @__PURE__ */ React.createElement( 3573 "div", { class: "primary disab\ 3574 led" }, props.buttonText), /* @__PURE__ */ React. 3575 createElement("small", null, "\ 3576 By signing up, you are agreeing \ 3577 to our ", /* @__PURE__ */ React. 3578 createElement("a", { href: "/t\ 3579 os/" }, "terms of service"), "."), 3580 /* @__PURE__ */ React.createElement( 3581 "img", { src: x_default }), /* @__PURE__ */ React. 3582 createElement("img", { src: copyURL }), 3583 /* @__PURE__ */ React.createElement( 3584 "img", { src: x_default2 })); 3585 }; 3586 export { 3587 SignUpForm 3588 }; 3589 3590 ---------- /out/style.css ---------- 3591 /* style.css */ 3592 body.light-mode.new-user-segment:not(.logged-in) 3593 .signup, 3594 body.light-mode.new-user-segment:not(.logged-in) 3595 .login { 3596 font: 3597 10px/12px "Font 1", 3598 "Font 2", 3599 "Font 3", 3600 "Font 4", 3601 sans-serif; 3602 user-select: none; 3603 color: var(--fg, rgba(11, 22, 33, 3604 0.5)); 3605 background: url("data:image/sv\ 3606 g+xml;base64,PHN2ZyB3aWR0aD0iMjA\ 3607 wIiBoZWlnaHQ9IjIwMCIgeG1sbnM9Imh\ 3608 0dHA6Ly93d3cudzMub3JnLzIwMDAvc3Z\ 3609 nIj4KICA8Y2lyY2xlIGN4PSIxMDAiIGN\ 3610 5PSIxMDAiIHI9IjEwMCIgZmlsbD0iI0Z\ 3611 GQ0YwMCIvPgogIDxwYXRoIGQ9Ik00Ny4\ 3612 1IDUyLjVMOTUgMTAwbC00Ny41IDQ3LjV\ 3613 tNjAtOTVMMTU1IDEwMGwtNDcuNSA0Ny4\ 3614 1IiBmaWxsPSJub25lIiBzdHJva2U9IiM\ 3615 xOTE5MTkiIHN0cm9rZS13aWR0aD0iMjQ\ 3616 iLz4KPC9zdmc+Cg=="); 3617 cursor: url("./x-TZ25B4WH.file"); 3618 cursor: url("./x-UF3O47Y3.copy"); 3619 cursor: url("data:text/plain;c\ 3620 harset=utf-8,...lots of long dat\ 3621 a...lots of long data..."); 3622 } 3623 3624 ================================================================================ 3625 TestMangleNoQuotedProps 3626 ---------- /out/entry.js ---------- 3627 x["_doNotMangleThis"]; 3628 x?.["_doNotMangleThis"]; 3629 x[y ? "_doNotMangleThis" : z]; 3630 x?.[y ? "_doNotMangleThis" : z]; 3631 x[y ? z : "_doNotMangleThis"]; 3632 x?.[y ? z : "_doNotMangleThis"]; 3633 ({ "_doNotMangleThis": x }); 3634 (class { 3635 "_doNotMangleThis" = x; 3636 }); 3637 var { "_doNotMangleThis": x } = y; 3638 "_doNotMangleThis" in x; 3639 (y ? "_doNotMangleThis" : z) in x; 3640 (y ? z : "_doNotMangleThis") in x; 3641 3642 ================================================================================ 3643 TestMangleNoQuotedPropsMinifySyntax 3644 ---------- /out/entry.js ---------- 3645 x._doNotMangleThis, x?._doNotMangleThis, x[y ? "_doNotMangleThis" : z], x?.[y ? "_doNotMangleThis" : z], x[y ? z : "_doNotMangleThis"], x?.[y ? z : "_doNotMangleThis"]; 3646 var { _doNotMangleThis: x } = y; 3647 "_doNotMangleThis" in x, (y ? "_doNotMangleThis" : z) in x, (y ? z : "_doNotMangleThis") in x; 3648 3649 ================================================================================ 3650 TestMangleProps 3651 ---------- /out/entry1.js ---------- 3652 export function shouldMangle() { 3653 let foo = { 3654 a: 0, 3655 b() { 3656 } 3657 }; 3658 let { a: bar_ } = foo; 3659 ({ a: bar_ } = foo); 3660 class foo_ { 3661 a = 0; 3662 b() { 3663 } 3664 static a = 0; 3665 static b() { 3666 } 3667 } 3668 return { a: bar_, c: foo_ }; 3669 } 3670 export function shouldNotMangle() { 3671 let foo = { 3672 "bar_": 0, 3673 "baz_"() { 3674 } 3675 }; 3676 let { "bar_": bar_ } = foo; 3677 ({ "bar_": bar_ } = foo); 3678 class foo_ { 3679 "bar_" = 0; 3680 "baz_"() { 3681 } 3682 static "bar_" = 0; 3683 static "baz_"() { 3684 } 3685 } 3686 return { "bar_": bar_, "foo_": foo_ }; 3687 } 3688 3689 ---------- /out/entry2.js ---------- 3690 export default { 3691 a: 0, 3692 "baz_": 1 3693 }; 3694 3695 ================================================================================ 3696 TestManglePropsAvoidCollisions 3697 ---------- /out.js ---------- 3698 export default { 3699 c: 0, 3700 // Must not be named "a" 3701 d: 1, 3702 // Must not be named "b" 3703 a: 2, 3704 b: 3, 3705 __proto__: {} 3706 // Always avoid mangling this 3707 }; 3708 3709 ================================================================================ 3710 TestManglePropsImportExport 3711 ---------- /out/esm.js ---------- 3712 export let foo_ = 123; 3713 import { bar_ } from "xyz"; 3714 3715 ---------- /out/cjs.js ---------- 3716 exports.a = 123; 3717 let bar_ = require("xyz").b; 3718 3719 ================================================================================ 3720 TestManglePropsImportExportBundled 3721 ---------- /out/entry-esm.js ---------- 3722 // cjs.js 3723 var require_cjs = __commonJS({ 3724 "cjs.js"(exports) { 3725 exports.a = "foo"; 3726 } 3727 }); 3728 3729 // esm.js 3730 var esm_exports = {}; 3731 __export(esm_exports, { 3732 esm_foo_: () => esm_foo_ 3733 }); 3734 var esm_foo_ = "foo"; 3735 3736 // entry-esm.js 3737 var import_cjs = __toESM(require_cjs()); 3738 var cjs = __toESM(require_cjs()); 3739 var bar_ = [ 3740 esm_foo_, 3741 import_cjs.cjs_foo_, 3742 esm_exports.b, 3743 cjs.a 3744 ]; 3745 export { 3746 bar_ 3747 }; 3748 3749 ---------- /out/entry-cjs.js ---------- 3750 // esm.js 3751 var esm_exports = {}; 3752 __export(esm_exports, { 3753 esm_foo_: () => esm_foo_ 3754 }); 3755 var esm_foo_; 3756 var init_esm = __esm({ 3757 "esm.js"() { 3758 esm_foo_ = "foo"; 3759 } 3760 }); 3761 3762 // cjs.js 3763 var require_cjs = __commonJS({ 3764 "cjs.js"(exports) { 3765 exports.a = "foo"; 3766 } 3767 }); 3768 3769 // entry-cjs.js 3770 var require_entry_cjs = __commonJS({ 3771 "entry-cjs.js"(exports) { 3772 var { b: esm_foo_2 } = (init_esm(), __toCommonJS(esm_exports)); 3773 var { a: cjs_foo_ } = require_cjs(); 3774 exports.c = [ 3775 esm_foo_2, 3776 cjs_foo_ 3777 ]; 3778 } 3779 }); 3780 export default require_entry_cjs(); 3781 3782 ================================================================================ 3783 TestManglePropsJSXPreserve 3784 ---------- /out.jsx ---------- 3785 let Foo = { 3786 a(props) { 3787 return <>{props.b}</>; 3788 }, 3789 c: "hello, world" 3790 }; 3791 export default <Foo.a b={Foo.c} />; 3792 3793 ================================================================================ 3794 TestManglePropsJSXTransform 3795 ---------- /out.js ---------- 3796 let Foo = { 3797 b(props) { 3798 return /* @__PURE__ */ Foo.a(Foo.d, null, props.c); 3799 }, 3800 e: "hello, world", 3801 a(...args) { 3802 console.log("createElement", ...args); 3803 }, 3804 d(...args) { 3805 console.log("Fragment", ...args); 3806 } 3807 }; 3808 export default /* @__PURE__ */ Foo.a(Foo.b, { c: Foo.e }); 3809 3810 ================================================================================ 3811 TestManglePropsJSXTransformNamespace 3812 ---------- /out.js ---------- 3813 export default [ 3814 /* @__PURE__ */ React.createElement(KEEP_THIS_, null), 3815 /* @__PURE__ */ React.createElement("KEEP:THIS_", null), 3816 /* @__PURE__ */ React.createElement("foo", { "KEEP:THIS_": true }) 3817 ]; 3818 3819 ================================================================================ 3820 TestManglePropsKeyComment 3821 ---------- /out/entry.js ---------- 3822 x( 3823 /* __KEY__ */ 3824 "_doNotMangleThis", 3825 /* __KEY__ */ 3826 `_doNotMangleThis` 3827 ); 3828 x.a(/* @__KEY__ */ "a", /* @__KEY__ */ "a"); 3829 x.b(/* @__KEY__ */ "b", /* @__KEY__ */ "b"); 3830 x.c = /* @__KEY__ */ "c" in y; 3831 x([ 3832 `foo.${/* @__KEY__ */ "a"} = bar.${/* @__KEY__ */ "b"}`, 3833 `foo.${/* @__KEY__ */ "notMangled"} = bar.${/* @__KEY__ */ "notMangledEither"}` 3834 ]); 3835 3836 ================================================================================ 3837 TestManglePropsKeyCommentMinify 3838 ---------- /out/entry.js ---------- 3839 x = class { 3840 a = 1; 3841 b = 2; 3842 _doNotMangleThis = 3; 3843 }, x = { 3844 a: 1, 3845 b: 2, 3846 _doNotMangleThis: 3 3847 }, x.a = 1, x.b = 2, x._doNotMangleThis = 3, x([ 3848 `${foo}.a = bar.b`, 3849 `${foo}.notMangled = bar.notMangledEither` 3850 ]); 3851 3852 ================================================================================ 3853 TestManglePropsKeywordPropertyMinify 3854 ---------- /out/entry.js ---------- 3855 class Foo{static t={get s(){return 123}}} 3856 3857 ================================================================================ 3858 TestManglePropsLoweredClassFields 3859 ---------- /out.js ---------- 3860 class Foo { 3861 constructor() { 3862 __publicField(this, "a", 123); 3863 } 3864 } 3865 __publicField(Foo, "b", 234); 3866 Foo.b = new Foo().a; 3867 3868 ================================================================================ 3869 TestManglePropsLoweredOptionalChain 3870 ---------- /out.js ---------- 3871 export default function(x) { 3872 var _a; 3873 x.a; 3874 (_a = x.a) == null ? void 0 : _a.call(x); 3875 x == null ? void 0 : x.a; 3876 x == null ? void 0 : x.a(); 3877 x == null ? void 0 : x.a.b; 3878 x == null ? void 0 : x.a.b(); 3879 x == null ? void 0 : x["foo_"].b; 3880 x == null ? void 0 : x.a["bar_"]; 3881 } 3882 3883 ================================================================================ 3884 TestManglePropsMinify 3885 ---------- /out/entry1.js ---------- 3886 export function shouldMangle_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX() { 3887 let X = { 3888 X: 0, 3889 Y() { 3890 } 3891 }, { X: Y } = X; 3892 ({ X: Y } = X); 3893 class t { 3894 X = 0; 3895 Y() { 3896 } 3897 static X = 0; 3898 static Y() { 3899 } 3900 } 3901 return { X: Y, t }; 3902 } 3903 export function shouldNotMangle_YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY() { 3904 let X = { 3905 bar_: 0, 3906 baz_() { 3907 } 3908 }, { bar_: Y } = X; 3909 ({ bar_: Y } = X); 3910 class t { 3911 bar_ = 0; 3912 baz_() { 3913 } 3914 static bar_ = 0; 3915 static baz_() { 3916 } 3917 } 3918 return { bar_: Y, foo_: t }; 3919 } 3920 3921 ---------- /out/entry2.js ---------- 3922 export default { 3923 a: 0, 3924 baz_: 1 3925 }; 3926 3927 ================================================================================ 3928 TestManglePropsNoShorthand 3929 ---------- /out.js ---------- 3930 export let yyyyy = ({ y }) => ({ y: y }); 3931 3932 ================================================================================ 3933 TestManglePropsOptionalChain 3934 ---------- /out.js ---------- 3935 export default function(x) { 3936 x.a; 3937 x.a?.(); 3938 x?.a; 3939 x?.a(); 3940 x?.a.b; 3941 x?.a.b(); 3942 x?.["foo_"].b; 3943 x?.a["bar_"]; 3944 } 3945 3946 ================================================================================ 3947 TestManglePropsShorthand 3948 ---------- /out.js ---------- 3949 export let yyyyy = ({ y }) => ({ y }); 3950 3951 ================================================================================ 3952 TestManglePropsSuperCall 3953 ---------- /out.js ---------- 3954 class Foo { 3955 } 3956 class Bar extends Foo { 3957 constructor() { 3958 super(); 3959 } 3960 } 3961 3962 ================================================================================ 3963 TestManglePropsTypeScriptFeatures 3964 ---------- /out/parameter-properties.js ---------- 3965 class Foo { 3966 constructor(KEEP_FIELD, MANGLE_FIELD_) { 3967 this.KEEP_FIELD = KEEP_FIELD; 3968 this.a = MANGLE_FIELD_; 3969 } 3970 } 3971 let foo = new Foo(); 3972 console.log(foo.KEEP_FIELD, foo.a); 3973 3974 ---------- /out/namespace-exports.js ---------- 3975 var ns; 3976 ((ns2) => { 3977 ns2.c = 1; 3978 ns2.d = 2; 3979 ns2.e = 3; 3980 ({ i: { a: ns2.a } } = 4); 3981 function MANGLE_FUNCTION_() { 3982 } 3983 ns2.g = MANGLE_FUNCTION_; 3984 class MANGLE_CLASS_ { 3985 } 3986 ns2.h = MANGLE_CLASS_; 3987 let MANGLE_NAMESPACE_; 3988 ((MANGLE_NAMESPACE_2) => { 3989 ; 3990 })(MANGLE_NAMESPACE_ = ns2.f || (ns2.f = {})); 3991 let MANGLE_ENUM_; 3992 ((MANGLE_ENUM_2) => { 3993 })(MANGLE_ENUM_ = ns2.b || (ns2.b = {})); 3994 console.log({ 3995 VAR: ns2.c, 3996 LET: ns2.d, 3997 CONST: ns2.e, 3998 DESTRUCTURING: ns2.a, 3999 FUNCTION: MANGLE_FUNCTION_, 4000 CLASS: MANGLE_CLASS_, 4001 NAMESPACE: MANGLE_NAMESPACE_, 4002 ENUM: MANGLE_ENUM_ 4003 }); 4004 })(ns || (ns = {})); 4005 console.log({ 4006 VAR: ns.c, 4007 LET: ns.d, 4008 CONST: ns.e, 4009 DESTRUCTURING: ns.a, 4010 FUNCTION: ns.g, 4011 CLASS: ns.h, 4012 NAMESPACE: ns.f, 4013 ENUM: ns.b 4014 }); 4015 ((ns2) => { 4016 console.log({ 4017 VAR: ns2.c, 4018 LET: ns2.d, 4019 CONST: ns2.e, 4020 DESTRUCTURING: ns2.a, 4021 FUNCTION: ns2.g, 4022 CLASS: ns2.h, 4023 NAMESPACE: ns2.f, 4024 ENUM: ns2.b 4025 }); 4026 })(ns || (ns = {})); 4027 4028 ---------- /out/enum-values.js ---------- 4029 var TopLevelNumber = /* @__PURE__ */ ((TopLevelNumber2) => { 4030 TopLevelNumber2[TopLevelNumber2["foo_"] = 0] = "foo_"; 4031 return TopLevelNumber2; 4032 })(TopLevelNumber || {}); 4033 var TopLevelString = /* @__PURE__ */ ((TopLevelString2) => { 4034 TopLevelString2["bar_"] = ""; 4035 return TopLevelString2; 4036 })(TopLevelString || {}); 4037 console.log({ 4038 foo: TopLevelNumber.a, 4039 bar: TopLevelString.b 4040 }); 4041 function fn() { 4042 let NestedNumber; 4043 ((NestedNumber2) => { 4044 NestedNumber2[NestedNumber2["foo_"] = 0] = "foo_"; 4045 })(NestedNumber || (NestedNumber = {})); 4046 let NestedString; 4047 ((NestedString2) => { 4048 NestedString2["bar_"] = ""; 4049 })(NestedString || (NestedString = {})); 4050 console.log({ 4051 foo: TopLevelNumber.a, 4052 bar: TopLevelString.b 4053 }); 4054 } 4055 4056 ================================================================================ 4057 TestMangleQuotedProps 4058 ---------- /out/keep.js ---------- 4059 foo("_keepThisProperty"); 4060 foo((x, "_keepThisProperty")); 4061 foo(x ? "_keepThisProperty" : "_keepThisPropertyToo"); 4062 x[foo("_keepThisProperty")]; 4063 x?.[foo("_keepThisProperty")]; 4064 ({ [foo("_keepThisProperty")]: x }); 4065 (class { 4066 [foo("_keepThisProperty")] = x; 4067 }); 4068 var { [foo("_keepThisProperty")]: x } = y; 4069 foo("_keepThisProperty") in x; 4070 4071 ---------- /out/mangle.js ---------- 4072 x.a; 4073 x?.a; 4074 x[y ? "a" : z]; 4075 x?.[y ? "a" : z]; 4076 x[y ? z : "a"]; 4077 x?.[y ? z : "a"]; 4078 x[y, "a"]; 4079 x?.[y, "a"]; 4080 ({ a: x }); 4081 ({ ["a"]: x }); 4082 ({ [(y, "a")]: x }); 4083 (class { 4084 a = x; 4085 }); 4086 (class { 4087 ["a"] = x; 4088 }); 4089 (class { 4090 [(y, "a")] = x; 4091 }); 4092 var { a: x } = y; 4093 var { ["a"]: x } = y; 4094 var { [(z, "a")]: x } = y; 4095 "a" in x; 4096 (y ? "a" : z) in x; 4097 (y ? z : "a") in x; 4098 (y, "a") in x; 4099 4100 ================================================================================ 4101 TestMangleQuotedPropsMinifySyntax 4102 ---------- /out/keep.js ---------- 4103 foo("_keepThisProperty"), foo("_keepThisProperty"), foo(x ? "_keepThisProperty" : "_keepThisPropertyToo"), x[foo("_keepThisProperty")], x?.[foo("_keepThisProperty")], foo("_keepThisProperty") + "", class { 4104 [foo("_keepThisProperty")] = x; 4105 }; 4106 var { [foo("_keepThisProperty")]: x } = y; 4107 foo("_keepThisProperty") in x; 4108 4109 ---------- /out/mangle.js ---------- 4110 x.a, x?.a, x[y ? "a" : z], x?.[y ? "a" : z], x[y ? z : "a"], x?.[y ? z : "a"], x[y, "a"], x?.[y, "a"], (y, "a") + "", class { 4111 [(y, "a")] = x; 4112 }; 4113 var { a: x } = y, { ["a"]: x } = y, { [(z, "a")]: x } = y; 4114 "a" in x, (y ? "a" : z) in x, (y ? z : "a") in x, y, "a" in x; 4115 4116 ================================================================================ 4117 TestManyEntryPoints 4118 ---------- /out/e00.js ---------- 4119 // shared.js 4120 var shared_default = 123; 4121 4122 // e00.js 4123 console.log(shared_default); 4124 4125 ---------- /out/e01.js ---------- 4126 // shared.js 4127 var shared_default = 123; 4128 4129 // e01.js 4130 console.log(shared_default); 4131 4132 ---------- /out/e02.js ---------- 4133 // shared.js 4134 var shared_default = 123; 4135 4136 // e02.js 4137 console.log(shared_default); 4138 4139 ---------- /out/e03.js ---------- 4140 // shared.js 4141 var shared_default = 123; 4142 4143 // e03.js 4144 console.log(shared_default); 4145 4146 ---------- /out/e04.js ---------- 4147 // shared.js 4148 var shared_default = 123; 4149 4150 // e04.js 4151 console.log(shared_default); 4152 4153 ---------- /out/e05.js ---------- 4154 // shared.js 4155 var shared_default = 123; 4156 4157 // e05.js 4158 console.log(shared_default); 4159 4160 ---------- /out/e06.js ---------- 4161 // shared.js 4162 var shared_default = 123; 4163 4164 // e06.js 4165 console.log(shared_default); 4166 4167 ---------- /out/e07.js ---------- 4168 // shared.js 4169 var shared_default = 123; 4170 4171 // e07.js 4172 console.log(shared_default); 4173 4174 ---------- /out/e08.js ---------- 4175 // shared.js 4176 var shared_default = 123; 4177 4178 // e08.js 4179 console.log(shared_default); 4180 4181 ---------- /out/e09.js ---------- 4182 // shared.js 4183 var shared_default = 123; 4184 4185 // e09.js 4186 console.log(shared_default); 4187 4188 ---------- /out/e10.js ---------- 4189 // shared.js 4190 var shared_default = 123; 4191 4192 // e10.js 4193 console.log(shared_default); 4194 4195 ---------- /out/e11.js ---------- 4196 // shared.js 4197 var shared_default = 123; 4198 4199 // e11.js 4200 console.log(shared_default); 4201 4202 ---------- /out/e12.js ---------- 4203 // shared.js 4204 var shared_default = 123; 4205 4206 // e12.js 4207 console.log(shared_default); 4208 4209 ---------- /out/e13.js ---------- 4210 // shared.js 4211 var shared_default = 123; 4212 4213 // e13.js 4214 console.log(shared_default); 4215 4216 ---------- /out/e14.js ---------- 4217 // shared.js 4218 var shared_default = 123; 4219 4220 // e14.js 4221 console.log(shared_default); 4222 4223 ---------- /out/e15.js ---------- 4224 // shared.js 4225 var shared_default = 123; 4226 4227 // e15.js 4228 console.log(shared_default); 4229 4230 ---------- /out/e16.js ---------- 4231 // shared.js 4232 var shared_default = 123; 4233 4234 // e16.js 4235 console.log(shared_default); 4236 4237 ---------- /out/e17.js ---------- 4238 // shared.js 4239 var shared_default = 123; 4240 4241 // e17.js 4242 console.log(shared_default); 4243 4244 ---------- /out/e18.js ---------- 4245 // shared.js 4246 var shared_default = 123; 4247 4248 // e18.js 4249 console.log(shared_default); 4250 4251 ---------- /out/e19.js ---------- 4252 // shared.js 4253 var shared_default = 123; 4254 4255 // e19.js 4256 console.log(shared_default); 4257 4258 ---------- /out/e20.js ---------- 4259 // shared.js 4260 var shared_default = 123; 4261 4262 // e20.js 4263 console.log(shared_default); 4264 4265 ---------- /out/e21.js ---------- 4266 // shared.js 4267 var shared_default = 123; 4268 4269 // e21.js 4270 console.log(shared_default); 4271 4272 ---------- /out/e22.js ---------- 4273 // shared.js 4274 var shared_default = 123; 4275 4276 // e22.js 4277 console.log(shared_default); 4278 4279 ---------- /out/e23.js ---------- 4280 // shared.js 4281 var shared_default = 123; 4282 4283 // e23.js 4284 console.log(shared_default); 4285 4286 ---------- /out/e24.js ---------- 4287 // shared.js 4288 var shared_default = 123; 4289 4290 // e24.js 4291 console.log(shared_default); 4292 4293 ---------- /out/e25.js ---------- 4294 // shared.js 4295 var shared_default = 123; 4296 4297 // e25.js 4298 console.log(shared_default); 4299 4300 ---------- /out/e26.js ---------- 4301 // shared.js 4302 var shared_default = 123; 4303 4304 // e26.js 4305 console.log(shared_default); 4306 4307 ---------- /out/e27.js ---------- 4308 // shared.js 4309 var shared_default = 123; 4310 4311 // e27.js 4312 console.log(shared_default); 4313 4314 ---------- /out/e28.js ---------- 4315 // shared.js 4316 var shared_default = 123; 4317 4318 // e28.js 4319 console.log(shared_default); 4320 4321 ---------- /out/e29.js ---------- 4322 // shared.js 4323 var shared_default = 123; 4324 4325 // e29.js 4326 console.log(shared_default); 4327 4328 ---------- /out/e30.js ---------- 4329 // shared.js 4330 var shared_default = 123; 4331 4332 // e30.js 4333 console.log(shared_default); 4334 4335 ---------- /out/e31.js ---------- 4336 // shared.js 4337 var shared_default = 123; 4338 4339 // e31.js 4340 console.log(shared_default); 4341 4342 ---------- /out/e32.js ---------- 4343 // shared.js 4344 var shared_default = 123; 4345 4346 // e32.js 4347 console.log(shared_default); 4348 4349 ---------- /out/e33.js ---------- 4350 // shared.js 4351 var shared_default = 123; 4352 4353 // e33.js 4354 console.log(shared_default); 4355 4356 ---------- /out/e34.js ---------- 4357 // shared.js 4358 var shared_default = 123; 4359 4360 // e34.js 4361 console.log(shared_default); 4362 4363 ---------- /out/e35.js ---------- 4364 // shared.js 4365 var shared_default = 123; 4366 4367 // e35.js 4368 console.log(shared_default); 4369 4370 ---------- /out/e36.js ---------- 4371 // shared.js 4372 var shared_default = 123; 4373 4374 // e36.js 4375 console.log(shared_default); 4376 4377 ---------- /out/e37.js ---------- 4378 // shared.js 4379 var shared_default = 123; 4380 4381 // e37.js 4382 console.log(shared_default); 4383 4384 ---------- /out/e38.js ---------- 4385 // shared.js 4386 var shared_default = 123; 4387 4388 // e38.js 4389 console.log(shared_default); 4390 4391 ---------- /out/e39.js ---------- 4392 // shared.js 4393 var shared_default = 123; 4394 4395 // e39.js 4396 console.log(shared_default); 4397 4398 ================================================================================ 4399 TestMetafileImportWithTypeJSON 4400 ---------- /out/entry.js ---------- 4401 // project/data.json 4402 var data_default = { some: "data" }; 4403 4404 // project/data.json with { type: 'json' } 4405 var data_default2 = { some: "data" }; 4406 4407 // project/entry.js 4408 x = [data_default, data_default, data_default2]; 4409 ---------- metafile.json ---------- 4410 { 4411 "inputs": { 4412 "project/data.json": { 4413 "bytes": 16, 4414 "imports": [] 4415 }, 4416 "project/data.json with { type: 'json' }": { 4417 "bytes": 16, 4418 "imports": [], 4419 "format": "esm", 4420 "with": { 4421 "type": "json" 4422 } 4423 }, 4424 "project/entry.js": { 4425 "bytes": 164, 4426 "imports": [ 4427 { 4428 "path": "project/data.json", 4429 "kind": "import-statement", 4430 "original": "./data.json" 4431 }, 4432 { 4433 "path": "project/data.json", 4434 "kind": "import-statement", 4435 "original": "./data.json" 4436 }, 4437 { 4438 "path": "project/data.json with { type: 'json' }", 4439 "kind": "import-statement", 4440 "original": "./data.json", 4441 "with": { 4442 "type": "json" 4443 } 4444 } 4445 ], 4446 "format": "esm" 4447 } 4448 }, 4449 "outputs": { 4450 "out/entry.js": { 4451 "imports": [], 4452 "exports": [], 4453 "entryPoint": "project/entry.js", 4454 "inputs": { 4455 "project/data.json": { 4456 "bytesInOutput": 37 4457 }, 4458 "project/data.json with { type: 'json' }": { 4459 "bytesInOutput": 38 4460 }, 4461 "project/entry.js": { 4462 "bytesInOutput": 49 4463 } 4464 }, 4465 "bytes": 210 4466 } 4467 } 4468 } 4469 4470 ================================================================================ 4471 TestMetafileNoBundle 4472 ---------- /out/entry.js ---------- 4473 import a from "pkg"; 4474 import b from "./file"; 4475 console.log( 4476 a, 4477 b, 4478 require("pkg2"), 4479 require("./file2"), 4480 import("./dynamic") 4481 ); 4482 let exported; 4483 4484 ---------- /out/entry.css ---------- 4485 @import "pkg"; 4486 @import "./file"; 4487 a { 4488 background: url(pkg2); 4489 } 4490 a { 4491 background: url(./file2); 4492 } 4493 ---------- metafile.json ---------- 4494 { 4495 "inputs": { 4496 "project/entry.js": { 4497 "bytes": 191, 4498 "imports": [], 4499 "format": "esm" 4500 }, 4501 "project/entry.css": { 4502 "bytes": 112, 4503 "imports": [] 4504 } 4505 }, 4506 "outputs": { 4507 "out/entry.js": { 4508 "imports": [ 4509 { 4510 "path": "pkg", 4511 "kind": "import-statement", 4512 "external": true 4513 }, 4514 { 4515 "path": "./file", 4516 "kind": "import-statement", 4517 "external": true 4518 }, 4519 { 4520 "path": "pkg2", 4521 "kind": "require-call", 4522 "external": true 4523 }, 4524 { 4525 "path": "./file2", 4526 "kind": "require-call", 4527 "external": true 4528 }, 4529 { 4530 "path": "./dynamic", 4531 "kind": "dynamic-import", 4532 "external": true 4533 } 4534 ], 4535 "exports": [ 4536 "exported" 4537 ], 4538 "entryPoint": "project/entry.js", 4539 "inputs": { 4540 "project/entry.js": { 4541 "bytesInOutput": 148 4542 } 4543 }, 4544 "bytes": 148 4545 }, 4546 "out/entry.css": { 4547 "imports": [ 4548 { 4549 "path": "pkg", 4550 "kind": "import-rule", 4551 "external": true 4552 }, 4553 { 4554 "path": "./file", 4555 "kind": "import-rule", 4556 "external": true 4557 }, 4558 { 4559 "path": "pkg2", 4560 "kind": "url-token", 4561 "external": true 4562 }, 4563 { 4564 "path": "./file2", 4565 "kind": "url-token", 4566 "external": true 4567 } 4568 ], 4569 "entryPoint": "project/entry.css", 4570 "inputs": { 4571 "project/entry.css": { 4572 "bytesInOutput": 65 4573 } 4574 }, 4575 "bytes": 98 4576 } 4577 } 4578 } 4579 4580 ================================================================================ 4581 TestMetafileVariousCases 4582 ---------- /out/file-NVISQQTV.file ---------- 4583 file 4584 ---------- /out/copy-O3Y5SCJE.copy ---------- 4585 copy 4586 ---------- /out/entry.js ---------- 4587 import { 4588 __commonJS, 4589 __require 4590 } from "./chunk-MQN2VSL5.js"; 4591 4592 // project/cjs.js 4593 var require_cjs = __commonJS({ 4594 "project/cjs.js"(exports, module) { 4595 module.exports = 4; 4596 } 4597 }); 4598 4599 // project/entry.js 4600 import a from "extern-esm"; 4601 4602 // project/esm.js 4603 var esm_default = 1; 4604 4605 // <data:application/json,2> 4606 var json_2_default = 2; 4607 4608 // project/file.file 4609 var file_default = "./file-NVISQQTV.file"; 4610 4611 // project/entry.js 4612 import e from "./copy-O3Y5SCJE.copy"; 4613 console.log( 4614 a, 4615 esm_default, 4616 json_2_default, 4617 file_default, 4618 e, 4619 __require("extern-cjs"), 4620 require_cjs(), 4621 import("./dynamic-Q2DWDUFV.js") 4622 ); 4623 var exported; 4624 export { 4625 exported 4626 }; 4627 4628 ---------- /out/dynamic-Q2DWDUFV.js ---------- 4629 import "./chunk-MQN2VSL5.js"; 4630 4631 // project/dynamic.js 4632 var dynamic_default = 5; 4633 export { 4634 dynamic_default as default 4635 }; 4636 4637 ---------- /out/chunk-MQN2VSL5.js ---------- 4638 export { 4639 __require, 4640 __commonJS 4641 }; 4642 4643 ---------- /out/entry.css ---------- 4644 @import "extern.css"; 4645 4646 /* project/entry.css */ 4647 a { 4648 background: url(data:image/svg+xml,<svg/>); 4649 } 4650 b { 4651 background: url("./file-NVISQQTV.file"); 4652 } 4653 c { 4654 background: url("./copy-O3Y5SCJE.copy"); 4655 } 4656 d { 4657 background: url(extern.png); 4658 } 4659 ---------- metafile.json ---------- 4660 { 4661 "inputs": { 4662 "project/esm.js": { 4663 "bytes": 16, 4664 "imports": [], 4665 "format": "esm" 4666 }, 4667 "<data:application/json,2>": { 4668 "bytes": 1, 4669 "imports": [] 4670 }, 4671 "project/file.file": { 4672 "bytes": 4, 4673 "imports": [] 4674 }, 4675 "project/copy.copy": { 4676 "bytes": 4, 4677 "imports": [] 4678 }, 4679 "project/cjs.js": { 4680 "bytes": 18, 4681 "imports": [], 4682 "format": "cjs" 4683 }, 4684 "project/dynamic.js": { 4685 "bytes": 16, 4686 "imports": [], 4687 "format": "esm" 4688 }, 4689 "project/entry.js": { 4690 "bytes": 333, 4691 "imports": [ 4692 { 4693 "path": "extern-esm", 4694 "kind": "import-statement", 4695 "external": true 4696 }, 4697 { 4698 "path": "project/esm.js", 4699 "kind": "import-statement", 4700 "original": "./esm" 4701 }, 4702 { 4703 "path": "<data:application/json,2>", 4704 "kind": "import-statement", 4705 "original": "data:application/json,2" 4706 }, 4707 { 4708 "path": "project/file.file", 4709 "kind": "import-statement", 4710 "original": "./file.file" 4711 }, 4712 { 4713 "path": "project/copy.copy", 4714 "kind": "import-statement", 4715 "original": "./copy.copy" 4716 }, 4717 { 4718 "path": "extern-cjs", 4719 "kind": "require-call", 4720 "external": true 4721 }, 4722 { 4723 "path": "project/cjs.js", 4724 "kind": "require-call", 4725 "original": "./cjs" 4726 }, 4727 { 4728 "path": "project/dynamic.js", 4729 "kind": "dynamic-import", 4730 "original": "./dynamic" 4731 } 4732 ], 4733 "format": "esm" 4734 }, 4735 "project/inline.svg": { 4736 "bytes": 6, 4737 "imports": [] 4738 }, 4739 "project/entry.css": { 4740 "bytes": 180, 4741 "imports": [ 4742 { 4743 "path": "extern.css", 4744 "kind": "import-rule", 4745 "external": true 4746 }, 4747 { 4748 "path": "project/inline.svg", 4749 "kind": "url-token", 4750 "original": "inline.svg" 4751 }, 4752 { 4753 "path": "project/file.file", 4754 "kind": "url-token", 4755 "original": "file.file" 4756 }, 4757 { 4758 "path": "project/copy.copy", 4759 "kind": "url-token", 4760 "original": "copy.copy" 4761 }, 4762 { 4763 "path": "extern.png", 4764 "kind": "url-token", 4765 "external": true 4766 } 4767 ] 4768 } 4769 }, 4770 "outputs": { 4771 "out/file-NVISQQTV.file": { 4772 "imports": [], 4773 "exports": [], 4774 "inputs": { 4775 "project/file.file": { 4776 "bytesInOutput": 4 4777 } 4778 }, 4779 "bytes": 4 4780 }, 4781 "out/copy-O3Y5SCJE.copy": { 4782 "imports": [], 4783 "exports": [], 4784 "inputs": { 4785 "project/copy.copy": { 4786 "bytesInOutput": 4 4787 } 4788 }, 4789 "bytes": 4 4790 }, 4791 "out/entry.js": { 4792 "imports": [ 4793 { 4794 "path": "out/chunk-MQN2VSL5.js", 4795 "kind": "import-statement" 4796 }, 4797 { 4798 "path": "extern-esm", 4799 "kind": "import-statement", 4800 "external": true 4801 }, 4802 { 4803 "path": "out/file-NVISQQTV.file", 4804 "kind": "file-loader" 4805 }, 4806 { 4807 "path": "out/copy-O3Y5SCJE.copy", 4808 "kind": "import-statement" 4809 }, 4810 { 4811 "path": "extern-cjs", 4812 "kind": "require-call", 4813 "external": true 4814 }, 4815 { 4816 "path": "out/dynamic-Q2DWDUFV.js", 4817 "kind": "dynamic-import" 4818 } 4819 ], 4820 "exports": [ 4821 "exported" 4822 ], 4823 "entryPoint": "project/entry.js", 4824 "inputs": { 4825 "project/cjs.js": { 4826 "bytesInOutput": 101 4827 }, 4828 "project/entry.js": { 4829 "bytesInOutput": 233 4830 }, 4831 "project/esm.js": { 4832 "bytesInOutput": 21 4833 }, 4834 "<data:application/json,2>": { 4835 "bytesInOutput": 24 4836 }, 4837 "project/file.file": { 4838 "bytesInOutput": 43 4839 } 4840 }, 4841 "bytes": 642 4842 }, 4843 "out/dynamic-Q2DWDUFV.js": { 4844 "imports": [ 4845 { 4846 "path": "out/chunk-MQN2VSL5.js", 4847 "kind": "import-statement" 4848 } 4849 ], 4850 "exports": [ 4851 "default" 4852 ], 4853 "entryPoint": "project/dynamic.js", 4854 "inputs": { 4855 "project/dynamic.js": { 4856 "bytesInOutput": 25 4857 } 4858 }, 4859 "bytes": 119 4860 }, 4861 "out/chunk-MQN2VSL5.js": { 4862 "imports": [], 4863 "exports": [ 4864 "__commonJS", 4865 "__require" 4866 ], 4867 "inputs": {}, 4868 "bytes": 38 4869 }, 4870 "out/entry.css": { 4871 "imports": [ 4872 { 4873 "path": "extern.css", 4874 "kind": "import-rule", 4875 "external": true 4876 }, 4877 { 4878 "path": "data:image/svg+xml,<svg/>", 4879 "kind": "url-token" 4880 }, 4881 { 4882 "path": "out/file-NVISQQTV.file", 4883 "kind": "url-token" 4884 }, 4885 { 4886 "path": "out/copy-O3Y5SCJE.copy", 4887 "kind": "url-token" 4888 }, 4889 { 4890 "path": "extern.png", 4891 "kind": "url-token", 4892 "external": true 4893 } 4894 ], 4895 "entryPoint": "project/entry.css", 4896 "inputs": { 4897 "project/entry.css": { 4898 "bytesInOutput": 187 4899 } 4900 }, 4901 "bytes": 234 4902 } 4903 } 4904 } 4905 4906 ================================================================================ 4907 TestMetafileVeryLongExternalPaths 4908 ---------- /out/111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111-55DNWN2R.file ---------- 4909 4910 ---------- /out/bytesInOutput should be at least 99 (1).js ---------- 4911 // project/111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.file 4912 var __default = "./111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111-55DNWN2R.file"; 4913 4914 // project/bytesInOutput should be at least 99 (1).js 4915 console.log(__default); 4916 4917 ---------- /out/222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222-55DNWN2R.copy ---------- 4918 4919 ---------- /out/bytesInOutput should be at least 99 (2).js ---------- 4920 // project/bytesInOutput should be at least 99 (2).js 4921 import a from "./222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222-55DNWN2R.copy"; 4922 console.log(a); 4923 4924 ---------- /out/bytesInOutput should be at least 99 (3).js ---------- 4925 // project/bytesInOutput should be at least 99 (3).js 4926 import("./333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333-DH3FVEAA.js").then(console.log); 4927 4928 ---------- /out/333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333-DH3FVEAA.js ---------- 4929 4930 ---------- /out/444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444-55DNWN2R.file ---------- 4931 4932 ---------- /out/bytesInOutput should be at least 99.css ---------- 4933 /* project/bytesInOutput should be at least 99.css */ 4934 a { 4935 background: url("./444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444-55DNWN2R.file"); 4936 } 4937 ---------- metafile.json ---------- 4938 { 4939 "inputs": { 4940 "project/111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.file": { 4941 "bytes": 0, 4942 "imports": [] 4943 }, 4944 "project/bytesInOutput should be at least 99 (1).js": { 4945 "bytes": 150, 4946 "imports": [ 4947 { 4948 "path": "project/111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.file", 4949 "kind": "import-statement", 4950 "original": "./111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.file" 4951 } 4952 ], 4953 "format": "esm" 4954 }, 4955 "project/222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222.copy": { 4956 "bytes": 0, 4957 "imports": [] 4958 }, 4959 "project/bytesInOutput should be at least 99 (2).js": { 4960 "bytes": 150, 4961 "imports": [ 4962 { 4963 "path": "project/222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222.copy", 4964 "kind": "import-statement", 4965 "original": "./222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222.copy" 4966 } 4967 ], 4968 "format": "esm" 4969 }, 4970 "project/333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333.js": { 4971 "bytes": 0, 4972 "imports": [] 4973 }, 4974 "project/bytesInOutput should be at least 99 (3).js": { 4975 "bytes": 141, 4976 "imports": [ 4977 { 4978 "path": "project/333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333.js", 4979 "kind": "dynamic-import", 4980 "original": "./333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333.js" 4981 } 4982 ] 4983 }, 4984 "project/444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444.file": { 4985 "bytes": 0, 4986 "imports": [] 4987 }, 4988 "project/bytesInOutput should be at least 99.css": { 4989 "bytes": 136, 4990 "imports": [ 4991 { 4992 "path": "project/444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444.file", 4993 "kind": "url-token", 4994 "original": "444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444.file" 4995 } 4996 ] 4997 } 4998 }, 4999 "outputs": { 5000 "out/111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111-55DNWN2R.file": { 5001 "imports": [], 5002 "exports": [], 5003 "inputs": { 5004 "project/111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.file": { 5005 "bytesInOutput": 0 5006 } 5007 }, 5008 "bytes": 0 5009 }, 5010 "out/bytesInOutput should be at least 99 (1).js": { 5011 "imports": [ 5012 { 5013 "path": "out/111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111-55DNWN2R.file", 5014 "kind": "file-loader" 5015 } 5016 ], 5017 "exports": [], 5018 "entryPoint": "project/bytesInOutput should be at least 99 (1).js", 5019 "inputs": { 5020 "project/111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111.file": { 5021 "bytesInOutput": 135 5022 }, 5023 "project/bytesInOutput should be at least 99 (1).js": { 5024 "bytesInOutput": 24 5025 } 5026 }, 5027 "bytes": 330 5028 }, 5029 "out/222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222-55DNWN2R.copy": { 5030 "imports": [], 5031 "exports": [], 5032 "inputs": { 5033 "project/222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222.copy": { 5034 "bytesInOutput": 0 5035 } 5036 }, 5037 "bytes": 0 5038 }, 5039 "out/bytesInOutput should be at least 99 (2).js": { 5040 "imports": [ 5041 { 5042 "path": "out/222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222-55DNWN2R.copy", 5043 "kind": "import-statement" 5044 } 5045 ], 5046 "exports": [], 5047 "entryPoint": "project/bytesInOutput should be at least 99 (2).js", 5048 "inputs": { 5049 "project/bytesInOutput should be at least 99 (2).js": { 5050 "bytesInOutput": 149 5051 } 5052 }, 5053 "bytes": 203 5054 }, 5055 "out/bytesInOutput should be at least 99 (3).js": { 5056 "imports": [ 5057 { 5058 "path": "out/333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333-DH3FVEAA.js", 5059 "kind": "dynamic-import" 5060 } 5061 ], 5062 "exports": [], 5063 "entryPoint": "project/bytesInOutput should be at least 99 (3).js", 5064 "inputs": { 5065 "project/bytesInOutput should be at least 99 (3).js": { 5066 "bytesInOutput": 143 5067 } 5068 }, 5069 "bytes": 197 5070 }, 5071 "out/333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333-DH3FVEAA.js": { 5072 "imports": [], 5073 "exports": [], 5074 "entryPoint": "project/333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333.js", 5075 "inputs": { 5076 "project/333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333.js": { 5077 "bytesInOutput": 0 5078 } 5079 }, 5080 "bytes": 0 5081 }, 5082 "out/444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444-55DNWN2R.file": { 5083 "imports": [], 5084 "exports": [], 5085 "inputs": { 5086 "project/444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444.file": { 5087 "bytesInOutput": 0 5088 } 5089 }, 5090 "bytes": 0 5091 }, 5092 "out/bytesInOutput should be at least 99.css": { 5093 "imports": [ 5094 { 5095 "path": "out/444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444-55DNWN2R.file", 5096 "kind": "url-token" 5097 } 5098 ], 5099 "entryPoint": "project/bytesInOutput should be at least 99.css", 5100 "inputs": { 5101 "project/bytesInOutput should be at least 99.css": { 5102 "bytesInOutput": 144 5103 } 5104 }, 5105 "bytes": 198 5106 } 5107 } 5108 } 5109 5110 ================================================================================ 5111 TestMinifiedBundleCommonJS 5112 ---------- /out.js ---------- 5113 var t=e(r=>{r.foo=function(){return 123}});var n=e((l,c)=>{c.exports={test:!0}});var{foo:f}=t();console.log(f(),n()); 5114 5115 ================================================================================ 5116 TestMinifiedBundleES6 5117 ---------- /out.js ---------- 5118 function o(){return 123}o();console.log(o()); 5119 5120 ================================================================================ 5121 TestMinifiedBundleEndingWithImportantSemicolon 5122 ---------- /out.js ---------- 5123 (()=>{while(foo());})(); 5124 5125 ================================================================================ 5126 TestMinifiedDynamicImportWithExpressionCJS 5127 ---------- /out.js ---------- 5128 import("foo");import(foo()); 5129 5130 ================================================================================ 5131 TestMinifiedExportsAndModuleFormatCommonJS 5132 ---------- /out.js ---------- 5133 // foo/test.js 5134 var o = {}; 5135 p(o, { 5136 foo: () => l 5137 }); 5138 var l = 123; 5139 5140 // bar/test.js 5141 var r = {}; 5142 p(r, { 5143 bar: () => m 5144 }); 5145 var m = 123; 5146 5147 // entry.js 5148 console.log(exports, module.exports, o, r); 5149 5150 ================================================================================ 5151 TestMinifiedJSXPreserveWithObjectSpread 5152 ---------- /out.js ---------- 5153 // entry.jsx 5154 var obj = { 5155 before, 5156 [key]: value, 5157 key: value, 5158 after 5159 }; 5160 <Foo 5161 before 5162 {...{ [key]: value }} 5163 key={value} 5164 after 5165 />; 5166 <Bar 5167 a={a} 5168 {...{ [b]: c }} 5169 {...d} 5170 e={e} 5171 />; 5172 5173 ================================================================================ 5174 TestMinifyArguments 5175 ---------- /out.js ---------- 5176 (() => { 5177 // entry.js 5178 function e(n = arguments) { 5179 let t; 5180 } 5181 function u(n = arguments) { 5182 let t; 5183 } 5184 function a(n = arguments) { 5185 let t; 5186 } 5187 e(); 5188 u(); 5189 a(); 5190 })(); 5191 5192 ================================================================================ 5193 TestMinifyIdentifiersImportPathFrequencyAnalysis 5194 ---------- /out/import.js ---------- 5195 var o=123;console.log(o,"no identifier in this file should be named W, X, Y, or Z"); 5196 5197 ---------- /out/require.js ---------- 5198 var i=r((t,e)=>{e.exports=123});var s=i();console.log(s,"no identifier in this file should be named A, B, C, or D"); 5199 5200 ================================================================================ 5201 TestMinifyNestedLabelsNoBundle 5202 ---------- /out.js ---------- 5203 l:n:a:b:c:d:e:f:g:h:i:j:k:m:o:p:{nl(` 5204 `);q:r:s:t:u:v:w:x:y:z:A:B:C:D:E:F:{nl(` 5205 `);G:H:I:J:K:L:M:N:O:P:Q:R:S:T:U:V:{nl(` 5206 `);W:X:Y:Z:_:$:ll:nl:al:bl:cl:dl:el:fl:gl:hl:{nl(` 5207 `);il:jl:kl:ml:ol:pl:ql:rl:sl:tl:ul:vl:wl:xl:yl:zl:{nl(` 5208 `);Al:Bl:Cl:Dl:El:Fl:Gl:Hl:Il:Jl:Kl:Ll:Ml:Nl:Ol:Pl:{nl(` 5209 `);Ql:Rl:Sl:Tl:Ul:Vl:Wl:Xl:Yl:Zl:_l:$l:ln:nn:an:bn:{nl(` 5210 `);cn:dn:en:fn:gn:hn:jn:kn:mn:on:pn:qn:rn:sn:tn:un:{nl(` 5211 `);vn:wn:xn:yn:zn:An:Bn:Cn:Dn:En:Fn:Gn:Hn:In:Jn:Kn:{nl(` 5212 `);Ln:Mn:Nn:On:Pn:Qn:Rn:Sn:Tn:Un:Vn:Wn:Xn:Yn:Zn:_n:{nl(` 5213 `);$n:la:na:aa:ba:ca:da:ea:fa:ga:ha:ia:ja:ka:ma:oa:{nl(` 5214 `);pa:qa:ra:sa:ta:ua:va:wa:xa:ya:za:Aa:Ba:Ca:Da:Ea:{nl(` 5215 `);Fa:Ga:Ha:Ia:Ja:Ka:La:Ma:Na:Oa:Pa:Qa:Ra:Sa:Ta:Ua:{nl(` 5216 `);Va:Wa:Xa:Ya:Za:_a:$a:lb:nb:ab:bb:cb:db:eb:fb:gb:{nl(` 5217 `);hb:ib:jb:kb:mb:ob:pb:qb:rb:sb:tb:ub:vb:wb:xb:yb:{nl(` 5218 `);zb:Ab:Bb:Cb:Db:Eb:Fb:Gb:Hb:Ib:Jb:Kb:Lb:Mb:Nb:Ob:{nl(` 5219 `);Pb:Qb:Rb:Sb:Tb:Ub:Vb:Wb:Xb:Yb:Zb:_b:$b:lc:nc:ac:{nl(` 5220 `);bc:cc:dc:ec:fc:gc:hc:ic:jc:kc:mc:oc:pc:qc:rc:sc:{nl(` 5221 `);tc:uc:vc:wc:xc:yc:zc:Ac:Bc:Cc:Dc:Ec:Fc:Gc:Hc:Ic:{nl(` 5222 `);Jc:Kc:Lc:Mc:Nc:Oc:Pc:Qc:Rc:Sc:Tc:Uc:Vc:Wc:Xc:Yc:{nl(` 5223 `);Zc:_c:$c:ld:nd:ad:bd:cd:dd:ed:fd:gd:hd:{}}}}}}}}}}}}}}}}}}nl(` 5224 `)}}} 5225 5226 ================================================================================ 5227 TestMinifyPrivateIdentifiersNoBundle 5228 ---------- /out.js ---------- 5229 class Foo { 5230 #a; 5231 foo = class { 5232 #s; 5233 #f; 5234 #r; 5235 }; 5236 get #o() { 5237 } 5238 set #o(a) { 5239 } 5240 } 5241 class Bar { 5242 #a; 5243 foo = class { 5244 #s; 5245 #f; 5246 #r; 5247 }; 5248 get #o() { 5249 } 5250 set #o(a) { 5251 } 5252 } 5253 5254 ================================================================================ 5255 TestMinifySiblingLabelsNoBundle 5256 ---------- /out.js ---------- 5257 a: { 5258 b: { 5259 if (x) break b; 5260 break a; 5261 } 5262 } 5263 a: { 5264 b: { 5265 if (x) break b; 5266 break a; 5267 } 5268 } 5269 a: { 5270 b: { 5271 if (x) break b; 5272 break a; 5273 } 5274 } 5275 5276 ================================================================================ 5277 TestMultipleEntryPointsSameNameCollision 5278 ---------- /out/a/entry.js ---------- 5279 // common.js 5280 var foo = 123; 5281 5282 // a/entry.js 5283 console.log(foo); 5284 5285 ---------- /out/b/entry.js ---------- 5286 // common.js 5287 var foo = 123; 5288 5289 // b/entry.js 5290 console.log(foo); 5291 5292 ================================================================================ 5293 TestNamedFunctionExpressionArgumentCollision 5294 ---------- /out/entry.js ---------- 5295 let x = function(foo) { 5296 var foo; 5297 return foo; 5298 }; 5299 5300 ================================================================================ 5301 TestNestedCommonJS 5302 ---------- /out.js ---------- 5303 // foo.js 5304 var require_foo = __commonJS({ 5305 "foo.js"(exports, module) { 5306 module.exports = function() { 5307 return 123; 5308 }; 5309 } 5310 }); 5311 5312 // entry.js 5313 function nestedScope() { 5314 const fn = require_foo(); 5315 console.log(fn()); 5316 } 5317 nestedScope(); 5318 5319 ================================================================================ 5320 TestNestedES6FromCommonJS 5321 ---------- /out.js ---------- 5322 // foo.js 5323 var require_foo = __commonJS({ 5324 "foo.js"(exports) { 5325 exports.fn = function() { 5326 return 123; 5327 }; 5328 } 5329 }); 5330 5331 // entry.js 5332 var import_foo = __toESM(require_foo()); 5333 (() => { 5334 console.log((0, import_foo.fn)()); 5335 })(); 5336 5337 ================================================================================ 5338 TestNestedRequireWithoutCall 5339 ---------- /out.js ---------- 5340 // entry.js 5341 (() => { 5342 const req = __require; 5343 req("./entry"); 5344 })(); 5345 5346 ================================================================================ 5347 TestNestedScopeBug 5348 ---------- /out.js ---------- 5349 // entry.js 5350 (() => { 5351 function a() { 5352 b(); 5353 } 5354 { 5355 var b = () => { 5356 }; 5357 } 5358 a(); 5359 })(); 5360 5361 ================================================================================ 5362 TestNewExpressionCommonJS 5363 ---------- /out.js ---------- 5364 // foo.js 5365 var require_foo = __commonJS({ 5366 "foo.js"(exports, module) { 5367 var Foo = class { 5368 }; 5369 module.exports = { Foo }; 5370 } 5371 }); 5372 5373 // entry.js 5374 new (require_foo()).Foo(); 5375 5376 ================================================================================ 5377 TestNoWarnCommonJSExportsInESMPassThrough 5378 ---------- /out/cjs-in-esm.js ---------- 5379 export let foo = 1; 5380 exports.foo = 2; 5381 module.exports = 3; 5382 5383 ---------- /out/import-in-cjs.js ---------- 5384 import { foo } from "bar"; 5385 exports.foo = foo; 5386 module.exports = foo; 5387 5388 ---------- /out/no-warnings-here.js ---------- 5389 console.log(module, exports); 5390 5391 ================================================================================ 5392 TestNodeAnnotationFalsePositiveIssue3544 5393 ---------- /out.js ---------- 5394 // entry.mjs 5395 var entry_exports = {}; 5396 __export(entry_exports, { 5397 confuseNode: () => confuseNode 5398 }); 5399 module.exports = __toCommonJS(entry_exports); 5400 function confuseNode(exports2) { 5401 exports2.notAnExport = function() { 5402 }; 5403 } 5404 // Annotate the CommonJS export names for ESM import in node: 5405 0 && (module.exports = { 5406 confuseNode 5407 }); 5408 5409 ================================================================================ 5410 TestNodeModules 5411 ---------- /Users/user/project/out.js ---------- 5412 // Users/user/project/node_modules/demo-pkg/index.js 5413 var require_demo_pkg = __commonJS({ 5414 "Users/user/project/node_modules/demo-pkg/index.js"(exports, module) { 5415 module.exports = function() { 5416 return 123; 5417 }; 5418 } 5419 }); 5420 5421 // Users/user/project/src/entry.js 5422 var import_demo_pkg = __toESM(require_demo_pkg()); 5423 console.log((0, import_demo_pkg.default)()); 5424 5425 ================================================================================ 5426 TestNonDeterminismIssue2537 5427 ---------- /out.js ---------- 5428 // entry.ts 5429 function i(o, e) { 5430 let r = "teun"; 5431 if (o) { 5432 let u = function(n) { 5433 return n * 2; 5434 }, t = function(n) { 5435 return n / 2; 5436 }; 5437 var b = u, f = t; 5438 r = u(e) + t(e); 5439 } 5440 return r; 5441 } 5442 export { 5443 i as aap 5444 }; 5445 5446 ================================================================================ 5447 TestObjectLiteralProtoSetterEdgeCases 5448 ---------- /out/import-normal.js ---------- 5449 import { __proto__, bar } from "foo"; 5450 function foo() { 5451 console.log( 5452 'this must not become "{ __proto__ }":', 5453 { 5454 __proto__: __proto__, 5455 bar 5456 } 5457 ); 5458 } 5459 5460 ---------- /out/import-shorthand.js ---------- 5461 import { __proto__, bar } from "foo"; 5462 function foo() { 5463 console.log( 5464 'this must not become "{ __proto__: ... }":', 5465 { 5466 __proto__, 5467 bar 5468 } 5469 ); 5470 } 5471 5472 ---------- /out/local-normal.js ---------- 5473 function foo(__proto__, bar) { 5474 console.log( 5475 'this must not become "{ __proto__ }":', 5476 { 5477 __proto__: __proto__, 5478 bar 5479 } 5480 ); 5481 } 5482 5483 ---------- /out/local-shorthand.js ---------- 5484 function foo(__proto__, bar) { 5485 { 5486 let __proto__2, bar2; 5487 console.log( 5488 'this must not become "{ __proto__: ... }":', 5489 { 5490 ["__proto__"]: __proto__2, 5491 bar: bar2 5492 } 5493 ); 5494 } 5495 } 5496 5497 ================================================================================ 5498 TestObjectLiteralProtoSetterEdgeCasesMinifySyntax 5499 ---------- /out/import-computed.js ---------- 5500 import { __proto__, bar } from "foo"; 5501 function foo() { 5502 console.log( 5503 'this must not become "{ __proto__: ... }":', 5504 { 5505 ["__proto__"]: __proto__, 5506 bar 5507 } 5508 ); 5509 } 5510 5511 ---------- /out/import-normal.js ---------- 5512 import { __proto__, bar } from "foo"; 5513 function foo() { 5514 console.log( 5515 'this must not become "{ __proto__ }":', 5516 { 5517 __proto__: __proto__, 5518 bar 5519 } 5520 ); 5521 } 5522 5523 ---------- /out/local-computed.js ---------- 5524 function foo(__proto__, bar) { 5525 { 5526 let __proto__2, bar2; 5527 console.log( 5528 'this must not become "{ __proto__: ... }":', 5529 { 5530 ["__proto__"]: __proto__2, 5531 bar: bar2 5532 } 5533 ); 5534 } 5535 } 5536 5537 ---------- /out/local-normal.js ---------- 5538 function foo(__proto__, bar) { 5539 console.log( 5540 'this must not become "{ __proto__ }":', 5541 { 5542 __proto__: __proto__, 5543 bar 5544 } 5545 ); 5546 } 5547 5548 ================================================================================ 5549 TestOutbase 5550 ---------- /out/a/b/c.js ---------- 5551 // a/b/c.js 5552 console.log("c"); 5553 5554 ---------- /out/a/b/d.js ---------- 5555 // a/b/d.js 5556 console.log("d"); 5557 5558 ================================================================================ 5559 TestOutputExtensionRemappingDir 5560 ---------- /out/entry.notjs ---------- 5561 // entry.js 5562 console.log("test"); 5563 5564 ================================================================================ 5565 TestOutputExtensionRemappingFile 5566 ---------- /out.js ---------- 5567 // entry.js 5568 console.log("test"); 5569 5570 ================================================================================ 5571 TestOutputForAssertTypeJSON 5572 ---------- /out/foo-FYKHFNL2.copy ---------- 5573 {} 5574 ---------- /out/js-entry.js ---------- 5575 // foo.json 5576 var foo_default = {}; 5577 5578 // js-entry.js 5579 import copy from "./foo-FYKHFNL2.copy" assert { type: "json" }; 5580 use(foo_default, copy, foo_default, void 0); 5581 export { 5582 foo_default as default 5583 }; 5584 5585 ---------- /out/ts-entry.js ---------- 5586 // foo.json 5587 var foo_default = {}; 5588 5589 // ts-entry.ts 5590 import copy from "./foo-FYKHFNL2.copy" assert { type: "json" }; 5591 use(foo_default, copy, foo_default, void 0); 5592 export { 5593 foo_default as default 5594 }; 5595 5596 ================================================================================ 5597 TestPackageAlias 5598 ---------- /out.js ---------- 5599 // node_modules/alias1/index.js 5600 console.log(1); 5601 5602 // node_modules/alias2/foo.js 5603 console.log(2); 5604 5605 // node_modules/alias3/index.js 5606 console.log(3); 5607 5608 // node_modules/alias4/index.js 5609 console.log(4); 5610 5611 // node_modules/alias5/foo.js 5612 console.log(5); 5613 5614 // alias6/dir/index.js 5615 console.log(6); 5616 5617 // alias7/dir/foo/index.js 5618 console.log(7); 5619 5620 // alias8/dir/pkg8/index.js 5621 console.log(8); 5622 5623 // alias9/some/file.js 5624 console.log(9); 5625 5626 // node_modules/prefix-foo/index.js 5627 console.log(10); 5628 5629 // node_modules/@scope/prefix-foo/index.js 5630 console.log(11); 5631 5632 ================================================================================ 5633 TestPackageAliasMatchLongest 5634 ---------- /out.js ---------- 5635 // entry.js 5636 import "alias/pkg"; 5637 import "alias/pkg_foo"; 5638 import "alias/pkg_foo_bar"; 5639 import "alias/pkg_foo_bar/baz"; 5640 import "alias/pkg/bar/baz"; 5641 import "alias/pkg/baz"; 5642 5643 ================================================================================ 5644 TestPreserveKeyComment 5645 ---------- /out/entry.js ---------- 5646 x( 5647 /* __KEY__ */ 5648 "notKey", 5649 /* __KEY__ */ 5650 `notKey` 5651 ); 5652 x(/* @__KEY__ */ "key", /* @__KEY__ */ `key`); 5653 x(/* @__KEY__ */ "alsoKey", /* @__KEY__ */ `alsoKey`); 5654 5655 ================================================================================ 5656 TestQuotedProperty 5657 ---------- /out/entry.js ---------- 5658 // entry.js 5659 var ns = __toESM(require("ext")); 5660 console.log(ns.mustBeUnquoted, ns["mustBeQuoted"]); 5661 5662 ================================================================================ 5663 TestQuotedPropertyMangle 5664 ---------- /out/entry.js ---------- 5665 // entry.js 5666 var ns = __toESM(require("ext")); 5667 console.log(ns.mustBeUnquoted, ns.mustBeUnquoted2); 5668 5669 ================================================================================ 5670 TestReExportCommonJSAsES6 5671 ---------- /out.js ---------- 5672 // foo.js 5673 var require_foo = __commonJS({ 5674 "foo.js"(exports) { 5675 exports.bar = 123; 5676 } 5677 }); 5678 5679 // entry.js 5680 var import_foo = __toESM(require_foo()); 5681 var export_bar = import_foo.bar; 5682 export { 5683 export_bar as bar 5684 }; 5685 5686 ================================================================================ 5687 TestReExportDefaultExternalCommonJS 5688 ---------- /out.js ---------- 5689 // entry.js 5690 var entry_exports = {}; 5691 __export(entry_exports, { 5692 bar: () => import_bar.default, 5693 foo: () => import_foo.default 5694 }); 5695 module.exports = __toCommonJS(entry_exports); 5696 var import_foo = __toESM(require("foo")); 5697 5698 // bar.js 5699 var import_bar = __toESM(require("bar")); 5700 5701 ================================================================================ 5702 TestReExportDefaultExternalES6 5703 ---------- /out.js ---------- 5704 // entry.js 5705 import { default as default3 } from "foo"; 5706 5707 // bar.js 5708 import { default as default2 } from "bar"; 5709 export { 5710 default2 as bar, 5711 default3 as foo 5712 }; 5713 5714 ================================================================================ 5715 TestReExportDefaultInternal 5716 ---------- /out.js ---------- 5717 // foo.js 5718 var foo_default = "foo"; 5719 5720 // bar.js 5721 var bar_default = "bar"; 5722 export { 5723 bar_default as bar, 5724 foo_default as foo 5725 }; 5726 5727 ================================================================================ 5728 TestReExportDefaultNoBundle 5729 ---------- /out.js ---------- 5730 export { default as foo } from "./foo"; 5731 export { default as bar } from "./bar"; 5732 5733 ================================================================================ 5734 TestReExportDefaultNoBundleCommonJS 5735 ---------- /out.js ---------- 5736 var entry_exports = {}; 5737 __export(entry_exports, { 5738 bar: () => import_bar.default, 5739 foo: () => import_foo.default 5740 }); 5741 module.exports = __toCommonJS(entry_exports); 5742 var import_foo = __toESM(require("./foo")); 5743 var import_bar = __toESM(require("./bar")); 5744 5745 ================================================================================ 5746 TestReExportDefaultNoBundleES6 5747 ---------- /out.js ---------- 5748 import { default as default2 } from "./foo"; 5749 import { default as default3 } from "./bar"; 5750 export { 5751 default3 as bar, 5752 default2 as foo 5753 }; 5754 5755 ================================================================================ 5756 TestReExportFSNode 5757 ---------- /out.js ---------- 5758 // foo.js 5759 import * as fs from "fs"; 5760 import { readFileSync } from "fs"; 5761 export { 5762 fs as f, 5763 readFileSync as rfs 5764 }; 5765 5766 ================================================================================ 5767 TestRenameLabelsNoBundle 5768 ---------- /out.js ---------- 5769 foo: { 5770 bar: { 5771 if (x) break bar; 5772 break foo; 5773 } 5774 } 5775 foo2: { 5776 bar2: { 5777 if (x) break bar2; 5778 break foo2; 5779 } 5780 } 5781 foo: { 5782 bar: { 5783 if (x) break bar; 5784 break foo; 5785 } 5786 } 5787 5788 ================================================================================ 5789 TestRenamePrivateIdentifiersNoBundle 5790 ---------- /out.js ---------- 5791 class Foo { 5792 #foo; 5793 foo = class { 5794 #foo2; 5795 #foo22; 5796 #bar2; 5797 }; 5798 get #bar() { 5799 } 5800 set #bar(x) { 5801 } 5802 } 5803 class Bar { 5804 #foo; 5805 foo = class { 5806 #foo2; 5807 #foo3; 5808 #bar2; 5809 }; 5810 get #bar() { 5811 } 5812 set #bar(x) { 5813 } 5814 } 5815 5816 ================================================================================ 5817 TestRequireAndDynamicImportInvalidTemplate 5818 ---------- /out.js ---------- 5819 // require("./**/*") in entry.js 5820 var globRequire; 5821 var init_ = __esm({ 5822 'require("./**/*") in entry.js'() { 5823 globRequire = __glob({ 5824 "./entry.js": () => require_entry() 5825 }); 5826 } 5827 }); 5828 5829 // import("./**/*") in entry.js 5830 var globImport; 5831 var init_2 = __esm({ 5832 'import("./**/*") in entry.js'() { 5833 globImport = __glob({ 5834 "./entry.js": () => Promise.resolve().then(() => __toESM(require_entry())) 5835 }); 5836 } 5837 }); 5838 5839 // entry.js 5840 var require_entry = __commonJS({ 5841 "entry.js"() { 5842 init_(); 5843 init_2(); 5844 __require(tag`./b`); 5845 globRequire(`./${b}`); 5846 try { 5847 __require(tag`./b`); 5848 globRequire(`./${b}`); 5849 } catch { 5850 } 5851 (async () => { 5852 import(tag`./b`); 5853 globImport(`./${b}`); 5854 await import(tag`./b`); 5855 await globImport(`./${b}`); 5856 try { 5857 import(tag`./b`); 5858 globImport(`./${b}`); 5859 await import(tag`./b`); 5860 await globImport(`./${b}`); 5861 } catch { 5862 } 5863 })(); 5864 } 5865 }); 5866 export default require_entry(); 5867 5868 ================================================================================ 5869 TestRequireBadArgumentCount 5870 ---------- /out.js ---------- 5871 // entry.js 5872 __require(); 5873 __require("a", "b"); 5874 try { 5875 __require(); 5876 __require("a", "b"); 5877 } catch { 5878 } 5879 5880 ================================================================================ 5881 TestRequireChildDirCommonJS 5882 ---------- /out.js ---------- 5883 // Users/user/project/src/dir/index.js 5884 var require_dir = __commonJS({ 5885 "Users/user/project/src/dir/index.js"(exports, module) { 5886 module.exports = 123; 5887 } 5888 }); 5889 5890 // Users/user/project/src/entry.js 5891 console.log(require_dir()); 5892 5893 ================================================================================ 5894 TestRequireChildDirES6 5895 ---------- /out.js ---------- 5896 // Users/user/project/src/dir/index.js 5897 var dir_default = 123; 5898 5899 // Users/user/project/src/entry.js 5900 console.log(dir_default); 5901 5902 ================================================================================ 5903 TestRequireFSNode 5904 ---------- /out.js ---------- 5905 // entry.js 5906 return require("fs"); 5907 5908 ================================================================================ 5909 TestRequireFSNodeMinify 5910 ---------- /out.js ---------- 5911 return require("fs"); 5912 5913 ================================================================================ 5914 TestRequireJson 5915 ---------- /out.js ---------- 5916 // test.json 5917 var require_test = __commonJS({ 5918 "test.json"(exports, module) { 5919 module.exports = { 5920 a: true, 5921 b: 123, 5922 c: [null] 5923 }; 5924 } 5925 }); 5926 5927 // entry.js 5928 console.log(require_test()); 5929 5930 ================================================================================ 5931 TestRequireMainCacheCommonJS 5932 ---------- /out.js ---------- 5933 // is-main.js 5934 var require_is_main = __commonJS({ 5935 "is-main.js"(exports2, module2) { 5936 module2.exports = require.main === module2; 5937 } 5938 }); 5939 5940 // entry.js 5941 console.log("is main:", require.main === module); 5942 console.log(require_is_main()); 5943 console.log("cache:", require.cache); 5944 5945 ================================================================================ 5946 TestRequireParentDirCommonJS 5947 ---------- /out.js ---------- 5948 // Users/user/project/src/index.js 5949 var require_src = __commonJS({ 5950 "Users/user/project/src/index.js"(exports, module) { 5951 module.exports = 123; 5952 } 5953 }); 5954 5955 // Users/user/project/src/dir/entry.js 5956 console.log(require_src()); 5957 5958 ================================================================================ 5959 TestRequireParentDirES6 5960 ---------- /out.js ---------- 5961 // Users/user/project/src/index.js 5962 var src_default = 123; 5963 5964 // Users/user/project/src/dir/entry.js 5965 console.log(src_default); 5966 5967 ================================================================================ 5968 TestRequirePropertyAccessCommonJS 5969 ---------- /out.js ---------- 5970 // entry.js 5971 console.log(Object.keys(require.cache)); 5972 console.log(Object.keys(require.extensions)); 5973 delete require.cache["fs"]; 5974 delete require.extensions[".json"]; 5975 5976 ================================================================================ 5977 TestRequireResolve 5978 ---------- /out.js ---------- 5979 // entry.js 5980 console.log(require.resolve); 5981 console.log(require.resolve()); 5982 console.log(require.resolve(foo)); 5983 console.log(require.resolve("a", "b")); 5984 console.log(require.resolve("./present-file")); 5985 console.log(require.resolve("./missing-file")); 5986 console.log(require.resolve("./external-file")); 5987 console.log(require.resolve("missing-pkg")); 5988 console.log(require.resolve("external-pkg")); 5989 console.log(require.resolve("@scope/missing-pkg")); 5990 console.log(require.resolve("@scope/external-pkg")); 5991 try { 5992 console.log(require.resolve("inside-try")); 5993 } catch (e) { 5994 } 5995 if (false) { 5996 console.log(null); 5997 } 5998 console.log(false ? null : 0); 5999 console.log(true ? 0 : null); 6000 console.log(false); 6001 console.log(true); 6002 console.log(true); 6003 6004 ================================================================================ 6005 TestRequireShimSubstitution 6006 ---------- /out/entry.js ---------- 6007 // example.json 6008 var require_example = __commonJS({ 6009 "example.json"(exports, module) { 6010 module.exports = { works: true }; 6011 } 6012 }); 6013 6014 // entry.js 6015 console.log([ 6016 __require, 6017 typeof __require, 6018 require_example(), 6019 __require("./example.json", { type: "json" }), 6020 __require(window.SOME_PATH), 6021 require_example(), 6022 __require("./example.json", { type: "json" }), 6023 __require(window.SOME_PATH), 6024 __require.resolve("some-path"), 6025 __require.resolve(window.SOME_PATH), 6026 Promise.resolve().then(() => __toESM(__require("some-path"))), 6027 Promise.resolve().then(() => __toESM(__require(window.SOME_PATH))) 6028 ]); 6029 6030 ================================================================================ 6031 TestRequireTxt 6032 ---------- /out.js ---------- 6033 // test.txt 6034 var require_test = __commonJS({ 6035 "test.txt"(exports, module) { 6036 module.exports = "This is a test."; 6037 } 6038 }); 6039 6040 // entry.js 6041 console.log(require_test()); 6042 6043 ================================================================================ 6044 TestRequireWithCallInsideTry 6045 ---------- /out.js ---------- 6046 // entry.js 6047 var require_entry = __commonJS({ 6048 "entry.js"(exports) { 6049 try { 6050 const supportsColor = __require("supports-color"); 6051 if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { 6052 exports.colors = []; 6053 } 6054 } catch (error) { 6055 } 6056 } 6057 }); 6058 export default require_entry(); 6059 6060 ================================================================================ 6061 TestRequireWithTemplate 6062 ---------- /out.js ---------- 6063 // b.js 6064 var require_b = __commonJS({ 6065 "b.js"(exports) { 6066 exports.x = 123; 6067 } 6068 }); 6069 6070 // a.js 6071 console.log(require_b()); 6072 console.log(require_b()); 6073 6074 ================================================================================ 6075 TestRequireWithoutCall 6076 ---------- /out.js ---------- 6077 // entry.js 6078 var req = __require; 6079 req("./entry"); 6080 6081 ================================================================================ 6082 TestRequireWithoutCallInsideTry 6083 ---------- /out.js ---------- 6084 // entry.js 6085 try { 6086 oldLocale = globalLocale._abbr; 6087 aliasedRequire = __require; 6088 aliasedRequire("./locale/" + name); 6089 getSetGlobalLocale(oldLocale); 6090 } catch (e) { 6091 } 6092 var aliasedRequire; 6093 6094 ================================================================================ 6095 TestReserveProps 6096 ---------- /out.js ---------- 6097 export default { 6098 a: 0, 6099 _bar_: 1 6100 }; 6101 6102 ================================================================================ 6103 TestRuntimeNameCollisionNoBundle 6104 ---------- /out.js ---------- 6105 function __require() { 6106 return 123; 6107 } 6108 console.log(__require()); 6109 6110 ================================================================================ 6111 TestScopedExternalModuleExclusion 6112 ---------- /out.js ---------- 6113 // index.js 6114 import { Foo } from "@scope/foo"; 6115 import { Bar } from "@scope/foo/bar"; 6116 var foo = new Foo(); 6117 var bar = new Bar(); 6118 export { 6119 bar, 6120 foo 6121 }; 6122 6123 ================================================================================ 6124 TestSimpleCommonJS 6125 ---------- /out.js ---------- 6126 // foo.js 6127 var require_foo = __commonJS({ 6128 "foo.js"(exports, module) { 6129 module.exports = function() { 6130 return 123; 6131 }; 6132 } 6133 }); 6134 6135 // entry.js 6136 var fn = require_foo(); 6137 console.log(fn()); 6138 6139 ================================================================================ 6140 TestSimpleES6 6141 ---------- /out.js ---------- 6142 // foo.js 6143 function fn() { 6144 return 123; 6145 } 6146 6147 // entry.js 6148 console.log(fn()); 6149 6150 ================================================================================ 6151 TestSourceMap 6152 ---------- /Users/user/project/out.js.map ---------- 6153 { 6154 "version": 3, 6155 "sources": ["src/bar.js", "src/data.txt", "src/entry.js"], 6156 "sourcesContent": ["\n\t\t\t\texport function bar() { throw new Error('test') }\n\t\t\t", "#2041", "\n\t\t\t\timport {bar} from './bar'\n\t\t\t\timport data from './data.txt'\n\t\t\t\tfunction foo() { bar() }\n\t\t\t\tfoo()\n\t\t\t\tconsole.log(data)\n\t\t\t"], 6157 "mappings": ";AACW,SAAS,MAAM;AAAE,QAAM,IAAI,MAAM,MAAM;AAAE;;;ACDpD;;;ACGI,SAAS,MAAM;AAAE,MAAI;AAAE;AACvB,IAAI;AACJ,QAAQ,IAAI,YAAI;", 6158 "names": [] 6159 } 6160 6161 ---------- /Users/user/project/out.js ---------- 6162 // Users/user/project/src/bar.js 6163 function bar() { 6164 throw new Error("test"); 6165 } 6166 6167 // Users/user/project/src/data.txt 6168 var data_default = "#2041"; 6169 6170 // Users/user/project/src/entry.js 6171 function foo() { 6172 bar(); 6173 } 6174 foo(); 6175 console.log(data_default); 6176 //# sourceMappingURL=out.js.map 6177 6178 ================================================================================ 6179 TestStrictModeNestedFnDeclKeepNamesVariableInliningIssue1552 6180 ---------- /out/entry.js ---------- 6181 export function outer() { 6182 { 6183 let inner = function() { 6184 return Math.random(); 6185 }; 6186 __name(inner, "inner"); 6187 const x = inner(); 6188 console.log(x); 6189 } 6190 } 6191 __name(outer, "outer"), outer(); 6192 6193 ================================================================================ 6194 TestStringExportNamesCommonJS 6195 ---------- /out.js ---------- 6196 var entry_exports = {}; 6197 __export(entry_exports, { 6198 "all the stuff": () => all_the_stuff, 6199 "some export": () => import_foo["some import"] 6200 }); 6201 module.exports = __toCommonJS(entry_exports); 6202 var import_foo = require("./foo"); 6203 var all_the_stuff = __toESM(require("./foo")); 6204 6205 ================================================================================ 6206 TestStringExportNamesIIFE 6207 ---------- /out.js ---------- 6208 var global; 6209 (global ||= {}).name = (() => { 6210 var entry_exports = {}; 6211 __export(entry_exports, { 6212 "all the stuff": () => all_the_stuff, 6213 "some export": () => import_foo["some import"] 6214 }); 6215 var import_foo = require("./foo"); 6216 var all_the_stuff = __toESM(require("./foo")); 6217 return __toCommonJS(entry_exports); 6218 })(); 6219 6220 ================================================================================ 6221 TestSwitchScopeNoBundle 6222 ---------- /out.js ---------- 6223 switch (foo) { 6224 default: 6225 var foo; 6226 } 6227 switch (bar) { 6228 default: 6229 let a; 6230 } 6231 6232 ================================================================================ 6233 TestThisInsideFunction 6234 ---------- /out.js ---------- 6235 // entry.js 6236 function foo(x = this) { 6237 console.log(this); 6238 } 6239 var objFoo = { 6240 foo(x = this) { 6241 console.log(this); 6242 } 6243 }; 6244 var Foo = class { 6245 x = this; 6246 static y = this.z; 6247 foo(x = this) { 6248 console.log(this); 6249 } 6250 static bar(x = this) { 6251 console.log(this); 6252 } 6253 }; 6254 new Foo(foo(objFoo)); 6255 if (nested) { 6256 let bar = function(x = this) { 6257 console.log(this); 6258 }; 6259 bar2 = bar; 6260 const objBar = { 6261 foo(x = this) { 6262 console.log(this); 6263 } 6264 }; 6265 class Bar { 6266 x = this; 6267 static y = this.z; 6268 foo(x = this) { 6269 console.log(this); 6270 } 6271 static bar(x = this) { 6272 console.log(this); 6273 } 6274 } 6275 new Bar(bar(objBar)); 6276 } 6277 var bar2; 6278 6279 ================================================================================ 6280 TestThisOutsideFunction 6281 ---------- /out.js ---------- 6282 // entry.js 6283 var require_entry = __commonJS({ 6284 "entry.js"(exports) { 6285 if (shouldBeExportsNotThis) { 6286 console.log(exports); 6287 console.log((x = exports) => exports); 6288 console.log({ x: exports }); 6289 console.log(class extends exports.foo { 6290 }); 6291 console.log(class { 6292 [exports.foo]; 6293 }); 6294 console.log(class { 6295 [exports.foo]() { 6296 } 6297 }); 6298 console.log(class { 6299 static [exports.foo]; 6300 }); 6301 console.log(class { 6302 static [exports.foo]() { 6303 } 6304 }); 6305 } 6306 if (shouldBeThisNotExports) { 6307 console.log(class { 6308 foo = this; 6309 }); 6310 console.log(class { 6311 foo() { 6312 this; 6313 } 6314 }); 6315 console.log(class { 6316 static foo = this; 6317 }); 6318 console.log(class { 6319 static foo() { 6320 this; 6321 } 6322 }); 6323 } 6324 } 6325 }); 6326 export default require_entry(); 6327 6328 ================================================================================ 6329 TestThisUndefinedWarningESM 6330 ---------- /out/entry.js ---------- 6331 // file1.js 6332 var file1_default = [void 0, void 0]; 6333 6334 // node_modules/pkg/file2.js 6335 var file2_default = [void 0, void 0]; 6336 6337 // entry.js 6338 console.log(file1_default, file2_default); 6339 6340 ================================================================================ 6341 TestThisWithES6Syntax 6342 ---------- /out.js ---------- 6343 // cjs.js 6344 var require_cjs = __commonJS({ 6345 "cjs.js"(exports) { 6346 console.log(exports); 6347 } 6348 }); 6349 6350 // dummy.js 6351 var dummy_exports = {}; 6352 __export(dummy_exports, { 6353 dummy: () => dummy 6354 }); 6355 var dummy; 6356 var init_dummy = __esm({ 6357 "dummy.js"() { 6358 dummy = 123; 6359 } 6360 }); 6361 6362 // es6-import-stmt.js 6363 var require_es6_import_stmt = __commonJS({ 6364 "es6-import-stmt.js"(exports) { 6365 init_dummy(); 6366 console.log(exports); 6367 } 6368 }); 6369 6370 // es6-import-assign.ts 6371 var require_es6_import_assign = __commonJS({ 6372 "es6-import-assign.ts"(exports) { 6373 var x2 = (init_dummy(), __toCommonJS(dummy_exports)); 6374 console.log(exports); 6375 } 6376 }); 6377 6378 // es6-import-dynamic.js 6379 var require_es6_import_dynamic = __commonJS({ 6380 "es6-import-dynamic.js"(exports) { 6381 Promise.resolve().then(() => init_dummy()); 6382 console.log(exports); 6383 } 6384 }); 6385 6386 // es6-expr-import-dynamic.js 6387 var require_es6_expr_import_dynamic = __commonJS({ 6388 "es6-expr-import-dynamic.js"(exports) { 6389 Promise.resolve().then(() => init_dummy()); 6390 console.log(exports); 6391 } 6392 }); 6393 6394 // es6-export-assign.ts 6395 var require_es6_export_assign = __commonJS({ 6396 "es6-export-assign.ts"(exports, module) { 6397 console.log(exports); 6398 module.exports = 123; 6399 } 6400 }); 6401 6402 // es6-ns-export-variable.ts 6403 var require_es6_ns_export_variable = __commonJS({ 6404 "es6-ns-export-variable.ts"(exports) { 6405 var ns; 6406 ((ns2) => { 6407 ns2.foo = 123; 6408 })(ns || (ns = {})); 6409 console.log(exports); 6410 } 6411 }); 6412 6413 // es6-ns-export-function.ts 6414 var require_es6_ns_export_function = __commonJS({ 6415 "es6-ns-export-function.ts"(exports) { 6416 var ns; 6417 ((ns2) => { 6418 function foo() { 6419 } 6420 ns2.foo = foo; 6421 })(ns || (ns = {})); 6422 console.log(exports); 6423 } 6424 }); 6425 6426 // es6-ns-export-async-function.ts 6427 var require_es6_ns_export_async_function = __commonJS({ 6428 "es6-ns-export-async-function.ts"(exports) { 6429 var ns; 6430 ((ns2) => { 6431 async function foo() { 6432 } 6433 ns2.foo = foo; 6434 })(ns || (ns = {})); 6435 console.log(exports); 6436 } 6437 }); 6438 6439 // es6-ns-export-enum.ts 6440 var require_es6_ns_export_enum = __commonJS({ 6441 "es6-ns-export-enum.ts"(exports) { 6442 var ns; 6443 ((ns2) => { 6444 let Foo; 6445 ((Foo2) => { 6446 })(Foo = ns2.Foo || (ns2.Foo = {})); 6447 })(ns || (ns = {})); 6448 console.log(exports); 6449 } 6450 }); 6451 6452 // es6-ns-export-const-enum.ts 6453 var require_es6_ns_export_const_enum = __commonJS({ 6454 "es6-ns-export-const-enum.ts"(exports) { 6455 var ns; 6456 ((ns2) => { 6457 let Foo; 6458 ((Foo2) => { 6459 })(Foo = ns2.Foo || (ns2.Foo = {})); 6460 })(ns || (ns = {})); 6461 console.log(exports); 6462 } 6463 }); 6464 6465 // es6-ns-export-module.ts 6466 var require_es6_ns_export_module = __commonJS({ 6467 "es6-ns-export-module.ts"(exports) { 6468 console.log(exports); 6469 } 6470 }); 6471 6472 // es6-ns-export-namespace.ts 6473 var require_es6_ns_export_namespace = __commonJS({ 6474 "es6-ns-export-namespace.ts"(exports) { 6475 console.log(exports); 6476 } 6477 }); 6478 6479 // es6-ns-export-class.ts 6480 var require_es6_ns_export_class = __commonJS({ 6481 "es6-ns-export-class.ts"(exports) { 6482 var ns; 6483 ((ns2) => { 6484 class Foo { 6485 } 6486 ns2.Foo = Foo; 6487 })(ns || (ns = {})); 6488 console.log(exports); 6489 } 6490 }); 6491 6492 // es6-ns-export-abstract-class.ts 6493 var require_es6_ns_export_abstract_class = __commonJS({ 6494 "es6-ns-export-abstract-class.ts"(exports) { 6495 var ns; 6496 ((ns2) => { 6497 class Foo { 6498 } 6499 ns2.Foo = Foo; 6500 })(ns || (ns = {})); 6501 console.log(exports); 6502 } 6503 }); 6504 6505 // entry.js 6506 var import_cjs = __toESM(require_cjs()); 6507 var import_es6_import_stmt = __toESM(require_es6_import_stmt()); 6508 var import_es6_import_assign = __toESM(require_es6_import_assign()); 6509 var import_es6_import_dynamic = __toESM(require_es6_import_dynamic()); 6510 6511 // es6-import-meta.js 6512 console.log(void 0); 6513 6514 // entry.js 6515 var import_es6_expr_import_dynamic = __toESM(require_es6_expr_import_dynamic()); 6516 6517 // es6-expr-import-meta.js 6518 console.log(void 0); 6519 6520 // es6-export-variable.js 6521 console.log(void 0); 6522 6523 // es6-export-function.js 6524 console.log(void 0); 6525 6526 // es6-export-async-function.js 6527 console.log(void 0); 6528 6529 // es6-export-enum.ts 6530 console.log(void 0); 6531 6532 // es6-export-const-enum.ts 6533 console.log(void 0); 6534 6535 // es6-export-module.ts 6536 console.log(void 0); 6537 6538 // es6-export-namespace.ts 6539 console.log(void 0); 6540 6541 // es6-export-class.js 6542 console.log(void 0); 6543 6544 // es6-export-abstract-class.ts 6545 console.log(void 0); 6546 6547 // es6-export-default.js 6548 console.log(void 0); 6549 6550 // es6-export-clause.js 6551 console.log(void 0); 6552 6553 // es6-export-clause-from.js 6554 init_dummy(); 6555 console.log(void 0); 6556 6557 // es6-export-star.js 6558 init_dummy(); 6559 console.log(void 0); 6560 6561 // es6-export-star-as.js 6562 init_dummy(); 6563 console.log(void 0); 6564 6565 // entry.js 6566 var import_es6_export_assign = __toESM(require_es6_export_assign()); 6567 6568 // es6-export-import-assign.ts 6569 var x = (init_dummy(), __toCommonJS(dummy_exports)); 6570 console.log(void 0); 6571 6572 // entry.js 6573 var import_es6_ns_export_variable = __toESM(require_es6_ns_export_variable()); 6574 var import_es6_ns_export_function = __toESM(require_es6_ns_export_function()); 6575 var import_es6_ns_export_async_function = __toESM(require_es6_ns_export_async_function()); 6576 var import_es6_ns_export_enum = __toESM(require_es6_ns_export_enum()); 6577 var import_es6_ns_export_const_enum = __toESM(require_es6_ns_export_const_enum()); 6578 var import_es6_ns_export_module = __toESM(require_es6_ns_export_module()); 6579 var import_es6_ns_export_namespace = __toESM(require_es6_ns_export_namespace()); 6580 var import_es6_ns_export_class = __toESM(require_es6_ns_export_class()); 6581 var import_es6_ns_export_abstract_class = __toESM(require_es6_ns_export_abstract_class()); 6582 6583 ================================================================================ 6584 TestToESMWrapperOmission 6585 ---------- /out/entry.js ---------- 6586 var entry_exports = {}; 6587 module.exports = __toCommonJS(entry_exports); 6588 var import_a_nowrap = require("a_nowrap"); 6589 var import_b_nowrap = require("b_nowrap"); 6590 __reExport(entry_exports, require("c_nowrap"), module.exports); 6591 var d = __toESM(require("d_WRAP")); 6592 var import_e_WRAP = __toESM(require("e_WRAP")); 6593 var import_f_WRAP = __toESM(require("f_WRAP")); 6594 var import_g_WRAP = __toESM(require("g_WRAP")); 6595 var h = __toESM(require("h_WRAP")); 6596 var i = __toESM(require("i_WRAP")); 6597 var j = __toESM(require("j_WRAP")); 6598 (0, import_b_nowrap.b)(); 6599 x = d.x; 6600 (0, import_e_WRAP.default)(); 6601 (0, import_f_WRAP.default)(); 6602 (0, import_g_WRAP.__esModule)(); 6603 x = h; 6604 i.x(); 6605 j.x``; 6606 x = Promise.resolve().then(() => __toESM(require("k_WRAP"))); 6607 6608 ================================================================================ 6609 TestTopLevelAwaitAllowedImportWithSplitting 6610 ---------- /out/entry.js ---------- 6611 // entry.js 6612 import("./a-3BAWOBN3.js"); 6613 import("./b-2IGVSUS7.js"); 6614 import("./c-DMBKURS2.js"); 6615 require_entry(); 6616 await 0; 6617 6618 ---------- /out/c-DMBKURS2.js ---------- 6619 import "./chunk-GETF6B5C.js"; 6620 6621 ---------- /out/b-2IGVSUS7.js ---------- 6622 import "./chunk-QJYGFXJG.js"; 6623 import "./chunk-GETF6B5C.js"; 6624 6625 ---------- /out/a-3BAWOBN3.js ---------- 6626 import "./chunk-QJYGFXJG.js"; 6627 import "./chunk-GETF6B5C.js"; 6628 6629 ---------- /out/chunk-QJYGFXJG.js ---------- 6630 6631 ---------- /out/chunk-GETF6B5C.js ---------- 6632 // c.js 6633 await 0; 6634 6635 ================================================================================ 6636 TestTopLevelAwaitAllowedImportWithoutSplitting 6637 ---------- /out.js ---------- 6638 // c.js 6639 var c_exports = {}; 6640 var init_c = __esm({ 6641 async "c.js"() { 6642 await 0; 6643 } 6644 }); 6645 6646 // b.js 6647 var b_exports = {}; 6648 var init_b = __esm({ 6649 async "b.js"() { 6650 await init_c(); 6651 } 6652 }); 6653 6654 // a.js 6655 var a_exports = {}; 6656 var init_a = __esm({ 6657 async "a.js"() { 6658 await init_b(); 6659 } 6660 }); 6661 6662 // entry.js 6663 var entry_exports = {}; 6664 var init_entry = __esm({ 6665 async "entry.js"() { 6666 init_a(); 6667 init_b(); 6668 init_c(); 6669 init_entry(); 6670 await 0; 6671 } 6672 }); 6673 await init_entry(); 6674 6675 ================================================================================ 6676 TestTopLevelAwaitCJSDeadBranch 6677 ---------- /out.js ---------- 6678 // entry.js 6679 if (false) foo; 6680 if (false) for (foo of bar) ; 6681 6682 ================================================================================ 6683 TestTopLevelAwaitESM 6684 ---------- /out.js ---------- 6685 // entry.js 6686 await foo; 6687 for await (foo of bar) ; 6688 6689 ================================================================================ 6690 TestTopLevelAwaitESMDeadBranch 6691 ---------- /out.js ---------- 6692 // entry.js 6693 if (false) await foo; 6694 if (false) for await (foo of bar) ; 6695 6696 ================================================================================ 6697 TestTopLevelAwaitForbiddenRequireDeadBranch 6698 ---------- /out.js ---------- 6699 (() => { 6700 // c.js 6701 var c_exports = {}; 6702 var init_c = __esm({ 6703 "c.js"() { 6704 if (false) for (let x of y) ; 6705 } 6706 }); 6707 6708 // b.js 6709 var b_exports = {}; 6710 var init_b = __esm({ 6711 "b.js"() { 6712 init_c(); 6713 } 6714 }); 6715 6716 // a.js 6717 var a_exports = {}; 6718 var init_a = __esm({ 6719 "a.js"() { 6720 init_b(); 6721 } 6722 }); 6723 6724 // entry.js 6725 var entry_exports = {}; 6726 var init_entry = __esm({ 6727 "entry.js"() { 6728 init_a(); 6729 init_b(); 6730 init_c(); 6731 init_entry(); 6732 if (false) for (let x of y) ; 6733 } 6734 }); 6735 init_entry(); 6736 })(); 6737 6738 ================================================================================ 6739 TestTopLevelAwaitIIFEDeadBranch 6740 ---------- /out.js ---------- 6741 (() => { 6742 // entry.js 6743 if (false) foo; 6744 if (false) for (foo of bar) ; 6745 })(); 6746 6747 ================================================================================ 6748 TestTopLevelAwaitNoBundle 6749 ---------- /out.js ---------- 6750 await foo; 6751 for await (foo of bar) ; 6752 6753 ================================================================================ 6754 TestTopLevelAwaitNoBundleCommonJSDeadBranch 6755 ---------- /out.js ---------- 6756 if (false) foo; 6757 if (false) for (foo of bar) ; 6758 6759 ================================================================================ 6760 TestTopLevelAwaitNoBundleDeadBranch 6761 ---------- /out.js ---------- 6762 if (false) await foo; 6763 if (false) for await (foo of bar) ; 6764 6765 ================================================================================ 6766 TestTopLevelAwaitNoBundleESM 6767 ---------- /out.js ---------- 6768 await foo; 6769 for await (foo of bar) ; 6770 6771 ================================================================================ 6772 TestTopLevelAwaitNoBundleESMDeadBranch 6773 ---------- /out.js ---------- 6774 if (false) await foo; 6775 if (false) for await (foo of bar) ; 6776 6777 ================================================================================ 6778 TestTopLevelAwaitNoBundleIIFEDeadBranch 6779 ---------- /out.js ---------- 6780 (() => { 6781 if (false) foo; 6782 if (false) for (foo of bar) ; 6783 })(); 6784 6785 ================================================================================ 6786 TestUseStrictDirectiveBundleCJSIssue2264 6787 ---------- /out.js ---------- 6788 "use strict"; 6789 6790 // entry.js 6791 var entry_exports = {}; 6792 __export(entry_exports, { 6793 a: () => a 6794 }); 6795 module.exports = __toCommonJS(entry_exports); 6796 var a = 1; 6797 6798 ================================================================================ 6799 TestUseStrictDirectiveBundleESMIssue2264 6800 ---------- /out.js ---------- 6801 // entry.js 6802 var a = 1; 6803 export { 6804 a 6805 }; 6806 6807 ================================================================================ 6808 TestUseStrictDirectiveBundleIIFEIssue2264 6809 ---------- /out.js ---------- 6810 "use strict"; 6811 (() => { 6812 // entry.js 6813 var a = 1; 6814 })(); 6815 6816 ================================================================================ 6817 TestUseStrictDirectiveBundleIssue1837 6818 ---------- /out.js ---------- 6819 (() => { 6820 // shims.js 6821 var import_process; 6822 var init_shims = __esm({ 6823 "shims.js"() { 6824 import_process = __toESM(__require("process")); 6825 } 6826 }); 6827 6828 // cjs.js 6829 var require_cjs = __commonJS({ 6830 "cjs.js"(exports) { 6831 "use strict"; 6832 init_shims(); 6833 exports.foo = import_process.default; 6834 } 6835 }); 6836 6837 // entry.js 6838 init_shims(); 6839 console.log(require_cjs()); 6840 })(); 6841 6842 ================================================================================ 6843 TestUseStrictDirectiveMinifyNoBundle 6844 ---------- /out.js ---------- 6845 "use strict";"use loose";a,b; 6846 6847 ================================================================================ 6848 TestVarRelocatingBundle 6849 ---------- /out/top-level.js ---------- 6850 // top-level.js 6851 for (; 0; ) ; 6852 var b; 6853 for ({ c, x: [d] } = {}; 0; ) ; 6854 var c; 6855 var d; 6856 for (e of []) ; 6857 var e; 6858 for ({ f, x: [g] } of []) ; 6859 var f; 6860 var g; 6861 for (h in {}) ; 6862 var h; 6863 i = 1; 6864 for (i in {}) ; 6865 var i; 6866 for ({ j, x: [k] } in {}) ; 6867 var j; 6868 var k; 6869 6870 ---------- /out/nested.js ---------- 6871 // nested.js 6872 if (true) { 6873 let l = function() { 6874 }; 6875 l2 = l; 6876 for (; 0; ) ; 6877 for ({ c, x: [d] } = {}; 0; ) ; 6878 for (e of []) ; 6879 for ({ f, x: [g] } of []) ; 6880 for (h in {}) ; 6881 i = 1; 6882 for (i in {}) ; 6883 for ({ j, x: [k] } in {}) ; 6884 } 6885 var a; 6886 var b; 6887 var c; 6888 var d; 6889 var e; 6890 var f; 6891 var g; 6892 var h; 6893 var i; 6894 var j; 6895 var k; 6896 var l2; 6897 6898 ---------- /out/let.js ---------- 6899 // let.js 6900 if (true) { 6901 let a; 6902 for (let b; 0; ) ; 6903 for (let { c, x: [d] } = {}; 0; ) ; 6904 for (let e of []) ; 6905 for (let { f, x: [g] } of []) ; 6906 for (let h in {}) ; 6907 for (let { j, x: [k] } in {}) ; 6908 } 6909 6910 ---------- /out/function.js ---------- 6911 // function.js 6912 function x() { 6913 var a; 6914 for (var b; 0; ) ; 6915 for (var { c, x: [d] } = {}; 0; ) ; 6916 for (var e of []) ; 6917 for (var { f, x: [g] } of []) ; 6918 for (var h in {}) ; 6919 i = 1; 6920 for (var i in {}) ; 6921 for (var { j, x: [k] } in {}) ; 6922 function l() { 6923 } 6924 } 6925 x(); 6926 6927 ---------- /out/function-nested.js ---------- 6928 // function-nested.js 6929 function x() { 6930 if (true) { 6931 let l2 = function() { 6932 }; 6933 var l = l2; 6934 var a; 6935 for (var b; 0; ) ; 6936 for (var { c, x: [d] } = {}; 0; ) ; 6937 for (var e of []) ; 6938 for (var { f, x: [g] } of []) ; 6939 for (var h in {}) ; 6940 i = 1; 6941 for (var i in {}) ; 6942 for (var { j, x: [k] } in {}) ; 6943 } 6944 } 6945 x(); 6946 6947 ================================================================================ 6948 TestVarRelocatingNoBundle 6949 ---------- /out/top-level.js ---------- 6950 var a; 6951 for (var b; 0; ) ; 6952 for (var { c, x: [d] } = {}; 0; ) ; 6953 for (var e of []) ; 6954 for (var { f, x: [g] } of []) ; 6955 for (var h in {}) ; 6956 i = 1; 6957 for (var i in {}) ; 6958 for (var { j, x: [k] } in {}) ; 6959 function l() { 6960 } 6961 6962 ---------- /out/nested.js ---------- 6963 if (true) { 6964 let l = function() { 6965 }; 6966 var l2 = l; 6967 var a; 6968 for (var b; 0; ) ; 6969 for (var { c, x: [d] } = {}; 0; ) ; 6970 for (var e of []) ; 6971 for (var { f, x: [g] } of []) ; 6972 for (var h in {}) ; 6973 i = 1; 6974 for (var i in {}) ; 6975 for (var { j, x: [k] } in {}) ; 6976 } 6977 6978 ---------- /out/let.js ---------- 6979 if (true) { 6980 let a; 6981 for (let b; 0; ) ; 6982 for (let { c, x: [d] } = {}; 0; ) ; 6983 for (let e of []) ; 6984 for (let { f, x: [g] } of []) ; 6985 for (let h in {}) ; 6986 for (let { j, x: [k] } in {}) ; 6987 } 6988 6989 ---------- /out/function.js ---------- 6990 function x() { 6991 var a; 6992 for (var b; 0; ) ; 6993 for (var { c, x: [d] } = {}; 0; ) ; 6994 for (var e of []) ; 6995 for (var { f, x: [g] } of []) ; 6996 for (var h in {}) ; 6997 i = 1; 6998 for (var i in {}) ; 6999 for (var { j, x: [k] } in {}) ; 7000 function l() { 7001 } 7002 } 7003 x(); 7004 7005 ---------- /out/function-nested.js ---------- 7006 function x() { 7007 if (true) { 7008 let l2 = function() { 7009 }; 7010 var l = l2; 7011 var a; 7012 for (var b; 0; ) ; 7013 for (var { c, x: [d] } = {}; 0; ) ; 7014 for (var e of []) ; 7015 for (var { f, x: [g] } of []) ; 7016 for (var h in {}) ; 7017 i = 1; 7018 for (var i in {}) ; 7019 for (var { j, x: [k] } in {}) ; 7020 } 7021 } 7022 x(); 7023 7024 ================================================================================ 7025 TestWarnCommonJSExportsInESMBundle 7026 ---------- /out/cjs-in-esm.js ---------- 7027 // cjs-in-esm.js 7028 var cjs_in_esm_exports = {}; 7029 __export(cjs_in_esm_exports, { 7030 foo: () => foo 7031 }); 7032 module.exports = __toCommonJS(cjs_in_esm_exports); 7033 var foo = 1; 7034 exports.foo = 2; 7035 module.exports = 3; 7036 7037 ---------- /out/import-in-cjs.js ---------- 7038 // import-in-cjs.js 7039 var import_bar = require("bar"); 7040 exports.foo = import_bar.foo; 7041 module.exports = import_bar.foo; 7042 7043 ---------- /out/no-warnings-here.js ---------- 7044 // no-warnings-here.js 7045 console.log(module, exports); 7046 7047 ================================================================================ 7048 TestWarnCommonJSExportsInESMConvert 7049 ---------- /out/cjs-in-esm.js ---------- 7050 var cjs_in_esm_exports = {}; 7051 __export(cjs_in_esm_exports, { 7052 foo: () => foo 7053 }); 7054 module.exports = __toCommonJS(cjs_in_esm_exports); 7055 let foo = 1; 7056 exports.foo = 2; 7057 module.exports = 3; 7058 7059 ---------- /out/cjs-in-esm2.js ---------- 7060 var cjs_in_esm2_exports = {}; 7061 __export(cjs_in_esm2_exports, { 7062 foo: () => foo 7063 }); 7064 module.exports = __toCommonJS(cjs_in_esm2_exports); 7065 let foo = 1; 7066 module.exports.bar = 3; 7067 7068 ---------- /out/import-in-cjs.js ---------- 7069 var import_bar = require("bar"); 7070 exports.foo = import_bar.foo; 7071 module.exports = import_bar.foo; 7072 module.exports.bar = import_bar.foo; 7073 7074 ---------- /out/no-warnings-here.js ---------- 7075 console.log(module, exports); 7076 7077 ================================================================================ 7078 TestWarningsInsideNodeModules 7079 ---------- /out.js ---------- 7080 // return-asi.js 7081 var require_return_asi = __commonJS({ 7082 "return-asi.js"() { 7083 return; 7084 } 7085 }); 7086 7087 // node_modules/return-asi.js 7088 var require_return_asi2 = __commonJS({ 7089 "node_modules/return-asi.js"() { 7090 return; 7091 } 7092 }); 7093 7094 // plugin-dir/node_modules/return-asi.js 7095 var require_return_asi3 = __commonJS({ 7096 "plugin-dir/node_modules/return-asi.js"() { 7097 return; 7098 } 7099 }); 7100 7101 // dup-case.js 7102 switch (x) { 7103 case 0: 7104 case 0: 7105 } 7106 7107 // node_modules/dup-case.js 7108 switch (x) { 7109 case 0: 7110 case 0: 7111 } 7112 7113 // plugin-dir/node_modules/dup-case.js 7114 switch (x) { 7115 case 0: 7116 case 0: 7117 } 7118 7119 // not-in.js 7120 !a in b; 7121 7122 // node_modules/not-in.js 7123 !a in b; 7124 7125 // plugin-dir/node_modules/not-in.js 7126 !a in b; 7127 7128 // not-instanceof.js 7129 !a instanceof b; 7130 7131 // node_modules/not-instanceof.js 7132 !a instanceof b; 7133 7134 // plugin-dir/node_modules/not-instanceof.js 7135 !a instanceof b; 7136 7137 // entry.js 7138 var import_return_asi = __toESM(require_return_asi()); 7139 var import_return_asi2 = __toESM(require_return_asi2()); 7140 var import_return_asi3 = __toESM(require_return_asi3()); 7141 7142 // equals-neg-zero.js 7143 x === -0; 7144 7145 // node_modules/equals-neg-zero.js 7146 x === -0; 7147 7148 // plugin-dir/node_modules/equals-neg-zero.js 7149 x === -0; 7150 7151 // equals-nan.js 7152 x === NaN; 7153 7154 // node_modules/equals-nan.js 7155 x === NaN; 7156 7157 // plugin-dir/node_modules/equals-nan.js 7158 x === NaN; 7159 7160 // equals-object.js 7161 x === []; 7162 7163 // node_modules/equals-object.js 7164 x === []; 7165 7166 // plugin-dir/node_modules/equals-object.js 7167 x === []; 7168 7169 // delete-super.js 7170 var Foo = class extends Bar { 7171 foo() { 7172 delete super.foo; 7173 } 7174 }; 7175 7176 // node_modules/delete-super.js 7177 var Foo2 = class extends Bar { 7178 foo() { 7179 delete super.foo; 7180 } 7181 }; 7182 7183 // plugin-dir/node_modules/delete-super.js 7184 var Foo3 = class extends Bar { 7185 foo() { 7186 delete super.foo; 7187 } 7188 }; 7189 7190 ================================================================================ 7191 TestWithStatementTaintingNoBundle 7192 ---------- /out.js ---------- 7193 (() => { 7194 let e = 1; 7195 let outer = 2; 7196 let outerDead = 3; 7197 with ({}) { 7198 var hoisted = 4; 7199 let t = 5; 7200 hoisted++; 7201 t++; 7202 if (1) outer++; 7203 if (0) outerDead++; 7204 } 7205 if (1) { 7206 hoisted++; 7207 e++; 7208 outer++; 7209 outerDead++; 7210 } 7211 })();