diff --git a/internal/bundler/bundler_css_test.go b/internal/bundler/bundler_css_test.go index 14fb5be2146..74e86a6deb5 100644 --- a/internal/bundler/bundler_css_test.go +++ b/internal/bundler/bundler_css_test.go @@ -39,7 +39,7 @@ func TestCSSAtImportMissing(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.css", }, - expectedScanLog: `/entry.css: error: Could not resolve "./missing.css" + expectedScanLog: `entry.css: error: Could not resolve "./missing.css" `, }) } @@ -124,7 +124,7 @@ func TestCSSFromJSMissingImport(t *testing.T) { Mode: config.ModeBundle, AbsOutputDir: "/out", }, - expectedCompileLog: `/entry.js: error: No matching export for import "missing" + expectedCompileLog: `entry.js: error: No matching export for import "missing" `, }) } @@ -145,7 +145,7 @@ func TestCSSFromJSMissingStarImport(t *testing.T) { Mode: config.ModeBundle, AbsOutputDir: "/out", }, - expectedCompileLog: `/entry.js: warning: No matching export for import "missing" + expectedCompileLog: `entry.js: warning: No matching export for import "missing" `, }) } @@ -195,7 +195,7 @@ func TestImportCSSFromJSWriteToStdout(t *testing.T) { Mode: config.ModeBundle, WriteToStdout: true, }, - expectedScanLog: `/entry.js: error: Cannot import "/entry.css" into a JavaScript file without an output path configured + expectedScanLog: `entry.js: error: Cannot import "entry.css" into a JavaScript file without an output path configured `, }) } @@ -215,7 +215,7 @@ func TestImportJSFromCSS(t *testing.T) { Mode: config.ModeBundle, AbsOutputDir: "/out", }, - expectedScanLog: `/entry.css: error: Cannot import "/entry.js" into a CSS file + expectedScanLog: `entry.css: error: Cannot import "entry.js" into a CSS file `, }) } @@ -235,7 +235,7 @@ func TestImportJSONFromCSS(t *testing.T) { Mode: config.ModeBundle, AbsOutputDir: "/out", }, - expectedScanLog: `/entry.css: error: Cannot import "/entry.json" into a CSS file + expectedScanLog: `entry.css: error: Cannot import "entry.json" into a CSS file `, }) } @@ -253,8 +253,8 @@ func TestMissingImportURLInCSS(t *testing.T) { Mode: config.ModeBundle, AbsOutputDir: "/out", }, - expectedScanLog: `/src/entry.css: error: Could not resolve "./one.png" -/src/entry.css: error: Could not resolve "./two.png" + expectedScanLog: `src/entry.css: error: Could not resolve "./one.png" +src/entry.css: error: Could not resolve "./two.png" `, }) } @@ -314,12 +314,12 @@ func TestInvalidImportURLInCSS(t *testing.T) { Mode: config.ModeBundle, AbsOutputDir: "/out", }, - expectedScanLog: `/entry.css: error: Cannot use "/js.js" as a URL -/entry.css: error: Cannot use "/jsx.jsx" as a URL -/entry.css: error: Cannot use "/ts.ts" as a URL -/entry.css: error: Cannot use "/tsx.tsx" as a URL -/entry.css: error: Cannot use "/json.json" as a URL -/entry.css: error: Cannot use "/css.css" as a URL + expectedScanLog: `entry.css: error: Cannot use "js.js" as a URL +entry.css: error: Cannot use "jsx.jsx" as a URL +entry.css: error: Cannot use "ts.ts" as a URL +entry.css: error: Cannot use "tsx.tsx" as a URL +entry.css: error: Cannot use "json.json" as a URL +entry.css: error: Cannot use "css.css" as a URL `, }) } @@ -517,7 +517,7 @@ func TestCSSAtImportExtensionOrderCollisionUnsupported(t *testing.T) { ".css": config.LoaderCSS, }, }, - expectedScanLog: `/entry.css: error: File could not be loaded: /test.sass + expectedScanLog: `entry.css: error: File could not be loaded: test.sass `, }) } diff --git a/internal/bundler/bundler_dce_test.go b/internal/bundler/bundler_dce_test.go index 103bfdc145d..cf805b26e8d 100644 --- a/internal/bundler/bundler_dce_test.go +++ b/internal/bundler/bundler_dce_test.go @@ -183,9 +183,9 @@ func TestPackageJsonSideEffectsFalseKeepBareImportAndRequireES6(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/Users/user/project/src/entry.js: warning: Ignoring this import because "` + - `/Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects -/Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` + + expectedScanLog: `Users/user/project/src/entry.js: warning: Ignoring this import because "` + + `Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects +Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` + `in the enclosing "package.json" file `, }) @@ -214,9 +214,9 @@ func TestPackageJsonSideEffectsFalseKeepBareImportAndRequireCommonJS(t *testing. Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/Users/user/project/src/entry.js: warning: Ignoring this import because "` + - `/Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects -/Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` + + expectedScanLog: `Users/user/project/src/entry.js: warning: Ignoring this import because "` + + `Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects +Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` + `in the enclosing "package.json" file `, }) @@ -244,9 +244,9 @@ func TestPackageJsonSideEffectsFalseRemoveBareImportES6(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/Users/user/project/src/entry.js: warning: Ignoring this import because "` + - `/Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects -/Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` + + expectedScanLog: `Users/user/project/src/entry.js: warning: Ignoring this import because "` + + `Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects +Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` + `in the enclosing "package.json" file `, }) @@ -274,9 +274,9 @@ func TestPackageJsonSideEffectsFalseRemoveBareImportCommonJS(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/Users/user/project/src/entry.js: warning: Ignoring this import because "` + - `/Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects -/Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` + + expectedScanLog: `Users/user/project/src/entry.js: warning: Ignoring this import because "` + + `Users/user/project/node_modules/demo-pkg/index.js" was marked as having no side effects +Users/user/project/node_modules/demo-pkg/package.json: note: "sideEffects" is false ` + `in the enclosing "package.json" file `, }) @@ -722,9 +722,9 @@ func TestPackageJsonSideEffectsArrayGlob(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/Users/user/project/src/entry.js: warning: Ignoring this import because ` + - `"/Users/user/project/node_modules/demo-pkg/remove/this/file.js" was marked as having no side effects -/Users/user/project/node_modules/demo-pkg/package.json: note: It was excluded from the "sideEffects" ` + + expectedScanLog: `Users/user/project/src/entry.js: warning: Ignoring this import because ` + + `"Users/user/project/node_modules/demo-pkg/remove/this/file.js" was marked as having no side effects +Users/user/project/node_modules/demo-pkg/package.json: note: It was excluded from the "sideEffects" ` + `array in the enclosing "package.json" file `, }) diff --git a/internal/bundler/bundler_default_test.go b/internal/bundler/bundler_default_test.go index 5986d85f16b..ca714e72656 100644 --- a/internal/bundler/bundler_default_test.go +++ b/internal/bundler/bundler_default_test.go @@ -421,10 +421,10 @@ func TestExportInfiniteCycle1(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: `/entry.js: error: Detected cycle while resolving import "a" -/entry.js: error: Detected cycle while resolving import "b" -/entry.js: error: Detected cycle while resolving import "c" -/entry.js: error: Detected cycle while resolving import "d" + expectedCompileLog: `entry.js: error: Detected cycle while resolving import "a" +entry.js: error: Detected cycle while resolving import "b" +entry.js: error: Detected cycle while resolving import "c" +entry.js: error: Detected cycle while resolving import "d" `, }) } @@ -446,10 +446,10 @@ func TestExportInfiniteCycle2(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: `/entry.js: error: Detected cycle while resolving import "a" -/entry.js: error: Detected cycle while resolving import "c" -/foo.js: error: Detected cycle while resolving import "b" -/foo.js: error: Detected cycle while resolving import "d" + expectedCompileLog: `entry.js: error: Detected cycle while resolving import "a" +entry.js: error: Detected cycle while resolving import "c" +foo.js: error: Detected cycle while resolving import "b" +foo.js: error: Detected cycle while resolving import "d" `, }) } @@ -513,7 +513,7 @@ func TestJSXSyntaxInJS(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.js: error: Unexpected "<" + expectedScanLog: `entry.js: error: Unexpected "<" `, }) } @@ -629,8 +629,8 @@ func TestImportMissingES6(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: `/entry.js: error: No matching export for import "default" -/entry.js: error: No matching export for import "y" + expectedCompileLog: `entry.js: error: No matching export for import "default" +entry.js: error: No matching export for import "y" `, }) } @@ -650,8 +650,8 @@ func TestImportMissingUnusedES6(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: `/entry.js: error: No matching export for import "default" -/entry.js: error: No matching export for import "y" + expectedCompileLog: `entry.js: error: No matching export for import "default" +entry.js: error: No matching export for import "y" `, }) } @@ -715,12 +715,12 @@ func TestImportMissingNeitherES6NorCommonJS(t *testing.T) { Mode: config.ModeBundle, AbsOutputDir: "/out", }, - expectedCompileLog: `/named.js: warning: Import "default" will always be undefined -/named.js: warning: Import "x" will always be undefined -/named.js: warning: Import "y" will always be undefined -/star.js: warning: Import "default" will always be undefined -/star.js: warning: Import "x" will always be undefined -/star.js: warning: Import "y" will always be undefined + expectedCompileLog: `named.js: warning: Import "default" will always be undefined +named.js: warning: Import "x" will always be undefined +named.js: warning: Import "y" will always be undefined +star.js: warning: Import "default" will always be undefined +star.js: warning: Import "x" will always be undefined +star.js: warning: Import "y" will always be undefined `, }) } @@ -744,7 +744,7 @@ func TestExportMissingES6(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: `/foo.js: error: No matching export for import "nope" + expectedCompileLog: `foo.js: error: No matching export for import "nope" `, }) } @@ -843,14 +843,14 @@ func TestRequireAndDynamicImportInvalidTemplate(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.js: warning: This call to "require" will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning) -/entry.js: warning: This call to "require" will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning) -/entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal -/entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal -/entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning) -/entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning) -/entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal -/entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal + expectedScanLog: `entry.js: warning: This call to "require" will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning) +entry.js: warning: This call to "require" will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning) +entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal +entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal +entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning) +entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning) +entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal +entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal `, }) } @@ -972,7 +972,7 @@ func TestConditionalRequire(t *testing.T) { }, }, }, - expectedScanLog: `/a.js: warning: This call to "require" will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning) + expectedScanLog: `a.js: warning: This call to "require" will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning) `, }) } @@ -999,7 +999,7 @@ func TestConditionalImport(t *testing.T) { }, }, }, - expectedScanLog: `/a.js: warning: This dynamic import will not be bundled because the argument is not a string literal + expectedScanLog: `a.js: warning: This dynamic import will not be bundled because the argument is not a string literal `, }) } @@ -1024,8 +1024,8 @@ func TestRequireBadArgumentCount(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.js: warning: This call to "require" will not be bundled because it has 0 arguments (surround with a try/catch to silence this warning) -/entry.js: warning: This call to "require" will not be bundled because it has 2 arguments (surround with a try/catch to silence this warning) + expectedScanLog: `entry.js: warning: This call to "require" will not be bundled because it has 0 arguments (surround with a try/catch to silence this warning) +entry.js: warning: This call to "require" will not be bundled because it has 2 arguments (surround with a try/catch to silence this warning) `, }) } @@ -1081,7 +1081,7 @@ func TestRequireBadExtension(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.js: error: File could not be loaded: /test + expectedScanLog: `entry.js: error: File could not be loaded: test `, }) } @@ -1115,7 +1115,7 @@ func TestRequireWithoutCall(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) + expectedScanLog: `entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) `, }) } @@ -1135,7 +1135,7 @@ func TestNestedRequireWithoutCall(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) + expectedScanLog: `entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) `, }) } @@ -1223,7 +1223,7 @@ func TestImportInsideTry(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal + expectedScanLog: `entry.js: warning: This dynamic import will not be bundled because the argument is not a string literal `, }) } @@ -1375,14 +1375,14 @@ func TestTypeofRequireBadPatterns(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) -/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) -/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) -/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) -/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) -/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) -/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) -/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) + expectedScanLog: `entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) +entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) +entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) +entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) +entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) +entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) +entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) +entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) `, }) } @@ -1400,7 +1400,7 @@ func TestRequireFSBrowser(t *testing.T) { AbsOutputFile: "/out.js", Platform: config.PlatformBrowser, }, - expectedScanLog: `/entry.js: error: Could not resolve "fs" (set platform to "node" when building for node) + expectedScanLog: `entry.js: error: Could not resolve "fs" (set platform to "node" when building for node) `, }) } @@ -1457,7 +1457,7 @@ func TestImportFSBrowser(t *testing.T) { AbsOutputFile: "/out.js", Platform: config.PlatformBrowser, }, - expectedScanLog: `/entry.js: error: Could not resolve "fs" (set platform to "node" when building for node) + expectedScanLog: `entry.js: error: Could not resolve "fs" (set platform to "node" when building for node) `, }) } @@ -1518,7 +1518,7 @@ func TestExportFSBrowser(t *testing.T) { AbsOutputFile: "/out.js", Platform: config.PlatformBrowser, }, - expectedScanLog: `/entry.js: error: Could not resolve "fs" (set platform to "node" when building for node) + expectedScanLog: `entry.js: error: Could not resolve "fs" (set platform to "node" when building for node) `, }) } @@ -2137,12 +2137,12 @@ func TestExternalModuleExclusionScopedPackage(t *testing.T) { }, }, }, - expectedScanLog: `/index.js: error: Could not resolve "@a1-a2" (mark it as external to exclude it from the bundle) -/index.js: error: Could not resolve "@b1" (mark it as external to exclude it from the bundle) -/index.js: error: Could not resolve "@b1/b2-b3" (mark it as external to exclude it from the bundle) -/index.js: error: Could not resolve "@c1" (mark it as external to exclude it from the bundle) -/index.js: error: Could not resolve "@c1/c2" (mark it as external to exclude it from the bundle) -/index.js: error: Could not resolve "@c1/c2/c3-c4" (mark it as external to exclude it from the bundle) + expectedScanLog: `index.js: error: Could not resolve "@a1-a2" (mark it as external to exclude it from the bundle) +index.js: error: Could not resolve "@b1" (mark it as external to exclude it from the bundle) +index.js: error: Could not resolve "@b1/b2-b3" (mark it as external to exclude it from the bundle) +index.js: error: Could not resolve "@c1" (mark it as external to exclude it from the bundle) +index.js: error: Could not resolve "@c1/c2" (mark it as external to exclude it from the bundle) +index.js: error: Could not resolve "@c1/c2/c3-c4" (mark it as external to exclude it from the bundle) `, }) } @@ -2247,9 +2247,9 @@ func TestExternalWithWildcard(t *testing.T) { }, }, }, - expectedScanLog: `/entry.js: error: Could not read from file: /sassets/images/test.jpg -/entry.js: error: Could not read from file: /dir/file.gif -/entry.js: error: Could not resolve "./file.ping" + expectedScanLog: `entry.js: error: Could not read from file: /sassets/images/test.jpg +entry.js: error: Could not read from file: /dir/file.gif +entry.js: error: Could not resolve "./file.ping" `, }) } @@ -2578,7 +2578,7 @@ func TestNoOverwriteInputFileError(t *testing.T) { Mode: config.ModeBundle, AbsOutputDir: "/", }, - expectedCompileLog: "error: Refusing to overwrite input file: /entry.js\n", + expectedCompileLog: "error: Refusing to overwrite input file: entry.js\n", }) } @@ -2594,7 +2594,7 @@ func TestDuplicateEntryPointError(t *testing.T) { Mode: config.ModeBundle, AbsOutputDir: "/out.js", }, - expectedScanLog: "error: Duplicate entry point \"/entry.js\"\n", + expectedScanLog: "error: Duplicate entry point \"entry.js\"\n", }) } @@ -2884,8 +2884,8 @@ func TestTopLevelAwait(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.js: error: Top-level await is currently not supported when bundling -/entry.js: error: Top-level await is currently not supported when bundling + expectedScanLog: `entry.js: error: Top-level await is currently not supported when bundling +entry.js: error: Top-level await is currently not supported when bundling `, }) } @@ -2936,8 +2936,8 @@ func TestTopLevelAwaitNoBundleCommonJS(t *testing.T) { Mode: config.ModeConvertFormat, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.js: error: Top-level await is currently not supported with the "cjs" output format -/entry.js: error: Top-level await is currently not supported with the "cjs" output format + expectedScanLog: `entry.js: error: Top-level await is currently not supported with the "cjs" output format +entry.js: error: Top-level await is currently not supported with the "cjs" output format `, }) } @@ -2956,8 +2956,8 @@ func TestTopLevelAwaitNoBundleIIFE(t *testing.T) { Mode: config.ModeConvertFormat, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.js: error: Top-level await is currently not supported with the "iife" output format -/entry.js: error: Top-level await is currently not supported with the "iife" output format + expectedScanLog: `entry.js: error: Top-level await is currently not supported with the "iife" output format +entry.js: error: Top-level await is currently not supported with the "iife" output format `, }) } @@ -3020,22 +3020,22 @@ func TestAssignToImport(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/bad0.js: error: Cannot assign to import "x" -/bad1.js: error: Cannot assign to import "x" -/bad10.js: error: Cannot assign to import "y z" -/bad11.js: error: Cannot assign to import "x" -/bad12.js: error: Cannot assign to import "x" -/bad13.js: error: Cannot assign to import "y" -/bad14.js: error: Cannot assign to import "y" -/bad15.js: error: Cannot assign to property on import "x" -/bad2.js: error: Cannot assign to import "x" -/bad3.js: error: Cannot assign to import "x" -/bad4.js: error: Cannot assign to import "x" -/bad5.js: error: Cannot assign to import "x" -/bad6.js: error: Cannot assign to import "x" -/bad7.js: error: Cannot assign to import "y" -/bad8.js: error: Cannot assign to property on import "x" -/bad9.js: error: Cannot assign to import "y" + expectedScanLog: `bad0.js: error: Cannot assign to import "x" +bad1.js: error: Cannot assign to import "x" +bad10.js: error: Cannot assign to import "y z" +bad11.js: error: Cannot assign to import "x" +bad12.js: error: Cannot assign to import "x" +bad13.js: error: Cannot assign to import "y" +bad14.js: error: Cannot assign to import "y" +bad15.js: error: Cannot assign to property on import "x" +bad2.js: error: Cannot assign to import "x" +bad3.js: error: Cannot assign to import "x" +bad4.js: error: Cannot assign to import "x" +bad5.js: error: Cannot assign to import "x" +bad6.js: error: Cannot assign to import "x" +bad7.js: error: Cannot assign to import "y" +bad8.js: error: Cannot assign to property on import "x" +bad9.js: error: Cannot assign to import "y" `, }) } @@ -3122,17 +3122,17 @@ func TestWarningsInsideNodeModules(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/bad-typeof.js: warning: The "typeof" operator will never evaluate to "null" -/delete-super.js: warning: Attempting to delete a property of "super" will throw a ReferenceError -/dup-case.js: warning: This case clause will never be evaluated because it duplicates an earlier case clause -/equals-nan.js: warning: Comparison with NaN using the "===" operator here is always false -/equals-neg-zero.js: warning: Comparison with -0 using the "===" operator will also match 0 -/equals-object.js: warning: Comparison using the "===" operator here is always false -/not-in.js: warning: Suspicious use of the "!" operator inside the "in" operator -/not-instanceof.js: warning: Suspicious use of the "!" operator inside the "instanceof" operator -/read-setter.js: warning: Reading from setter-only property "#foo" will throw -/return-asi.js: warning: The following expression is not returned because of an automatically-inserted semicolon -/write-getter.js: warning: Writing to getter-only property "#foo" will throw + expectedScanLog: `bad-typeof.js: warning: The "typeof" operator will never evaluate to "null" +delete-super.js: warning: Attempting to delete a property of "super" will throw a ReferenceError +dup-case.js: warning: This case clause will never be evaluated because it duplicates an earlier case clause +equals-nan.js: warning: Comparison with NaN using the "===" operator here is always false +equals-neg-zero.js: warning: Comparison with -0 using the "===" operator will also match 0 +equals-object.js: warning: Comparison using the "===" operator here is always false +not-in.js: warning: Suspicious use of the "!" operator inside the "in" operator +not-instanceof.js: warning: Suspicious use of the "!" operator inside the "instanceof" operator +read-setter.js: warning: Reading from setter-only property "#foo" will throw +return-asi.js: warning: The following expression is not returned because of an automatically-inserted semicolon +write-getter.js: warning: Writing to getter-only property "#foo" will throw `, }) } @@ -3181,13 +3181,13 @@ func TestRequireResolve(t *testing.T) { }, }, }, - expectedScanLog: `/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) -/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) -/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) -/entry.js: warning: "./present-file" should be marked as external for use with "require.resolve" -/entry.js: warning: "./missing-file" should be marked as external for use with "require.resolve" -/entry.js: warning: "missing-pkg" should be marked as external for use with "require.resolve" -/entry.js: warning: "@scope/missing-pkg" should be marked as external for use with "require.resolve" + expectedScanLog: `entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) +entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) +entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) +entry.js: warning: "./present-file" should be marked as external for use with "require.resolve" +entry.js: warning: "./missing-file" should be marked as external for use with "require.resolve" +entry.js: warning: "missing-pkg" should be marked as external for use with "require.resolve" +entry.js: warning: "@scope/missing-pkg" should be marked as external for use with "require.resolve" `, }) } @@ -3225,7 +3225,7 @@ func TestInjectDuplicate(t *testing.T) { "/inject.js", }, }, - expectedScanLog: `error: Duplicate injected file "/inject.js" + expectedScanLog: `error: Duplicate injected file "inject.js" `, }) } @@ -3525,7 +3525,7 @@ func TestProcessEnvNodeEnvWarning(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.js: warning: Define "process.env.NODE_ENV" when bundling for the browser + expectedScanLog: `entry.js: warning: Define "process.env.NODE_ENV" when bundling for the browser `, }) } @@ -3659,8 +3659,8 @@ func TestImportRelativeAsPackage(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/Users/user/project/out.js", }, - expectedScanLog: `/Users/user/project/src/entry.js: error: Could not resolve "some/other/file" ` + - `(use "./some/other/file" to import "/Users/user/project/src/some/other/file.js") + expectedScanLog: `Users/user/project/src/entry.js: error: Could not resolve "some/other/file" ` + + `(use "./some/other/file" to import "Users/user/project/src/some/other/file.js") `, }) } @@ -3678,8 +3678,8 @@ func TestForbidConstAssignWhenBundling(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.js: error: Cannot assign to "x" because it is a constant -/entry.js: note: "x" was declared a constant here + expectedScanLog: `entry.js: error: Cannot assign to "x" because it is a constant +entry.js: note: "x" was declared a constant here `, }) } @@ -3776,7 +3776,7 @@ func TestRequireMainIIFE(t *testing.T) { AbsOutputFile: "/out.js", OutputFormat: config.FormatIIFE, }, - expectedScanLog: `/entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) + expectedScanLog: `entry.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning) `, }) } diff --git a/internal/bundler/bundler_importstar_test.go b/internal/bundler/bundler_importstar_test.go index 65590a32d8e..a564782fe3b 100644 --- a/internal/bundler/bundler_importstar_test.go +++ b/internal/bundler/bundler_importstar_test.go @@ -512,7 +512,8 @@ func TestImportExportStarAmbiguousError(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: "/entry.js: error: Ambiguous import \"y\" has multiple matching exports\n", + expectedCompileLog: `entry.js: error: Ambiguous import "y" has multiple matching exports +`, }) } @@ -979,7 +980,7 @@ func TestNamespaceImportMissingES6(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: `/entry.js: warning: No matching export for import "foo" + expectedCompileLog: `entry.js: warning: No matching export for import "foo" `, }) } @@ -1041,7 +1042,7 @@ func TestNamespaceImportUnusedMissingES6(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: `/entry.js: warning: No matching export for import "foo" + expectedCompileLog: `entry.js: warning: No matching export for import "foo" `, }) } @@ -1147,8 +1148,8 @@ func TestNamespaceImportReExportMissingES6(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: `/foo.js: error: No matching export for import "foo" -/foo.js: error: No matching export for import "foo" + expectedCompileLog: `foo.js: error: No matching export for import "foo" +foo.js: error: No matching export for import "foo" `, }) } @@ -1172,8 +1173,8 @@ func TestNamespaceImportReExportUnusedMissingES6(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: `/foo.js: error: No matching export for import "foo" -/foo.js: error: No matching export for import "foo" + expectedCompileLog: `foo.js: error: No matching export for import "foo" +foo.js: error: No matching export for import "foo" `, }) } @@ -1197,7 +1198,7 @@ func TestNamespaceImportReExportStarMissingES6(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: `/entry.js: warning: No matching export for import "foo" + expectedCompileLog: `entry.js: warning: No matching export for import "foo" `, }) } @@ -1221,7 +1222,7 @@ func TestNamespaceImportReExportStarUnusedMissingES6(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: `/entry.js: warning: No matching export for import "foo" + expectedCompileLog: `entry.js: warning: No matching export for import "foo" `, }) } @@ -1575,8 +1576,8 @@ func TestImportDefaultNamespaceComboIssue446(t *testing.T) { }, }, }, - expectedCompileLog: `/internal-def.js: warning: No matching export for import "def" -/internal-ns-def.js: warning: No matching export for import "def" + expectedCompileLog: `internal-def.js: warning: No matching export for import "def" +internal-ns-def.js: warning: No matching export for import "def" `, }) } @@ -1607,13 +1608,13 @@ func TestImportDefaultNamespaceComboNoDefault(t *testing.T) { }, }, }, - expectedCompileLog: `/entry-default-ns-prop.js: error: No matching export for import "default" -/entry-default-ns-prop.js: warning: No matching export for import "default" -/entry-default-ns.js: error: No matching export for import "default" -/entry-default-prop.js: error: No matching export for import "default" -/entry-default-prop.js: warning: No matching export for import "default" -/entry-default.js: error: No matching export for import "default" -/entry-prop.js: warning: No matching export for import "default" + expectedCompileLog: `entry-default-ns-prop.js: error: No matching export for import "default" +entry-default-ns-prop.js: warning: No matching export for import "default" +entry-default-ns.js: error: No matching export for import "default" +entry-default-prop.js: error: No matching export for import "default" +entry-default-prop.js: warning: No matching export for import "default" +entry-default.js: error: No matching export for import "default" +entry-prop.js: warning: No matching export for import "default" `, }) } diff --git a/internal/bundler/bundler_loader_test.go b/internal/bundler/bundler_loader_test.go index 3a34b5bd994..38a7c0e8bfa 100644 --- a/internal/bundler/bundler_loader_test.go +++ b/internal/bundler/bundler_loader_test.go @@ -233,7 +233,8 @@ func TestLoaderJSONMissingES6(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: "/entry.js: error: No matching export for import \"missing\"\n", + expectedCompileLog: `entry.js: error: No matching export for import "missing" +`, }) } diff --git a/internal/bundler/bundler_lower_test.go b/internal/bundler/bundler_lower_test.go index 54c9daec840..0f8c7d6d0dc 100644 --- a/internal/bundler/bundler_lower_test.go +++ b/internal/bundler/bundler_lower_test.go @@ -99,7 +99,8 @@ func TestLowerExponentiationOperatorNoBundle(t *testing.T) { UnsupportedJSFeatures: es(2015), AbsOutputFile: "/out.js", }, - expectedScanLog: "/entry.js: error: Big integer literals are not available in the configured target environment\n", + expectedScanLog: `entry.js: error: Big integer literals are not available in the configured target environment +`, }) } @@ -899,14 +900,14 @@ func TestLowerAsyncES5(t *testing.T) { UnsupportedJSFeatures: es(5), AbsOutputFile: "/out.js", }, - expectedScanLog: `/arrow-1.js: error: Transforming async functions to the configured target environment is not supported yet -/arrow-2.js: error: Transforming async functions to the configured target environment is not supported yet -/export-def-1.js: error: Transforming async functions to the configured target environment is not supported yet -/export-def-2.js: error: Transforming async functions to the configured target environment is not supported yet -/fn-expr.js: error: Transforming async functions to the configured target environment is not supported yet -/fn-stmt.js: error: Transforming async functions to the configured target environment is not supported yet -/obj-method.js: error: Transforming async functions to the configured target environment is not supported yet -/obj-method.js: error: Transforming object literal extensions to the configured target environment is not supported yet + expectedScanLog: `arrow-1.js: error: Transforming async functions to the configured target environment is not supported yet +arrow-2.js: error: Transforming async functions to the configured target environment is not supported yet +export-def-1.js: error: Transforming async functions to the configured target environment is not supported yet +export-def-2.js: error: Transforming async functions to the configured target environment is not supported yet +fn-expr.js: error: Transforming async functions to the configured target environment is not supported yet +fn-stmt.js: error: Transforming async functions to the configured target environment is not supported yet +obj-method.js: error: Transforming async functions to the configured target environment is not supported yet +obj-method.js: error: Transforming object literal extensions to the configured target environment is not supported yet `, }) } diff --git a/internal/bundler/bundler_packagejson_test.go b/internal/bundler/bundler_packagejson_test.go index a9964fbe7ed..361ca08b634 100644 --- a/internal/bundler/bundler_packagejson_test.go +++ b/internal/bundler/bundler_packagejson_test.go @@ -86,7 +86,8 @@ func TestPackageJsonSyntaxErrorComment(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/Users/user/project/out.js", }, - expectedScanLog: "/Users/user/project/node_modules/demo-pkg/package.json: error: JSON does not support comments\n", + expectedScanLog: `Users/user/project/node_modules/demo-pkg/package.json: error: JSON does not support comments +`, }) } @@ -114,7 +115,8 @@ func TestPackageJsonSyntaxErrorTrailingComma(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/Users/user/project/out.js", }, - expectedScanLog: "/Users/user/project/node_modules/demo-pkg/package.json: error: JSON does not support trailing commas\n", + expectedScanLog: `Users/user/project/node_modules/demo-pkg/package.json: error: JSON does not support trailing commas +`, }) } diff --git a/internal/bundler/bundler_splitting_test.go b/internal/bundler/bundler_splitting_test.go index a13a9e9b29d..3548269f07f 100644 --- a/internal/bundler/bundler_splitting_test.go +++ b/internal/bundler/bundler_splitting_test.go @@ -272,7 +272,7 @@ func TestSplittingMissingLazyExport(t *testing.T) { OutputFormat: config.FormatESModule, AbsOutputDir: "/out", }, - expectedCompileLog: `/common.js: warning: No matching export for import "missing" + expectedCompileLog: `common.js: warning: No matching export for import "missing" `, }) } diff --git a/internal/bundler/bundler_ts_test.go b/internal/bundler/bundler_ts_test.go index 27b9aac4673..a0dbcad12a5 100644 --- a/internal/bundler/bundler_ts_test.go +++ b/internal/bundler/bundler_ts_test.go @@ -206,8 +206,8 @@ func TestTSImportMissingES6(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedCompileLog: `/entry.ts: error: No matching export for import "default" -/entry.ts: error: No matching export for import "y" + expectedCompileLog: `entry.ts: error: No matching export for import "default" +entry.ts: error: No matching export for import "y" `, }) } @@ -266,7 +266,7 @@ func TestTSImportMissingFile(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.ts: error: Could not resolve "./doesNotExist.ts" + expectedScanLog: `entry.ts: error: Could not resolve "./doesNotExist.ts" `, }) } @@ -820,10 +820,10 @@ func TestTSImplicitExtensionsMissing(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: `/entry.ts: error: Could not resolve "./mjs.mjs" -/entry.ts: error: Could not resolve "./cjs.cjs" -/entry.ts: error: Could not resolve "./js.js" -/entry.ts: error: Could not resolve "./jsx.jsx" + expectedScanLog: `entry.ts: error: Could not resolve "./mjs.mjs" +entry.ts: error: Could not resolve "./cjs.cjs" +entry.ts: error: Could not resolve "./js.js" +entry.ts: error: Could not resolve "./jsx.jsx" `, }) } diff --git a/internal/bundler/bundler_tsconfig_test.go b/internal/bundler/bundler_tsconfig_test.go index 0182c394290..e6dcca824d1 100644 --- a/internal/bundler/bundler_tsconfig_test.go +++ b/internal/bundler/bundler_tsconfig_test.go @@ -331,15 +331,15 @@ func TestTsConfigBadPathsNoBaseURL(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/Users/user/project/out.js", }, - expectedScanLog: `/Users/user/project/entry.ts: error: Could not resolve "should-not-be-imported" ` + - `(use "./should-not-be-imported" to import "/Users/user/project/should-not-be-imported.ts") -/Users/user/project/tsconfig.json: warning: Non-relative path "bad" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) -/Users/user/project/tsconfig.json: warning: Non-relative path "@bad/core" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) -/Users/user/project/tsconfig.json: warning: Non-relative path ".*/bad" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) -/Users/user/project/tsconfig.json: warning: Non-relative path "..*/bad" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) -/Users/user/project/tsconfig.json: warning: Non-relative path "c*:\\bad" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) -/Users/user/project/tsconfig.json: warning: Non-relative path "c:*\\bad" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) -/Users/user/project/tsconfig.json: warning: Non-relative path "http://bad" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) + expectedScanLog: `Users/user/project/entry.ts: error: Could not resolve "should-not-be-imported" ` + + `(use "./should-not-be-imported" to import "Users/user/project/should-not-be-imported.ts") +Users/user/project/tsconfig.json: warning: Non-relative path "bad" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) +Users/user/project/tsconfig.json: warning: Non-relative path "@bad/core" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) +Users/user/project/tsconfig.json: warning: Non-relative path ".*/bad" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) +Users/user/project/tsconfig.json: warning: Non-relative path "..*/bad" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) +Users/user/project/tsconfig.json: warning: Non-relative path "c*:\\bad" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) +Users/user/project/tsconfig.json: warning: Non-relative path "c:*\\bad" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) +Users/user/project/tsconfig.json: warning: Non-relative path "http://bad" is not allowed when "baseUrl" is not set (did you forget a leading "./"?) `, }) } @@ -654,7 +654,8 @@ func TestTsconfigJsonExtendsLoop(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/out.js", }, - expectedScanLog: "/base.json: warning: Base config file \"./tsconfig\" forms cycle\n", + expectedScanLog: `base.json: warning: Base config file "./tsconfig" forms cycle +`, }) } @@ -783,7 +784,8 @@ func TestTsconfigJsonOverrideInvalid(t *testing.T) { AbsOutputFile: "/out.js", TsConfigOverride: "/this/file/doesn't/exist/tsconfig.json", }, - expectedScanLog: "error: Cannot find tsconfig file \"/this/file/doesn't/exist/tsconfig.json\"\n", + expectedScanLog: `error: Cannot find tsconfig file "this/file/doesn't/exist/tsconfig.json" +`, }) } @@ -834,7 +836,7 @@ func TestTsconfigWarningsInsideNodeModules(t *testing.T) { Mode: config.ModeBundle, AbsOutputFile: "/Users/user/project/out.js", }, - expectedScanLog: `/Users/user/project/src/foo/tsconfig.json: warning: Cannot find base config file "extends for foo" + expectedScanLog: `Users/user/project/src/foo/tsconfig.json: warning: Cannot find base config file "extends for foo" `, }) } diff --git a/internal/bundler/snapshots/snapshots_css.txt b/internal/bundler/snapshots/snapshots_css.txt index 73bd94931f5..ce7dcf1abf6 100644 --- a/internal/bundler/snapshots/snapshots_css.txt +++ b/internal/bundler/snapshots/snapshots_css.txt @@ -1,6 +1,6 @@ TestBase64ImportURLInCSS ---------- /out/entry.css ---------- -/* /entry.css */ +/* entry.css */ a { background: url(data:image/png;base64,iVBORw0KGgo=); } @@ -8,7 +8,7 @@ a { ================================================================================ TestBinaryImportURLInCSS ---------- /out/entry.css ---------- -/* /entry.css */ +/* entry.css */ a { background: url(data:application/octet-stream;base64,iVBORw0KGgo=); } @@ -16,22 +16,22 @@ a { ================================================================================ TestCSSAtImport ---------- /out.css ---------- -/* /shared.css */ +/* shared.css */ .shared { color: black; } -/* /a.css */ +/* a.css */ .a { color: green; } -/* /b.css */ +/* b.css */ .b { color: blue; } -/* /entry.css */ +/* entry.css */ .entry { color: red; } @@ -39,12 +39,12 @@ TestCSSAtImport ================================================================================ TestCSSAtImportExtensionOrderCollision ---------- /out.css ---------- -/* /test.css */ +/* test.css */ .css { color: red; } -/* /entry.css */ +/* entry.css */ ================================================================================ TestCSSAtImportExternal @@ -53,27 +53,27 @@ TestCSSAtImportExternal @import "./external1.css"; @import "./external2.css"; -/* /internal.css */ +/* internal.css */ .before { color: red; } -/* /charset1.css */ +/* charset1.css */ .middle { color: green; } -/* /charset2.css */ +/* charset2.css */ .after { color: blue; } -/* /entry.css */ +/* entry.css */ ================================================================================ TestCSSEntryPoint ---------- /out.css ---------- -/* /entry.css */ +/* entry.css */ body { background: white; color: black; @@ -82,11 +82,11 @@ body { ================================================================================ TestCSSFromJSMissingStarImport ---------- /out/entry.js ---------- -// /entry.js +// entry.js console.log(void 0); ---------- /out/entry.css ---------- -/* /a.css */ +/* a.css */ .a { color: red; } @@ -94,7 +94,7 @@ console.log(void 0); ================================================================================ TestDataURLImportURLInCSS ---------- /out/entry.css ---------- -/* /entry.css */ +/* entry.css */ a { background: url(data:image/png;base64,iVBORw0KGgo=); } @@ -102,7 +102,7 @@ a { ================================================================================ TestExternalImportURLInCSS ---------- /out/entry.css ---------- -/* /src/entry.css */ +/* src/entry.css */ div:after { content: 'If this is recognized, the path should become "../src/external.png"'; background: url(../src/external.png); @@ -128,22 +128,22 @@ TestFileImportURLInCSS ---------- /out/example.RPS4CMHF.data ---------- This is some data. ---------- /out/entry.css ---------- -/* /one.css */ +/* one.css */ a { background: url(example.RPS4CMHF.data); } -/* /two.css */ +/* two.css */ b { background: url(example.RPS4CMHF.data); } -/* /entry.css */ +/* entry.css */ ================================================================================ TestIgnoreURLsInAtRulePrelude ---------- /out/entry.css ---------- -/* /entry.css */ +/* entry.css */ @supports (background: url(ignored.png)) { a { color: red; @@ -153,19 +153,19 @@ TestIgnoreURLsInAtRulePrelude ================================================================================ TestImportCSSFromJS ---------- /out/entry.js ---------- -// /a.js +// a.js console.log("a"); -// /b.js +// b.js console.log("b"); ---------- /out/entry.css ---------- -/* /a.css */ +/* a.css */ .a { color: red; } -/* /b.css */ +/* b.css */ .b { color: blue; } @@ -173,7 +173,7 @@ console.log("b"); ================================================================================ TestPackageURLsInCSS ---------- /out/entry.css ---------- -/* /entry.css */ +/* entry.css */ a { background: url(data:image/png;base64,YS0x); } @@ -187,7 +187,7 @@ c { ================================================================================ TestTextImportURLInCSSText ---------- /out/entry.css ---------- -/* /entry.css */ +/* entry.css */ a { background: url(data:text/plain;base64,VGhpcyBpcyBzb21lIHRleHQu); } diff --git a/internal/bundler/snapshots/snapshots_dce.txt b/internal/bundler/snapshots/snapshots_dce.txt index 40005fd2402..f7b442b06db 100644 --- a/internal/bundler/snapshots/snapshots_dce.txt +++ b/internal/bundler/snapshots/snapshots_dce.txt @@ -1,21 +1,21 @@ TestBase64LoaderRemoveUnused ---------- /out.js ---------- -// /entry.js +// entry.js console.log("unused import"); ================================================================================ TestDataURLLoaderRemoveUnused ---------- /out.js ---------- -// /entry.js +// entry.js console.log("unused import"); ================================================================================ TestDisableTreeShaking ---------- /out.js ---------- -// /keep-me/index.js +// keep-me/index.js console.log("side effects"); -// /entry.jsx +// entry.jsx function KeepMe1() { } var keepMe2 = React.createElement(KeepMe1, null); @@ -29,34 +29,34 @@ var keepMe6 = some.fn(); ================================================================================ TestFileLoaderRemoveUnused ---------- /out.js ---------- -// /entry.js +// entry.js console.log("unused import"); ================================================================================ TestJSONLoaderRemoveUnused ---------- /out.js ---------- -// /entry.js +// entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsArrayGlob ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/keep/this/file.js +// Users/user/project/node_modules/demo-pkg/keep/this/file.js console.log("this should be kept"); ================================================================================ TestPackageJsonSideEffectsArrayKeep ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js console.log("hello"); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsArrayKeepMainImplicitMain ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index-main.js +// Users/user/project/node_modules/demo-pkg/index-main.js var require_index_main = __commonJS((exports) => { __export(exports, { foo: () => foo2 @@ -65,40 +65,40 @@ var require_index_main = __commonJS((exports) => { console.log("this should be kept"); }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_index_main()); -// /Users/user/project/src/require-demo-pkg.js +// Users/user/project/src/require-demo-pkg.js require_index_main(); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsArrayKeepMainImplicitModule ---------- /out.js ---------- -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsArrayKeepMainUseMain ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index-main.js +// Users/user/project/node_modules/demo-pkg/index-main.js console.log("this should be kept"); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsArrayKeepMainUseModule ---------- /out.js ---------- -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsArrayKeepModuleImplicitMain ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index-main.js +// Users/user/project/node_modules/demo-pkg/index-main.js var require_index_main = __commonJS((exports) => { __export(exports, { foo: () => foo @@ -107,59 +107,59 @@ var require_index_main = __commonJS((exports) => { console.log("this should be kept"); }); -// /Users/user/project/src/require-demo-pkg.js +// Users/user/project/src/require-demo-pkg.js require_index_main(); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsArrayKeepModuleImplicitModule ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index-module.js +// Users/user/project/node_modules/demo-pkg/index-module.js console.log("this should be kept"); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsArrayKeepModuleUseMain ---------- /out.js ---------- -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsArrayKeepModuleUseModule ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index-module.js +// Users/user/project/node_modules/demo-pkg/index-module.js console.log("this should be kept"); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsArrayRemove ---------- /out.js ---------- -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsFalseKeepBareImportAndRequireCommonJS ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var require_demo_pkg = __commonJS((exports) => { exports.foo = 123; console.log("hello"); }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js require_demo_pkg(); console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsFalseKeepBareImportAndRequireES6 ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var require_demo_pkg = __commonJS((exports) => { __export(exports, { foo: () => foo @@ -168,50 +168,50 @@ var require_demo_pkg = __commonJS((exports) => { console.log("hello"); }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js require_demo_pkg(); console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsFalseKeepNamedImportCommonJS ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var require_demo_pkg = __commonJS((exports) => { exports.foo = 123; console.log("hello"); }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_demo_pkg()); console.log(demo_pkg.foo); ================================================================================ TestPackageJsonSideEffectsFalseKeepNamedImportES6 ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var foo = 123; console.log("hello"); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log(foo); ================================================================================ TestPackageJsonSideEffectsFalseKeepStarImportCommonJS ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var require_demo_pkg = __commonJS((exports) => { exports.foo = 123; console.log("hello"); }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var ns = __toModule(require_demo_pkg()); console.log(ns); ================================================================================ TestPackageJsonSideEffectsFalseKeepStarImportES6 ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var demo_pkg_exports = {}; __export(demo_pkg_exports, { foo: () => foo @@ -219,92 +219,92 @@ __export(demo_pkg_exports, { var foo = 123; console.log("hello"); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log(demo_pkg_exports); ================================================================================ TestPackageJsonSideEffectsFalseRemoveBareImportCommonJS ---------- /out.js ---------- -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsFalseRemoveBareImportES6 ---------- /out.js ---------- -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsFalseRemoveNamedImportCommonJS ---------- /out.js ---------- -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsFalseRemoveNamedImportES6 ---------- /out.js ---------- -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsFalseRemoveStarImportCommonJS ---------- /out.js ---------- -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsFalseRemoveStarImportES6 ---------- /out.js ---------- -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsKeepExportDefaultExpr ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var demo_pkg_default = exprWithSideEffects(); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log(demo_pkg_default); ================================================================================ TestPackageJsonSideEffectsNestedDirectoryRemove ---------- /out.js ---------- -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsTrueKeepCommonJS ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var require_demo_pkg = __commonJS((exports) => { exports.foo = 123; console.log("hello"); }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_demo_pkg()); console.log("unused import"); ================================================================================ TestPackageJsonSideEffectsTrueKeepES6 ---------- /out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js console.log("hello"); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log("unused import"); ================================================================================ TestRemoveUnusedImportMeta ---------- /out.js ---------- -// /entry.js +// entry.js console.log("foo is unused"); ================================================================================ TestRemoveUnusedPureCommentCalls ---------- /out.js ---------- -// /entry.js +// entry.js function bar() { } var bare = foo(bar); @@ -330,13 +330,13 @@ var new_exp_no = /* @__PURE__ */ new foo() ** foo(); ================================================================================ TestTextLoaderRemoveUnused ---------- /out.js ---------- -// /entry.js +// entry.js console.log("unused import"); ================================================================================ TestTreeShakingReactElements ---------- /out.js ---------- -// /entry.jsx +// entry.jsx function Foo() { } var d = /* @__PURE__ */ React.createElement("div", null); diff --git a/internal/bundler/snapshots/snapshots_default.txt b/internal/bundler/snapshots/snapshots_default.txt index 1fb9244212b..62f4add62d1 100644 --- a/internal/bundler/snapshots/snapshots_default.txt +++ b/internal/bundler/snapshots/snapshots_default.txt @@ -124,7 +124,7 @@ TestArgumentsSpecialCaseNoBundle ================================================================================ TestArrowFnScope ---------- /out.js ---------- -// /entry.js +// entry.js tests = { 0: (s = (e) => s + e, t) => s + t, 1: (s, t = (e) => t + e) => t + s, @@ -139,7 +139,7 @@ tests = { ================================================================================ TestAutoExternal ---------- /out/entry.js ---------- -// /entry.js +// entry.js import "http://example.com/code.js"; import "https://example.com/code.js"; import "//example.com/code.js"; @@ -148,7 +148,7 @@ import "data:application/javascript;base64,ZXhwb3J0IGRlZmF1bHQgMTIz"; ================================================================================ TestAvoidTDZ ---------- /out.js ---------- -// /entry.js +// entry.js var Foo2 = class { }; var Foo = Foo2; @@ -178,7 +178,7 @@ export let bar = 123; ================================================================================ TestAwaitImportInsideTry ---------- /out.js ---------- -// /entry.js +// entry.js async function main(name) { try { return await import(name); @@ -190,7 +190,7 @@ main("fs"); ================================================================================ TestCharFreqIgnoreComments ---------- /out/a.js ---------- -// /a.js +// a.js function e(t, n, r, u) { return "the argument names must be the same"; } @@ -199,7 +199,7 @@ export { }; ---------- /out/b.js ---------- -// /b.js +// b.js function e(t, n, r, u) { return "the argument names must be the same"; } @@ -210,7 +210,7 @@ export { ================================================================================ TestCommonJSFromES6 ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports) => { __export(exports, { foo: () => foo2 @@ -220,7 +220,7 @@ var require_foo = __commonJS((exports) => { } }); -// /bar.js +// bar.js var require_bar = __commonJS((exports) => { __export(exports, { bar: () => bar2 @@ -230,7 +230,7 @@ var require_bar = __commonJS((exports) => { } }); -// /entry.js +// entry.js var {foo} = require_foo(); console.log(foo(), bar()); var {bar} = require_bar(); @@ -238,38 +238,38 @@ var {bar} = require_bar(); ================================================================================ TestConditionalImport ---------- /out.js ---------- -// /b.js +// b.js var require_b = __commonJS((exports) => { exports.foo = 213; }); -// /a.js +// a.js x ? import("a") : y ? Promise.resolve().then(() => __toModule(require_b())) : import("c"); x ? y ? import("a") : Promise.resolve().then(() => __toModule(require_b())) : import(c); ================================================================================ TestConditionalRequire ---------- /out.js ---------- -// /b.js +// b.js var require_b = __commonJS((exports) => { exports.foo = 213; }); -// /a.js +// a.js x ? require("a") : y ? require_b() : require("c"); x ? y ? require("a") : require_b() : require(c); ================================================================================ TestConditionalRequireResolve ---------- /out.js ---------- -// /a.js +// a.js x ? require.resolve("a") : y ? require.resolve("b") : require.resolve("c"); x ? y ? require.resolve("a") : require.resolve("b") : require.resolve(c); ================================================================================ TestConstWithLet ---------- /out.js ---------- -// /entry.js +// entry.js var a = 1; console.log(a); { @@ -302,7 +302,7 @@ for (const e of x) ================================================================================ TestConstWithLetNoMangle ---------- /out.js ---------- -// /entry.js +// entry.js var a = 1; console.log(a); if (true) { @@ -361,12 +361,12 @@ function test5() { ================================================================================ TestDotImport ---------- /out.js ---------- -// /index.js +// index.js var require_index = __commonJS((exports) => { exports.x = 123; }); -// /entry.js +// entry.js var _ = __toModule(require_index()); console.log(_.x); @@ -390,12 +390,12 @@ Promise.resolve().then(function() { TestDynamicImportWithTemplateIIFE ---------- /out.js ---------- (() => { - // /b.js + // b.js var require_b = __commonJS((exports) => { exports.x = 123; }); - // /a.js + // a.js Promise.resolve().then(() => __toModule(require_b())).then((ns) => console.log(ns)); Promise.resolve().then(() => __toModule(require_b())).then((ns) => console.log(ns)); })(); @@ -403,21 +403,21 @@ TestDynamicImportWithTemplateIIFE ================================================================================ TestES6FromCommonJS ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports) => { exports.foo = function() { return "foo"; }; }); -// /bar.js +// bar.js var require_bar = __commonJS((exports) => { exports.bar = function() { return "bar"; }; }); -// /entry.js +// entry.js var foo = __toModule(require_foo()); var bar = __toModule(require_bar()); console.log(foo.foo(), bar.bar()); @@ -425,7 +425,7 @@ console.log(foo.foo(), bar.bar()); ================================================================================ TestExportChain ---------- /out.js ---------- -// /bar.js +// bar.js var c = 123; export { c as a @@ -434,7 +434,7 @@ export { ================================================================================ TestExportFSNode ---------- /out.js ---------- -// /entry.js +// entry.js import * as fs from "fs"; import {readFileSync} from "fs"; export { @@ -445,7 +445,7 @@ export { ================================================================================ TestExportFSNodeInCommonJSModule ---------- /out.js ---------- -// /entry.js +// entry.js import * as fs from "fs"; import {readFileSync} from "fs"; var require_entry = __commonJS((exports) => { @@ -460,7 +460,7 @@ export default require_entry(); ================================================================================ TestExportFormsCommonJS ---------- /out.js ---------- -// /commonjs.js +// commonjs.js var require_commonjs = __commonJS((exports) => { __export(exports, { C: () => Class, @@ -483,7 +483,7 @@ var require_commonjs = __commonJS((exports) => { }; }); -// /c.js +// c.js var require_c = __commonJS((exports) => { __export(exports, { default: () => c_default2 @@ -493,7 +493,7 @@ var require_c = __commonJS((exports) => { var c_default2 = c_default; }); -// /d.js +// d.js var require_d = __commonJS((exports) => { __export(exports, { default: () => d_default @@ -504,7 +504,7 @@ var require_d = __commonJS((exports) => { Foo.prop = 123; }); -// /e.js +// e.js var require_e = __commonJS((exports) => { __export(exports, { default: () => e_default @@ -513,7 +513,7 @@ var require_e = __commonJS((exports) => { } }); -// /f.js +// f.js var require_f = __commonJS((exports) => { __export(exports, { default: () => foo @@ -523,7 +523,7 @@ var require_f = __commonJS((exports) => { foo.prop = 123; }); -// /g.js +// g.js var require_g = __commonJS((exports) => { __export(exports, { default: () => g_default @@ -532,7 +532,7 @@ var require_g = __commonJS((exports) => { } }); -// /h.js +// h.js var require_h = __commonJS((exports) => { __export(exports, { default: () => foo @@ -542,17 +542,17 @@ var require_h = __commonJS((exports) => { foo.prop = 123; }); -// /a.js +// a.js var abc = void 0; -// /b.js +// b.js var b_exports = {}; __export(b_exports, { xyz: () => xyz }); var xyz = null; -// /entry.js +// entry.js require_commonjs(); require_c(); require_d(); @@ -564,17 +564,17 @@ require_h(); ================================================================================ TestExportFormsES6 ---------- /out.js ---------- -// /a.js +// a.js var abc = void 0; -// /b.js +// b.js var b_exports = {}; __export(b_exports, { xyz: () => xyz }); var xyz = null; -// /entry.js +// entry.js var entry_default = 123; var v = 234; var l = 234; @@ -599,7 +599,7 @@ export { TestExportFormsIIFE ---------- /out.js ---------- var globalName = (() => { - // /entry.js + // entry.js var entry_exports = {}; __export(entry_exports, { C: () => Class, @@ -613,17 +613,17 @@ var globalName = (() => { v: () => v }); - // /a.js + // a.js var abc = void 0; - // /b.js + // b.js var b_exports = {}; __export(b_exports, { xyz: () => xyz }); var xyz = null; - // /entry.js + // entry.js var entry_default = 123; var v = 234; var l = 234; @@ -673,39 +673,39 @@ export default class o { ================================================================================ TestExportWildcardFSNodeCommonJS ---------- /out.js ---------- -// /entry.js +// entry.js __exportStar(exports, __toModule(require("fs"))); ================================================================================ TestExportWildcardFSNodeES6 ---------- /out.js ---------- -// /entry.js +// entry.js export * from "fs"; ================================================================================ TestExportsAndModuleFormatCommonJS ---------- /out.js ---------- -// /foo/test.js +// foo/test.js var test_exports = {}; __export(test_exports, { foo: () => foo }); var foo = 123; -// /bar/test.js +// bar/test.js var test_exports2 = {}; __export(test_exports2, { bar: () => bar }); var bar = 123; -// /entry.js +// entry.js console.log(exports, module.exports, test_exports, test_exports2); ================================================================================ TestExternalES6ConvertedToCommonJS ---------- /out.js ---------- -// /a.js +// a.js import * as ns from "x"; var require_a = __commonJS((exports) => { __export(exports, { @@ -713,7 +713,7 @@ var require_a = __commonJS((exports) => { }); }); -// /b.js +// b.js import * as ns2 from "x"; var require_b = __commonJS((exports) => { __export(exports, { @@ -721,7 +721,7 @@ var require_b = __commonJS((exports) => { }); }); -// /c.js +// c.js import * as ns3 from "x"; var require_c = __commonJS((exports) => { __export(exports, { @@ -729,7 +729,7 @@ var require_c = __commonJS((exports) => { }); }); -// /d.js +// d.js import {ns as ns4} from "x"; var require_d = __commonJS((exports) => { __export(exports, { @@ -737,13 +737,13 @@ var require_d = __commonJS((exports) => { }); }); -// /e.js +// e.js import * as x_star from "x"; var require_e = __commonJS((exports) => { __exportStar(exports, x_star); }); -// /entry.js +// entry.js require_a(); require_b(); require_c(); @@ -753,7 +753,7 @@ require_e(); ================================================================================ TestExternalModuleExclusionPackage ---------- /out.js ---------- -// /index.js +// index.js import {S3} from "aws-sdk"; import {DocumentClient} from "aws-sdk/clients/dynamodb"; var s3 = new S3(); @@ -766,7 +766,7 @@ export { ================================================================================ TestExternalModuleExclusionRelativePath ---------- /Users/user/project/out/index.js ---------- -// /Users/user/project/src/nested/folder/test.js +// Users/user/project/src/nested/folder/test.js import foo2 from "../src/nested/folder/foo.js"; import out from "./in-out-dir.js"; import sha256 from "../src/sha256.min.js"; @@ -776,7 +776,7 @@ console.log(foo2, out, sha256, config); ================================================================================ TestFalseRequire ---------- /out.js ---------- -// /entry.js +// entry.js ((require2) => require2("/test.txt"))(); ================================================================================ @@ -784,10 +784,10 @@ TestHashbangBundle ---------- /out.js ---------- #!/usr/bin/env a -// /code.js +// code.js var code = 0; -// /entry.js +// entry.js process.exit(code); ================================================================================ @@ -800,14 +800,14 @@ process.exit(0); TestIIFE_ES5 ---------- /out.js ---------- (function() { - // /entry.js + // entry.js console.log("test"); })(); ================================================================================ TestImportFSNodeCommonJS ---------- /out.js ---------- -// /entry.js +// entry.js var fs = __toModule(require("fs")); var fs2 = __toModule(require("fs")); var fs3 = __toModule(require("fs")); @@ -817,7 +817,7 @@ console.log(fs2, fs4.readFileSync, fs3.default); ================================================================================ TestImportFSNodeES6 ---------- /out.js ---------- -// /entry.js +// entry.js import "fs"; import * as fs2 from "fs"; import defaultValue from "fs"; @@ -863,7 +863,7 @@ console.log(ns, a, c, def, def2, ns2, def3, a2, c3, imp); ================================================================================ TestImportInsideTry ---------- /out.js ---------- -// /entry.js +// entry.js async function main(name) { try { return import(name); @@ -875,14 +875,14 @@ main("fs"); ================================================================================ TestImportMetaCommonJS ---------- /out.js ---------- -// /entry.js +// entry.js var import_meta = {}; console.log(import_meta.url, import_meta.path); ================================================================================ TestImportMetaES6 ---------- /out.js ---------- -// /entry.js +// entry.js console.log(import.meta.url, import.meta.path); ================================================================================ @@ -893,97 +893,97 @@ console.log(import.meta.url, import.meta.path); ================================================================================ TestImportMissingCommonJS ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports) => { exports.x = 123; }); -// /entry.js +// entry.js var foo = __toModule(require_foo()); console.log(foo.default(foo.x, foo.y)); ================================================================================ TestImportMissingNeitherES6NorCommonJS ---------- /out/named.js ---------- -// /foo.js +// foo.js console.log("no exports here"); -// /named.js +// named.js console.log((void 0)(void 0, void 0)); ---------- /out/star.js ---------- -// /foo.js +// foo.js console.log("no exports here"); -// /star.js +// star.js console.log((void 0)(void 0, void 0)); ---------- /out/star-capture.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS(() => { console.log("no exports here"); }); -// /star-capture.js +// star-capture.js var ns = __toModule(require_foo()); console.log(ns); ---------- /out/bare.js ---------- -// /foo.js +// foo.js console.log("no exports here"); ---------- /out/require.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS(() => { console.log("no exports here"); }); -// /require.js +// require.js console.log(require_foo()); ---------- /out/import.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS(() => { console.log("no exports here"); }); -// /import.js +// import.js console.log(Promise.resolve().then(() => __toModule(require_foo()))); ================================================================================ TestImportReExportES6Issue149 ---------- /out.js ---------- -// /import.js +// import.js import {h, render} from "preact"; var p = "p"; -// /in2.jsx +// in2.jsx var Internal = () => /* @__PURE__ */ h(p, null, " Test 2 "); -// /app.jsx +// app.jsx var App = () => /* @__PURE__ */ h(p, null, " ", /* @__PURE__ */ h(Internal, null), " T "); render(/* @__PURE__ */ h(App, null), document.getElementById("app")); ================================================================================ TestInject ---------- /out.js ---------- -// /inject.js +// inject.js var obj = {}; var sideEffects = console.log("side effects"); -// /node_modules/unused/index.js +// node_modules/unused/index.js console.log("This is unused but still has side effects"); -// /replacement.js +// replacement.js var replace = { test() { } }; -// /re-export.js +// re-export.js var external_pkg = __toModule(require("external-pkg")); -// /entry.js +// entry.js var sideEffects2 = console.log("this should be renamed"); var collide = 123; console.log(obj.prop); @@ -994,15 +994,15 @@ console.log(external_pkg.re_export); ================================================================================ TestInjectImportOrder ---------- /out.js ---------- -// /inject-1.js +// inject-1.js import "first"; console.log("first"); -// /inject-2.js +// inject-2.js import "second"; console.log("second"); -// /entry.ts +// entry.ts import "third"; console.log("third"); @@ -1015,11 +1015,11 @@ console.log("here"); ================================================================================ TestInjectJSX ---------- /out.js ---------- -// /inject.js +// inject.js function el() { } -// /entry.jsx +// entry.jsx console.log(/* @__PURE__ */ el("div", null)); ================================================================================ @@ -1043,31 +1043,31 @@ console.log(re_export); ================================================================================ TestJSXImportsCommonJS ---------- /out.js ---------- -// /custom-react.js +// custom-react.js var require_custom_react = __commonJS((exports, module) => { module.exports = {}; }); -// /entry.jsx +// entry.jsx var custom_react = __toModule(require_custom_react()); console.log(/* @__PURE__ */ custom_react.elem("div", null), /* @__PURE__ */ custom_react.elem(custom_react.frag, null, "fragment")); ================================================================================ TestJSXImportsES6 ---------- /out.js ---------- -// /custom-react.js +// custom-react.js function elem() { } function frag() { } -// /entry.jsx +// entry.jsx console.log(/* @__PURE__ */ elem("div", null), /* @__PURE__ */ elem(frag, null, "fragment")); ================================================================================ TestKeepNamesTreeShaking ---------- /out.js ---------- -// /entry.js +// entry.js function fnStmtKeep() { } __name(fnStmtKeep, "fnStmtKeep"); @@ -1086,283 +1086,283 @@ new clsExprKeep(); ================================================================================ TestManyEntryPoints ---------- /out/e00.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e00.js +// e00.js console.log(shared_default); ---------- /out/e01.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e01.js +// e01.js console.log(shared_default); ---------- /out/e02.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e02.js +// e02.js console.log(shared_default); ---------- /out/e03.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e03.js +// e03.js console.log(shared_default); ---------- /out/e04.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e04.js +// e04.js console.log(shared_default); ---------- /out/e05.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e05.js +// e05.js console.log(shared_default); ---------- /out/e06.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e06.js +// e06.js console.log(shared_default); ---------- /out/e07.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e07.js +// e07.js console.log(shared_default); ---------- /out/e08.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e08.js +// e08.js console.log(shared_default); ---------- /out/e09.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e09.js +// e09.js console.log(shared_default); ---------- /out/e10.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e10.js +// e10.js console.log(shared_default); ---------- /out/e11.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e11.js +// e11.js console.log(shared_default); ---------- /out/e12.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e12.js +// e12.js console.log(shared_default); ---------- /out/e13.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e13.js +// e13.js console.log(shared_default); ---------- /out/e14.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e14.js +// e14.js console.log(shared_default); ---------- /out/e15.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e15.js +// e15.js console.log(shared_default); ---------- /out/e16.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e16.js +// e16.js console.log(shared_default); ---------- /out/e17.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e17.js +// e17.js console.log(shared_default); ---------- /out/e18.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e18.js +// e18.js console.log(shared_default); ---------- /out/e19.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e19.js +// e19.js console.log(shared_default); ---------- /out/e20.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e20.js +// e20.js console.log(shared_default); ---------- /out/e21.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e21.js +// e21.js console.log(shared_default); ---------- /out/e22.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e22.js +// e22.js console.log(shared_default); ---------- /out/e23.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e23.js +// e23.js console.log(shared_default); ---------- /out/e24.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e24.js +// e24.js console.log(shared_default); ---------- /out/e25.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e25.js +// e25.js console.log(shared_default); ---------- /out/e26.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e26.js +// e26.js console.log(shared_default); ---------- /out/e27.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e27.js +// e27.js console.log(shared_default); ---------- /out/e28.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e28.js +// e28.js console.log(shared_default); ---------- /out/e29.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e29.js +// e29.js console.log(shared_default); ---------- /out/e30.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e30.js +// e30.js console.log(shared_default); ---------- /out/e31.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e31.js +// e31.js console.log(shared_default); ---------- /out/e32.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e32.js +// e32.js console.log(shared_default); ---------- /out/e33.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e33.js +// e33.js console.log(shared_default); ---------- /out/e34.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e34.js +// e34.js console.log(shared_default); ---------- /out/e35.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e35.js +// e35.js console.log(shared_default); ---------- /out/e36.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e36.js +// e36.js console.log(shared_default); ---------- /out/e37.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e37.js +// e37.js console.log(shared_default); ---------- /out/e38.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e38.js +// e38.js console.log(shared_default); ---------- /out/e39.js ---------- -// /shared.js +// shared.js var shared_default = 123; -// /e39.js +// e39.js console.log(shared_default); ================================================================================ @@ -1393,27 +1393,27 @@ Promise.resolve().then(function(){return __toModule(require("foo"))});Promise.re ================================================================================ TestMinifiedExportsAndModuleFormatCommonJS ---------- /out.js ---------- -// /foo/test.js +// foo/test.js var t = {}; f(t, { foo: () => l }); var l = 123; -// /bar/test.js +// bar/test.js var r = {}; f(r, { bar: () => m }); var m = 123; -// /entry.js +// entry.js console.log(exports, module.exports, t, r); ================================================================================ TestMinifyArguments ---------- /out.js ---------- -// /entry.js +// entry.js function e(n = arguments) { let t; } @@ -1512,30 +1512,30 @@ a: { ================================================================================ TestMultipleEntryPointsSameNameCollision ---------- /out/a/entry.js ---------- -// /common.js +// common.js var foo = 123; -// /a/entry.js +// a/entry.js console.log(foo); ---------- /out/b/entry.js ---------- -// /common.js +// common.js var foo = 123; -// /b/entry.js +// b/entry.js console.log(foo); ================================================================================ TestNestedCommonJS ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /entry.js +// entry.js function nestedScope() { const fn = require_foo(); console.log(fn()); @@ -1545,14 +1545,14 @@ nestedScope(); ================================================================================ TestNestedES6FromCommonJS ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports) => { exports.fn = function() { return 123; }; }); -// /entry.js +// entry.js var foo = __toModule(require_foo()); (() => { console.log(foo.fn()); @@ -1561,7 +1561,7 @@ var foo = __toModule(require_foo()); ================================================================================ TestNestedRequireWithoutCall ---------- /out.js ---------- -// /entry.js +// entry.js (() => { const req = require; req("./entry"); @@ -1570,7 +1570,7 @@ TestNestedRequireWithoutCall ================================================================================ TestNestedScopeBug ---------- /out.js ---------- -// /entry.js +// entry.js (() => { function a() { b(); @@ -1585,62 +1585,62 @@ TestNestedScopeBug ================================================================================ TestNewExpressionCommonJS ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports, module) => { var Foo = class { }; module.exports = {Foo}; }); -// /entry.js +// entry.js new (require_foo()).Foo(); ================================================================================ TestNodeModules ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var require_demo_pkg = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_demo_pkg()); console.log(demo_pkg.default()); ================================================================================ TestOutbase ---------- /out/a/b/c.js ---------- -// /a/b/c.js +// a/b/c.js console.log("c"); ---------- /out/a/b/d.js ---------- -// /a/b/d.js +// a/b/d.js console.log("d"); ================================================================================ TestOutputExtensionRemappingDir ---------- /out/entry.notjs ---------- -// /entry.js +// entry.js console.log("test"); ================================================================================ TestOutputExtensionRemappingFile ---------- /out.js ---------- -// /entry.js +// entry.js console.log("test"); ================================================================================ TestProcessEnvNodeEnvWarning ---------- /out.js ---------- -// /entry.js +// entry.js console.log(process.env.NODE_ENV, process.env.NODE_ENV); ================================================================================ TestProcessEnvNodeEnvWarningDefine ---------- /out.js ---------- -// /entry.js +// entry.js console.log(null); ================================================================================ @@ -1651,18 +1651,18 @@ console.log(process.env.NODE_ENV); ================================================================================ TestProcessEnvNodeEnvWarningNode ---------- /out.js ---------- -// /entry.js +// entry.js console.log(process.env.NODE_ENV); ================================================================================ TestReExportCommonJSAsES6 ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports) => { exports.bar = 123; }); -// /entry.js +// entry.js var foo = __toModule(require_foo()); var export_bar = foo.bar; export { @@ -1672,7 +1672,7 @@ export { ================================================================================ TestReExportDefaultCommonJS ---------- /out.js ---------- -// /bar.js +// bar.js var require_bar = __commonJS((exports) => { __export(exports, { default: () => foo2 @@ -1682,32 +1682,32 @@ var require_bar = __commonJS((exports) => { } }); -// /foo.js +// foo.js var bar = __toModule(require_bar()); -// /entry.js +// entry.js bar.default(); ================================================================================ TestReExportDefaultExternalCommonJS ---------- /out.js ---------- -// /entry.js +// entry.js __export(exports, { bar: () => bar.default, foo: () => foo.default }); var foo = __toModule(require("foo")); -// /bar.js +// bar.js var bar = __toModule(require("bar")); ================================================================================ TestReExportDefaultExternalES6 ---------- /out.js ---------- -// /entry.js +// entry.js import {default as default3} from "foo"; -// /bar.js +// bar.js import {default as default2} from "bar"; export { default2 as bar, @@ -1717,10 +1717,10 @@ export { ================================================================================ TestReExportDefaultInternal ---------- /out.js ---------- -// /foo.js +// foo.js var foo_default = "foo"; -// /bar.js +// bar.js var bar_default = "bar"; export { bar_default as bar, @@ -1756,7 +1756,7 @@ export { ================================================================================ TestReExportFSNode ---------- /out.js ---------- -// /foo.js +// foo.js import * as fs from "fs"; import {readFileSync} from "fs"; export { @@ -1820,7 +1820,7 @@ class Bar { ================================================================================ TestRequireAndDynamicImportInvalidTemplate ---------- /out.js ---------- -// /entry.js +// entry.js require(tag`./b`); require(`./${b}`); try { @@ -1845,7 +1845,7 @@ try { ================================================================================ TestRequireBadArgumentCount ---------- /out.js ---------- -// /entry.js +// entry.js require(); require("a", "b"); try { @@ -1857,27 +1857,27 @@ try { ================================================================================ TestRequireChildDirCommonJS ---------- /out.js ---------- -// /Users/user/project/src/dir/index.js +// Users/user/project/src/dir/index.js var require_dir = __commonJS((exports, module) => { module.exports = 123; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log(require_dir()); ================================================================================ TestRequireChildDirES6 ---------- /out.js ---------- -// /Users/user/project/src/dir/index.js +// Users/user/project/src/dir/index.js var dir_default = 123; -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log(dir_default); ================================================================================ TestRequireFSNode ---------- /out.js ---------- -// /entry.js +// entry.js return require("fs"); ================================================================================ @@ -1888,7 +1888,7 @@ return require("fs"); ================================================================================ TestRequireJson ---------- /out.js ---------- -// /test.json +// test.json var require_test = __commonJS((exports, module) => { module.exports = { a: true, @@ -1897,18 +1897,18 @@ var require_test = __commonJS((exports, module) => { }; }); -// /entry.js +// entry.js console.log(require_test()); ================================================================================ TestRequireMainCommonJS ---------- /out.js ---------- -// /is-main.js +// is-main.js var require_is_main = __commonJS((exports2, module2) => { module2.exports = require.main === module2; }); -// /entry.js +// entry.js console.log("is main:", require.main === module); console.log(require_is_main()); @@ -1916,7 +1916,7 @@ console.log(require_is_main()); TestRequireMainIIFE ---------- /out.js ---------- (() => { - // /entry.js + // entry.js var require_entry = __commonJS((exports, module) => { console.log("is main:", require.main === module); }); @@ -1926,27 +1926,27 @@ TestRequireMainIIFE ================================================================================ TestRequireParentDirCommonJS ---------- /out.js ---------- -// /Users/user/project/src/index.js +// Users/user/project/src/index.js var require_src = __commonJS((exports, module) => { module.exports = 123; }); -// /Users/user/project/src/dir/entry.js +// Users/user/project/src/dir/entry.js console.log(require_src()); ================================================================================ TestRequireParentDirES6 ---------- /out.js ---------- -// /Users/user/project/src/index.js +// Users/user/project/src/index.js var src_default = 123; -// /Users/user/project/src/dir/entry.js +// Users/user/project/src/dir/entry.js console.log(src_default); ================================================================================ TestRequireResolve ---------- /out.js ---------- -// /entry.js +// entry.js console.log(require.resolve); console.log(require.resolve()); console.log(require.resolve(foo)); @@ -1974,18 +1974,18 @@ console.log(true); ================================================================================ TestRequireTxt ---------- /out.js ---------- -// /test.txt +// test.txt var require_test = __commonJS((exports, module) => { module.exports = "This is a test."; }); -// /entry.js +// entry.js console.log(require_test()); ================================================================================ TestRequireWithCallInsideTry ---------- /out.js ---------- -// /entry.js +// entry.js var require_entry = __commonJS((exports) => { try { const supportsColor = require("supports-color"); @@ -2000,26 +2000,26 @@ export default require_entry(); ================================================================================ TestRequireWithTemplate ---------- /out.js ---------- -// /b.js +// b.js var require_b = __commonJS((exports) => { exports.x = 123; }); -// /a.js +// a.js console.log(require_b()); console.log(require_b()); ================================================================================ TestRequireWithoutCall ---------- /out.js ---------- -// /entry.js +// entry.js var req = require; req("./entry"); ================================================================================ TestRequireWithoutCallInsideTry ---------- /out.js ---------- -// /entry.js +// entry.js try { oldLocale = globalLocale._abbr; aliasedRequire = require; @@ -2040,7 +2040,7 @@ console.log(__require()); ================================================================================ TestScopedExternalModuleExclusion ---------- /out.js ---------- -// /index.js +// index.js import {Foo} from "@scope/foo"; import {Bar} from "@scope/foo/bar"; var foo2 = new Foo(); @@ -2053,37 +2053,37 @@ export { ================================================================================ TestSimpleCommonJS ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /entry.js +// entry.js var fn = require_foo(); console.log(fn()); ================================================================================ TestSimpleES6 ---------- /out.js ---------- -// /foo.js +// foo.js function fn() { return 123; } -// /entry.js +// entry.js console.log(fn()); ================================================================================ TestSourceMap ---------- /Users/user/project/out.js ---------- -// /Users/user/project/src/bar.js +// Users/user/project/src/bar.js function bar() { throw new Error("test"); } -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js function foo() { bar(); } @@ -2105,7 +2105,7 @@ switch (bar) { ================================================================================ TestThisInsideFunction ---------- /out.js ---------- -// /entry.js +// entry.js function foo(x = this) { console.log(this); } @@ -2129,7 +2129,7 @@ new Foo(foo(obj)); ================================================================================ TestThisOutsideFunction ---------- /out.js ---------- -// /entry.js +// entry.js var require_entry = __commonJS((exports) => { console.log(exports); console.log((x = exports) => exports); @@ -2142,12 +2142,12 @@ export default require_entry(); ================================================================================ TestThisWithES6Syntax ---------- /out.js ---------- -// /cjs.js +// cjs.js var require_cjs = __commonJS((exports) => { console.log(exports); }); -// /dummy.js +// dummy.js var require_dummy = __commonJS((exports) => { __export(exports, { dummy: () => dummy3 @@ -2155,19 +2155,19 @@ var require_dummy = __commonJS((exports) => { var dummy3 = 123; }); -// /es6-export-star.js +// es6-export-star.js var require_es6_export_star = __commonJS((exports) => { __exportStar(exports, __toModule(require_dummy())); console.log(void 0); }); -// /es6-export-assign.ts +// es6-export-assign.ts var require_es6_export_assign = __commonJS((exports, module) => { console.log(void 0); module.exports = 123; }); -// /es6-ns-export-variable.ts +// es6-ns-export-variable.ts var require_es6_ns_export_variable = __commonJS((exports) => { var ns2; (function(ns3) { @@ -2176,7 +2176,7 @@ var require_es6_ns_export_variable = __commonJS((exports) => { console.log(exports); }); -// /es6-ns-export-function.ts +// es6-ns-export-function.ts var require_es6_ns_export_function = __commonJS((exports) => { var ns2; (function(ns3) { @@ -2187,7 +2187,7 @@ var require_es6_ns_export_function = __commonJS((exports) => { console.log(exports); }); -// /es6-ns-export-async-function.ts +// es6-ns-export-async-function.ts var require_es6_ns_export_async_function = __commonJS((exports) => { var ns2; (function(ns3) { @@ -2198,7 +2198,7 @@ var require_es6_ns_export_async_function = __commonJS((exports) => { console.log(exports); }); -// /es6-ns-export-enum.ts +// es6-ns-export-enum.ts var require_es6_ns_export_enum = __commonJS((exports) => { var ns2; (function(ns3) { @@ -2209,7 +2209,7 @@ var require_es6_ns_export_enum = __commonJS((exports) => { console.log(exports); }); -// /es6-ns-export-const-enum.ts +// es6-ns-export-const-enum.ts var require_es6_ns_export_const_enum = __commonJS((exports) => { var ns2; (function(ns3) { @@ -2220,17 +2220,17 @@ var require_es6_ns_export_const_enum = __commonJS((exports) => { console.log(exports); }); -// /es6-ns-export-module.ts +// es6-ns-export-module.ts var require_es6_ns_export_module = __commonJS((exports) => { console.log(exports); }); -// /es6-ns-export-namespace.ts +// es6-ns-export-namespace.ts var require_es6_ns_export_namespace = __commonJS((exports) => { console.log(exports); }); -// /es6-ns-export-class.ts +// es6-ns-export-class.ts var require_es6_ns_export_class = __commonJS((exports) => { var ns2; (function(ns3) { @@ -2241,7 +2241,7 @@ var require_es6_ns_export_class = __commonJS((exports) => { console.log(exports); }); -// /es6-ns-export-abstract-class.ts +// es6-ns-export-abstract-class.ts var require_es6_ns_export_abstract_class = __commonJS((exports) => { var ns2; (function(ns3) { @@ -2252,89 +2252,89 @@ var require_es6_ns_export_abstract_class = __commonJS((exports) => { console.log(exports); }); -// /entry.js +// entry.js var cjs = __toModule(require_cjs()); -// /es6-import-stmt.js +// es6-import-stmt.js var dummy = __toModule(require_dummy()); console.log(void 0); -// /es6-import-assign.ts +// es6-import-assign.ts var x = require_dummy(); console.log(void 0); -// /es6-import-dynamic.js +// es6-import-dynamic.js Promise.resolve().then(() => __toModule(require_dummy())); console.log(void 0); -// /es6-import-meta.js +// es6-import-meta.js console.log(void 0); -// /es6-expr-import-dynamic.js +// es6-expr-import-dynamic.js Promise.resolve().then(() => __toModule(require_dummy())); console.log(void 0); -// /es6-expr-import-meta.js +// es6-expr-import-meta.js console.log(void 0); -// /es6-export-variable.js +// es6-export-variable.js console.log(void 0); -// /es6-export-function.js +// es6-export-function.js console.log(void 0); -// /es6-export-async-function.js +// es6-export-async-function.js console.log(void 0); -// /es6-export-enum.ts +// es6-export-enum.ts var Foo; (function(Foo3) { })(Foo || (Foo = {})); console.log(void 0); -// /es6-export-const-enum.ts +// es6-export-const-enum.ts var Foo2; (function(Foo3) { })(Foo2 || (Foo2 = {})); console.log(void 0); -// /es6-export-module.ts +// es6-export-module.ts console.log(void 0); -// /es6-export-namespace.ts +// es6-export-namespace.ts console.log(void 0); -// /es6-export-class.js +// es6-export-class.js console.log(void 0); -// /es6-export-abstract-class.ts +// es6-export-abstract-class.ts console.log(void 0); -// /es6-export-default.js +// es6-export-default.js console.log(void 0); -// /es6-export-clause.js +// es6-export-clause.js console.log(void 0); -// /es6-export-clause-from.js +// es6-export-clause-from.js var dummy2 = __toModule(require_dummy()); console.log(void 0); -// /entry.js +// entry.js var es6_export_star = __toModule(require_es6_export_star()); -// /es6-export-star-as.js +// es6-export-star-as.js var ns = __toModule(require_dummy()); console.log(void 0); -// /entry.js +// entry.js var es6_export_assign = __toModule(require_es6_export_assign()); -// /es6-export-import-assign.ts +// es6-export-import-assign.ts var x2 = require_dummy(); console.log(void 0); -// /entry.js +// entry.js var es6_ns_export_variable = __toModule(require_es6_ns_export_variable()); var es6_ns_export_function = __toModule(require_es6_ns_export_function()); var es6_ns_export_async_function = __toModule(require_es6_ns_export_async_function()); @@ -2362,7 +2362,7 @@ for await (foo of bar) ================================================================================ TestTopLevelReturn ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports) => { __export(exports, { foo: () => foo3 @@ -2373,14 +2373,14 @@ var require_foo = __commonJS((exports) => { } }); -// /entry.js +// entry.js var foo = __toModule(require_foo()); foo.foo(); ================================================================================ TestTypeofRequireBadPatterns ---------- /out.js ---------- -// /entry.js +// entry.js console.log([ false, require, @@ -2397,7 +2397,7 @@ console.log([ ================================================================================ TestTypeofRequireBundle ---------- /out.js ---------- -// /entry.js +// entry.js console.log([ "function", true, @@ -2425,69 +2425,69 @@ TestUseStrictDirectiveMinifyNoBundle ================================================================================ TestWarningsInsideNodeModules ---------- /out.js ---------- -// /return-asi.js +// return-asi.js var require_return_asi = __commonJS(() => { return; }); -// /node_modules/return-asi.js +// node_modules/return-asi.js var require_return_asi2 = __commonJS(() => { return; }); -// /dup-case.js +// dup-case.js switch (x) { case 0: case 0: } -// /node_modules/dup-case.js +// node_modules/dup-case.js switch (x) { case 0: case 0: } -// /not-in.js +// not-in.js !a in b; -// /node_modules/not-in.js +// node_modules/not-in.js !a in b; -// /not-instanceof.js +// not-instanceof.js !a instanceof b; -// /node_modules/not-instanceof.js +// node_modules/not-instanceof.js !a instanceof b; -// /entry.js +// entry.js var return_asi = __toModule(require_return_asi()); var return_asi2 = __toModule(require_return_asi2()); -// /bad-typeof.js +// bad-typeof.js typeof x == "null"; -// /node_modules/bad-typeof.js +// node_modules/bad-typeof.js typeof x == "null"; -// /equals-neg-zero.js +// equals-neg-zero.js x === -0; -// /node_modules/equals-neg-zero.js +// node_modules/equals-neg-zero.js x === -0; -// /equals-nan.js +// equals-nan.js x === NaN; -// /node_modules/equals-nan.js +// node_modules/equals-nan.js x === NaN; -// /equals-object.js +// equals-object.js x === []; -// /node_modules/equals-object.js +// node_modules/equals-object.js x === []; -// /write-getter.js +// write-getter.js var Foo = class { get #foo() { } @@ -2496,7 +2496,7 @@ var Foo = class { } }; -// /node_modules/write-getter.js +// node_modules/write-getter.js var Foo2 = class { get #foo() { } @@ -2505,7 +2505,7 @@ var Foo2 = class { } }; -// /read-setter.js +// read-setter.js var Foo3 = class { set #foo(x2) { } @@ -2514,7 +2514,7 @@ var Foo3 = class { } }; -// /node_modules/read-setter.js +// node_modules/read-setter.js var Foo4 = class { set #foo(x2) { } @@ -2523,14 +2523,14 @@ var Foo4 = class { } }; -// /delete-super.js +// delete-super.js var Foo5 = class extends Bar { foo() { delete super.foo; } }; -// /node_modules/delete-super.js +// node_modules/delete-super.js var Foo6 = class extends Bar { foo() { delete super.foo; diff --git a/internal/bundler/snapshots/snapshots_importstar.txt b/internal/bundler/snapshots/snapshots_importstar.txt index 8a42e118d4f..cf4ffddee07 100644 --- a/internal/bundler/snapshots/snapshots_importstar.txt +++ b/internal/bundler/snapshots/snapshots_importstar.txt @@ -1,11 +1,11 @@ TestExportOtherAsNamespaceCommonJS ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports2) => { exports2.foo = 123; }); -// /entry.js +// entry.js __export(exports, { ns: () => ns }); @@ -14,12 +14,12 @@ var ns = __toModule(require_foo()); ================================================================================ TestExportOtherCommonJS ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports2) => { exports2.foo = 123; }); -// /entry.js +// entry.js __export(exports, { bar: () => foo.bar }); @@ -28,23 +28,23 @@ var foo = __toModule(require_foo()); ================================================================================ TestExportOtherNestedCommonJS ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports2) => { exports2.foo = 123; }); -// /entry.js +// entry.js __export(exports, { y: () => foo.x }); -// /bar.js +// bar.js var foo = __toModule(require_foo()); ================================================================================ TestExportSelfAndImportSelfCommonJS ---------- /out.js ---------- -// /entry.js +// entry.js __export(exports, { foo: () => foo }); @@ -54,7 +54,7 @@ console.log(exports); ================================================================================ TestExportSelfAndRequireSelfCommonJS ---------- /out.js ---------- -// /entry.js +// entry.js var require_entry = __commonJS((exports) => { __export(exports, { foo: () => foo @@ -67,7 +67,7 @@ module.exports = require_entry(); ================================================================================ TestExportSelfAsNamespaceCommonJS ---------- /out.js ---------- -// /entry.js +// entry.js __export(exports, { foo: () => foo, ns: () => exports @@ -77,7 +77,7 @@ var foo = 123; ================================================================================ TestExportSelfAsNamespaceES6 ---------- /out.js ---------- -// /entry.js +// entry.js var entry_exports = {}; __export(entry_exports, { foo: () => foo, @@ -92,7 +92,7 @@ export { ================================================================================ TestExportSelfCommonJS ---------- /out.js ---------- -// /entry.js +// entry.js __export(exports, { foo: () => foo }); @@ -101,7 +101,7 @@ var foo = 123; ================================================================================ TestExportSelfCommonJSMinified ---------- /out.js ---------- -// /entry.js +// entry.js var e = n((t, r) => { r.exports = {foo: 123}; console.log(e()); @@ -111,7 +111,7 @@ module.exports = e(); ================================================================================ TestExportSelfES6 ---------- /out.js ---------- -// /entry.js +// entry.js var foo = 123; export { foo @@ -121,7 +121,7 @@ export { TestExportSelfIIFE ---------- /out.js ---------- (() => { - // /entry.js + // entry.js var foo = 123; })(); @@ -129,7 +129,7 @@ TestExportSelfIIFE TestExportSelfIIFEWithName ---------- /out.js ---------- var someName = (() => { - // /entry.js + // entry.js var entry_exports = {}; __export(entry_exports, { foo: () => foo @@ -141,113 +141,113 @@ var someName = (() => { ================================================================================ TestExportStarDefaultExportCommonJS ---------- /out.js ---------- -// /entry.js +// entry.js __export(exports, { foo: () => foo }); -// /foo.js +// foo.js var foo = "foo"; ================================================================================ TestImportDefaultNamespaceComboIssue446 ---------- /out/external-default2.js ---------- -// /external-default2.js +// external-default2.js import def, {default as default2} from "external"; console.log(def, default2); ---------- /out/external-ns.js ---------- -// /external-ns.js +// external-ns.js import def, * as ns from "external"; console.log(def, ns); ---------- /out/external-ns-default.js ---------- -// /external-ns-default.js +// external-ns-default.js import def, * as ns from "external"; console.log(def, ns, ns.default); ---------- /out/external-ns-def.js ---------- -// /external-ns-def.js +// external-ns-def.js import def, * as ns from "external"; console.log(def, ns, ns.def); ---------- /out/external-default.js ---------- -// /external-default.js +// external-default.js import def, { default as default2 } from "external"; console.log(def, default2); ---------- /out/external-def.js ---------- -// /external-def.js +// external-def.js import def, { def as def2 } from "external"; console.log(def, def2); ---------- /out/internal-default2.js ---------- -// /internal.js +// internal.js var internal_default = 123; -// /internal-default2.js +// internal-default2.js console.log(internal_default, internal_default); ---------- /out/internal-ns.js ---------- -// /internal.js +// internal.js var internal_exports = {}; __export(internal_exports, { default: () => internal_default }); var internal_default = 123; -// /internal-ns.js +// internal-ns.js console.log(internal_default, internal_exports); ---------- /out/internal-ns-default.js ---------- -// /internal.js +// internal.js var internal_exports = {}; __export(internal_exports, { default: () => internal_default }); var internal_default = 123; -// /internal-ns-default.js +// internal-ns-default.js console.log(internal_default, internal_exports, internal_default); ---------- /out/internal-ns-def.js ---------- -// /internal.js +// internal.js var internal_exports = {}; __export(internal_exports, { default: () => internal_default }); var internal_default = 123; -// /internal-ns-def.js +// internal-ns-def.js console.log(internal_default, internal_exports, void 0); ---------- /out/internal-default.js ---------- -// /internal.js +// internal.js var internal_default = 123; -// /internal-default.js +// internal-default.js console.log(internal_default, internal_default); ---------- /out/internal-def.js ---------- -// /internal.js +// internal.js var internal_default = 123; -// /internal-def.js +// internal-def.js console.log(internal_default, void 0); ================================================================================ TestImportExportOtherAsNamespaceCommonJS ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports2) => { exports2.foo = 123; }); -// /entry.js +// entry.js __export(exports, { ns: () => ns }); @@ -256,7 +256,7 @@ var ns = __toModule(require_foo()); ================================================================================ TestImportExportSelfAsNamespaceES6 ---------- /out.js ---------- -// /entry.js +// entry.js var entry_exports = {}; __export(entry_exports, { foo: () => foo, @@ -271,35 +271,35 @@ export { ================================================================================ TestImportOfExportStar ---------- /out.js ---------- -// /bar.js +// bar.js statement(); statement(); statement(); statement(); var bar = 123; -// /entry.js +// entry.js console.log(bar); ================================================================================ TestImportOfExportStarOfImport ---------- /out.js ---------- -// /baz.js +// baz.js var value = 123; -// /foo.js +// foo.js statement(); statement(); statement(); statement(); -// /entry.js +// entry.js console.log(value); ================================================================================ TestImportSelfCommonJS ---------- /out.js ---------- -// /entry.js +// entry.js var require_entry = __commonJS((exports) => { var entry = __toModule(require_entry()); exports.foo = 123; @@ -310,7 +310,7 @@ module.exports = require_entry(); ================================================================================ TestImportStarAndCommonJS ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports) => { __export(exports, { foo: () => foo2 @@ -318,7 +318,7 @@ var require_foo = __commonJS((exports) => { var foo2 = 123; }); -// /entry.js +// entry.js var ns = __toModule(require_foo()); var ns2 = require_foo(); console.log(ns.foo, ns2.foo); @@ -326,26 +326,26 @@ console.log(ns.foo, ns2.foo); ================================================================================ TestImportStarCapture ---------- /out.js ---------- -// /foo.js +// foo.js var foo_exports = {}; __export(foo_exports, { foo: () => foo }); var foo = 123; -// /entry.js +// entry.js var foo2 = 234; console.log(foo_exports, foo, foo2); ================================================================================ TestImportStarCommonJSCapture ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports) => { exports.foo = 123; }); -// /entry.js +// entry.js var ns = __toModule(require_foo()); var foo = 234; console.log(ns, ns.foo, foo); @@ -353,12 +353,12 @@ console.log(ns, ns.foo, foo); ================================================================================ TestImportStarCommonJSNoCapture ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports) => { exports.foo = 123; }); -// /entry.js +// entry.js var ns = __toModule(require_foo()); var foo2 = 234; console.log(ns.foo, ns.foo, foo2); @@ -366,12 +366,12 @@ console.log(ns.foo, ns.foo, foo2); ================================================================================ TestImportStarCommonJSUnused ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports) => { exports.foo = 123; }); -// /entry.js +// entry.js var ns = __toModule(require_foo()); var foo = 234; console.log(foo); @@ -379,122 +379,122 @@ console.log(foo); ================================================================================ TestImportStarExportImportStarCapture ---------- /out.js ---------- -// /foo.js +// foo.js var foo_exports = {}; __export(foo_exports, { foo: () => foo }); var foo = 123; -// /entry.js +// entry.js var foo2 = 234; console.log(foo_exports, foo_exports.foo, foo2); ================================================================================ TestImportStarExportImportStarNoCapture ---------- /out.js ---------- -// /foo.js +// foo.js var foo_exports = {}; __export(foo_exports, { foo: () => foo }); var foo = 123; -// /entry.js +// entry.js var foo2 = 234; console.log(foo_exports.foo, foo_exports.foo, foo2); ================================================================================ TestImportStarExportImportStarUnused ---------- /out.js ---------- -// /entry.js +// entry.js var foo = 234; console.log(foo); ================================================================================ TestImportStarExportStarAsCapture ---------- /out.js ---------- -// /foo.js +// foo.js var foo_exports = {}; __export(foo_exports, { foo: () => foo }); var foo = 123; -// /entry.js +// entry.js var foo2 = 234; console.log(foo_exports, foo_exports.foo, foo2); ================================================================================ TestImportStarExportStarAsNoCapture ---------- /out.js ---------- -// /foo.js +// foo.js var foo_exports = {}; __export(foo_exports, { foo: () => foo }); var foo = 123; -// /entry.js +// entry.js var foo2 = 234; console.log(foo_exports.foo, foo_exports.foo, foo2); ================================================================================ TestImportStarExportStarAsUnused ---------- /out.js ---------- -// /entry.js +// entry.js var foo = 234; console.log(foo); ================================================================================ TestImportStarExportStarCapture ---------- /out.js ---------- -// /bar.js +// bar.js var bar_exports = {}; __export(bar_exports, { foo: () => foo }); -// /foo.js +// foo.js var foo = 123; -// /entry.js +// entry.js var foo2 = 234; console.log(bar_exports, foo, foo2); ================================================================================ TestImportStarExportStarNoCapture ---------- /out.js ---------- -// /foo.js +// foo.js var foo = 123; -// /entry.js +// entry.js var foo2 = 234; console.log(foo, foo, foo2); ================================================================================ TestImportStarExportStarOmitAmbiguous ---------- /out.js ---------- -// /common.js +// common.js var common_exports = {}; __export(common_exports, { x: () => x, z: () => z }); -// /foo.js +// foo.js var x = 1; -// /bar.js +// bar.js var z = 4; -// /entry.js +// entry.js console.log(common_exports); ================================================================================ TestImportStarExportStarUnused ---------- /out.js ---------- -// /entry.js +// entry.js var foo = 234; console.log(foo); @@ -543,122 +543,122 @@ console.log(foo); ================================================================================ TestImportStarNoCapture ---------- /out.js ---------- -// /foo.js +// foo.js var foo = 123; -// /entry.js +// entry.js var foo2 = 234; console.log(foo, foo, foo2); ================================================================================ TestImportStarOfExportStarAs ---------- /out.js ---------- -// /foo.js +// foo.js var foo_exports = {}; __export(foo_exports, { bar_ns: () => bar_exports }); -// /bar.js +// bar.js var bar_exports = {}; __export(bar_exports, { bar: () => bar }); var bar = 123; -// /entry.js +// entry.js console.log(foo_exports); ================================================================================ TestImportStarUnused ---------- /out.js ---------- -// /entry.js +// entry.js var foo = 234; console.log(foo); ================================================================================ TestIssue176 ---------- /out.js ---------- -// /folders/index.js +// folders/index.js var folders_exports = {}; __export(folders_exports, { foo: () => foo }); -// /folders/child/foo.js +// folders/child/foo.js var foo = () => "hi there"; -// /entry.js +// entry.js console.log(JSON.stringify(folders_exports)); ================================================================================ TestNamespaceImportMissingCommonJS ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports) => { exports.x = 123; }); -// /entry.js +// entry.js var ns = __toModule(require_foo()); console.log(ns, ns.foo); ================================================================================ TestNamespaceImportMissingES6 ---------- /out.js ---------- -// /foo.js +// foo.js var foo_exports = {}; __export(foo_exports, { x: () => x }); var x = 123; -// /entry.js +// entry.js console.log(foo_exports, void 0); ================================================================================ TestNamespaceImportReExportStarMissingES6 ---------- /out.js ---------- -// /foo.js +// foo.js var foo_exports = {}; __export(foo_exports, { x: () => x }); -// /bar.js +// bar.js var x = 123; -// /entry.js +// entry.js console.log(foo_exports, void 0); ================================================================================ TestNamespaceImportReExportStarUnusedMissingES6 ---------- /out.js ---------- -// /entry.js +// entry.js console.log(void 0); ================================================================================ TestNamespaceImportUnusedMissingCommonJS ---------- /out.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports) => { exports.x = 123; }); -// /entry.js +// entry.js var ns = __toModule(require_foo()); console.log(ns.foo); ================================================================================ TestNamespaceImportUnusedMissingES6 ---------- /out.js ---------- -// /entry.js +// entry.js console.log(void 0); ================================================================================ TestOtherFileExportSelfAsNamespaceUnusedES6 ---------- /out.js ---------- -// /foo.js +// foo.js var foo = 123; export { foo @@ -667,7 +667,7 @@ export { ================================================================================ TestOtherFileImportExportSelfAsNamespaceUnusedES6 ---------- /out.js ---------- -// /foo.js +// foo.js var foo = 123; export { foo @@ -676,33 +676,33 @@ export { ================================================================================ TestReExportNamespaceImportMissingES6 ---------- /out.js ---------- -// /bar.js +// bar.js var bar_exports = {}; __export(bar_exports, { x: () => x }); var x = 123; -// /entry.js +// entry.js console.log(bar_exports, bar_exports.foo); ================================================================================ TestReExportNamespaceImportUnusedMissingES6 ---------- /out.js ---------- -// /bar.js +// bar.js var bar_exports = {}; __export(bar_exports, { x: () => x }); var x = 123; -// /entry.js +// entry.js console.log(bar_exports.foo); ================================================================================ TestReExportOtherFileExportSelfAsNamespaceES6 ---------- /out.js ---------- -// /foo.js +// foo.js var foo_exports = {}; __export(foo_exports, { foo: () => foo, @@ -717,7 +717,7 @@ export { ================================================================================ TestReExportOtherFileImportExportSelfAsNamespaceES6 ---------- /out.js ---------- -// /foo.js +// foo.js var foo_exports = {}; __export(foo_exports, { foo: () => foo, @@ -748,7 +748,7 @@ export { ================================================================================ TestReExportStarAsExternalCommonJS ---------- /out.js ---------- -// /entry.js +// entry.js __export(exports, { out: () => out }); @@ -757,7 +757,7 @@ var out = __toModule(require("foo")); ================================================================================ TestReExportStarAsExternalES6 ---------- /out.js ---------- -// /entry.js +// entry.js import * as out from "foo"; export { out @@ -767,7 +767,7 @@ export { TestReExportStarAsExternalIIFE ---------- /out.js ---------- var mod = (() => { - // /entry.js + // entry.js var entry_exports = {}; __export(entry_exports, { out: () => out @@ -801,20 +801,20 @@ export * from "foo"; ================================================================================ TestReExportStarExternalCommonJS ---------- /out.js ---------- -// /entry.js +// entry.js __exportStar(exports, __toModule(require("foo"))); ================================================================================ TestReExportStarExternalES6 ---------- /out.js ---------- -// /entry.js +// entry.js export * from "foo"; ================================================================================ TestReExportStarExternalIIFE ---------- /out.js ---------- var mod = (() => { - // /entry.js + // entry.js var require_entry = __commonJS((exports) => { __exportStar(exports, __toModule(require("foo"))); }); @@ -834,7 +834,7 @@ var mod = (() => { ================================================================================ TestReExportStarNameCollisionNotAmbiguousExport ---------- /out.js ---------- -// /c.js +// c.js var x = 1; var y = 2; export { @@ -845,9 +845,9 @@ export { ================================================================================ TestReExportStarNameCollisionNotAmbiguousImport ---------- /out.js ---------- -// /c.js +// c.js var x = 1; var y = 2; -// /entry.js +// entry.js console.log(x, y); diff --git a/internal/bundler/snapshots/snapshots_importstar_ts.txt b/internal/bundler/snapshots/snapshots_importstar_ts.txt index eb7e9846145..7c02ec7f64f 100644 --- a/internal/bundler/snapshots/snapshots_importstar_ts.txt +++ b/internal/bundler/snapshots/snapshots_importstar_ts.txt @@ -1,6 +1,6 @@ TestTSImportStarAndCommonJS ---------- /out.js ---------- -// /foo.ts +// foo.ts var require_foo = __commonJS((exports) => { __export(exports, { foo: () => foo2 @@ -8,7 +8,7 @@ var require_foo = __commonJS((exports) => { var foo2 = 123; }); -// /entry.js +// entry.js var ns = __toModule(require_foo()); var ns2 = require_foo(); console.log(ns.foo, ns2.foo); @@ -16,26 +16,26 @@ console.log(ns.foo, ns2.foo); ================================================================================ TestTSImportStarCapture ---------- /out.js ---------- -// /foo.ts +// foo.ts var foo_exports = {}; __export(foo_exports, { foo: () => foo }); var foo = 123; -// /entry.ts +// entry.ts var foo2 = 234; console.log(foo_exports, foo, foo2); ================================================================================ TestTSImportStarCommonJSCapture ---------- /out.js ---------- -// /foo.ts +// foo.ts var require_foo = __commonJS((exports) => { exports.foo = 123; }); -// /entry.ts +// entry.ts var ns = __toModule(require_foo()); var foo = 234; console.log(ns, ns.foo, foo); @@ -43,12 +43,12 @@ console.log(ns, ns.foo, foo); ================================================================================ TestTSImportStarCommonJSNoCapture ---------- /out.js ---------- -// /foo.ts +// foo.ts var require_foo = __commonJS((exports) => { exports.foo = 123; }); -// /entry.ts +// entry.ts var ns = __toModule(require_foo()); var foo2 = 234; console.log(ns.foo, ns.foo, foo2); @@ -56,110 +56,110 @@ console.log(ns.foo, ns.foo, foo2); ================================================================================ TestTSImportStarCommonJSUnused ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = 234; console.log(foo); ================================================================================ TestTSImportStarExportImportStarCapture ---------- /out.js ---------- -// /foo.ts +// foo.ts var foo_exports = {}; __export(foo_exports, { foo: () => foo }); var foo = 123; -// /entry.ts +// entry.ts var foo2 = 234; console.log(foo_exports, foo_exports.foo, foo2); ================================================================================ TestTSImportStarExportImportStarNoCapture ---------- /out.js ---------- -// /foo.ts +// foo.ts var foo_exports = {}; __export(foo_exports, { foo: () => foo }); var foo = 123; -// /entry.ts +// entry.ts var foo2 = 234; console.log(foo_exports.foo, foo_exports.foo, foo2); ================================================================================ TestTSImportStarExportImportStarUnused ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = 234; console.log(foo); ================================================================================ TestTSImportStarExportStarAsCapture ---------- /out.js ---------- -// /foo.ts +// foo.ts var foo_exports = {}; __export(foo_exports, { foo: () => foo }); var foo = 123; -// /entry.ts +// entry.ts var foo2 = 234; console.log(foo_exports, foo_exports.foo, foo2); ================================================================================ TestTSImportStarExportStarAsNoCapture ---------- /out.js ---------- -// /foo.ts +// foo.ts var foo_exports = {}; __export(foo_exports, { foo: () => foo }); var foo = 123; -// /entry.ts +// entry.ts var foo2 = 234; console.log(foo_exports.foo, foo_exports.foo, foo2); ================================================================================ TestTSImportStarExportStarAsUnused ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = 234; console.log(foo); ================================================================================ TestTSImportStarExportStarCapture ---------- /out.js ---------- -// /bar.ts +// bar.ts var bar_exports = {}; __export(bar_exports, { foo: () => foo }); -// /foo.ts +// foo.ts var foo = 123; -// /entry.ts +// entry.ts var foo2 = 234; console.log(bar_exports, foo, foo2); ================================================================================ TestTSImportStarExportStarNoCapture ---------- /out.js ---------- -// /foo.ts +// foo.ts var foo = 123; -// /entry.ts +// entry.ts var foo2 = 234; console.log(foo, foo, foo2); ================================================================================ TestTSImportStarExportStarUnused ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = 234; console.log(foo); @@ -206,34 +206,34 @@ console.log(foo); ================================================================================ TestTSImportStarNoCapture ---------- /out.js ---------- -// /foo.ts +// foo.ts var foo = 123; -// /entry.ts +// entry.ts var foo2 = 234; console.log(foo, foo, foo2); ================================================================================ TestTSImportStarUnused ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = 234; console.log(foo); ================================================================================ TestTSReExportTypeOnlyFileES6 ---------- /out.js ---------- -// /types1.ts +// types1.ts console.log("some code"); -// /types2.ts +// types2.ts console.log("some code"); -// /types3.ts +// types3.ts console.log("some code"); -// /values.ts +// values.ts var foo = 123; -// /entry.ts +// entry.ts console.log(foo); diff --git a/internal/bundler/snapshots/snapshots_loader.txt b/internal/bundler/snapshots/snapshots_loader.txt index 8036fd02fb6..2bc3f39b269 100644 --- a/internal/bundler/snapshots/snapshots_loader.txt +++ b/internal/bundler/snapshots/snapshots_loader.txt @@ -1,46 +1,46 @@ TestAutoDetectMimeTypeFromExtension ---------- /out.js ---------- -// /test.svg +// test.svg var require_test = __commonJS((exports, module) => { module.exports = "data:image/svg+xml;base64,YQBigGP/ZA=="; }); -// /entry.js +// entry.js console.log(require_test()); ================================================================================ TestJSXSyntaxInJSWithJSXLoader ---------- /out.js ---------- -// /entry.js +// entry.js console.log(/* @__PURE__ */ React.createElement("div", null)); ================================================================================ TestLoaderBase64CommonJSAndES6 ---------- /out.js ---------- -// /x.b64 +// x.b64 var require_x = __commonJS((exports, module) => { module.exports = "eA=="; }); -// /y.b64 +// y.b64 var y_default = "eQ=="; -// /entry.js +// entry.js var x_b64 = require_x(); console.log(x_b64, y_default); ================================================================================ TestLoaderDataURLCommonJSAndES6 ---------- /out.js ---------- -// /x.txt +// x.txt var require_x = __commonJS((exports, module) => { module.exports = "data:text/plain;charset=utf-8;base64,eA=="; }); -// /y.txt +// y.txt var y_default = "data:text/plain;charset=utf-8;base64,eQ=="; -// /entry.js +// entry.js var x_url = require_x(); console.log(x_url, y_default); @@ -49,12 +49,12 @@ TestLoaderFile ---------- /out/test.T3K5TRK4.svg ---------- ---------- /out/entry.js ---------- -// /test.svg +// test.svg var require_test = __commonJS((exports, module) => { module.exports = "test.T3K5TRK4.svg"; }); -// /entry.js +// entry.js console.log(require_test()); ================================================================================ @@ -64,15 +64,15 @@ y ---------- /x.CH3K3DWF.txt ---------- x ---------- /out.js ---------- -// /x.txt +// x.txt var require_x = __commonJS((exports, module) => { module.exports = "x.CH3K3DWF.txt"; }); -// /y.txt +// y.txt var y_default = "y.SXFQX7JJ.txt"; -// /entry.js +// entry.js var x_url = require_x(); console.log(x_url, y_default); @@ -81,47 +81,47 @@ TestLoaderFileMultipleNoCollision ---------- /dist/test.VFFI7ZOM.txt ---------- test ---------- /dist/out.js ---------- -// /a/test.txt +// a/test.txt var require_test = __commonJS((exports, module) => { module.exports = "test.VFFI7ZOM.txt"; }); -// /b/test.txt +// b/test.txt var require_test2 = __commonJS((exports, module) => { module.exports = "test.VFFI7ZOM.txt"; }); -// /entry.js +// entry.js console.log(require_test(), require_test2()); ================================================================================ TestLoaderJSONCommonJSAndES6 ---------- /out.js ---------- -// /x.json +// x.json var require_x = __commonJS((exports, module) => { module.exports = {x: true}; }); -// /y.json +// y.json var y1 = true; var y2 = false; var y_default = {y1, y2}; -// /z.json +// z.json var small = "some small text"; var if2 = "test keyword imports"; -// /entry.js +// entry.js var x_json = require_x(); console.log(x_json, y_default, small, if2); ================================================================================ TestLoaderJSONInvalidIdentifierES6 ---------- /out.js ---------- -// /test.json +// test.json var invalid_identifier = true; -// /test2.json +// test2.json var test2_exports = {}; __export(test2_exports, { default: () => test2_default, @@ -130,7 +130,7 @@ __export(test2_exports, { var invalid_identifier2 = true; var test2_default = {"invalid-identifier": invalid_identifier2}; -// /entry.js +// entry.js console.log(invalid_identifier, test2_exports); ================================================================================ @@ -166,81 +166,81 @@ TestLoaderJSONNoBundleIIFE ================================================================================ TestLoaderJSONSharedWithMultipleEntriesIssue413 ---------- /out/a.js ---------- -// /data.json +// data.json var test = 123; var data_default = {test}; -// /a.js +// a.js console.log("a:", data_default); ---------- /out/b.js ---------- -// /data.json +// data.json var test = 123; var data_default = {test}; -// /b.js +// b.js console.log("b:", data_default); ================================================================================ TestLoaderTextCommonJSAndES6 ---------- /out.js ---------- -// /x.txt +// x.txt var require_x = __commonJS((exports, module) => { module.exports = "x"; }); -// /y.txt +// y.txt var y_default = "y"; -// /entry.js +// entry.js var x_txt = require_x(); console.log(x_txt, y_default); ================================================================================ TestRequireCustomExtensionBase64 ---------- /out.js ---------- -// /test.custom +// test.custom var require_test = __commonJS((exports, module) => { module.exports = "YQBigGP/ZA=="; }); -// /entry.js +// entry.js console.log(require_test()); ================================================================================ TestRequireCustomExtensionDataURL ---------- /out.js ---------- -// /test.custom +// test.custom var require_test = __commonJS((exports, module) => { module.exports = "data:application/octet-stream;base64,YQBigGP/ZA=="; }); -// /entry.js +// entry.js console.log(require_test()); ================================================================================ TestRequireCustomExtensionPreferLongest ---------- /out.js ---------- -// /test.txt +// test.txt var require_test = __commonJS((exports, module) => { module.exports = "test.txt"; }); -// /test.base64.txt +// test.base64.txt var require_test_base64 = __commonJS((exports, module) => { module.exports = "dGVzdC5iYXNlNjQudHh0"; }); -// /entry.js +// entry.js console.log(require_test(), require_test_base64()); ================================================================================ TestRequireCustomExtensionString ---------- /out.js ---------- -// /test.custom +// test.custom var require_test = __commonJS((exports, module) => { module.exports = "#include "; }); -// /entry.js +// entry.js console.log(require_test()); diff --git a/internal/bundler/snapshots/snapshots_lower.txt b/internal/bundler/snapshots/snapshots_lower.txt index b2c2b4276f3..392ac2f5378 100644 --- a/internal/bundler/snapshots/snapshots_lower.txt +++ b/internal/bundler/snapshots/snapshots_lower.txt @@ -118,7 +118,7 @@ class Derived extends Base { ================================================================================ TestLowerAsyncThis2016CommonJS ---------- /out.js ---------- -// /entry.js +// entry.js var require_entry = __commonJS((exports) => { exports.foo = () => __async(exports, null, function* () { return exports; @@ -129,7 +129,7 @@ export default require_entry(); ================================================================================ TestLowerAsyncThis2016ES6 ---------- /out.js ---------- -// /entry.js +// entry.js var foo = () => __async(void 0, null, function* () { return void 0; }); @@ -175,7 +175,7 @@ class Foo { ================================================================================ TestLowerClassFieldStrictTsconfigJson2020 ---------- /out.js ---------- -// /loose/index.js +// loose/index.js var loose_default = class { constructor() { __publicField(this, "foo"); @@ -183,7 +183,7 @@ var loose_default = class { }; var loose_default2 = loose_default; -// /strict/index.js +// strict/index.js var strict_default = class { constructor() { __publicField(this, "foo"); @@ -191,17 +191,17 @@ var strict_default = class { }; var strict_default2 = strict_default; -// /entry.js +// entry.js console.log(loose_default2, strict_default2); ================================================================================ TestLowerExportStarAsNameCollision ---------- /out.js ---------- -// /nested.js +// nested.js import * as foo from "path2"; var foo2 = 123; -// /entry.js +// entry.js import * as ns from "path1"; console.log(foo, foo2); var ns2 = 123; @@ -470,7 +470,7 @@ class Foo { ================================================================================ TestLowerPrivateGetterSetter2015 ---------- /out.js ---------- -// /entry.js +// entry.js var _foo, foo_get, _bar, bar_set, _prop, prop_get, prop_set; var Foo = class { constructor() { @@ -530,7 +530,7 @@ prop_set = function(val) { ================================================================================ TestLowerPrivateGetterSetter2019 ---------- /out.js ---------- -// /entry.js +// entry.js var _foo, foo_get, _bar, bar_set, _prop, prop_get, prop_set; var Foo = class { constructor() { @@ -590,7 +590,7 @@ prop_set = function(val) { ================================================================================ TestLowerPrivateGetterSetter2020 ---------- /out.js ---------- -// /entry.js +// entry.js var _foo, foo_get, _bar, bar_set, _prop, prop_get, prop_set; var Foo = class { constructor() { @@ -650,7 +650,7 @@ prop_set = function(val) { ================================================================================ TestLowerPrivateGetterSetterNext ---------- /out.js ---------- -// /entry.js +// entry.js var Foo = class { get #foo() { return this.foo; @@ -699,7 +699,7 @@ var Foo = class { ================================================================================ TestLowerPrivateMethod2019 ---------- /out.js ---------- -// /entry.js +// entry.js var _field, _method, method_fn; var Foo = class { constructor() { @@ -741,7 +741,7 @@ method_fn = function() { ================================================================================ TestLowerPrivateMethod2020 ---------- /out.js ---------- -// /entry.js +// entry.js var _field, _method, method_fn; var Foo = class { constructor() { @@ -782,7 +782,7 @@ method_fn = function() { ================================================================================ TestLowerPrivateMethodNext ---------- /out.js ---------- -// /entry.js +// entry.js var Foo = class { #field; #method() { @@ -815,7 +815,7 @@ var Foo = class { ================================================================================ TestLowerPrivateMethodWithModifiers2020 ---------- /out.js ---------- -// /entry.js +// entry.js var _g, g_fn, _a, a_fn, _ag, ag_fn, _sg, sg_fn, _sa, sa_fn, _sag, sag_fn; var Foo = class { constructor() { @@ -868,12 +868,12 @@ Foo.s_foo = 123; ================================================================================ TestTSLowerClassFieldStrictTsconfigJson2020 ---------- /out.js ---------- -// /loose/index.ts +// loose/index.ts var loose_default = class { }; var loose_default2 = loose_default; -// /strict/index.ts +// strict/index.ts var strict_default = class { constructor() { __publicField(this, "foo"); @@ -881,7 +881,7 @@ var strict_default = class { }; var strict_default2 = strict_default; -// /entry.js +// entry.js console.log(loose_default2, strict_default2); ================================================================================ @@ -1033,7 +1033,7 @@ for ({...x} = {}; x; x = null) { ================================================================================ TestTSLowerPrivateFieldAndMethodAvoidNameCollision2015 ---------- /out.js ---------- -// /entry.ts +// entry.ts var _x; var WeakMap2 = class { constructor() { diff --git a/internal/bundler/snapshots/snapshots_packagejson.txt b/internal/bundler/snapshots/snapshots_packagejson.txt index 3b4008ec836..158130d2663 100644 --- a/internal/bundler/snapshots/snapshots_packagejson.txt +++ b/internal/bundler/snapshots/snapshots_packagejson.txt @@ -1,27 +1,27 @@ TestPackageJsonBadMain ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var require_demo_pkg = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_demo_pkg()); console.log(demo_pkg.default()); ================================================================================ TestPackageJsonBrowserMapAvoidMissing ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/component-indexof/index.js +// Users/user/project/node_modules/component-indexof/index.js var require_component_indexof = __commonJS((exports, module) => { module.exports = function() { return 234; }; }); -// /Users/user/project/node_modules/component-classes/index.js +// Users/user/project/node_modules/component-classes/index.js try { index = require_component_indexof(); } catch (err) { @@ -36,7 +36,7 @@ TestPackageJsonBrowserMapModuleDisabled var require_node_pkg = __commonJS(() => { }); -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var require_demo_pkg = __commonJS((exports, module) => { var fn2 = require_node_pkg(); module.exports = function() { @@ -44,21 +44,21 @@ var require_demo_pkg = __commonJS((exports, module) => { }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_demo_pkg()); console.log(demo_pkg.default()); ================================================================================ TestPackageJsonBrowserMapModuleToModule ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/node-pkg-browser/index.js +// Users/user/project/node_modules/node-pkg-browser/index.js var require_node_pkg_browser = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var require_demo_pkg = __commonJS((exports, module) => { var fn2 = require_node_pkg_browser(); module.exports = function() { @@ -66,21 +66,21 @@ var require_demo_pkg = __commonJS((exports, module) => { }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_demo_pkg()); console.log(demo_pkg.default()); ================================================================================ TestPackageJsonBrowserMapModuleToRelative ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/node-pkg-browser.js +// Users/user/project/node_modules/demo-pkg/node-pkg-browser.js var require_node_pkg_browser = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var require_demo_pkg = __commonJS((exports, module) => { var fn2 = require_node_pkg_browser(); module.exports = function() { @@ -88,7 +88,7 @@ var require_demo_pkg = __commonJS((exports, module) => { }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_demo_pkg()); console.log(demo_pkg.default()); @@ -99,7 +99,7 @@ TestPackageJsonBrowserMapNativeModuleDisabled var require_fs = __commonJS(() => { }); -// /Users/user/project/node_modules/demo-pkg/index.js +// Users/user/project/node_modules/demo-pkg/index.js var require_demo_pkg = __commonJS((exports, module) => { var fs = require_fs(); module.exports = function() { @@ -107,7 +107,7 @@ var require_demo_pkg = __commonJS((exports, module) => { }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_demo_pkg()); console.log(demo_pkg.default()); @@ -118,7 +118,7 @@ TestPackageJsonBrowserMapRelativeDisabled var require_util_node = __commonJS(() => { }); -// /Users/user/project/node_modules/demo-pkg/main.js +// Users/user/project/node_modules/demo-pkg/main.js var require_main = __commonJS((exports, module) => { var util = require_util_node(); module.exports = function(obj) { @@ -126,19 +126,19 @@ var require_main = __commonJS((exports, module) => { }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_main()); console.log(demo_pkg.default()); ================================================================================ TestPackageJsonBrowserMapRelativeToModule ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/util-browser/index.js +// Users/user/project/node_modules/util-browser/index.js var require_util_browser = __commonJS((exports, module) => { module.exports = "util-browser"; }); -// /Users/user/project/node_modules/demo-pkg/main.js +// Users/user/project/node_modules/demo-pkg/main.js var require_main = __commonJS((exports, module) => { var util = require_util_browser(); module.exports = function() { @@ -146,19 +146,19 @@ var require_main = __commonJS((exports, module) => { }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_main()); console.log(demo_pkg.default()); ================================================================================ TestPackageJsonBrowserMapRelativeToRelative ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/lib/util-browser.js +// Users/user/project/node_modules/demo-pkg/lib/util-browser.js var require_util_browser = __commonJS((exports, module) => { module.exports = "util-browser"; }); -// /Users/user/project/node_modules/demo-pkg/main-browser.js +// Users/user/project/node_modules/demo-pkg/main-browser.js var require_main_browser = __commonJS((exports, module) => { var util = require_util_browser(); module.exports = function() { @@ -166,96 +166,96 @@ var require_main_browser = __commonJS((exports, module) => { }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_main_browser()); console.log(demo_pkg.default()); ================================================================================ TestPackageJsonBrowserOverMainNode ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/main.js +// Users/user/project/node_modules/demo-pkg/main.js var require_main = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_main()); console.log(demo_pkg.default()); ================================================================================ TestPackageJsonBrowserOverModuleBrowser ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/main.browser.js +// Users/user/project/node_modules/demo-pkg/main.browser.js var require_main_browser = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_main_browser()); console.log(demo_pkg.default()); ================================================================================ TestPackageJsonBrowserString ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/browser.js +// Users/user/project/node_modules/demo-pkg/browser.js var require_browser = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_browser()); console.log(demo_pkg.default()); ================================================================================ TestPackageJsonBrowserWithMainNode ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/main.js +// Users/user/project/node_modules/demo-pkg/main.js var require_main = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_main()); console.log(demo_pkg.default()); ================================================================================ TestPackageJsonBrowserWithModuleBrowser ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/main.browser.esm.js +// Users/user/project/node_modules/demo-pkg/main.browser.esm.js function main_browser_esm_default() { return 123; } -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log(main_browser_esm_default()); ================================================================================ TestPackageJsonDualPackageHazardImportAndRequireBrowser ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/main.browser.js +// Users/user/project/node_modules/demo-pkg/main.browser.js var require_main_browser = __commonJS((exports, module) => { module.exports = "browser main"; }); -// /Users/user/project/src/test-main.js +// Users/user/project/src/test-main.js console.log(require_main_browser()); -// /Users/user/project/src/test-module.js +// Users/user/project/src/test-module.js var demo_pkg = __toModule(require_main_browser()); console.log(demo_pkg.default); ================================================================================ TestPackageJsonDualPackageHazardImportAndRequireForceModuleBeforeMain ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/module.js +// Users/user/project/node_modules/demo-pkg/module.js var require_module = __commonJS((exports) => { __export(exports, { default: () => module_default @@ -263,102 +263,102 @@ var require_module = __commonJS((exports) => { var module_default = "module"; }); -// /Users/user/project/src/test-main.js +// Users/user/project/src/test-main.js console.log(require_module()); -// /Users/user/project/src/test-module.js +// Users/user/project/src/test-module.js var demo_pkg = __toModule(require_module()); console.log(demo_pkg.default); ================================================================================ TestPackageJsonDualPackageHazardImportAndRequireSameFile ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/main.js +// Users/user/project/node_modules/demo-pkg/main.js var require_main = __commonJS((exports, module) => { module.exports = "main"; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_main()); console.log(demo_pkg.default, require_main()); ================================================================================ TestPackageJsonDualPackageHazardImportAndRequireSeparateFiles ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/main.js +// Users/user/project/node_modules/demo-pkg/main.js var require_main = __commonJS((exports, module) => { module.exports = "main"; }); -// /Users/user/project/src/test-main.js +// Users/user/project/src/test-main.js console.log(require_main()); -// /Users/user/project/src/test-module.js +// Users/user/project/src/test-module.js var demo_pkg = __toModule(require_main()); console.log(demo_pkg.default); ================================================================================ TestPackageJsonDualPackageHazardImportOnly ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/module.js +// Users/user/project/node_modules/demo-pkg/module.js var module_default = "module"; -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log(module_default); ================================================================================ TestPackageJsonDualPackageHazardRequireOnly ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/main.js +// Users/user/project/node_modules/demo-pkg/main.js var require_main = __commonJS((exports, module) => { module.exports = "main"; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log(require_main()); ================================================================================ TestPackageJsonMain ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/custom-main.js +// Users/user/project/node_modules/demo-pkg/custom-main.js var require_custom_main = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_custom_main()); console.log(demo_pkg.default()); ================================================================================ TestPackageJsonMainFieldsA ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/a.js +// Users/user/project/node_modules/demo-pkg/a.js var require_a = __commonJS((exports, module) => { module.exports = "a"; }); -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js var demo_pkg = __toModule(require_a()); console.log(demo_pkg.default); ================================================================================ TestPackageJsonMainFieldsB ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/b.js +// Users/user/project/node_modules/demo-pkg/b.js var b_default = "b"; -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log(b_default); ================================================================================ TestPackageJsonModule ---------- /Users/user/project/out.js ---------- -// /Users/user/project/node_modules/demo-pkg/main.esm.js +// Users/user/project/node_modules/demo-pkg/main.esm.js function main_esm_default() { return 123; } -// /Users/user/project/src/entry.js +// Users/user/project/src/entry.js console.log(main_esm_default()); diff --git a/internal/bundler/snapshots/snapshots_splitting.txt b/internal/bundler/snapshots/snapshots_splitting.txt index b05301cabd4..b57cd5c1e80 100644 --- a/internal/bundler/snapshots/snapshots_splitting.txt +++ b/internal/bundler/snapshots/snapshots_splitting.txt @@ -3,22 +3,22 @@ TestSplittingAssignToLocal import { foo, setFoo -} from "./chunk.WSWJZEET.js"; +} from "./chunk.P3KLZXCV.js"; -// /a.js +// a.js setFoo(123); console.log(foo); ---------- /out/b.js ---------- import { foo -} from "./chunk.WSWJZEET.js"; +} from "./chunk.P3KLZXCV.js"; -// /b.js +// b.js console.log(foo); ----------- /out/chunk.WSWJZEET.js ---------- -// /shared.js +---------- /out/chunk.P3KLZXCV.js ---------- +// shared.js var foo; function setFoo(value) { foo = value; @@ -35,7 +35,7 @@ TestSplittingCircularReferenceIssue251 import { p, q -} from "./chunk.4MSIEML2.js"; +} from "./chunk.5U72HV2A.js"; export { p, q @@ -45,17 +45,17 @@ export { import { p, q -} from "./chunk.4MSIEML2.js"; +} from "./chunk.5U72HV2A.js"; export { p, q }; ----------- /out/chunk.4MSIEML2.js ---------- -// /b.js +---------- /out/chunk.5U72HV2A.js ---------- +// b.js var q = 6; -// /a.js +// a.js var p = 5; export { @@ -68,16 +68,16 @@ TestSplittingCrossChunkAssignmentDependencies ---------- /out/a.js ---------- import { setValue -} from "./chunk.77LFXWQJ.js"; +} from "./chunk.SQHBWDFZ.js"; -// /a.js +// a.js setValue(123); ---------- /out/b.js ---------- -import "./chunk.77LFXWQJ.js"; +import "./chunk.SQHBWDFZ.js"; ----------- /out/chunk.77LFXWQJ.js ---------- -// /shared.js +---------- /out/chunk.SQHBWDFZ.js ---------- +// shared.js var observer; var value; function getValue() { @@ -99,40 +99,40 @@ TestSplittingCrossChunkAssignmentDependenciesRecursive ---------- /out/a.js ---------- import { setX -} from "./chunk.AKQCJJJT.js"; +} from "./chunk.F4Y6GYTO.js"; -// /a.js +// a.js setX(); ---------- /out/b.js ---------- import { setZ -} from "./chunk.TE7N3FCA.js"; -import "./chunk.AKQCJJJT.js"; +} from "./chunk.OEJRSNU2.js"; +import "./chunk.F4Y6GYTO.js"; -// /b.js +// b.js setZ(); ---------- /out/c.js ---------- import { setY2, setZ2 -} from "./chunk.TE7N3FCA.js"; +} from "./chunk.OEJRSNU2.js"; import { setX2 -} from "./chunk.AKQCJJJT.js"; +} from "./chunk.F4Y6GYTO.js"; -// /c.js +// c.js setX2(); setY2(); setZ2(); ----------- /out/chunk.TE7N3FCA.js ---------- +---------- /out/chunk.OEJRSNU2.js ---------- import { setX -} from "./chunk.AKQCJJJT.js"; +} from "./chunk.F4Y6GYTO.js"; -// /y.js +// y.js var _y; function setY(v) { _y = v; @@ -142,7 +142,7 @@ function setY2(v) { _y = v; } -// /z.js +// z.js var _z; function setZ(v) { _z = v; @@ -158,8 +158,8 @@ export { setZ2 }; ----------- /out/chunk.AKQCJJJT.js ---------- -// /x.js +---------- /out/chunk.F4Y6GYTO.js ---------- +// x.js var _x; function setX(v) { _x = v; @@ -195,20 +195,20 @@ TestSplittingDynamicAndNotDynamicCommonJSIntoES6 ---------- /out/entry.js ---------- import { require_foo -} from "./chunk.FPKGPTVM.js"; +} from "./chunk.JGDLH2UC.js"; -// /entry.js +// entry.js var foo = __toModule(require_foo()); import("./foo.js").then(({default: {bar: b}}) => console.log(foo.bar, b)); ---------- /out/foo.js ---------- import { require_foo -} from "./chunk.FPKGPTVM.js"; +} from "./chunk.JGDLH2UC.js"; export default require_foo(); ----------- /out/chunk.FPKGPTVM.js ---------- -// /foo.js +---------- /out/chunk.JGDLH2UC.js ---------- +// foo.js var require_foo = __commonJS((exports) => { exports.bar = 123; }); @@ -222,21 +222,21 @@ TestSplittingDynamicAndNotDynamicES6IntoES6 ---------- /out/entry.js ---------- import { bar -} from "./chunk.SDIREVTJ.js"; +} from "./chunk.HCZ3ACUK.js"; -// /entry.js +// entry.js import("./foo.js").then(({bar: b}) => console.log(bar, b)); ---------- /out/foo.js ---------- import { bar -} from "./chunk.SDIREVTJ.js"; +} from "./chunk.HCZ3ACUK.js"; export { bar }; ----------- /out/chunk.SDIREVTJ.js ---------- -// /foo.js +---------- /out/chunk.HCZ3ACUK.js ---------- +// foo.js var bar = 123; export { @@ -246,11 +246,11 @@ export { ================================================================================ TestSplittingDynamicCommonJSIntoES6 ---------- /out/entry.js ---------- -// /entry.js +// entry.js import("./foo.js").then(({default: {bar}}) => console.log(bar)); ---------- /out/foo.js ---------- -// /foo.js +// foo.js var require_foo = __commonJS((exports) => { exports.bar = 123; }); @@ -259,11 +259,11 @@ export default require_foo(); ================================================================================ TestSplittingDynamicES6IntoES6 ---------- /out/entry.js ---------- -// /entry.js +// entry.js import("./foo.js").then(({bar}) => console.log(bar)); ---------- /out/foo.js ---------- -// /foo.js +// foo.js var bar = 123; export { bar @@ -272,11 +272,11 @@ export { ================================================================================ TestSplittingDynamicImportIssue272 ---------- /out/a.js ---------- -// /a.js +// a.js import("./b.js"); ---------- /out/b.js ---------- -// /b.js +// b.js var b_default = 1; export { b_default as default @@ -285,15 +285,15 @@ export { ================================================================================ TestSplittingDynamicImportOutsideSourceTreeIssue264 ---------- /out/src/entry1.js ---------- -// /Users/user/project/src/entry1.js +// Users/user/project/src/entry1.js import("../node_modules/package/index.js"); ---------- /out/src/entry2.js ---------- -// /Users/user/project/src/entry2.js +// Users/user/project/src/entry2.js import("../node_modules/package/index.js"); ---------- /out/node_modules/package/index.js ---------- -// /Users/user/project/node_modules/package/index.js +// Users/user/project/node_modules/package/index.js console.log("imported"); ================================================================================ @@ -301,21 +301,21 @@ TestSplittingMinifyIdentifiersCrashIssue437 ---------- /out/a.js ---------- import { a as o -} from "./chunk.Q6GOQWO2.js"; +} from "./chunk.Z3ZGMYXI.js"; -// /a.js +// a.js console.log(o); ---------- /out/b.js ---------- import { a as o -} from "./chunk.Q6GOQWO2.js"; +} from "./chunk.Z3ZGMYXI.js"; -// /b.js +// b.js console.log(o); ----------- /out/chunk.Q6GOQWO2.js ---------- -// /shared.js +---------- /out/chunk.Z3ZGMYXI.js ---------- +// shared.js function n(o) { } @@ -330,26 +330,26 @@ TestSplittingMissingLazyExport ---------- /out/a.js ---------- import "./chunk.3I42H3S6.js"; -// /empty.js +// empty.js var empty_exports = {}; -// /common.js +// common.js function foo() { return [empty_exports, void 0]; } -// /a.js +// a.js console.log(foo()); ---------- /out/b.js ---------- import "./chunk.3I42H3S6.js"; -// /common.js +// common.js function bar() { return [void 0]; } -// /b.js +// b.js console.log(bar()); ---------- /out/chunk.3I42H3S6.js ---------- @@ -359,21 +359,21 @@ TestSplittingNestedDirectories ---------- /Users/user/project/out/pageA/page.js ---------- import { shared_default -} from "../chunk.MPPSAPHD.js"; +} from "../chunk.YR3BWXSL.js"; -// /Users/user/project/src/pages/pageA/page.js +// Users/user/project/src/pages/pageA/page.js console.log(shared_default); ---------- /Users/user/project/out/pageB/page.js ---------- import { shared_default -} from "../chunk.MPPSAPHD.js"; +} from "../chunk.YR3BWXSL.js"; -// /Users/user/project/src/pages/pageB/page.js +// Users/user/project/src/pages/pageB/page.js console.log(-shared_default); ----------- /Users/user/project/out/chunk.MPPSAPHD.js ---------- -// /Users/user/project/src/pages/shared.js +---------- /Users/user/project/out/chunk.YR3BWXSL.js ---------- +// Users/user/project/src/pages/shared.js var shared_default = 123; export { @@ -385,7 +385,7 @@ TestSplittingReExportIssue273 ---------- /out/a.js ---------- import { a -} from "./chunk.S2KAUQ7B.js"; +} from "./chunk.QE4JUSKC.js"; export { a }; @@ -393,13 +393,13 @@ export { ---------- /out/b.js ---------- import { a -} from "./chunk.S2KAUQ7B.js"; +} from "./chunk.QE4JUSKC.js"; export { a }; ----------- /out/chunk.S2KAUQ7B.js ---------- -// /a.js +---------- /out/chunk.QE4JUSKC.js ---------- +// a.js var a = 1; export { @@ -411,23 +411,23 @@ TestSplittingSharedCommonJSIntoES6 ---------- /out/a.js ---------- import { require_shared -} from "./chunk.LOHJC32K.js"; +} from "./chunk.KMMICCE3.js"; -// /a.js +// a.js var {foo} = require_shared(); console.log(foo); ---------- /out/b.js ---------- import { require_shared -} from "./chunk.LOHJC32K.js"; +} from "./chunk.KMMICCE3.js"; -// /b.js +// b.js var {foo} = require_shared(); console.log(foo); ----------- /out/chunk.LOHJC32K.js ---------- -// /shared.js +---------- /out/chunk.KMMICCE3.js ---------- +// shared.js var require_shared = __commonJS((exports) => { exports.foo = 123; }); @@ -441,21 +441,21 @@ TestSplittingSharedES6IntoES6 ---------- /out/a.js ---------- import { foo -} from "./chunk.FGUQNUIX.js"; +} from "./chunk.NAV7B6IH.js"; -// /a.js +// a.js console.log(foo); ---------- /out/b.js ---------- import { foo -} from "./chunk.FGUQNUIX.js"; +} from "./chunk.NAV7B6IH.js"; -// /b.js +// b.js console.log(foo); ----------- /out/chunk.FGUQNUIX.js ---------- -// /shared.js +---------- /out/chunk.NAV7B6IH.js ---------- +// shared.js var foo = 123; export { @@ -465,23 +465,23 @@ export { ================================================================================ TestSplittingSideEffectsWithoutDependencies ---------- /out/a.js ---------- -import "./chunk.LKVKH4P2.js"; +import "./chunk.SVEWJSRA.js"; -// /shared.js +// shared.js var a = 1; -// /a.js +// a.js console.log(a); ---------- /out/b.js ---------- -import "./chunk.LKVKH4P2.js"; +import "./chunk.SVEWJSRA.js"; -// /shared.js +// shared.js var b = 2; -// /b.js +// b.js console.log(b); ----------- /out/chunk.LKVKH4P2.js ---------- -// /shared.js +---------- /out/chunk.SVEWJSRA.js ---------- +// shared.js console.log("side effect"); diff --git a/internal/bundler/snapshots/snapshots_ts.txt b/internal/bundler/snapshots/snapshots_ts.txt index 5c7b31f7536..2bfa97713c7 100644 --- a/internal/bundler/snapshots/snapshots_ts.txt +++ b/internal/bundler/snapshots/snapshots_ts.txt @@ -1,147 +1,147 @@ TestExportTypeIssue379 ---------- /out.js ---------- -// /a.ts +// a.ts var a_exports = {}; __export(a_exports, { foo: () => foo }); var foo = 123; -// /b.ts +// b.ts var b_exports = {}; __export(b_exports, { foo: () => foo2 }); var foo2 = 123; -// /c.ts +// c.ts var c_exports = {}; __export(c_exports, { foo: () => foo3 }); var foo3 = 123; -// /d.ts +// d.ts var d_exports = {}; __export(d_exports, { foo: () => foo4 }); var foo4 = 123; -// /entry.ts +// entry.ts console.log(a_exports, b_exports, c_exports, d_exports); ================================================================================ TestTSDeclareClass ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = bar(); ================================================================================ TestTSDeclareConst ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = bar(); ================================================================================ TestTSDeclareConstEnum ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = bar(); ================================================================================ TestTSDeclareEnum ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = bar(); ================================================================================ TestTSDeclareFunction ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = bar(); ================================================================================ TestTSDeclareLet ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = bar(); ================================================================================ TestTSDeclareNamespace ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = bar(); ================================================================================ TestTSDeclareVar ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = bar(); ================================================================================ TestTSExportDefaultTypeIssue316 ---------- /out.js ---------- -// /keep/declare-class.ts +// keep/declare-class.ts var declare_class_default = foo; var bar = 123; -// /keep/declare-let.ts +// keep/declare-let.ts var declare_let_default = foo; var bar2 = 123; -// /keep/interface-merged.ts +// keep/interface-merged.ts var foo3 = class { }; var foo2 = foo3; foo2.x = new foo3(); var bar3 = 123; -// /keep/interface-nested.ts +// keep/interface-nested.ts if (true) { } var interface_nested_default = foo; var bar4 = 123; -// /keep/type-nested.ts +// keep/type-nested.ts if (true) { } var type_nested_default = foo; var bar5 = 123; -// /keep/value-namespace.ts +// keep/value-namespace.ts var foo4; (function(foo6) { foo6.num = 0; })(foo4 || (foo4 = {})); var bar6 = 123; -// /keep/value-namespace-merged.ts +// keep/value-namespace-merged.ts var foo5; (function(foo6) { foo6.num = 0; })(foo5 || (foo5 = {})); var bar7 = 123; -// /remove/interface.ts +// remove/interface.ts var bar8 = 123; -// /remove/interface-exported.ts +// remove/interface-exported.ts var bar9 = 123; -// /remove/type.ts +// remove/type.ts var bar10 = 123; -// /remove/type-exported.ts +// remove/type-exported.ts var bar11 = 123; -// /remove/type-only-namespace.ts +// remove/type-only-namespace.ts var bar12 = 123; -// /remove/type-only-namespace-exported.ts +// remove/type-only-namespace-exported.ts var bar13 = 123; -// /entry.ts +// entry.ts var entry_default = [ bar, bar2, @@ -164,30 +164,30 @@ export { ================================================================================ TestTSExportEquals ---------- /out.js ---------- -// /b.ts +// b.ts var require_b = __commonJS((exports, module) => { function foo() { } module.exports = [123, foo]; }); -// /a.ts +// a.ts var b = __toModule(require_b()); console.log(b.default); ================================================================================ TestTSExportMissingES6 ---------- /out.js ---------- -// /foo.ts +// foo.ts var foo_exports = {}; -// /entry.js +// entry.js console.log(foo_exports); ================================================================================ TestTSExportNamespace ---------- /out.js ---------- -// /b.ts +// b.ts var Foo = class { }; (function(Foo2) { @@ -197,34 +197,34 @@ var Foo = class { Foo2.bar = 2; })(Foo || (Foo = {})); -// /a.ts +// a.ts console.log(new Foo()); ================================================================================ TestTSImplicitExtensions ---------- /out.js ---------- -// /pick-js.js +// pick-js.js console.log("correct"); -// /pick-ts.ts +// pick-ts.ts console.log("correct"); -// /pick-jsx.jsx +// pick-jsx.jsx console.log("correct"); -// /pick-tsx.tsx +// pick-tsx.tsx console.log("correct"); -// /order-js.ts +// order-js.ts console.log("correct"); -// /order-jsx.ts +// order-jsx.ts console.log("correct"); ================================================================================ TestTSImportEmptyNamespace ---------- /out.js ---------- -// /entry.ts +// entry.ts function foo() { } foo(); @@ -236,13 +236,13 @@ TestTSImportMissingUnusedES6 ================================================================================ TestTSImportTypeOnlyFile ---------- /out.js ---------- -// /entry.ts +// entry.ts var foo = bar(); ================================================================================ TestTSImportVsLocalCollisionAllTypes ---------- /out.js ---------- -// /entry.ts +// entry.ts var a; var b = 0; var c; @@ -255,10 +255,10 @@ console.log(a, b, c, d, e); ================================================================================ TestTSImportVsLocalCollisionMixed ---------- /out.js ---------- -// /other.ts +// other.ts var real = 123; -// /entry.ts +// entry.ts var a; var b = 0; var c; @@ -309,7 +309,7 @@ export var Foo;(function(e){let a;(function(p){foo(e,p)})(a=e.Bar||(e.Bar={}))}) ================================================================================ TestTypeScriptDecorators ---------- /out.js ---------- -// /all.ts +// all.ts var Foo = class { constructor() { this.mDef = 1; @@ -360,7 +360,7 @@ Foo = __decorate([ ], Foo); var all_default = Foo; -// /all_computed.ts +// all_computed.ts var _a, _b, _c, _d, _e, _f, _g, _h; var Foo2 = class { constructor() { @@ -414,7 +414,7 @@ Foo2 = __decorate([ ], Foo2); var all_computed_default = Foo2; -// /a.ts +// a.ts var a_class = class { fn() { return new a_class(); @@ -427,7 +427,7 @@ a_class = __decorate([ ], a_class); var a = a_class; -// /b.ts +// b.ts var b_class = class { fn() { return new b_class(); @@ -440,7 +440,7 @@ b_class = __decorate([ ], b_class); var b = b_class; -// /c.ts +// c.ts var c = class { fn() { return new c(); @@ -452,7 +452,7 @@ c = __decorate([ y(() => 1) ], c); -// /d.ts +// d.ts var d = class { fn() { return new d(); @@ -464,7 +464,7 @@ d = __decorate([ y(() => 1) ], d); -// /e.ts +// e.ts var e_default = class { }; e_default = __decorate([ @@ -473,7 +473,7 @@ e_default = __decorate([ ], e_default); var e_default2 = e_default; -// /f.ts +// f.ts var f = class { fn() { return new f(); @@ -486,7 +486,7 @@ f = __decorate([ ], f); var f_default = f; -// /g.ts +// g.ts var g_default = class { }; g_default = __decorate([ @@ -495,7 +495,7 @@ g_default = __decorate([ ], g_default); var g_default2 = g_default; -// /h.ts +// h.ts var h = class { fn() { return new h(); @@ -508,7 +508,7 @@ h = __decorate([ ], h); var h_default = h; -// /i.ts +// i.ts var i_class = class { }; __decorate([ @@ -517,7 +517,7 @@ __decorate([ ], i_class.prototype, "foo", 2); var i = i_class; -// /j.ts +// j.ts var j = class { foo() { } @@ -527,7 +527,7 @@ __decorate([ y(() => 1) ], j.prototype, "foo", 1); -// /k.ts +// k.ts var k_default = class { foo(x2) { } @@ -538,5 +538,5 @@ __decorate([ ], k_default.prototype, "foo", 1); var k_default2 = k_default; -// /entry.js +// entry.js console.log(all_default, all_computed_default, a, b, c, d, e_default2, f_default, g_default2, h_default, i, j, k_default2); diff --git a/internal/bundler/snapshots/snapshots_tsconfig.txt b/internal/bundler/snapshots/snapshots_tsconfig.txt index 97c458b9f9e..ca171e048ce 100644 --- a/internal/bundler/snapshots/snapshots_tsconfig.txt +++ b/internal/bundler/snapshots/snapshots_tsconfig.txt @@ -1,62 +1,62 @@ TestJsconfigJsonBaseUrl ---------- /Users/user/project/out.js ---------- -// /Users/user/project/src/lib/util.js +// Users/user/project/src/lib/util.js var require_util = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/src/app/entry.js +// Users/user/project/src/app/entry.js var util = __toModule(require_util()); console.log(util.default()); ================================================================================ TestTsConfigJSX ---------- /Users/user/project/out.js ---------- -// /Users/user/project/entry.tsx +// Users/user/project/entry.tsx console.log(/* @__PURE__ */ R.c(R.F, null, /* @__PURE__ */ R.c("div", null), /* @__PURE__ */ R.c("div", null))); ================================================================================ TestTsConfigNestedJSX ---------- /Users/user/project/out.js ---------- -// /Users/user/project/factory/index.tsx +// Users/user/project/factory/index.tsx var factory_default = /* @__PURE__ */ h(React.Fragment, null, /* @__PURE__ */ h("div", null), /* @__PURE__ */ h("div", null)); -// /Users/user/project/fragment/index.tsx +// Users/user/project/fragment/index.tsx var fragment_default = /* @__PURE__ */ React.createElement(a.b, null, /* @__PURE__ */ React.createElement("div", null), /* @__PURE__ */ React.createElement("div", null)); -// /Users/user/project/both/index.tsx +// Users/user/project/both/index.tsx var both_default = /* @__PURE__ */ R.c(R.F, null, /* @__PURE__ */ R.c("div", null), /* @__PURE__ */ R.c("div", null)); -// /Users/user/project/entry.ts +// Users/user/project/entry.ts console.log(factory_default, fragment_default, both_default); ================================================================================ TestTsConfigPaths ---------- /Users/user/project/out.js ---------- -// /Users/user/project/baseurl_dot/test0-success.ts +// Users/user/project/baseurl_dot/test0-success.ts var test0_success_default = "test0-success"; -// /Users/user/project/baseurl_dot/test1-success.ts +// Users/user/project/baseurl_dot/test1-success.ts var test1_success_default = "test1-success"; -// /Users/user/project/baseurl_dot/test2-success/foo.ts +// Users/user/project/baseurl_dot/test2-success/foo.ts var foo_default = "test2-success"; -// /Users/user/project/baseurl_dot/test3-success.ts +// Users/user/project/baseurl_dot/test3-success.ts var test3_success_default = "test3-success"; -// /Users/user/project/baseurl_dot/test4-first/foo.ts +// Users/user/project/baseurl_dot/test4-first/foo.ts var foo_default2 = "test4-success"; -// /Users/user/project/baseurl_dot/test5-second/foo.ts +// Users/user/project/baseurl_dot/test5-second/foo.ts var foo_default3 = "test5-success"; -// /Users/user/project/baseurl_dot/actual/test.ts +// Users/user/project/baseurl_dot/actual/test.ts var test_default = "absolute-success"; -// /Users/user/project/baseurl_dot/index.ts +// Users/user/project/baseurl_dot/index.ts var baseurl_dot_default = { test0: test0_success_default, test1: test1_success_default, @@ -67,28 +67,28 @@ var baseurl_dot_default = { absolute: test_default }; -// /Users/user/project/baseurl_nested/nested/test0-success.ts +// Users/user/project/baseurl_nested/nested/test0-success.ts var test0_success_default2 = "test0-success"; -// /Users/user/project/baseurl_nested/nested/test1-success.ts +// Users/user/project/baseurl_nested/nested/test1-success.ts var test1_success_default2 = "test1-success"; -// /Users/user/project/baseurl_nested/nested/test2-success/foo.ts +// Users/user/project/baseurl_nested/nested/test2-success/foo.ts var foo_default4 = "test2-success"; -// /Users/user/project/baseurl_nested/nested/test3-success.ts +// Users/user/project/baseurl_nested/nested/test3-success.ts var test3_success_default2 = "test3-success"; -// /Users/user/project/baseurl_nested/nested/test4-first/foo.ts +// Users/user/project/baseurl_nested/nested/test4-first/foo.ts var foo_default5 = "test4-success"; -// /Users/user/project/baseurl_nested/nested/test5-second/foo.ts +// Users/user/project/baseurl_nested/nested/test5-second/foo.ts var foo_default6 = "test5-success"; -// /Users/user/project/baseurl_nested/nested/actual/test.ts +// Users/user/project/baseurl_nested/nested/actual/test.ts var test_default2 = "absolute-success"; -// /Users/user/project/baseurl_nested/index.ts +// Users/user/project/baseurl_nested/index.ts var baseurl_nested_default = { test0: test0_success_default2, test1: test1_success_default2, @@ -99,34 +99,34 @@ var baseurl_nested_default = { absolute: test_default2 }; -// /Users/user/project/entry.ts +// Users/user/project/entry.ts console.log(baseurl_dot_default, baseurl_nested_default); ================================================================================ TestTsConfigPathsNoBaseURL ---------- /Users/user/project/out.js ---------- -// /Users/user/project/simple/test0-success.ts +// Users/user/project/simple/test0-success.ts var test0_success_default = "test0-success"; -// /Users/user/project/simple/test1-success.ts +// Users/user/project/simple/test1-success.ts var test1_success_default = "test1-success"; -// /Users/user/project/simple/test2-success/foo.ts +// Users/user/project/simple/test2-success/foo.ts var foo_default = "test2-success"; -// /Users/user/project/simple/test3-success.ts +// Users/user/project/simple/test3-success.ts var test3_success_default = "test3-success"; -// /Users/user/project/simple/test4-first/foo.ts +// Users/user/project/simple/test4-first/foo.ts var foo_default2 = "test4-success"; -// /Users/user/project/simple/test5-second/foo.ts +// Users/user/project/simple/test5-second/foo.ts var foo_default3 = "test5-success"; -// /Users/user/project/simple/actual/test.ts +// Users/user/project/simple/actual/test.ts var test_default = "absolute-success"; -// /Users/user/project/simple/index.ts +// Users/user/project/simple/index.ts var simple_default = { test0: test0_success_default, test1: test1_success_default, @@ -137,28 +137,28 @@ var simple_default = { absolute: test_default }; -// /Users/user/project/extended/nested/test0-success.ts +// Users/user/project/extended/nested/test0-success.ts var test0_success_default2 = "test0-success"; -// /Users/user/project/extended/nested/test1-success.ts +// Users/user/project/extended/nested/test1-success.ts var test1_success_default2 = "test1-success"; -// /Users/user/project/extended/nested/test2-success/foo.ts +// Users/user/project/extended/nested/test2-success/foo.ts var foo_default4 = "test2-success"; -// /Users/user/project/extended/nested/test3-success.ts +// Users/user/project/extended/nested/test3-success.ts var test3_success_default2 = "test3-success"; -// /Users/user/project/extended/nested/test4-first/foo.ts +// Users/user/project/extended/nested/test4-first/foo.ts var foo_default5 = "test4-success"; -// /Users/user/project/extended/nested/test5-second/foo.ts +// Users/user/project/extended/nested/test5-second/foo.ts var foo_default6 = "test5-success"; -// /Users/user/project/extended/nested/actual/test.ts +// Users/user/project/extended/nested/actual/test.ts var test_default2 = "absolute-success"; -// /Users/user/project/extended/index.ts +// Users/user/project/extended/index.ts var extended_default = { test0: test0_success_default2, test1: test1_success_default2, @@ -169,121 +169,121 @@ var extended_default = { absolute: test_default2 }; -// /Users/user/project/entry.ts +// Users/user/project/entry.ts console.log(simple_default, extended_default); ================================================================================ TestTsconfigJsonAbsoluteBaseUrl ---------- /Users/user/project/out.js ---------- -// /Users/user/project/src/lib/util.js +// Users/user/project/src/lib/util.js var require_util = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/src/app/entry.js +// Users/user/project/src/app/entry.js var util = __toModule(require_util()); console.log(util.default()); ================================================================================ TestTsconfigJsonBaseUrl ---------- /Users/user/project/out.js ---------- -// /Users/user/project/src/lib/util.js +// Users/user/project/src/lib/util.js var require_util = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/src/app/entry.js +// Users/user/project/src/app/entry.js var util = __toModule(require_util()); console.log(util.default()); ================================================================================ TestTsconfigJsonCommentAllowed ---------- /Users/user/project/out.js ---------- -// /Users/user/project/src/lib/util.js +// Users/user/project/src/lib/util.js var require_util = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/src/app/entry.js +// Users/user/project/src/app/entry.js var util = __toModule(require_util()); console.log(util.default()); ================================================================================ TestTsconfigJsonExtends ---------- /out.js ---------- -// /entry.jsx +// entry.jsx console.log(/* @__PURE__ */ baseFactory("div", null), /* @__PURE__ */ baseFactory(derivedFragment, null)); ================================================================================ TestTsconfigJsonExtendsLoop ---------- /out.js ---------- -// /entry.js +// entry.js console.log(123); ================================================================================ TestTsconfigJsonExtendsPackage ---------- /Users/user/project/out.js ---------- -// /Users/user/project/src/app/entry.jsx +// Users/user/project/src/app/entry.jsx console.log(/* @__PURE__ */ worked("div", null)); ================================================================================ TestTsconfigJsonExtendsThreeLevels ---------- /out.js ---------- -// /Users/user/project/src/path2/works/import.js +// Users/user/project/src/path2/works/import.js console.log("works"); -// /Users/user/project/src/entry.jsx +// Users/user/project/src/entry.jsx console.log(/* @__PURE__ */ baseFactory("div", null), /* @__PURE__ */ baseFactory(derivedFragment, null)); ================================================================================ TestTsconfigJsonNodeModulesImplicitFile ---------- /Users/user/project/out.js ---------- -// /Users/user/project/src/app/entry.tsx +// Users/user/project/src/app/entry.tsx console.log(/* @__PURE__ */ worked("div", null)); ================================================================================ TestTsconfigJsonOverrideMissing ---------- /Users/user/project/out.js ---------- -// /Users/user/project/other/foo-good.ts +// Users/user/project/other/foo-good.ts console.log("good"); ================================================================================ TestTsconfigJsonOverrideNodeModules ---------- /Users/user/project/out.js ---------- -// /Users/user/project/other/foo-good.ts +// Users/user/project/other/foo-good.ts console.log("good"); ================================================================================ TestTsconfigJsonTrailingCommaAllowed ---------- /Users/user/project/out.js ---------- -// /Users/user/project/src/lib/util.js +// Users/user/project/src/lib/util.js var require_util = __commonJS((exports, module) => { module.exports = function() { return 123; }; }); -// /Users/user/project/src/app/entry.js +// Users/user/project/src/app/entry.js var util = __toModule(require_util()); console.log(util.default()); ================================================================================ TestTsconfigPreserveTypeImports ---------- /Users/user/project/out.js ---------- -// /Users/user/project/src/entry.ts +// Users/user/project/src/entry.ts import "./src/foo"; console.log(1); ================================================================================ TestTsconfigRemoveTypeImports ---------- /Users/user/project/out.js ---------- -// /Users/user/project/src/entry.ts +// Users/user/project/src/entry.ts console.log(1); ================================================================================ diff --git a/internal/fs/fs.go b/internal/fs/fs.go index 39041f0c972..7844350501a 100644 --- a/internal/fs/fs.go +++ b/internal/fs/fs.go @@ -221,7 +221,7 @@ func (*mockFS) Join(parts ...string) string { } func (*mockFS) Cwd() string { - return "" + return "/" } func splitOnSlash(path string) (string, string) {