diff --git a/_submodules/TypeScript b/_submodules/TypeScript index bc7d42611e..1ee9e0d9a2 160000 --- a/_submodules/TypeScript +++ b/_submodules/TypeScript @@ -1 +1 @@ -Subproject commit bc7d42611e35678c7cbddb104aa4b117a95ccdfa +Subproject commit 1ee9e0d9a24b629da3a8cae2748616af1dc8fc0c diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt index 0e7496180a..3aa26eb8bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt @@ -1,27 +1,12 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +18,11 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -55,17 +34,15 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cjs (3 errors) ==== +==== index.cjs (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -78,6 +55,9 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding typei.implicitCjsSource; ts.cjsSource; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -87,8 +67,10 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -98,8 +80,10 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const mjsSource = true; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -109,7 +93,6 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js index 2f99e51c4c..e8c327cbb8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js.diff deleted file mode 100644 index 6fd54f278d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node16).js -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node16).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols index 48ff9d9033..aa9ad6d6bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.js, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.js, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.js, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mjs === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mjs, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cjs === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cjs, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cjs, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cjs, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols.diff deleted file mode 100644 index b8ce6b6cc3..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node16).symbols -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node16).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cjs, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types index 296335f7dc..2b6e971e79 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt index 0e7496180a..3aa26eb8bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt @@ -1,27 +1,12 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +18,11 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -55,17 +34,15 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cjs (3 errors) ==== +==== index.cjs (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -78,6 +55,9 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding typei.implicitCjsSource; ts.cjsSource; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -87,8 +67,10 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -98,8 +80,10 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const mjsSource = true; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -109,7 +93,6 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js index 2f99e51c4c..e8c327cbb8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js.diff deleted file mode 100644 index 67f41a0a18..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node18).js -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node18).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols index 48ff9d9033..aa9ad6d6bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.js, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.js, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.js, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mjs === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mjs, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cjs === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cjs, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cjs, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cjs, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols.diff deleted file mode 100644 index ef0e58c515..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node18).symbols -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node18).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cjs, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types index 296335f7dc..2b6e971e79 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt index c34e5bec84..7f5c445198 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt @@ -1,41 +1,24 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. index.cjs(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. index.cjs(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. index.js(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. index.js(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. index.js(12,6): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? index.js(15,4): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. index.mjs(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -node_modules/inner/index.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -node_modules/inner/index.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -node_modules/inner/index.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. +node_modules/inner/test.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. +node_modules/inner/test.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. +node_modules/inner/test.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. +node_modules/inner/test.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. +node_modules/inner/test.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. !!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (7 errors) ==== +==== index.js (4 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -50,24 +33,18 @@ node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or cjsi.mjsSource; ~~~~~~~~~ !!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. +!!! related TS2728 node_modules/inner/index.d.cts:2:14: 'cjsSource' is declared here. mjsi.mjsSource; typei.mjsSource; ts.mjsSource; ~~~~~~~~~ !!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -==== index.mjs (4 errors) ==== +!!! related TS2728 node_modules/inner/index.d.cts:2:14: 'cjsSource' is declared here. +==== index.mjs (1 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -81,17 +58,11 @@ node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cjs (5 errors) ==== +==== index.cjs (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -107,7 +78,10 @@ node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; -==== node_modules/inner/index.d.ts (2 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (2 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -121,8 +95,10 @@ node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (1 errors) ==== +==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (1 errors) ==== // esm format file import * as cjs from "inner/a"; ~~~~~~~~~ @@ -134,8 +110,10 @@ node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or export { mjs }; export { type }; export { ts }; - export const mjsSource = true; -==== node_modules/inner/index.d.cts (2 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (2 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -149,7 +127,6 @@ node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js index 4fb8ca4f24..4dea165994 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,7 +129,7 @@ export const cjsSource = true; } -//// [index.js] +//// [index.mjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // esm format file @@ -141,10 +147,10 @@ cjsi.mjsSource; mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -//// [index.mjs] +//// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file +// cjs format file const cjs = require("package/cjs"); const mjs = require("package/mjs"); const type = require("package"); @@ -155,14 +161,14 @@ const cjsi = require("inner/a"); const mjsi = require("inner/b"); const typei = require("inner"); const ts = require("inner/types"); -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; -//// [index.cjs] +cjsi.cjsSource; +mjsi.cjsSource; +typei.implicitCjsSource; +ts.cjsSource; +//// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -// cjs format file +// esm format file const cjs = require("package/cjs"); const mjs = require("package/mjs"); const type = require("package"); @@ -173,15 +179,15 @@ const cjsi = require("inner/a"); const mjsi = require("inner/b"); const typei = require("inner"); const ts = require("inner/types"); -cjsi.cjsSource; -mjsi.cjsSource; -typei.implicitCjsSource; -ts.cjsSource; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js.diff index 36075a475c..b9ae58a743 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js.diff @@ -1,27 +1,8 @@ --- old.nodeModulesAllowJsConditionalPackageExports(module=node20).js +++ new.nodeModulesAllowJsConditionalPackageExports(module=node20).js -@@= skipped -122, +122 lines =@@ - } +@@= skipped -129, +129 lines =@@ -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; //// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); @@ -105,31 +86,27 @@ mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; --//// [index.js] --// esm format file + //// [index.js] ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); + // esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; --cjs; --mjs; --type; ++const cjs = require("package/cjs"); ++const mjs = require("package/mjs"); ++const type = require("package"); + cjs; + mjs; + type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file ++const cjsi = require("inner/a"); ++const mjsi = require("inner/b"); ++const typei = require("inner"); ++const ts = require("inner/types"); + cjsi.mjsSource; + mjsi.mjsSource; + typei.mjsSource; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols index 4a556ae9e3..f942c3d7b2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols @@ -80,19 +80,19 @@ cjsi.mjsSource; >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cjs === // cjs format file @@ -127,9 +127,9 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cjs, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) @@ -138,94 +138,100 @@ typei.implicitCjsSource; >typei : Symbol(typei, Decl(index.cjs, 9, 6)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cjs, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols.diff index 2c11338782..64a947b14a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols.diff @@ -4,24 +4,24 @@ >ts : Symbol(ts, Decl(index.js, 10, 6)) cjsi.mjsSource; -->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; -->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; -->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.js, 9, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; -->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.js, 10, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mjs === // esm format file @@ -29,85 +29,45 @@ >ts : Symbol(ts, Decl(index.mjs, 10, 6)) cjsi.mjsSource; -->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; -->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ++>mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ++>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; -->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ++>typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ++>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; -->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ++>ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ++>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cjs === // cjs format file @@= skipped -57, +55 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) + >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; -->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) -->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) +->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cjs, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) +->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -29, +25 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) + >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types index 36b23e0799..10b43a61e1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : any @@ -107,22 +107,22 @@ ts.mjsSource; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : any @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof mjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 0e7496180a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,153 +0,0 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.mjs (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const mjsSource = true; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const cjsSource = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./a": { - "require": "./index.cjs", - "node": "./index.mjs" - }, - "./b": { - "import": "./index.mjs", - "node": "./index.cjs" - }, - ".": { - "import": "./index.mjs", - "node": "./index.js" - }, - "./types": { - "types": { - "import": "./index.d.mts", - "require": "./index.d.cts" - }, - "node": { - "import": "./index.mjs", - "require": "./index.cjs" - } - } - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js index 2f99e51c4c..e8c327cbb8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js.diff deleted file mode 100644 index 321270cbcb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=nodenext).js -+++ new.nodeModulesAllowJsConditionalPackageExports(module=nodenext).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols index 48ff9d9033..aa9ad6d6bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.js, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.js, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.js, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mjs === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mjs, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cjs === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cjs, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cjs, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cjs, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index 8dc875ae80..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols -+++ new.nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cjs, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types index 296335f7dc..2b6e971e79 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt index 0543bf37ed..da41d18ca9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt @@ -1,30 +1,15 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -34,17 +19,11 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -54,17 +33,15 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.cjs (4 errors) ==== +==== index.cjs (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -76,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -87,6 +67,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -94,7 +77,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -124,4 +110,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js index 817ed97973..6f61b6de6a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js.diff deleted file mode 100644 index 4b82b99738..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node16).js -+++ new.nodeModulesAllowJsPackageExports(module=node16).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols index 241c74412b..ac3958d2ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols.diff deleted file mode 100644 index 953631b6c5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node16).symbols -+++ new.nodeModulesAllowJsPackageExports(module=node16).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).types index 794aab4871..815ad11048 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt index 0543bf37ed..da41d18ca9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt @@ -1,30 +1,15 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -34,17 +19,11 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -54,17 +33,15 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.cjs (4 errors) ==== +==== index.cjs (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -76,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -87,6 +67,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -94,7 +77,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -124,4 +110,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js index 817ed97973..6f61b6de6a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js.diff deleted file mode 100644 index 8db327a4a4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node18).js -+++ new.nodeModulesAllowJsPackageExports(module=node18).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols index 241c74412b..ac3958d2ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols.diff deleted file mode 100644 index 8a8dc5b706..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node18).symbols -+++ new.nodeModulesAllowJsPackageExports(module=node18).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).types index 794aab4871..815ad11048 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt index fc1ec8d133..2d7b01f5fa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt @@ -1,29 +1,12 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. !!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +16,11 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding cjsi; mjsi; typei; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -53,17 +30,11 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding cjsi; mjsi; typei; -==== index.cjs (3 errors) ==== +==== index.cjs (0 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -74,6 +45,9 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi; typei; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -82,6 +56,9 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -90,6 +67,9 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -117,4 +97,5 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js index 05f5e0949e..ec9727152e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,9 +95,10 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} -//// [index.js] + +//// [index.mjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // esm format file @@ -104,10 +114,10 @@ const typei = require("inner"); cjsi; mjsi; typei; -//// [index.mjs] +//// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file +// cjs format file const cjs = require("package/cjs"); const mjs = require("package/mjs"); const type = require("package"); @@ -120,10 +130,10 @@ const typei = require("inner"); cjsi; mjsi; typei; -//// [index.cjs] +//// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -// cjs format file +// esm format file const cjs = require("package/cjs"); const mjs = require("package/mjs"); const type = require("package"); @@ -138,9 +148,9 @@ mjsi; typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js.diff index 7a800e6da3..1fa4ba4736 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js.diff @@ -1,25 +1,8 @@ --- old.nodeModulesAllowJsPackageExports(module=node20).js +++ new.nodeModulesAllowJsPackageExports(module=node20).js -@@= skipped -87, +87 lines =@@ - } - } +@@= skipped -98, +98 lines =@@ + -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+cjsi; -+mjsi; -+typei; //// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); @@ -82,50 +65,40 @@ -const cjs = __importStar(require("package/cjs")); -const mjs = __importStar(require("package/mjs")); -const type = __importStar(require("package")); --cjs; --mjs; --type; ++const cjs = require("package/cjs"); ++const mjs = require("package/mjs"); ++const type = require("package"); + cjs; + mjs; + type; -const cjsi = __importStar(require("inner/cjs")); -const mjsi = __importStar(require("inner/mjs")); -const typei = __importStar(require("inner")); --cjsi; --mjsi; --typei; --//// [index.js] --// esm format file ++const cjsi = require("inner/cjs"); ++const mjsi = require("inner/mjs"); ++const typei = require("inner"); + cjsi; + mjsi; + typei; + //// [index.js] ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); + // esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); -+cjs; -+mjs; -+type; + cjs; + mjs; + type; +-import * as cjsi from "inner/cjs"; +-import * as mjsi from "inner/mjs"; +-import * as typei from "inner"; +const cjsi = require("inner/cjs"); +const mjsi = require("inner/mjs"); +const typei = require("inner"); -+cjsi; -+mjsi; -+typei; -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file + cjsi; + mjsi; + typei; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols index 241c74412b..ac3958d2ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols.diff deleted file mode 100644 index 8ccc6b87fb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node20).symbols -+++ new.nodeModulesAllowJsPackageExports(module=node20).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).types index 794aab4871..815ad11048 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 4297bbb071..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,118 +0,0 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.mjs (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js index 817ed97973..6f61b6de6a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js.diff deleted file mode 100644 index 66c28515a1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=nodenext).js -+++ new.nodeModulesAllowJsPackageExports(module=nodenext).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols index 241c74412b..ac3958d2ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index f24b75dfb1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=nodenext).symbols -+++ new.nodeModulesAllowJsPackageExports(module=nodenext).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types index 794aab4871..815ad11048 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt index 6804fa2040..95ba0345cb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt @@ -1,6 +1,6 @@ index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.js (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).js index 0c82c6e77b..5bab0a82ca 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols index 8aaf670265..802e24e797 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols.diff deleted file mode 100644 index ecb7c5f0f8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node16).symbols -+++ new.nodeModulesAllowJsPackagePatternExports(module=node16).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types index 632a6d9901..b5c99b67eb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt index 6804fa2040..95ba0345cb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt @@ -1,6 +1,6 @@ index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.js (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).js index 0c82c6e77b..5bab0a82ca 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols index 8aaf670265..802e24e797 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols.diff deleted file mode 100644 index 43114922cc..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node18).symbols -+++ new.nodeModulesAllowJsPackagePatternExports(module=node18).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types index 632a6d9901..b5c99b67eb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt index c6178671ea..e34f3f76ec 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt @@ -27,6 +27,9 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci mjsi; typei; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -35,6 +38,9 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -43,6 +49,9 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci export { mjs }; export { type }; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js index 473118b4ba..47d7bec1e3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js.diff index 4b39a11291..a596f08f18 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js.diff @@ -1,6 +1,6 @@ --- old.nodeModulesAllowJsPackagePatternExports(module=node20).js +++ new.nodeModulesAllowJsPackagePatternExports(module=node20).js -@@= skipped -66, +66 lines =@@ +@@= skipped -75, +75 lines =@@ //// [index.js] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols index 8aaf670265..802e24e797 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols.diff deleted file mode 100644 index 6ab2d9d14c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node20).symbols -+++ new.nodeModulesAllowJsPackagePatternExports(module=node20).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types index 632a6d9901..b5c99b67eb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).js index 0c82c6e77b..5bab0a82ca 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols index 8aaf670265..802e24e797 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols.diff deleted file mode 100644 index 70d7f7ba93..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols -+++ new.nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types index 632a6d9901..b5c99b67eb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt index 64814c9a08..43b333f902 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt @@ -1,6 +1,6 @@ index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. ==== index.js (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js index 5c434e9847..19140a3fe5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols index b6cc027370..182fd209da 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols.diff deleted file mode 100644 index d132592983..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types index 2530671b34..4c7b763f3a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt index 64814c9a08..43b333f902 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt @@ -1,6 +1,6 @@ index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. ==== index.js (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js index 5c434e9847..19140a3fe5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols index b6cc027370..182fd209da 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols.diff deleted file mode 100644 index 11bbac7a71..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types index 2530671b34..4c7b763f3a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt index 523c9c90a7..2c63a6f67a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt @@ -27,6 +27,9 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci mjsi; typei; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -35,6 +38,9 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -43,6 +49,9 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci export { mjs }; export { type }; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js index b2f2aabab4..2d065ea355 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js.diff index b42fac0647..814755ced2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js.diff @@ -1,6 +1,6 @@ --- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js +++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js -@@= skipped -66, +66 lines =@@ +@@= skipped -75, +75 lines =@@ //// [index.js] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols index b6cc027370..182fd209da 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols.diff deleted file mode 100644 index e9f329450a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types index 2530671b34..4c7b763f3a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js index 5c434e9847..19140a3fe5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols index b6cc027370..182fd209da 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols.diff deleted file mode 100644 index 00aaf409ca..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types index 2530671b34..4c7b763f3a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt index 35c27166e7..7400a788e2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt @@ -1,27 +1,12 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +18,11 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -55,17 +34,15 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cts (3 errors) ==== +==== index.cts (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -78,6 +55,9 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding typei.implicitCjsSource; ts.cjsSource; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -87,8 +67,10 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -98,8 +80,10 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const mjsSource = true; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -109,7 +93,6 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt.diff deleted file mode 100644 index db9b2c18e8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,139 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node16).errors.txt -+++ new.nodeModulesConditionalPackageExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cts (2 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -57, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js index 87d5cda21c..7653fb782c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js.diff deleted file mode 100644 index 5a8f5c9077..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node16).js -+++ new.nodeModulesConditionalPackageExports(module=node16).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols index e574ed5f77..fed90e232d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.ts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.ts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mts === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cts === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cts, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cts, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols.diff deleted file mode 100644 index db7e92d3d8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node16).symbols -+++ new.nodeModulesConditionalPackageExports(module=node16).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cts, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types index 548c7f4fc2..2cc0823cd4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types.diff deleted file mode 100644 index b5d4494171..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node16).types -+++ new.nodeModulesConditionalPackageExports(module=node16).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt index 35c27166e7..7400a788e2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt @@ -1,27 +1,12 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +18,11 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -55,17 +34,15 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cts (3 errors) ==== +==== index.cts (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -78,6 +55,9 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding typei.implicitCjsSource; ts.cjsSource; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -87,8 +67,10 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -98,8 +80,10 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const mjsSource = true; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -109,7 +93,6 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt.diff deleted file mode 100644 index 9f08cb4b48..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,139 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node18).errors.txt -+++ new.nodeModulesConditionalPackageExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cts (2 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -57, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js index 87d5cda21c..7653fb782c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js.diff deleted file mode 100644 index 88c09cb208..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node18).js -+++ new.nodeModulesConditionalPackageExports(module=node18).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols index e574ed5f77..fed90e232d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.ts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.ts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mts === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cts === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cts, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cts, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols.diff deleted file mode 100644 index 069b3123ae..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node18).symbols -+++ new.nodeModulesConditionalPackageExports(module=node18).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cts, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types index 548c7f4fc2..2cc0823cd4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types.diff deleted file mode 100644 index 5d552d69c5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node18).types -+++ new.nodeModulesConditionalPackageExports(module=node18).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt index 25d206bde9..610e0ab3d6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt @@ -1,41 +1,24 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. index.cts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. index.cts(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. index.mts(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. index.ts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. index.ts(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. index.ts(12,6): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? index.ts(15,4): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -node_modules/inner/index.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -node_modules/inner/index.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -node_modules/inner/index.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -node_modules/inner/index.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. +node_modules/inner/test.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. +node_modules/inner/test.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. +node_modules/inner/test.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. +node_modules/inner/test.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. +node_modules/inner/test.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. !!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (7 errors) ==== +==== index.ts (4 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -50,24 +33,18 @@ node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or cjsi.mjsSource; ~~~~~~~~~ !!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. +!!! related TS2728 node_modules/inner/index.d.cts:2:14: 'cjsSource' is declared here. mjsi.mjsSource; typei.mjsSource; ts.mjsSource; ~~~~~~~~~ !!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -==== index.mts (4 errors) ==== +!!! related TS2728 node_modules/inner/index.d.cts:2:14: 'cjsSource' is declared here. +==== index.mts (1 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -81,17 +58,11 @@ node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cts (5 errors) ==== +==== index.cts (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -107,7 +78,10 @@ node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; -==== node_modules/inner/index.d.ts (2 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (2 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -121,8 +95,10 @@ node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (1 errors) ==== +==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (1 errors) ==== // esm format file import * as cjs from "inner/a"; ~~~~~~~~~ @@ -134,8 +110,10 @@ node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or export { mjs }; export { type }; export { ts }; - export const mjsSource = true; -==== node_modules/inner/index.d.cts (2 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (2 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -149,7 +127,6 @@ node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt.diff index f694e2de34..11449fc135 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt.diff @@ -1,81 +1,28 @@ --- old.nodeModulesConditionalPackageExports(module=node20).errors.txt +++ new.nodeModulesConditionalPackageExports(module=node20).errors.txt @@= skipped -0, +0 lines =@@ +- +error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. +index.cts(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.mts(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.ts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. +index.ts(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. +index.ts(12,6): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? +index.ts(15,4): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+node_modules/inner/index.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+node_modules/inner/index.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+node_modules/inner/index.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+node_modules/inner/index.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. ++node_modules/inner/test.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. ++node_modules/inner/test.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. ++node_modules/inner/test.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. ++node_modules/inner/test.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. ++node_modules/inner/test.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cts (0 errors) ==== -+==== index.ts (7 errors) ==== ++==== index.ts (4 errors) ==== + // esm format file + import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. + import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. + import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. + cjs; + mjs; + type; @@ -90,24 +37,18 @@ + cjsi.mjsSource; + ~~~~~~~~~ +!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. ++!!! related TS2728 node_modules/inner/index.d.cts:2:14: 'cjsSource' is declared here. + mjsi.mjsSource; + typei.mjsSource; + ts.mjsSource; + ~~~~~~~~~ +!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -+==== index.mts (4 errors) ==== ++!!! related TS2728 node_modules/inner/index.d.cts:2:14: 'cjsSource' is declared here. ++==== index.mts (1 errors) ==== + // esm format file + import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. + import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. + import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. + cjs; + mjs; + type; @@ -121,72 +62,113 @@ + mjsi.mjsSource; + typei.mjsSource; + ts.mjsSource; -+==== index.cts (5 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; ++==== index.cts (2 errors) ==== ++ // cjs format file ++ import * as cjs from "package/cjs"; ++ import * as mjs from "package/mjs"; ++ import * as type from "package"; ++ cjs; ++ mjs; ++ type; ++ import * as cjsi from "inner/a"; ++ import * as mjsi from "inner/b"; + ~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; ++ import * as typei from "inner"; + ~~~~~~~ +!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; ++ import * as ts from "inner/types"; ++ cjsi.cjsSource; ++ mjsi.cjsSource; ++ typei.implicitCjsSource; ++ ts.cjsSource; ++==== node_modules/inner/index.d.ts (0 errors) ==== ++ // cjs format file ++ export const implicitCjsSource = true; ++==== node_modules/inner/test.d.ts (2 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/a"; ++ import * as mjs from "inner/b"; + ~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; ++ import * as type from "inner"; + ~~~~~~~ +!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; -@@= skipped -67, +124 lines =@@ - ==== node_modules/inner/index.d.mts (1 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. ++ import * as ts from "inner/types"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++ export { ts }; ++==== node_modules/inner/index.d.mts (0 errors) ==== ++ // esm format file ++ export const mjsSource = true; ++==== node_modules/inner/test.d.mts (1 errors) ==== ++ // esm format file ++ import * as cjs from "inner/a"; + ~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -10, +10 lines =@@ - export { type }; - export { ts }; - export const mjsSource = true; --==== node_modules/inner/index.d.cts (0 errors) ==== -+==== node_modules/inner/index.d.cts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; ++ import * as mjs from "inner/b"; ++ import * as type from "inner"; ++ import * as ts from "inner/types"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++ export { ts }; ++==== node_modules/inner/index.d.cts (0 errors) ==== ++ // cjs format file ++ export const cjsSource = true; ++==== node_modules/inner/test.d.cts (2 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/a"; ++ import * as mjs from "inner/b"; + ~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; ++ import * as type from "inner"; + ~~~~~~~ +!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; \ No newline at end of file ++ import * as ts from "inner/types"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++ export { ts }; ++==== package.json (0 errors) ==== ++ { ++ "name": "package", ++ "private": true, ++ "type": "module", ++ "exports": { ++ "./cjs": "./index.cjs", ++ "./mjs": "./index.mjs", ++ ".": "./index.js" ++ } ++ } ++==== node_modules/inner/package.json (0 errors) ==== ++ { ++ "name": "inner", ++ "private": true, ++ "exports": { ++ "./a": { ++ "require": "./index.cjs", ++ "node": "./index.mjs" ++ }, ++ "./b": { ++ "import": "./index.mjs", ++ "node": "./index.cjs" ++ }, ++ ".": { ++ "import": "./index.mjs", ++ "node": "./index.js" ++ }, ++ "./types": { ++ "types": { ++ "import": "./index.d.mts", ++ "require": "./index.d.cts" ++ }, ++ "node": { ++ "import": "./index.mjs", ++ "require": "./index.cjs" ++ } ++ } ++ } ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js index 791b1d07d9..6cba1dbec9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,7 +129,7 @@ export const cjsSource = true; } -//// [index.js] +//// [index.mjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // esm format file @@ -141,10 +147,10 @@ cjsi.mjsSource; mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -//// [index.mjs] +//// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file +// cjs format file const cjs = require("package/cjs"); const mjs = require("package/mjs"); const type = require("package"); @@ -155,14 +161,14 @@ const cjsi = require("inner/a"); const mjsi = require("inner/b"); const typei = require("inner"); const ts = require("inner/types"); -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; -//// [index.cjs] +cjsi.cjsSource; +mjsi.cjsSource; +typei.implicitCjsSource; +ts.cjsSource; +//// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -// cjs format file +// esm format file const cjs = require("package/cjs"); const mjs = require("package/mjs"); const type = require("package"); @@ -173,15 +179,15 @@ const cjsi = require("inner/a"); const mjsi = require("inner/b"); const typei = require("inner"); const ts = require("inner/types"); -cjsi.cjsSource; -mjsi.cjsSource; -typei.implicitCjsSource; -ts.cjsSource; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js.diff index 86fc03121d..0a0b774ba8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js.diff @@ -1,27 +1,8 @@ --- old.nodeModulesConditionalPackageExports(module=node20).js +++ new.nodeModulesConditionalPackageExports(module=node20).js -@@= skipped -122, +122 lines =@@ - } +@@= skipped -129, +129 lines =@@ -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; //// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); @@ -105,31 +86,27 @@ mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; --//// [index.js] --// esm format file + //// [index.js] ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); + // esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; --cjs; --mjs; --type; ++const cjs = require("package/cjs"); ++const mjs = require("package/mjs"); ++const type = require("package"); + cjs; + mjs; + type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file ++const cjsi = require("inner/a"); ++const mjsi = require("inner/b"); ++const typei = require("inner"); ++const ts = require("inner/types"); + cjsi.mjsSource; + mjsi.mjsSource; + typei.mjsSource; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols index 193a06aa9c..e04fb25f3a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols @@ -80,19 +80,19 @@ cjsi.mjsSource; >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cts === // cjs format file @@ -127,9 +127,9 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cts, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) @@ -138,94 +138,100 @@ typei.implicitCjsSource; >typei : Symbol(typei, Decl(index.cts, 9, 6)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cts, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols.diff index 3cd5f6d53d..19104f5b7d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols.diff @@ -4,24 +4,24 @@ >ts : Symbol(ts, Decl(index.ts, 10, 6)) cjsi.mjsSource; -->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; -->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; -->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; -->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.ts, 10, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mts === // esm format file @@ -29,85 +29,45 @@ >ts : Symbol(ts, Decl(index.mts, 10, 6)) cjsi.mjsSource; -->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; -->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ++>mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ++>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; -->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ++>typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ++>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; -->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ++>ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ++>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cts === // cjs format file @@= skipped -57, +55 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) + >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; -->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) -->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) +->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) +->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -29, +25 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) + >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types index 174f42a653..b076b34454 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : any @@ -107,22 +107,22 @@ ts.mjsSource; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : any @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof mjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types.diff index 87fe4ad1ae..322d810e15 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types.diff @@ -1,33 +1,6 @@ --- old.nodeModulesConditionalPackageExports(module=node20).types +++ new.nodeModulesConditionalPackageExports(module=node20).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; +@@= skipped -23, +23 lines =@@ >cjsi : typeof cjsi import * as mjsi from "inner/b"; @@ -73,29 +46,8 @@ === index.mts === // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any +@@= skipped -49, +49 lines =@@ + >type : typeof type import * as cjsi from "inner/a"; ->cjsi : typeof cjsi @@ -140,32 +92,7 @@ >mjsSource : true === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; +@@= skipped -55, +55 lines =@@ >cjsi : typeof cjsi import * as mjsi from "inner/b"; @@ -173,12 +100,12 @@ +>mjsi : any import * as typei from "inner"; -->typei : typeof cjsi.type +->typei : typeof typei +>typei : any import * as ts from "inner/types"; >ts : typeof cjsi -@@= skipped -139, +139 lines =@@ +@@= skipped -14, +14 lines =@@ >cjsSource : true mjsi.cjsSource; @@ -191,7 +118,7 @@ typei.implicitCjsSource; ->typei.implicitCjsSource : true -->typei : typeof cjsi.type +->typei : typeof typei ->implicitCjsSource : true +>typei.implicitCjsSource : any +>typei : any @@ -199,44 +126,70 @@ ts.cjsSource; >ts.cjsSource : true -@@= skipped -17, +17 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs +@@= skipped -26, +26 lines =@@ + >cjs : typeof cjs import * as mjs from "inner/b"; -->mjs : typeof mjs +->mjs : typeof cjs +>mjs : any import * as type from "inner"; -->type : typeof mjs.type +->type : typeof type +>type : any import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs + >ts : typeof cjs +@@= skipped -12, +12 lines =@@ + >cjs : typeof cjs export { mjs }; -->mjs : typeof mjs +->mjs : typeof cjs +>mjs : any export { type }; -->type : typeof mjs.type +->type : typeof type +>type : any export { ts }; -->ts : typeof mjs -+>ts : typeof cjs + >ts : typeof cjs +@@= skipped -17, +17 lines =@@ + === node_modules/inner/test.d.mts === + // esm format file + import * as cjs from "inner/a"; +->cjs : typeof cjs ++>cjs : any + + import * as mjs from "inner/b"; +->mjs : typeof cjs ++>mjs : typeof mjs + + import * as type from "inner"; +->type : typeof cjs ++>type : typeof mjs + + import * as ts from "inner/types"; +->ts : typeof cjs ++>ts : typeof mjs + + export { cjs }; +->cjs : typeof cjs ++>cjs : any + + export { mjs }; +->mjs : typeof cjs ++>mjs : typeof mjs + + export { type }; +->type : typeof cjs ++>type : typeof mjs - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -63, +63 lines =@@ + export { ts }; +->ts : typeof cjs ++>ts : typeof mjs + + === node_modules/inner/index.d.cts === + // cjs format file +@@= skipped -35, +35 lines =@@ >cjs : typeof cjs import * as mjs from "inner/b"; @@ -244,7 +197,7 @@ +>mjs : any import * as type from "inner"; -->type : typeof cjs.type +->type : typeof type +>type : any import * as ts from "inner/types"; @@ -257,7 +210,7 @@ +>mjs : any export { type }; -->type : typeof cjs.type +->type : typeof type +>type : any export { ts }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 35c27166e7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,153 +0,0 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.mts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const mjsSource = true; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const cjsSource = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./a": { - "require": "./index.cjs", - "node": "./index.mjs" - }, - "./b": { - "import": "./index.mjs", - "node": "./index.cjs" - }, - ".": { - "import": "./index.mjs", - "node": "./index.js" - }, - "./types": { - "types": { - "import": "./index.d.mts", - "require": "./index.d.cts" - }, - "node": { - "import": "./index.mjs", - "require": "./index.cjs" - } - } - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt.diff deleted file mode 100644 index e5d6ca3d03..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,135 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=nodenext).errors.txt -+++ new.nodeModulesConditionalPackageExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cts (0 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -51, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js index 87d5cda21c..7653fb782c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js.diff deleted file mode 100644 index f1050b1157..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=nodenext).js -+++ new.nodeModulesConditionalPackageExports(module=nodenext).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols index e574ed5f77..fed90e232d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.ts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.ts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mts === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cts === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cts, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cts, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index cd9c20a184..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=nodenext).symbols -+++ new.nodeModulesConditionalPackageExports(module=nodenext).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cts, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types index 548c7f4fc2..2cc0823cd4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types.diff deleted file mode 100644 index 0fc79c354b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=nodenext).types -+++ new.nodeModulesConditionalPackageExports(module=nodenext).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt index c3a3b37e59..4c1ba7fcce 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt @@ -1,30 +1,15 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -34,17 +19,11 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -54,17 +33,15 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.cts (4 errors) ==== +==== index.cts (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -76,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -87,6 +67,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -94,7 +77,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -124,4 +110,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt.diff deleted file mode 100644 index 416acbdd60..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesPackageExports(module=node16).errors.txt -+++ new.nodeModulesPackageExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cts (3 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cts (4 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -55, +75 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js index 53f53dc3c1..1b38f77f6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js.diff deleted file mode 100644 index 8d29012f51..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesPackageExports(module=node16).js -+++ new.nodeModulesPackageExports(module=node16).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols index 378496d0a4..991d0d05c6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols.diff deleted file mode 100644 index 4801bd4be0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackageExports(module=node16).symbols -+++ new.nodeModulesPackageExports(module=node16).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types index 67faa06aa6..4dca52efaf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types.diff deleted file mode 100644 index edf00e2a30..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesPackageExports(module=node16).types -+++ new.nodeModulesPackageExports(module=node16).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt index c3a3b37e59..4c1ba7fcce 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt @@ -1,30 +1,15 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -34,17 +19,11 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -54,17 +33,15 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.cts (4 errors) ==== +==== index.cts (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -76,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -87,6 +67,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -94,7 +77,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -124,4 +110,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt.diff deleted file mode 100644 index b95e8cb421..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesPackageExports(module=node18).errors.txt -+++ new.nodeModulesPackageExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cts (3 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cts (4 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -55, +75 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js index 53f53dc3c1..1b38f77f6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js.diff deleted file mode 100644 index 20989c5ae2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesPackageExports(module=node18).js -+++ new.nodeModulesPackageExports(module=node18).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols index 378496d0a4..991d0d05c6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols.diff deleted file mode 100644 index 4cd29da040..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackageExports(module=node18).symbols -+++ new.nodeModulesPackageExports(module=node18).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types index 67faa06aa6..4dca52efaf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types.diff deleted file mode 100644 index 7d89191a71..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesPackageExports(module=node18).types -+++ new.nodeModulesPackageExports(module=node18).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt index cd2e8c262c..4f809f66cb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt @@ -1,29 +1,12 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. !!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +16,11 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding cjsi; mjsi; typei; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -53,17 +30,11 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding cjsi; mjsi; typei; -==== index.cts (3 errors) ==== +==== index.cts (0 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -74,6 +45,9 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi; typei; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -82,6 +56,9 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -90,6 +67,9 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -117,4 +97,5 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt.diff index b5302f6b7e..2f9510c428 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt.diff @@ -1,64 +1,16 @@ --- old.nodeModulesPackageExports(module=node20).errors.txt +++ new.nodeModulesPackageExports(module=node20).errors.txt @@= skipped -0, +0 lines =@@ +- +error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cts (0 errors) ==== -+==== index.ts (3 errors) ==== ++==== index.ts (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. + import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. + import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. + cjs; + mjs; + type; @@ -68,17 +20,11 @@ + cjsi; + mjsi; + typei; -+==== index.mts (3 errors) ==== ++==== index.mts (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. + import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. + import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. + cjs; + mjs; + type; @@ -88,30 +34,72 @@ + cjsi; + mjsi; + typei; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -44, +72 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== ++==== index.cts (0 errors) ==== ++ // cjs format file ++ import * as cjs from "package/cjs"; ++ import * as mjs from "package/mjs"; ++ import * as type from "package"; ++ cjs; ++ mjs; ++ type; ++ import * as cjsi from "inner/cjs"; ++ import * as mjsi from "inner/mjs"; ++ import * as typei from "inner"; ++ cjsi; ++ mjsi; ++ typei; +==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; \ No newline at end of file ++ // cjs format file ++ export const implicitCjsSource = true; ++==== node_modules/inner/test.d.ts (0 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/cjs"; ++ import * as mjs from "inner/mjs"; ++ import * as type from "inner"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== node_modules/inner/index.d.mts (0 errors) ==== ++ // esm format file ++ export const mjsSource = true; ++==== node_modules/inner/test.d.mts (0 errors) ==== ++ // esm format file ++ import * as cjs from "inner/cjs"; ++ import * as mjs from "inner/mjs"; ++ import * as type from "inner"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== node_modules/inner/index.d.cts (0 errors) ==== ++ // cjs format file ++ export const cjsSource = true; ++==== node_modules/inner/test.d.cts (0 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/cjs"; ++ import * as mjs from "inner/mjs"; ++ import * as type from "inner"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== package.json (0 errors) ==== ++ { ++ "name": "package", ++ "private": true, ++ "type": "module", ++ "exports": { ++ "./cjs": "./index.cjs", ++ "./mjs": "./index.mjs", ++ ".": "./index.js" ++ } ++ } ++==== node_modules/inner/package.json (0 errors) ==== ++ { ++ "name": "inner", ++ "private": true, ++ "exports": { ++ "./cjs": "./index.cjs", ++ "./mjs": "./index.mjs", ++ ".": "./index.js" ++ } ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js index 0c6d333921..41acd22039 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,9 +95,10 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} -//// [index.js] + +//// [index.mjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // esm format file @@ -104,10 +114,10 @@ const typei = require("inner"); cjsi; mjsi; typei; -//// [index.mjs] +//// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file +// cjs format file const cjs = require("package/cjs"); const mjs = require("package/mjs"); const type = require("package"); @@ -120,10 +130,10 @@ const typei = require("inner"); cjsi; mjsi; typei; -//// [index.cjs] +//// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -// cjs format file +// esm format file const cjs = require("package/cjs"); const mjs = require("package/mjs"); const type = require("package"); @@ -138,9 +148,9 @@ mjsi; typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js.diff index 17c70b0fff..a827384b19 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js.diff @@ -1,25 +1,8 @@ --- old.nodeModulesPackageExports(module=node20).js +++ new.nodeModulesPackageExports(module=node20).js -@@= skipped -87, +87 lines =@@ - } - } +@@= skipped -98, +98 lines =@@ + -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+cjsi; -+mjsi; -+typei; //// [index.mjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); @@ -82,50 +65,40 @@ -const cjs = __importStar(require("package/cjs")); -const mjs = __importStar(require("package/mjs")); -const type = __importStar(require("package")); --cjs; --mjs; --type; ++const cjs = require("package/cjs"); ++const mjs = require("package/mjs"); ++const type = require("package"); + cjs; + mjs; + type; -const cjsi = __importStar(require("inner/cjs")); -const mjsi = __importStar(require("inner/mjs")); -const typei = __importStar(require("inner")); --cjsi; --mjsi; --typei; --//// [index.js] --// esm format file ++const cjsi = require("inner/cjs"); ++const mjsi = require("inner/mjs"); ++const typei = require("inner"); + cjsi; + mjsi; + typei; + //// [index.js] ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); + // esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- +const cjs = require("package/cjs"); +const mjs = require("package/mjs"); +const type = require("package"); -+cjs; -+mjs; -+type; + cjs; + mjs; + type; +-import * as cjsi from "inner/cjs"; +-import * as mjsi from "inner/mjs"; +-import * as typei from "inner"; +const cjsi = require("inner/cjs"); +const mjsi = require("inner/mjs"); +const typei = require("inner"); -+cjsi; -+mjsi; -+typei; -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file + cjsi; + mjsi; + typei; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols index 378496d0a4..991d0d05c6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols.diff deleted file mode 100644 index 4e9e7bab24..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackageExports(module=node20).symbols -+++ new.nodeModulesPackageExports(module=node20).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types index 67faa06aa6..4dca52efaf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types.diff deleted file mode 100644 index db1a459945..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesPackageExports(module=node20).types -+++ new.nodeModulesPackageExports(module=node20).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 965adec9a2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,118 +0,0 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.mts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt.diff deleted file mode 100644 index 959f1e7201..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,113 +0,0 @@ ---- old.nodeModulesPackageExports(module=nodenext).errors.txt -+++ new.nodeModulesPackageExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cts (0 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -44, +70 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js index 53f53dc3c1..1b38f77f6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js.diff deleted file mode 100644 index e6df4ccb71..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesPackageExports(module=nodenext).js -+++ new.nodeModulesPackageExports(module=nodenext).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols index 378496d0a4..991d0d05c6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index 3f3cb3b59e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackageExports(module=nodenext).symbols -+++ new.nodeModulesPackageExports(module=nodenext).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types index 67faa06aa6..4dca52efaf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types.diff deleted file mode 100644 index 9730a78e76..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesPackageExports(module=nodenext).types -+++ new.nodeModulesPackageExports(module=nodenext).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt index 8805dce4dc..edded79874 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt @@ -1,6 +1,6 @@ index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt.diff deleted file mode 100644 index 33b0fbc52c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node16).errors.txt -+++ new.nodeModulesPackagePatternExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).js index 16d7442eb7..fd642683ab 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols index 495d39b65a..80efcda8a2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols.diff deleted file mode 100644 index e61594f40d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node16).symbols -+++ new.nodeModulesPackagePatternExports(module=node16).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types index 953c741c90..1162099dc3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types.diff deleted file mode 100644 index a1c7499804..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node16).types -+++ new.nodeModulesPackagePatternExports(module=node16).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt index 8805dce4dc..edded79874 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt @@ -1,6 +1,6 @@ index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt.diff deleted file mode 100644 index dc743a6e3b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node18).errors.txt -+++ new.nodeModulesPackagePatternExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).js index 16d7442eb7..fd642683ab 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols index 495d39b65a..80efcda8a2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols.diff deleted file mode 100644 index b1fdabb2e7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node18).symbols -+++ new.nodeModulesPackagePatternExports(module=node18).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types index 953c741c90..1162099dc3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types.diff deleted file mode 100644 index ce6a5bb0e8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node18).types -+++ new.nodeModulesPackagePatternExports(module=node18).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt index ed4a986720..1a37633f97 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt @@ -27,6 +27,9 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci mjsi; typei; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -35,6 +38,9 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -43,6 +49,9 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci export { mjs }; export { type }; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt.diff index f0b2c2a1ba..ff1e3767c7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt.diff @@ -1,26 +1,82 @@ --- old.nodeModulesPackagePatternExports(module=node20).errors.txt +++ new.nodeModulesPackagePatternExports(module=node20).errors.txt @@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- +- +error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.ts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; -@@= skipped -24, +25 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== ++==== index.ts (0 errors) ==== ++ // esm format file ++ import * as cjsi from "inner/cjs/index"; ++ import * as mjsi from "inner/mjs/index"; ++ import * as typei from "inner/js/index"; ++ cjsi; ++ mjsi; ++ typei; ++==== index.mts (0 errors) ==== ++ // esm format file ++ import * as cjsi from "inner/cjs/index"; ++ import * as mjsi from "inner/mjs/index"; ++ import * as typei from "inner/js/index"; ++ cjsi; ++ mjsi; ++ typei; ++==== index.cts (0 errors) ==== ++ // cjs format file ++ import * as cjsi from "inner/cjs/index"; ++ import * as mjsi from "inner/mjs/index"; ++ import * as typei from "inner/js/index"; ++ cjsi; ++ mjsi; ++ typei; +==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; \ No newline at end of file ++ // cjs format file ++ export const implicitCjsSource = true; ++==== node_modules/inner/test.d.ts (0 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/cjs/index"; ++ import * as mjs from "inner/mjs/index"; ++ import * as type from "inner/js/index"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== node_modules/inner/index.d.mts (0 errors) ==== ++ // esm format file ++ export const mjsSource = true; ++==== node_modules/inner/test.d.mts (0 errors) ==== ++ // esm format file ++ import * as cjs from "inner/cjs/index"; ++ import * as mjs from "inner/mjs/index"; ++ import * as type from "inner/js/index"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== node_modules/inner/index.d.cts (0 errors) ==== ++ // cjs format file ++ export const cjsSource = true; ++==== node_modules/inner/test.d.cts (0 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/cjs/index"; ++ import * as mjs from "inner/mjs/index"; ++ import * as type from "inner/js/index"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== package.json (0 errors) ==== ++ { ++ "name": "package", ++ "private": true, ++ "type": "module" ++ } ++==== node_modules/inner/package.json (0 errors) ==== ++ { ++ "name": "inner", ++ "private": true, ++ "exports": { ++ "./cjs/*": "./*.cjs", ++ "./mjs/*": "./*.mjs", ++ "./js/*": "./*.js" ++ } ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js index 7de6c11c18..af12313ee1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js.diff index 25cfbdbef8..5b0bf98d7b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js.diff @@ -1,6 +1,6 @@ --- old.nodeModulesPackagePatternExports(module=node20).js +++ new.nodeModulesPackagePatternExports(module=node20).js -@@= skipped -66, +66 lines =@@ +@@= skipped -75, +75 lines =@@ //// [index.js] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols index 495d39b65a..80efcda8a2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols.diff deleted file mode 100644 index 6082514674..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node20).symbols -+++ new.nodeModulesPackagePatternExports(module=node20).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types index 953c741c90..1162099dc3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types.diff deleted file mode 100644 index 185e002670..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node20).types -+++ new.nodeModulesPackagePatternExports(module=node20).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt.diff deleted file mode 100644 index 4dee5d096a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=nodenext).errors.txt -+++ new.nodeModulesPackagePatternExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.cts (0 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (0 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*": "./*.cjs", -- "./mjs/*": "./*.mjs", -- "./js/*": "./*.js" -- } -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).js index 16d7442eb7..fd642683ab 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols index 495d39b65a..80efcda8a2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols.diff deleted file mode 100644 index 976d0a42fb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=nodenext).symbols -+++ new.nodeModulesPackagePatternExports(module=nodenext).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types index 953c741c90..1162099dc3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types.diff deleted file mode 100644 index b2f81d75d6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=nodenext).types -+++ new.nodeModulesPackagePatternExports(module=nodenext).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt index 491a598cda..ca1c1e7352 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt @@ -8,17 +8,17 @@ index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or it index.ts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.ts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.ts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/exclude/test.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (3 errors) ==== @@ -83,7 +83,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi2; mjsi2; typei2; -==== node_modules/inner/exclude/index.d.ts (3 errors) ==== +==== node_modules/inner/exclude/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/exclude/test.d.ts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -97,7 +100,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.mts (3 errors) ==== +==== node_modules/inner/exclude/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/exclude/test.d.mts (3 errors) ==== // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -111,7 +117,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.cts (3 errors) ==== +==== node_modules/inner/exclude/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/exclude/test.d.cts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -125,7 +134,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -136,6 +148,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -143,7 +158,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -171,4 +189,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt.diff deleted file mode 100644 index 59c7ffbc5c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node16).errors.txt -+++ new.nodeModulesPackagePatternExportsExclude(module=node16).errors.txt -@@= skipped -17, +17 lines =@@ - node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -108, +107 lines =@@ - export { cjs }; - export { mjs }; - export { type }; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).js index 5fe735dbc3..86bc3022de 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).js @@ -44,6 +44,9 @@ mjsi2; typei2; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -68,6 +77,9 @@ export { mjs }; export { type }; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -76,6 +88,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -84,6 +99,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -108,7 +126,8 @@ export { type }; "./js/*": "./*.js", "./js/exclude/*": null } -} +} + //// [index.js] // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols index 9bcd25bcd7..8f1e180a5e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols @@ -116,121 +116,151 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols.diff deleted file mode 100644 index 4e7b9ae82f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node16).symbols -+++ new.nodeModulesPackagePatternExportsExclude(module=node16).symbols -@@= skipped -185, +185 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types index 8bdf18e1e4..893175b77c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types @@ -116,6 +116,12 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -176,6 +194,12 @@ export { type }; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -196,6 +220,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -216,6 +246,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types.diff deleted file mode 100644 index ae03ffea99..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node16).types -+++ new.nodeModulesPackagePatternExportsExclude(module=node16).types -@@= skipped -23, +23 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - cjsi2; - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - typei2; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - === node_modules/inner/exclude/index.d.ts === - // cjs format file -@@= skipped -77, +77 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -23, +23 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt index 491a598cda..ca1c1e7352 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt @@ -8,17 +8,17 @@ index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or it index.ts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.ts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.ts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/exclude/test.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (3 errors) ==== @@ -83,7 +83,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi2; mjsi2; typei2; -==== node_modules/inner/exclude/index.d.ts (3 errors) ==== +==== node_modules/inner/exclude/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/exclude/test.d.ts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -97,7 +100,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.mts (3 errors) ==== +==== node_modules/inner/exclude/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/exclude/test.d.mts (3 errors) ==== // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -111,7 +117,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.cts (3 errors) ==== +==== node_modules/inner/exclude/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/exclude/test.d.cts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -125,7 +134,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -136,6 +148,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -143,7 +158,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -171,4 +189,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt.diff deleted file mode 100644 index a13dc3c492..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node18).errors.txt -+++ new.nodeModulesPackagePatternExportsExclude(module=node18).errors.txt -@@= skipped -17, +17 lines =@@ - node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -108, +107 lines =@@ - export { cjs }; - export { mjs }; - export { type }; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).js index 5fe735dbc3..86bc3022de 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).js @@ -44,6 +44,9 @@ mjsi2; typei2; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -68,6 +77,9 @@ export { mjs }; export { type }; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -76,6 +88,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -84,6 +99,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -108,7 +126,8 @@ export { type }; "./js/*": "./*.js", "./js/exclude/*": null } -} +} + //// [index.js] // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols index 9bcd25bcd7..8f1e180a5e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols @@ -116,121 +116,151 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols.diff deleted file mode 100644 index 866ec52ea4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node18).symbols -+++ new.nodeModulesPackagePatternExportsExclude(module=node18).symbols -@@= skipped -185, +185 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types index 8bdf18e1e4..893175b77c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types @@ -116,6 +116,12 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -176,6 +194,12 @@ export { type }; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -196,6 +220,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -216,6 +246,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types.diff deleted file mode 100644 index 920348eae4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node18).types -+++ new.nodeModulesPackagePatternExportsExclude(module=node18).types -@@= skipped -23, +23 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - cjsi2; - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - typei2; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - === node_modules/inner/exclude/index.d.ts === - // cjs format file -@@= skipped -77, +77 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -23, +23 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt index 294d009582..83a798411e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt @@ -8,15 +8,15 @@ index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or it index.ts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.ts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.ts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. !!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. @@ -80,7 +80,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i cjsi2; mjsi2; typei2; -==== node_modules/inner/exclude/index.d.ts (3 errors) ==== +==== node_modules/inner/exclude/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/exclude/test.d.ts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -94,7 +97,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.mts (3 errors) ==== +==== node_modules/inner/exclude/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/exclude/test.d.mts (3 errors) ==== // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -108,7 +114,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.cts (3 errors) ==== +==== node_modules/inner/exclude/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/exclude/test.d.cts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -123,6 +132,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -131,6 +143,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -139,6 +154,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -164,4 +182,5 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt.diff index 77a825c121..65832ffdc8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt.diff @@ -5,29 +5,11 @@ index.cts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.cts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.cts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -@@= skipped -15, +16 lines =@@ - node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+ -+ +@@= skipped -17, +18 lines =@@ + node_modules/inner/exclude/test.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== index.ts (3 errors) ==== // esm format file - import * as cjsi from "inner/cjs/exclude/index"; -@@= skipped -105, +105 lines =@@ - export { cjs }; - export { mjs }; - export { type }; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; \ No newline at end of file + import * as cjsi from "inner/cjs/exclude/index"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js index 47d4d67006..ba3e754c34 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js @@ -44,6 +44,9 @@ mjsi2; typei2; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -68,6 +77,9 @@ export { mjs }; export { type }; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -76,6 +88,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -84,6 +99,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -108,7 +126,8 @@ export { type }; "./js/*": "./*.js", "./js/exclude/*": null } -} +} + //// [index.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js.diff index 24dcd30773..693b22bd38 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js.diff @@ -1,7 +1,7 @@ --- old.nodeModulesPackagePatternExportsExclude(module=node20).js +++ new.nodeModulesPackagePatternExportsExclude(module=node20).js -@@= skipped -110, +110 lines =@@ - } +@@= skipped -129, +129 lines =@@ + //// [index.js] +"use strict"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols index 9bcd25bcd7..8f1e180a5e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols @@ -116,121 +116,151 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols.diff deleted file mode 100644 index d499d5611f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node20).symbols -+++ new.nodeModulesPackagePatternExportsExclude(module=node20).symbols -@@= skipped -185, +185 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types index 8bdf18e1e4..893175b77c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types @@ -116,6 +116,12 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -176,6 +194,12 @@ export { type }; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -196,6 +220,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -216,6 +246,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types.diff deleted file mode 100644 index 354ba167c7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node20).types -+++ new.nodeModulesPackagePatternExportsExclude(module=node20).types -@@= skipped -23, +23 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - cjsi2; - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - typei2; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - === node_modules/inner/exclude/index.d.ts === - // cjs format file -@@= skipped -77, +77 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -23, +23 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt index 7b905f13c1..2a889543f6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt @@ -7,15 +7,15 @@ index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or it index.ts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.ts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.ts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. ==== index.ts (3 errors) ==== @@ -78,7 +78,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i cjsi2; mjsi2; typei2; -==== node_modules/inner/exclude/index.d.ts (3 errors) ==== +==== node_modules/inner/exclude/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/exclude/test.d.ts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -92,7 +95,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.mts (3 errors) ==== +==== node_modules/inner/exclude/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/exclude/test.d.mts (3 errors) ==== // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -106,7 +112,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.cts (3 errors) ==== +==== node_modules/inner/exclude/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/exclude/test.d.cts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -121,6 +130,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -129,6 +141,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -137,6 +152,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -162,4 +180,5 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt.diff deleted file mode 100644 index 222b759f1a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt -+++ new.nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt -@@= skipped -15, +15 lines =@@ - node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - - - ==== index.ts (3 errors) ==== -@@= skipped -105, +104 lines =@@ - export { cjs }; - export { mjs }; - export { type }; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).js index 5fe735dbc3..86bc3022de 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).js @@ -44,6 +44,9 @@ mjsi2; typei2; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -68,6 +77,9 @@ export { mjs }; export { type }; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -76,6 +88,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -84,6 +99,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -108,7 +126,8 @@ export { type }; "./js/*": "./*.js", "./js/exclude/*": null } -} +} + //// [index.js] // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols index 9bcd25bcd7..8f1e180a5e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols @@ -116,121 +116,151 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols.diff deleted file mode 100644 index 4d2881e721..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=nodenext).symbols -+++ new.nodeModulesPackagePatternExportsExclude(module=nodenext).symbols -@@= skipped -185, +185 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types index 8bdf18e1e4..893175b77c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types @@ -116,6 +116,12 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -176,6 +194,12 @@ export { type }; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -196,6 +220,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -216,6 +246,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types.diff deleted file mode 100644 index 6a0208d1ed..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=nodenext).types -+++ new.nodeModulesPackagePatternExportsExclude(module=nodenext).types -@@= skipped -23, +23 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - cjsi2; - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - typei2; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - === node_modules/inner/exclude/index.d.ts === - // cjs format file -@@= skipped -77, +77 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -23, +23 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt index 2210b62d74..df6aa2d2e6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt @@ -1,6 +1,6 @@ index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. ==== index.ts (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt.diff deleted file mode 100644 index c8e9804b85..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt -+++ new.nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).js index 7e40184e6a..52eefeb460 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols index 8b4f028de2..c8615a5f47 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols.diff deleted file mode 100644 index 6efcd2e82c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node16).symbols -+++ new.nodeModulesPackagePatternExportsTrailers(module=node16).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json index df9bceab10..586e2b5caf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json @@ -38,9 +38,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist. File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -48,9 +51,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -58,9 +64,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -69,9 +78,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -79,9 +91,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -89,9 +104,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -100,7 +118,7 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -110,7 +128,7 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -120,7 +138,7 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -131,12 +149,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -144,12 +159,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -157,12 +169,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -171,12 +180,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -184,12 +190,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -197,12 +200,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types index 7d054eb128..7f7b1d09ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types.diff deleted file mode 100644 index 0eb34521ce..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node16).types -+++ new.nodeModulesPackagePatternExportsTrailers(module=node16).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt index 2210b62d74..df6aa2d2e6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt @@ -1,6 +1,6 @@ index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. ==== index.ts (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt.diff deleted file mode 100644 index 9477452c75..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt -+++ new.nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).js index 7e40184e6a..52eefeb460 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols index 8b4f028de2..c8615a5f47 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols.diff deleted file mode 100644 index dbec2322af..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node18).symbols -+++ new.nodeModulesPackagePatternExportsTrailers(module=node18).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json index df9bceab10..586e2b5caf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json @@ -38,9 +38,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist. File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -48,9 +51,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -58,9 +64,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -69,9 +78,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -79,9 +91,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -89,9 +104,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -100,7 +118,7 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -110,7 +128,7 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -120,7 +138,7 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -131,12 +149,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -144,12 +159,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -157,12 +169,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -171,12 +180,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -184,12 +190,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -197,12 +200,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types index 7d054eb128..7f7b1d09ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types.diff deleted file mode 100644 index db52145154..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node18).types -+++ new.nodeModulesPackagePatternExportsTrailers(module=node18).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt index 719d75264b..c98c2a7019 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt @@ -27,6 +27,9 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci mjsi; typei; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -35,6 +38,9 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -43,6 +49,9 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci export { mjs }; export { type }; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt.diff index 86de4c001a..613ef6ede6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt.diff @@ -1,26 +1,82 @@ --- old.nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt +++ new.nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt @@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- +- +error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.ts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; -@@= skipped -24, +25 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== ++==== index.ts (0 errors) ==== ++ // esm format file ++ import * as cjsi from "inner/cjs/index.cjs"; ++ import * as mjsi from "inner/mjs/index.mjs"; ++ import * as typei from "inner/js/index.js"; ++ cjsi; ++ mjsi; ++ typei; ++==== index.mts (0 errors) ==== ++ // esm format file ++ import * as cjsi from "inner/cjs/index.cjs"; ++ import * as mjsi from "inner/mjs/index.mjs"; ++ import * as typei from "inner/js/index.js"; ++ cjsi; ++ mjsi; ++ typei; ++==== index.cts (0 errors) ==== ++ // cjs format file ++ import * as cjsi from "inner/cjs/index.cjs"; ++ import * as mjsi from "inner/mjs/index.mjs"; ++ import * as typei from "inner/js/index.js"; ++ cjsi; ++ mjsi; ++ typei; +==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; \ No newline at end of file ++ // cjs format file ++ export const implicitCjsSource = true; ++==== node_modules/inner/test.d.ts (0 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/cjs/index.cjs"; ++ import * as mjs from "inner/mjs/index.mjs"; ++ import * as type from "inner/js/index.js"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== node_modules/inner/index.d.mts (0 errors) ==== ++ // esm format file ++ export const mjsSource = true; ++==== node_modules/inner/test.d.mts (0 errors) ==== ++ // esm format file ++ import * as cjs from "inner/cjs/index.cjs"; ++ import * as mjs from "inner/mjs/index.mjs"; ++ import * as type from "inner/js/index.js"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== node_modules/inner/index.d.cts (0 errors) ==== ++ // cjs format file ++ export const cjsSource = true; ++==== node_modules/inner/test.d.cts (0 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/cjs/index.cjs"; ++ import * as mjs from "inner/mjs/index.mjs"; ++ import * as type from "inner/js/index.js"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== package.json (0 errors) ==== ++ { ++ "name": "package", ++ "private": true, ++ "type": "module" ++ } ++==== node_modules/inner/package.json (0 errors) ==== ++ { ++ "name": "inner", ++ "private": true, ++ "exports": { ++ "./cjs/*.cjs": "./*.cjs", ++ "./mjs/*.mjs": "./*.mjs", ++ "./js/*.js": "./*.js" ++ } ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js index 2cfbc7f1fa..303c10dba7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js.diff index b0579fb6ca..8d6b61b4d1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js.diff @@ -1,6 +1,6 @@ --- old.nodeModulesPackagePatternExportsTrailers(module=node20).js +++ new.nodeModulesPackagePatternExportsTrailers(module=node20).js -@@= skipped -66, +66 lines =@@ +@@= skipped -75, +75 lines =@@ //// [index.js] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols index 8b4f028de2..c8615a5f47 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols.diff deleted file mode 100644 index bc462f6f50..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node20).symbols -+++ new.nodeModulesPackagePatternExportsTrailers(module=node20).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json index 06b7bca3a7..36769a23e3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json @@ -38,9 +38,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist. File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Resolving in CJS mode with conditions 'import', 'types'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -48,9 +51,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Resolving in CJS mode with conditions 'import', 'types'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -58,9 +64,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Resolving in CJS mode with conditions 'import', 'types'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -69,9 +78,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Resolving in CJS mode with conditions 'require', 'types'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -79,9 +91,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Resolving in CJS mode with conditions 'require', 'types'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -89,9 +104,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Resolving in CJS mode with conditions 'require', 'types'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -100,7 +118,7 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'require', 'types'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -110,7 +128,7 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'require', 'types'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -120,7 +138,7 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'require', 'types'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -131,12 +149,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'import', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -144,12 +159,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'import', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -157,12 +169,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'import', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -171,12 +180,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'require', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -184,12 +190,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'require', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -197,12 +200,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Bundler'. Resolving in CJS mode with conditions 'require', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types index 7d054eb128..7f7b1d09ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types.diff deleted file mode 100644 index 60501fc3e5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node20).types -+++ new.nodeModulesPackagePatternExportsTrailers(module=node20).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt.diff deleted file mode 100644 index 140525150f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt -+++ new.nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.cts (0 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (0 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*.cjs": "./*.cjs", -- "./mjs/*.mjs": "./*.mjs", -- "./js/*.js": "./*.js" -- } -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).js index 7e40184e6a..52eefeb460 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols index 8b4f028de2..c8615a5f47 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols.diff deleted file mode 100644 index f5dd3186c0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols -+++ new.nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json index f537658d65..937c9e4784 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json @@ -38,9 +38,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist. File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -48,9 +51,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -58,9 +64,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -69,9 +78,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -79,9 +91,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -89,9 +104,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -100,7 +118,7 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -110,7 +128,7 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -120,7 +138,7 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -131,12 +149,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -144,12 +159,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -157,12 +169,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -171,12 +180,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -184,12 +190,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -197,12 +200,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types index 7d054eb128..7f7b1d09ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types.diff deleted file mode 100644 index edc61e89d4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=nodenext).types -+++ new.nodeModulesPackagePatternExportsTrailers(module=nodenext).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt.diff deleted file mode 100644 index e08d1da38d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,139 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cjs (2 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -57, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types.diff deleted file mode 100644 index 2dffe05f69..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node16).types -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node16).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt.diff deleted file mode 100644 index 1dc19bd5b1..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,139 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cjs (2 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -57, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types.diff deleted file mode 100644 index d7b146de5d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node18).types -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node18).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt.diff index e202428077..349645382a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt.diff @@ -1,81 +1,28 @@ --- old.nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt +++ new.nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt @@= skipped -0, +0 lines =@@ +- +error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cjs(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. +index.cjs(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.js(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. +index.js(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. +index.js(12,6): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? +index.js(15,4): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.mjs(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+node_modules/inner/index.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+node_modules/inner/index.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+node_modules/inner/index.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+node_modules/inner/index.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. ++node_modules/inner/test.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. ++node_modules/inner/test.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. ++node_modules/inner/test.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. ++node_modules/inner/test.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. ++node_modules/inner/test.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cjs (0 errors) ==== -+==== index.js (7 errors) ==== ++==== index.js (4 errors) ==== + // esm format file + import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. + import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. + import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. + cjs; + mjs; + type; @@ -90,24 +37,18 @@ + cjsi.mjsSource; + ~~~~~~~~~ +!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. ++!!! related TS2728 node_modules/inner/index.d.cts:2:14: 'cjsSource' is declared here. + mjsi.mjsSource; + typei.mjsSource; + ts.mjsSource; + ~~~~~~~~~ +!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -+==== index.mjs (4 errors) ==== ++!!! related TS2728 node_modules/inner/index.d.cts:2:14: 'cjsSource' is declared here. ++==== index.mjs (1 errors) ==== + // esm format file + import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. + import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. + import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. + cjs; + mjs; + type; @@ -121,72 +62,113 @@ + mjsi.mjsSource; + typei.mjsSource; + ts.mjsSource; -+==== index.cjs (5 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; ++==== index.cjs (2 errors) ==== ++ // cjs format file ++ import * as cjs from "package/cjs"; ++ import * as mjs from "package/mjs"; ++ import * as type from "package"; ++ cjs; ++ mjs; ++ type; ++ import * as cjsi from "inner/a"; ++ import * as mjsi from "inner/b"; + ~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; ++ import * as typei from "inner"; + ~~~~~~~ +!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; ++ import * as ts from "inner/types"; ++ cjsi.cjsSource; ++ mjsi.cjsSource; ++ typei.implicitCjsSource; ++ ts.cjsSource; ++==== node_modules/inner/index.d.ts (0 errors) ==== ++ // cjs format file ++ export const implicitCjsSource = true; ++==== node_modules/inner/test.d.ts (2 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/a"; ++ import * as mjs from "inner/b"; + ~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; ++ import * as type from "inner"; + ~~~~~~~ +!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; -@@= skipped -67, +124 lines =@@ - ==== node_modules/inner/index.d.mts (1 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. ++ import * as ts from "inner/types"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++ export { ts }; ++==== node_modules/inner/index.d.mts (0 errors) ==== ++ // esm format file ++ export const mjsSource = true; ++==== node_modules/inner/test.d.mts (1 errors) ==== ++ // esm format file ++ import * as cjs from "inner/a"; + ~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -10, +10 lines =@@ - export { type }; - export { ts }; - export const mjsSource = true; --==== node_modules/inner/index.d.cts (0 errors) ==== -+==== node_modules/inner/index.d.cts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; ++ import * as mjs from "inner/b"; ++ import * as type from "inner"; ++ import * as ts from "inner/types"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++ export { ts }; ++==== node_modules/inner/index.d.cts (0 errors) ==== ++ // cjs format file ++ export const cjsSource = true; ++==== node_modules/inner/test.d.cts (2 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/a"; ++ import * as mjs from "inner/b"; + ~~~~~~~~~ +!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; ++ import * as type from "inner"; + ~~~~~~~ +!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; \ No newline at end of file ++ import * as ts from "inner/types"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++ export { ts }; ++==== package.json (0 errors) ==== ++ { ++ "name": "package", ++ "private": true, ++ "type": "module", ++ "exports": { ++ "./cjs": "./index.cjs", ++ "./mjs": "./index.mjs", ++ ".": "./index.js" ++ } ++ } ++==== node_modules/inner/package.json (0 errors) ==== ++ { ++ "name": "inner", ++ "private": true, ++ "exports": { ++ "./a": { ++ "require": "./index.cjs", ++ "node": "./index.mjs" ++ }, ++ "./b": { ++ "import": "./index.mjs", ++ "node": "./index.cjs" ++ }, ++ ".": { ++ "import": "./index.mjs", ++ "node": "./index.js" ++ }, ++ "./types": { ++ "types": { ++ "import": "./index.d.mts", ++ "require": "./index.d.cts" ++ }, ++ "node": { ++ "import": "./index.mjs", ++ "require": "./index.cjs" ++ } ++ } ++ } ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types.diff index 3bda3207a5..6e1b2f1289 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types.diff @@ -1,33 +1,6 @@ --- old.nodeModulesAllowJsConditionalPackageExports(module=node20).types +++ new.nodeModulesAllowJsConditionalPackageExports(module=node20).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; +@@= skipped -23, +23 lines =@@ >cjsi : typeof cjsi import * as mjsi from "inner/b"; @@ -73,29 +46,8 @@ === index.mjs === // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any +@@= skipped -49, +49 lines =@@ + >type : typeof type import * as cjsi from "inner/a"; ->cjsi : typeof cjsi @@ -140,32 +92,7 @@ >mjsSource : true === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; +@@= skipped -55, +55 lines =@@ >cjsi : typeof cjsi import * as mjsi from "inner/b"; @@ -173,12 +100,12 @@ +>mjsi : any import * as typei from "inner"; -->typei : typeof cjsi.type +->typei : typeof typei +>typei : any import * as ts from "inner/types"; >ts : typeof cjsi -@@= skipped -139, +139 lines =@@ +@@= skipped -14, +14 lines =@@ >cjsSource : true mjsi.cjsSource; @@ -191,7 +118,7 @@ typei.implicitCjsSource; ->typei.implicitCjsSource : true -->typei : typeof cjsi.type +->typei : typeof typei ->implicitCjsSource : true +>typei.implicitCjsSource : any +>typei : any @@ -199,44 +126,70 @@ ts.cjsSource; >ts.cjsSource : true -@@= skipped -17, +17 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs +@@= skipped -26, +26 lines =@@ + >cjs : typeof cjs import * as mjs from "inner/b"; -->mjs : typeof mjs +->mjs : typeof cjs +>mjs : any import * as type from "inner"; -->type : typeof mjs.type +->type : typeof type +>type : any import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs + >ts : typeof cjs +@@= skipped -12, +12 lines =@@ + >cjs : typeof cjs export { mjs }; -->mjs : typeof mjs +->mjs : typeof cjs +>mjs : any export { type }; -->type : typeof mjs.type +->type : typeof type +>type : any export { ts }; -->ts : typeof mjs -+>ts : typeof cjs + >ts : typeof cjs +@@= skipped -17, +17 lines =@@ + === node_modules/inner/test.d.mts === + // esm format file + import * as cjs from "inner/a"; +->cjs : typeof cjs ++>cjs : any + + import * as mjs from "inner/b"; +->mjs : typeof cjs ++>mjs : typeof mjs + + import * as type from "inner"; +->type : typeof cjs ++>type : typeof mjs + + import * as ts from "inner/types"; +->ts : typeof cjs ++>ts : typeof mjs + + export { cjs }; +->cjs : typeof cjs ++>cjs : any + + export { mjs }; +->mjs : typeof cjs ++>mjs : typeof mjs + + export { type }; +->type : typeof cjs ++>type : typeof mjs - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -63, +63 lines =@@ + export { ts }; +->ts : typeof cjs ++>ts : typeof mjs + + === node_modules/inner/index.d.cts === + // cjs format file +@@= skipped -35, +35 lines =@@ >cjs : typeof cjs import * as mjs from "inner/b"; @@ -244,7 +197,7 @@ +>mjs : any import * as type from "inner"; -->type : typeof cjs.type +->type : typeof type +>type : any import * as ts from "inner/types"; @@ -257,7 +210,7 @@ +>mjs : any export { type }; -->type : typeof cjs.type +->type : typeof type +>type : any export { ts }; diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt.diff deleted file mode 100644 index 2ef14964d2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,135 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt -+++ new.nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cjs (0 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -51, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types.diff deleted file mode 100644 index 68322d3ac2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=nodenext).types -+++ new.nodeModulesAllowJsConditionalPackageExports(module=nodenext).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt.diff deleted file mode 100644 index e593bff0b7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node16).errors.txt -+++ new.nodeModulesAllowJsPackageExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (3 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cjs (4 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -55, +75 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).types.diff deleted file mode 100644 index fef834137b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node16).types -+++ new.nodeModulesAllowJsPackageExports(module=node16).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt.diff deleted file mode 100644 index 7df9bf176f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node18).errors.txt -+++ new.nodeModulesAllowJsPackageExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (3 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cjs (4 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -55, +75 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).types.diff deleted file mode 100644 index 0cb07ae47e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node18).types -+++ new.nodeModulesAllowJsPackageExports(module=node18).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt.diff index 813ea4bbc6..600d64f83b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt.diff @@ -1,64 +1,16 @@ --- old.nodeModulesAllowJsPackageExports(module=node20).errors.txt +++ new.nodeModulesAllowJsPackageExports(module=node20).errors.txt @@= skipped -0, +0 lines =@@ +- +error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (0 errors) ==== -+==== index.js (3 errors) ==== ++==== index.js (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. + import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. + import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. + cjs; + mjs; + type; @@ -68,17 +20,11 @@ + cjsi; + mjsi; + typei; -+==== index.mjs (3 errors) ==== ++==== index.mjs (0 errors) ==== + // esm format file + import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. + import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. + import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. + cjs; + mjs; + type; @@ -88,30 +34,72 @@ + cjsi; + mjsi; + typei; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -44, +72 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== ++==== index.cjs (0 errors) ==== ++ // cjs format file ++ import * as cjs from "package/cjs"; ++ import * as mjs from "package/mjs"; ++ import * as type from "package"; ++ cjs; ++ mjs; ++ type; ++ import * as cjsi from "inner/cjs"; ++ import * as mjsi from "inner/mjs"; ++ import * as typei from "inner"; ++ cjsi; ++ mjsi; ++ typei; +==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; \ No newline at end of file ++ // cjs format file ++ export const implicitCjsSource = true; ++==== node_modules/inner/test.d.ts (0 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/cjs"; ++ import * as mjs from "inner/mjs"; ++ import * as type from "inner"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== node_modules/inner/index.d.mts (0 errors) ==== ++ // esm format file ++ export const mjsSource = true; ++==== node_modules/inner/test.d.mts (0 errors) ==== ++ // esm format file ++ import * as cjs from "inner/cjs"; ++ import * as mjs from "inner/mjs"; ++ import * as type from "inner"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== node_modules/inner/index.d.cts (0 errors) ==== ++ // cjs format file ++ export const cjsSource = true; ++==== node_modules/inner/test.d.cts (0 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/cjs"; ++ import * as mjs from "inner/mjs"; ++ import * as type from "inner"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== package.json (0 errors) ==== ++ { ++ "name": "package", ++ "private": true, ++ "type": "module", ++ "exports": { ++ "./cjs": "./index.cjs", ++ "./mjs": "./index.mjs", ++ ".": "./index.js" ++ } ++ } ++==== node_modules/inner/package.json (0 errors) ==== ++ { ++ "name": "inner", ++ "private": true, ++ "exports": { ++ "./cjs": "./index.cjs", ++ "./mjs": "./index.mjs", ++ ".": "./index.js" ++ } ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).types.diff deleted file mode 100644 index 9a046a7cc5..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node20).types -+++ new.nodeModulesAllowJsPackageExports(module=node20).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt.diff deleted file mode 100644 index c15c3e629d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,113 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=nodenext).errors.txt -+++ new.nodeModulesAllowJsPackageExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (0 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -44, +70 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types.diff deleted file mode 100644 index 9090c96128..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=nodenext).types -+++ new.nodeModulesAllowJsPackageExports(module=nodenext).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt.diff deleted file mode 100644 index d8edc7785a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types.diff deleted file mode 100644 index f588eaafe5..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node16).types -+++ new.nodeModulesAllowJsPackagePatternExports(module=node16).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt.diff deleted file mode 100644 index d3235546df..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types.diff deleted file mode 100644 index 86cb0215d7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node18).types -+++ new.nodeModulesAllowJsPackagePatternExports(module=node18).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt.diff index 69acc68c62..f2268a541f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt.diff @@ -1,26 +1,82 @@ --- old.nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt +++ new.nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt @@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- +- +error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.js (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; -@@= skipped -24, +25 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== ++==== index.js (0 errors) ==== ++ // esm format file ++ import * as cjsi from "inner/cjs/index"; ++ import * as mjsi from "inner/mjs/index"; ++ import * as typei from "inner/js/index"; ++ cjsi; ++ mjsi; ++ typei; ++==== index.mjs (0 errors) ==== ++ // esm format file ++ import * as cjsi from "inner/cjs/index"; ++ import * as mjsi from "inner/mjs/index"; ++ import * as typei from "inner/js/index"; ++ cjsi; ++ mjsi; ++ typei; ++==== index.cjs (0 errors) ==== ++ // cjs format file ++ import * as cjsi from "inner/cjs/index"; ++ import * as mjsi from "inner/mjs/index"; ++ import * as typei from "inner/js/index"; ++ cjsi; ++ mjsi; ++ typei; +==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; \ No newline at end of file ++ // cjs format file ++ export const implicitCjsSource = true; ++==== node_modules/inner/test.d.ts (0 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/cjs/index"; ++ import * as mjs from "inner/mjs/index"; ++ import * as type from "inner/js/index"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== node_modules/inner/index.d.mts (0 errors) ==== ++ // esm format file ++ export const mjsSource = true; ++==== node_modules/inner/test.d.mts (0 errors) ==== ++ // esm format file ++ import * as cjs from "inner/cjs/index"; ++ import * as mjs from "inner/mjs/index"; ++ import * as type from "inner/js/index"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== node_modules/inner/index.d.cts (0 errors) ==== ++ // cjs format file ++ export const cjsSource = true; ++==== node_modules/inner/test.d.cts (0 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/cjs/index"; ++ import * as mjs from "inner/mjs/index"; ++ import * as type from "inner/js/index"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== package.json (0 errors) ==== ++ { ++ "name": "package", ++ "private": true, ++ "type": "module" ++ } ++==== node_modules/inner/package.json (0 errors) ==== ++ { ++ "name": "inner", ++ "private": true, ++ "exports": { ++ "./cjs/*": "./*.cjs", ++ "./mjs/*": "./*.mjs", ++ "./js/*": "./*.js" ++ } ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types.diff deleted file mode 100644 index c71f993ccd..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node20).types -+++ new.nodeModulesAllowJsPackagePatternExports(module=node20).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt.diff deleted file mode 100644 index b07ff1defa..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- --==== index.js (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (0 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (0 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*": "./*.cjs", -- "./mjs/*": "./*.mjs", -- "./js/*": "./*.js" -- } -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types.diff deleted file mode 100644 index dfcec69d5b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=nodenext).types -+++ new.nodeModulesAllowJsPackagePatternExports(module=nodenext).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt.diff deleted file mode 100644 index 318d7c9f6c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types.diff deleted file mode 100644 index 8e657345b4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt.diff deleted file mode 100644 index 6e005d3729..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types.diff deleted file mode 100644 index 9ef7fde633..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt.diff index 4816e4b1ba..6886a17706 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt.diff @@ -1,26 +1,82 @@ --- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt +++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt @@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- +- +error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. + + +!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.js (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; -@@= skipped -24, +25 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== ++==== index.js (0 errors) ==== ++ // esm format file ++ import * as cjsi from "inner/cjs/index.cjs"; ++ import * as mjsi from "inner/mjs/index.mjs"; ++ import * as typei from "inner/js/index.js"; ++ cjsi; ++ mjsi; ++ typei; ++==== index.mjs (0 errors) ==== ++ // esm format file ++ import * as cjsi from "inner/cjs/index.cjs"; ++ import * as mjsi from "inner/mjs/index.mjs"; ++ import * as typei from "inner/js/index.js"; ++ cjsi; ++ mjsi; ++ typei; ++==== index.cjs (0 errors) ==== ++ // cjs format file ++ import * as cjsi from "inner/cjs/index.cjs"; ++ import * as mjsi from "inner/mjs/index.mjs"; ++ import * as typei from "inner/js/index.js"; ++ cjsi; ++ mjsi; ++ typei; +==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; \ No newline at end of file ++ // cjs format file ++ export const implicitCjsSource = true; ++==== node_modules/inner/test.d.ts (0 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/cjs/index.cjs"; ++ import * as mjs from "inner/mjs/index.mjs"; ++ import * as type from "inner/js/index.js"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== node_modules/inner/index.d.mts (0 errors) ==== ++ // esm format file ++ export const mjsSource = true; ++==== node_modules/inner/test.d.mts (0 errors) ==== ++ // esm format file ++ import * as cjs from "inner/cjs/index.cjs"; ++ import * as mjs from "inner/mjs/index.mjs"; ++ import * as type from "inner/js/index.js"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== node_modules/inner/index.d.cts (0 errors) ==== ++ // cjs format file ++ export const cjsSource = true; ++==== node_modules/inner/test.d.cts (0 errors) ==== ++ // cjs format file ++ import * as cjs from "inner/cjs/index.cjs"; ++ import * as mjs from "inner/mjs/index.mjs"; ++ import * as type from "inner/js/index.js"; ++ export { cjs }; ++ export { mjs }; ++ export { type }; ++==== package.json (0 errors) ==== ++ { ++ "name": "package", ++ "private": true, ++ "type": "module" ++ } ++==== node_modules/inner/package.json (0 errors) ==== ++ { ++ "name": "inner", ++ "private": true, ++ "exports": { ++ "./cjs/*.cjs": "./*.cjs", ++ "./mjs/*.mjs": "./*.mjs", ++ "./js/*.js": "./*.js" ++ } ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types.diff deleted file mode 100644 index 1dcb539099..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt.diff deleted file mode 100644 index d8a2e4916c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- --==== index.js (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (0 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (0 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*.cjs": "./*.cjs", -- "./mjs/*.mjs": "./*.mjs", -- "./js/*.js": "./*.js" -- } -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types.diff deleted file mode 100644 index 32aa176903..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type