From 5117003e19eb15daa54b05e5b7c413e420dd73cc Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 8 Oct 2025 15:10:25 -0700 Subject: [PATCH 1/2] Remove circularity errors from node modules compiler tests --- ...alPackageExports(module=node16).errors.txt | 22 +-- ...onditionalPackageExports(module=node16).js | 18 ++- ...ionalPackageExports(module=node16).symbols | 120 ++++++++-------- ...itionalPackageExports(module=node16).types | 92 +++++++------ ...alPackageExports(module=node18).errors.txt | 22 +-- ...onditionalPackageExports(module=node18).js | 18 ++- ...ionalPackageExports(module=node18).symbols | 120 ++++++++-------- ...itionalPackageExports(module=node18).types | 92 +++++++------ ...alPackageExports(module=node20).errors.txt | 22 +-- ...onditionalPackageExports(module=node20).js | 18 ++- ...ionalPackageExports(module=node20).symbols | 120 ++++++++-------- ...itionalPackageExports(module=node20).types | 92 +++++++------ ...PackageExports(module=nodenext).errors.txt | 22 +-- ...ditionalPackageExports(module=nodenext).js | 18 ++- ...nalPackageExports(module=nodenext).symbols | 120 ++++++++-------- ...ionalPackageExports(module=nodenext).types | 92 +++++++------ ...JsPackageExports(module=node16).errors.txt | 23 ++-- ...lesAllowJsPackageExports(module=node16).js | 12 +- ...lowJsPackageExports(module=node16).symbols | 51 ++++--- ...AllowJsPackageExports(module=node16).types | 104 ++++++++------ ...JsPackageExports(module=node18).errors.txt | 23 ++-- ...lesAllowJsPackageExports(module=node18).js | 12 +- ...lowJsPackageExports(module=node18).symbols | 51 ++++--- ...AllowJsPackageExports(module=node18).types | 104 ++++++++------ ...JsPackageExports(module=node20).errors.txt | 17 ++- ...lesAllowJsPackageExports(module=node20).js | 12 +- ...lowJsPackageExports(module=node20).symbols | 51 ++++--- ...AllowJsPackageExports(module=node20).types | 104 ++++++++------ ...PackageExports(module=nodenext).errors.txt | 17 ++- ...sAllowJsPackageExports(module=nodenext).js | 12 +- ...wJsPackageExports(module=nodenext).symbols | 51 ++++--- ...lowJsPackageExports(module=nodenext).types | 104 ++++++++------ ...gePatternExports(module=node16).errors.txt | 20 ++- ...wJsPackagePatternExports(module=node16).js | 9 ++ ...ckagePatternExports(module=node16).symbols | 51 ++++--- ...PackagePatternExports(module=node16).types | 104 ++++++++------ ...gePatternExports(module=node18).errors.txt | 20 ++- ...wJsPackagePatternExports(module=node18).js | 9 ++ ...ckagePatternExports(module=node18).symbols | 51 ++++--- ...PackagePatternExports(module=node18).types | 104 ++++++++------ ...gePatternExports(module=node20).errors.txt | 70 ---------- ...wJsPackagePatternExports(module=node20).js | 9 ++ ...ckagePatternExports(module=node20).symbols | 51 ++++--- ...PackagePatternExports(module=node20).types | 104 ++++++++------ ...PatternExports(module=nodenext).errors.txt | 70 ---------- ...sPackagePatternExports(module=nodenext).js | 9 ++ ...agePatternExports(module=nodenext).symbols | 51 ++++--- ...ckagePatternExports(module=nodenext).types | 104 ++++++++------ ...nExportsTrailers(module=node16).errors.txt | 20 ++- ...gePatternExportsTrailers(module=node16).js | 9 ++ ...ternExportsTrailers(module=node16).symbols | 51 ++++--- ...atternExportsTrailers(module=node16).types | 104 ++++++++------ ...nExportsTrailers(module=node18).errors.txt | 20 ++- ...gePatternExportsTrailers(module=node18).js | 9 ++ ...ternExportsTrailers(module=node18).symbols | 51 ++++--- ...atternExportsTrailers(module=node18).types | 104 ++++++++------ ...nExportsTrailers(module=node20).errors.txt | 70 ---------- ...gePatternExportsTrailers(module=node20).js | 9 ++ ...ternExportsTrailers(module=node20).symbols | 51 ++++--- ...atternExportsTrailers(module=node20).types | 104 ++++++++------ ...xportsTrailers(module=nodenext).errors.txt | 70 ---------- ...PatternExportsTrailers(module=nodenext).js | 9 ++ ...rnExportsTrailers(module=nodenext).symbols | 51 ++++--- ...ternExportsTrailers(module=nodenext).types | 104 ++++++++------ ...alPackageExports(module=node16).errors.txt | 22 +-- ...onditionalPackageExports(module=node16).js | 18 ++- ...ionalPackageExports(module=node16).symbols | 120 ++++++++-------- ...itionalPackageExports(module=node16).types | 92 +++++++------ ...alPackageExports(module=node18).errors.txt | 22 +-- ...onditionalPackageExports(module=node18).js | 18 ++- ...ionalPackageExports(module=node18).symbols | 120 ++++++++-------- ...itionalPackageExports(module=node18).types | 92 +++++++------ ...alPackageExports(module=node20).errors.txt | 22 +-- ...onditionalPackageExports(module=node20).js | 18 ++- ...ionalPackageExports(module=node20).symbols | 120 ++++++++-------- ...itionalPackageExports(module=node20).types | 92 +++++++------ ...PackageExports(module=nodenext).errors.txt | 22 +-- ...ditionalPackageExports(module=nodenext).js | 18 ++- ...nalPackageExports(module=nodenext).symbols | 120 ++++++++-------- ...ionalPackageExports(module=nodenext).types | 92 +++++++------ ...esPackageExports(module=node16).errors.txt | 23 ++-- ...odeModulesPackageExports(module=node16).js | 12 +- ...dulesPackageExports(module=node16).symbols | 51 ++++--- ...ModulesPackageExports(module=node16).types | 104 ++++++++------ ...esPackageExports(module=node18).errors.txt | 23 ++-- ...odeModulesPackageExports(module=node18).js | 12 +- ...dulesPackageExports(module=node18).symbols | 51 ++++--- ...ModulesPackageExports(module=node18).types | 104 ++++++++------ ...esPackageExports(module=node20).errors.txt | 17 ++- ...odeModulesPackageExports(module=node20).js | 12 +- ...dulesPackageExports(module=node20).symbols | 51 ++++--- ...ModulesPackageExports(module=node20).types | 104 ++++++++------ ...PackageExports(module=nodenext).errors.txt | 17 ++- ...eModulesPackageExports(module=nodenext).js | 12 +- ...lesPackageExports(module=nodenext).symbols | 51 ++++--- ...dulesPackageExports(module=nodenext).types | 104 ++++++++------ ...gePatternExports(module=node16).errors.txt | 20 ++- ...lesPackagePatternExports(module=node16).js | 9 ++ ...ckagePatternExports(module=node16).symbols | 51 ++++--- ...PackagePatternExports(module=node16).types | 104 ++++++++------ ...gePatternExports(module=node18).errors.txt | 20 ++- ...lesPackagePatternExports(module=node18).js | 9 ++ ...ckagePatternExports(module=node18).symbols | 51 ++++--- ...PackagePatternExports(module=node18).types | 104 ++++++++------ ...gePatternExports(module=node20).errors.txt | 70 ---------- ...lesPackagePatternExports(module=node20).js | 9 ++ ...ckagePatternExports(module=node20).symbols | 51 ++++--- ...PackagePatternExports(module=node20).types | 104 ++++++++------ ...PatternExports(module=nodenext).errors.txt | 70 ---------- ...sPackagePatternExports(module=nodenext).js | 9 ++ ...agePatternExports(module=nodenext).symbols | 51 ++++--- ...ckagePatternExports(module=nodenext).types | 104 ++++++++------ ...rnExportsExclude(module=node16).errors.txt | 56 +++++--- ...agePatternExportsExclude(module=node16).js | 21 ++- ...tternExportsExclude(module=node16).symbols | 102 +++++++++----- ...PatternExportsExclude(module=node16).types | 128 ++++++++++++------ ...rnExportsExclude(module=node18).errors.txt | 56 +++++--- ...agePatternExportsExclude(module=node18).js | 21 ++- ...tternExportsExclude(module=node18).symbols | 102 +++++++++----- ...PatternExportsExclude(module=node18).types | 128 ++++++++++++------ ...rnExportsExclude(module=node20).errors.txt | 50 ++++--- ...agePatternExportsExclude(module=node20).js | 21 ++- ...tternExportsExclude(module=node20).symbols | 102 +++++++++----- ...PatternExportsExclude(module=node20).types | 128 ++++++++++++------ ...ExportsExclude(module=nodenext).errors.txt | 50 ++++--- ...ePatternExportsExclude(module=nodenext).js | 21 ++- ...ernExportsExclude(module=nodenext).symbols | 102 +++++++++----- ...tternExportsExclude(module=nodenext).types | 128 ++++++++++++------ ...nExportsTrailers(module=node16).errors.txt | 20 ++- ...gePatternExportsTrailers(module=node16).js | 9 ++ ...ternExportsTrailers(module=node16).symbols | 51 ++++--- ...nExportsTrailers(module=node16).trace.json | 108 ++++++--------- ...atternExportsTrailers(module=node16).types | 104 ++++++++------ ...nExportsTrailers(module=node18).errors.txt | 20 ++- ...gePatternExportsTrailers(module=node18).js | 9 ++ ...ternExportsTrailers(module=node18).symbols | 51 ++++--- ...nExportsTrailers(module=node18).trace.json | 108 ++++++--------- ...atternExportsTrailers(module=node18).types | 104 ++++++++------ ...nExportsTrailers(module=node20).errors.txt | 70 ---------- ...gePatternExportsTrailers(module=node20).js | 9 ++ ...ternExportsTrailers(module=node20).symbols | 51 ++++--- ...nExportsTrailers(module=node20).trace.json | 108 ++++++--------- ...atternExportsTrailers(module=node20).types | 104 ++++++++------ ...xportsTrailers(module=nodenext).errors.txt | 70 ---------- ...PatternExportsTrailers(module=nodenext).js | 9 ++ ...rnExportsTrailers(module=nodenext).symbols | 51 ++++--- ...xportsTrailers(module=nodenext).trace.json | 108 ++++++--------- ...ternExportsTrailers(module=nodenext).types | 104 ++++++++------ ...ModulesAllowJsConditionalPackageExports.ts | 12 +- .../nodeModulesAllowJsPackageExports.ts | 11 +- ...nodeModulesAllowJsPackagePatternExports.ts | 9 ++ ...lesAllowJsPackagePatternExportsTrailers.ts | 9 ++ .../nodeModulesConditionalPackageExports.ts | 12 +- .../node/nodeModulesPackageExports.ts | 11 +- .../node/nodeModulesPackagePatternExports.ts | 9 ++ ...nodeModulesPackagePatternExportsExclude.ts | 20 ++- ...odeModulesPackagePatternExportsTrailers.ts | 9 ++ 157 files changed, 4943 insertions(+), 3663 deletions(-) delete mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt index 0988bb9766421..efad33826ef1f 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt @@ -1,8 +1,6 @@ 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'. !!! 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. @@ -58,11 +56,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 + export const implicitCjsSource = true; +==== node_modules/inner/test.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"; @@ -70,12 +69,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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"; @@ -83,8 +82,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -94,7 +95,6 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).js b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).js index 62fb2abec9167..e8c327cbb8962 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).js +++ b/tests/baselines/reference/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", diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols index 6ac785d10279f..aa9ad6d6bdfce 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols +++ b/tests/baselines/reference/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(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)) +>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(mjs.type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(mjs.type.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(mjs.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(cjs.cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).types b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).types index bfa4914e21fe9..68265aa9a5ca7 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).types +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).types @@ -183,8 +183,8 @@ import * as mjsi from "inner/b"; > : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjsi @@ -209,8 +209,8 @@ mjsi.cjsSource; typei.implicitCjsSource; >typei.implicitCjsSource : true > : ^^^^ ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ >implicitCjsSource : true > : ^^^^ @@ -224,85 +224,97 @@ 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 : 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 -> : ^^^^ +=== 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 -> : ^^^ +>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 +=== 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 @@ -313,8 +325,8 @@ import * as mjs from "inner/b"; > : ^^^^^^^^^^ import * as type from "inner"; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjs @@ -329,16 +341,10 @@ export { mjs }; > : ^^^^^^^^^^ export { type }; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ export { ts }; >ts : typeof cjs > : ^^^^^^^^^^ -export const cjsSource = true; ->cjsSource : true -> : ^^^^ ->true : true -> : ^^^^ - diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt index 0988bb9766421..efad33826ef1f 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt @@ -1,8 +1,6 @@ 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'. !!! 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. @@ -58,11 +56,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 + export const implicitCjsSource = true; +==== node_modules/inner/test.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"; @@ -70,12 +69,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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"; @@ -83,8 +82,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -94,7 +95,6 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).js index 62fb2abec9167..e8c327cbb8962 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).js +++ b/tests/baselines/reference/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", diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols index 6ac785d10279f..aa9ad6d6bdfce 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols +++ b/tests/baselines/reference/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(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)) +>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(mjs.type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(mjs.type.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(mjs.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(cjs.cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).types index bfa4914e21fe9..68265aa9a5ca7 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).types @@ -183,8 +183,8 @@ import * as mjsi from "inner/b"; > : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjsi @@ -209,8 +209,8 @@ mjsi.cjsSource; typei.implicitCjsSource; >typei.implicitCjsSource : true > : ^^^^ ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ >implicitCjsSource : true > : ^^^^ @@ -224,85 +224,97 @@ 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 : 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 -> : ^^^^ +=== 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 -> : ^^^ +>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 +=== 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 @@ -313,8 +325,8 @@ import * as mjs from "inner/b"; > : ^^^^^^^^^^ import * as type from "inner"; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjs @@ -329,16 +341,10 @@ export { mjs }; > : ^^^^^^^^^^ export { type }; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ export { ts }; >ts : typeof cjs > : ^^^^^^^^^^ -export const cjsSource = true; ->cjsSource : true -> : ^^^^ ->true : true -> : ^^^^ - diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt index fc4e33b7310c1..202998c89cff5 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt @@ -1,6 +1,4 @@ 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'. !!! 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. @@ -52,11 +50,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 + export const implicitCjsSource = true; +==== node_modules/inner/test.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"; @@ -64,12 +63,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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"; @@ -77,8 +76,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -88,7 +89,6 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).js b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).js index 62fb2abec9167..e8c327cbb8962 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).js +++ b/tests/baselines/reference/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", diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols index 6ac785d10279f..aa9ad6d6bdfce 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).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(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)) +>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(mjs.type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(mjs.type.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(mjs.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(cjs.cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).types b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).types index bfa4914e21fe9..68265aa9a5ca7 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).types +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).types @@ -183,8 +183,8 @@ import * as mjsi from "inner/b"; > : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjsi @@ -209,8 +209,8 @@ mjsi.cjsSource; typei.implicitCjsSource; >typei.implicitCjsSource : true > : ^^^^ ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ >implicitCjsSource : true > : ^^^^ @@ -224,85 +224,97 @@ 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 : 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 -> : ^^^^ +=== 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 -> : ^^^ +>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 +=== 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 @@ -313,8 +325,8 @@ import * as mjs from "inner/b"; > : ^^^^^^^^^^ import * as type from "inner"; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjs @@ -329,16 +341,10 @@ export { mjs }; > : ^^^^^^^^^^ export { type }; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ export { ts }; >ts : typeof cjs > : ^^^^^^^^^^ -export const cjsSource = true; ->cjsSource : true -> : ^^^^ ->true : true -> : ^^^^ - diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt index fc4e33b7310c1..202998c89cff5 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt @@ -1,6 +1,4 @@ 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'. !!! 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. @@ -52,11 +50,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 + export const implicitCjsSource = true; +==== node_modules/inner/test.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"; @@ -64,12 +63,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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"; @@ -77,8 +76,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -88,7 +89,6 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js index 62fb2abec9167..e8c327cbb8962 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js +++ b/tests/baselines/reference/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", diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols index 6ac785d10279f..aa9ad6d6bdfce 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols +++ b/tests/baselines/reference/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(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)) +>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(mjs.type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(mjs.type.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(mjs.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(cjs.cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types index bfa4914e21fe9..68265aa9a5ca7 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types @@ -183,8 +183,8 @@ import * as mjsi from "inner/b"; > : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjsi @@ -209,8 +209,8 @@ mjsi.cjsSource; typei.implicitCjsSource; >typei.implicitCjsSource : true > : ^^^^ ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ >implicitCjsSource : true > : ^^^^ @@ -224,85 +224,97 @@ 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 : 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 -> : ^^^^ +=== 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 -> : ^^^ +>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 +=== 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 @@ -313,8 +325,8 @@ import * as mjs from "inner/b"; > : ^^^^^^^^^^ import * as type from "inner"; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjs @@ -329,16 +341,10 @@ export { mjs }; > : ^^^^^^^^^^ export { type }; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ export { ts }; >ts : typeof cjs > : ^^^^^^^^^^ -export const cjsSource = true; ->cjsSource : true -> : ^^^^ ->true : true -> : ^^^^ - diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).errors.txt index f5736b5998181..4203bffd74dd5 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).errors.txt @@ -2,9 +2,8 @@ error TS2209: The project root is ambiguous, but is required to resolve export m 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. -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. +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. @@ -56,11 +55,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -69,6 +69,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"; @@ -76,7 +79,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"; @@ -106,4 +112,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/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).js b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).js index 208b7a1a36fde..6f61b6de6a066 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).js +++ b/tests/baselines/reference/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,7 +95,8 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + //// [index.mjs] // esm format file diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).symbols b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).symbols index 9fe0e570a7061..ac3958d2edf64 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).types b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).types index 4a54afca62898..fae62576d2f7a 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).types @@ -31,8 +31,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -43,8 +43,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -81,8 +81,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -93,8 +93,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -131,100 +131,124 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ 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 +export const implicitCjsSource = true; +>implicitCjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/test.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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt index f5736b5998181..4203bffd74dd5 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt @@ -2,9 +2,8 @@ error TS2209: The project root is ambiguous, but is required to resolve export m 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. -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. +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. @@ -56,11 +55,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -69,6 +69,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"; @@ -76,7 +79,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"; @@ -106,4 +112,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/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js index 208b7a1a36fde..6f61b6de6a066 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).js +++ b/tests/baselines/reference/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,7 +95,8 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + //// [index.mjs] // esm format file diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).symbols index 9fe0e570a7061..ac3958d2edf64 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).types index 4a54afca62898..fae62576d2f7a 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).types @@ -31,8 +31,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -43,8 +43,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -81,8 +81,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -93,8 +93,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -131,100 +131,124 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ 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 +export const implicitCjsSource = true; +>implicitCjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/test.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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).errors.txt index 36f24f2759974..4fbcfb0ad4b8d 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).errors.txt @@ -1,5 +1,4 @@ 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'. !!! 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. @@ -45,17 +44,21 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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 }; 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"; @@ -64,6 +67,9 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -91,4 +97,5 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).js b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).js index 208b7a1a36fde..6f61b6de6a066 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).js +++ b/tests/baselines/reference/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,7 +95,8 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + //// [index.mjs] // esm format file diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).symbols b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).symbols index 9fe0e570a7061..ac3958d2edf64 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).types b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).types index 4a54afca62898..fae62576d2f7a 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).types @@ -31,8 +31,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -43,8 +43,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -81,8 +81,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -93,8 +93,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -131,100 +131,124 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ 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 +export const implicitCjsSource = true; +>implicitCjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/test.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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt index 36f24f2759974..4fbcfb0ad4b8d 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt @@ -1,5 +1,4 @@ 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'. !!! 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. @@ -45,17 +44,21 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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 }; 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"; @@ -64,6 +67,9 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -91,4 +97,5 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).js b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).js index 208b7a1a36fde..6f61b6de6a066 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).js +++ b/tests/baselines/reference/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,7 +95,8 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + //// [index.mjs] // esm format file diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).symbols b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).symbols index 9fe0e570a7061..ac3958d2edf64 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).types b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).types index 4a54afca62898..fae62576d2f7a 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).types @@ -31,8 +31,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -43,8 +43,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -81,8 +81,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -93,8 +93,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -131,100 +131,124 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ 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 +export const implicitCjsSource = true; +>implicitCjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/test.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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt index fb9aef2c45c33..95ba0345cb0d8 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt @@ -1,7 +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(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. +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) ==== @@ -30,11 +29,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -43,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"; @@ -50,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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).js index 0c82c6e77b0ea..5bab0a82caa0f 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).symbols b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).symbols index d6dea7356d738..802e24e79782a 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).types b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).types index ab36a515a18bd..f3a64f752ef78 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node16).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt index fb9aef2c45c33..95ba0345cb0d8 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt @@ -1,7 +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(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. +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) ==== @@ -30,11 +29,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -43,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"; @@ -50,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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js index 0c82c6e77b0ea..5bab0a82caa0f 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).symbols index d6dea7356d738..802e24e79782a 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).types index ab36a515a18bd..f3a64f752ef78 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node18).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt deleted file mode 100644 index 17ac25641f96d..0000000000000 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt +++ /dev/null @@ -1,70 +0,0 @@ -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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).js index 0c82c6e77b0ea..5bab0a82caa0f 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).symbols b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).symbols index d6dea7356d738..802e24e79782a 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).types b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).types index ab36a515a18bd..f3a64f752ef78 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=node20).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt deleted file mode 100644 index 17ac25641f96d..0000000000000 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt +++ /dev/null @@ -1,70 +0,0 @@ -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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).js index 0c82c6e77b0ea..5bab0a82caa0f 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols index d6dea7356d738..802e24e79782a 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).types b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).types index ab36a515a18bd..f3a64f752ef78 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExports(module=nodenext).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt index d2ca255ec3567..43b333f9021fe 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt @@ -1,7 +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(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. +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) ==== @@ -30,11 +29,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -43,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"; @@ -50,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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js index 5c434e984720f..19140a3fe5d38 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols index 5dd3851cacbbc..182fd209dac90 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types index 8aec22f2cab84..bb7cc9204e106 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt index d2ca255ec3567..43b333f9021fe 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt @@ -1,7 +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(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. +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) ==== @@ -30,11 +29,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -43,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"; @@ -50,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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js index 5c434e984720f..19140a3fe5d38 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols index 5dd3851cacbbc..182fd209dac90 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types index 8aec22f2cab84..bb7cc9204e106 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt deleted file mode 100644 index 20a391524c9b8..0000000000000 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt +++ /dev/null @@ -1,70 +0,0 @@ -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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js index 5c434e984720f..19140a3fe5d38 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols index 5dd3851cacbbc..182fd209dac90 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types index 8aec22f2cab84..bb7cc9204e106 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt deleted file mode 100644 index 20a391524c9b8..0000000000000 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt +++ /dev/null @@ -1,70 +0,0 @@ -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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js index 5c434e984720f..19140a3fe5d38 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols index 5dd3851cacbbc..182fd209dac90 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types index 8aec22f2cab84..bb7cc9204e106 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).errors.txt b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).errors.txt index 06c79e025ad47..87b0669f0d6ac 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).errors.txt @@ -1,8 +1,6 @@ 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'. !!! 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. @@ -58,11 +56,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 + export const implicitCjsSource = true; +==== node_modules/inner/test.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"; @@ -70,12 +69,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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"; @@ -83,8 +82,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -94,7 +95,6 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).js b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).js index 7948f14a9550e..7653fb782c52d 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).js +++ b/tests/baselines/reference/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", diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).symbols b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).symbols index 07c60903e55eb..fed90e232d781 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).symbols +++ b/tests/baselines/reference/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(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)) +>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(mjs.type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(mjs.type.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(mjs.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(cjs.cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).types b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).types index a7cb6f45bf8e8..9955225761501 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).types +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).types @@ -183,8 +183,8 @@ import * as mjsi from "inner/b"; > : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjsi @@ -209,8 +209,8 @@ mjsi.cjsSource; typei.implicitCjsSource; >typei.implicitCjsSource : true > : ^^^^ ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ >implicitCjsSource : true > : ^^^^ @@ -224,85 +224,97 @@ 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 : 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 -> : ^^^^ +=== 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 -> : ^^^ +>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 +=== 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 @@ -313,8 +325,8 @@ import * as mjs from "inner/b"; > : ^^^^^^^^^^ import * as type from "inner"; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjs @@ -329,16 +341,10 @@ export { mjs }; > : ^^^^^^^^^^ export { type }; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ export { ts }; >ts : typeof cjs > : ^^^^^^^^^^ -export const cjsSource = true; ->cjsSource : true -> : ^^^^ ->true : true -> : ^^^^ - diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt index 06c79e025ad47..87b0669f0d6ac 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt @@ -1,8 +1,6 @@ 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'. !!! 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. @@ -58,11 +56,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 + export const implicitCjsSource = true; +==== node_modules/inner/test.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"; @@ -70,12 +69,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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"; @@ -83,8 +82,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -94,7 +95,6 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).js index 7948f14a9550e..7653fb782c52d 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).js +++ b/tests/baselines/reference/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", diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).symbols index 07c60903e55eb..fed90e232d781 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).symbols +++ b/tests/baselines/reference/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(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)) +>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(mjs.type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(mjs.type.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(mjs.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(cjs.cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).types index a7cb6f45bf8e8..9955225761501 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).types @@ -183,8 +183,8 @@ import * as mjsi from "inner/b"; > : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjsi @@ -209,8 +209,8 @@ mjsi.cjsSource; typei.implicitCjsSource; >typei.implicitCjsSource : true > : ^^^^ ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ >implicitCjsSource : true > : ^^^^ @@ -224,85 +224,97 @@ 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 : 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 -> : ^^^^ +=== 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 -> : ^^^ +>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 +=== 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 @@ -313,8 +325,8 @@ import * as mjs from "inner/b"; > : ^^^^^^^^^^ import * as type from "inner"; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjs @@ -329,16 +341,10 @@ export { mjs }; > : ^^^^^^^^^^ export { type }; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ export { ts }; >ts : typeof cjs > : ^^^^^^^^^^ -export const cjsSource = true; ->cjsSource : true -> : ^^^^ ->true : true -> : ^^^^ - diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).errors.txt b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).errors.txt index 9065db099d670..5a05dbe061ea6 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).errors.txt +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).errors.txt @@ -1,6 +1,4 @@ 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'. !!! 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. @@ -52,11 +50,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 + export const implicitCjsSource = true; +==== node_modules/inner/test.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"; @@ -64,12 +63,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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"; @@ -77,8 +76,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -88,7 +89,6 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).js b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).js index 7948f14a9550e..7653fb782c52d 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).js +++ b/tests/baselines/reference/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", diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).symbols b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).symbols index 07c60903e55eb..fed90e232d781 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).symbols +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).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(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)) +>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(mjs.type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(mjs.type.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(mjs.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(cjs.cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).types b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).types index a7cb6f45bf8e8..9955225761501 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).types +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).types @@ -183,8 +183,8 @@ import * as mjsi from "inner/b"; > : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjsi @@ -209,8 +209,8 @@ mjsi.cjsSource; typei.implicitCjsSource; >typei.implicitCjsSource : true > : ^^^^ ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ >implicitCjsSource : true > : ^^^^ @@ -224,85 +224,97 @@ 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 : 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 -> : ^^^^ +=== 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 -> : ^^^ +>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 +=== 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 @@ -313,8 +325,8 @@ import * as mjs from "inner/b"; > : ^^^^^^^^^^ import * as type from "inner"; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjs @@ -329,16 +341,10 @@ export { mjs }; > : ^^^^^^^^^^ export { type }; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ export { ts }; >ts : typeof cjs > : ^^^^^^^^^^ -export const cjsSource = true; ->cjsSource : true -> : ^^^^ ->true : true -> : ^^^^ - diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).errors.txt index 9065db099d670..5a05dbe061ea6 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).errors.txt @@ -1,6 +1,4 @@ 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'. !!! 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. @@ -52,11 +50,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 + export const implicitCjsSource = true; +==== node_modules/inner/test.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"; @@ -64,12 +63,12 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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"; @@ -77,8 +76,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -88,7 +89,6 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).js b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).js index 7948f14a9550e..7653fb782c52d 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).js +++ b/tests/baselines/reference/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", diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).symbols b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).symbols index 07c60903e55eb..fed90e232d781 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).symbols +++ b/tests/baselines/reference/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(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)) +>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(mjs.type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(mjs.type.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(mjs.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(cjs.cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).types b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).types index a7cb6f45bf8e8..9955225761501 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).types @@ -183,8 +183,8 @@ import * as mjsi from "inner/b"; > : ^^^^^^^^^^^ import * as typei from "inner"; ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjsi @@ -209,8 +209,8 @@ mjsi.cjsSource; typei.implicitCjsSource; >typei.implicitCjsSource : true > : ^^^^ ->typei : typeof cjsi.type -> : ^^^^^^^^^^^^^^^^ +>typei : typeof typei +> : ^^^^^^^^^^^^ >implicitCjsSource : true > : ^^^^ @@ -224,85 +224,97 @@ 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 : 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 -> : ^^^^ +=== 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 -> : ^^^ +>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 +=== 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 @@ -313,8 +325,8 @@ import * as mjs from "inner/b"; > : ^^^^^^^^^^ import * as type from "inner"; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ import * as ts from "inner/types"; >ts : typeof cjs @@ -329,16 +341,10 @@ export { mjs }; > : ^^^^^^^^^^ export { type }; ->type : typeof cjs.type -> : ^^^^^^^^^^^^^^^ +>type : typeof type +> : ^^^^^^^^^^^ export { ts }; >ts : typeof cjs > : ^^^^^^^^^^ -export const cjsSource = true; ->cjsSource : true -> : ^^^^ ->true : true -> : ^^^^ - diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node16).errors.txt b/tests/baselines/reference/nodeModulesPackageExports(module=node16).errors.txt index 1c28214a47363..b1e53a170ea67 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node16).errors.txt @@ -2,9 +2,8 @@ error TS2209: The project root is ambiguous, but is required to resolve export m 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. -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. +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. @@ -56,11 +55,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -69,6 +69,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"; @@ -76,7 +79,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"; @@ -106,4 +112,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/tests/baselines/reference/nodeModulesPackageExports(module=node16).js b/tests/baselines/reference/nodeModulesPackageExports(module=node16).js index 7d1a5738c7346..1b38f77f6df26 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node16).js +++ b/tests/baselines/reference/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,7 +95,8 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + //// [index.mjs] // esm format file diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node16).symbols b/tests/baselines/reference/nodeModulesPackageExports(module=node16).symbols index 9e1ccdd9c0683..991d0d05c6d5f 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node16).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackageExports(module=node16).types b/tests/baselines/reference/nodeModulesPackageExports(module=node16).types index 536830b78cd02..a81ca8c5e10f5 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node16).types +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node16).types @@ -31,8 +31,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -43,8 +43,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -81,8 +81,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -93,8 +93,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -131,100 +131,124 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ 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 +export const implicitCjsSource = true; +>implicitCjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/test.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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt index 1c28214a47363..b1e53a170ea67 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt @@ -2,9 +2,8 @@ error TS2209: The project root is ambiguous, but is required to resolve export m 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. -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. +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. @@ -56,11 +55,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -69,6 +69,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"; @@ -76,7 +79,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"; @@ -106,4 +112,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/tests/baselines/reference/nodeModulesPackageExports(module=node18).js b/tests/baselines/reference/nodeModulesPackageExports(module=node18).js index 7d1a5738c7346..1b38f77f6df26 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node18).js +++ b/tests/baselines/reference/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,7 +95,8 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + //// [index.mjs] // esm format file diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node18).symbols b/tests/baselines/reference/nodeModulesPackageExports(module=node18).symbols index 9e1ccdd9c0683..991d0d05c6d5f 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node18).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackageExports(module=node18).types b/tests/baselines/reference/nodeModulesPackageExports(module=node18).types index 536830b78cd02..a81ca8c5e10f5 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node18).types @@ -31,8 +31,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -43,8 +43,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -81,8 +81,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -93,8 +93,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -131,100 +131,124 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ 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 +export const implicitCjsSource = true; +>implicitCjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/test.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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackageExports(module=node20).errors.txt b/tests/baselines/reference/nodeModulesPackageExports(module=node20).errors.txt index 451122bc5b66b..89ff894be6644 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node20).errors.txt +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node20).errors.txt @@ -1,5 +1,4 @@ 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'. !!! 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. @@ -45,17 +44,21 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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 }; 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"; @@ -64,6 +67,9 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -91,4 +97,5 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node20).js b/tests/baselines/reference/nodeModulesPackageExports(module=node20).js index 7d1a5738c7346..1b38f77f6df26 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node20).js +++ b/tests/baselines/reference/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,7 +95,8 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + //// [index.mjs] // esm format file diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node20).symbols b/tests/baselines/reference/nodeModulesPackageExports(module=node20).symbols index 9e1ccdd9c0683..991d0d05c6d5f 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node20).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackageExports(module=node20).types b/tests/baselines/reference/nodeModulesPackageExports(module=node20).types index 536830b78cd02..a81ca8c5e10f5 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node20).types +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node20).types @@ -31,8 +31,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -43,8 +43,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -81,8 +81,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -93,8 +93,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -131,100 +131,124 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ 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 +export const implicitCjsSource = true; +>implicitCjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/test.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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).errors.txt index 451122bc5b66b..89ff894be6644 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).errors.txt @@ -1,5 +1,4 @@ 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'. !!! 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. @@ -45,17 +44,21 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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 }; 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"; @@ -64,6 +67,9 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -91,4 +97,5 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).js b/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).js index 7d1a5738c7346..1b38f77f6df26 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).js +++ b/tests/baselines/reference/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,7 +95,8 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + //// [index.mjs] // esm format file diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).symbols b/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).symbols index 9e1ccdd9c0683..991d0d05c6d5f 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).types b/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).types index 536830b78cd02..a81ca8c5e10f5 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).types @@ -31,8 +31,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -43,8 +43,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -81,8 +81,8 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ import * as mjsi from "inner/mjs"; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ import * as typei from "inner"; >typei : typeof typei @@ -93,8 +93,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -131,100 +131,124 @@ import * as cjsi from "inner/cjs"; > : ^^^^^^^^^^^ 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 +export const implicitCjsSource = true; +>implicitCjsSource : true +> : ^^^^ +>true : true +> : ^^^^ + +=== node_modules/inner/test.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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).errors.txt index 41f789f7b29b3..edded798749b7 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).errors.txt @@ -1,7 +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(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. +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) ==== @@ -30,11 +29,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -43,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"; @@ -50,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/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).js b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).js index 16d7442eb7ff8..fd642683ab410 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).symbols b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).symbols index 40ff4714e8e00..80efcda8a2d79 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).types b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).types index 8de436002a1fa..ff23109c5742d 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node16).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).errors.txt index 41f789f7b29b3..edded798749b7 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).errors.txt @@ -1,7 +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(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. +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) ==== @@ -30,11 +29,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -43,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"; @@ -50,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/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js index 16d7442eb7ff8..fd642683ab410 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).symbols b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).symbols index 40ff4714e8e00..80efcda8a2d79 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).types b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).types index 8de436002a1fa..ff23109c5742d 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node18).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).errors.txt deleted file mode 100644 index 8fb721949b168..0000000000000 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).errors.txt +++ /dev/null @@ -1,70 +0,0 @@ -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/tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).js b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).js index 16d7442eb7ff8..fd642683ab410 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).symbols b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).symbols index 40ff4714e8e00..80efcda8a2d79 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).types b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).types index 8de436002a1fa..ff23109c5742d 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=node20).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).errors.txt deleted file mode 100644 index 8fb721949b168..0000000000000 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).errors.txt +++ /dev/null @@ -1,70 +0,0 @@ -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/tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).js b/tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).js index 16d7442eb7ff8..fd642683ab410 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).symbols b/tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).symbols index 40ff4714e8e00..80efcda8a2d79 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).types b/tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).types index 8de436002a1fa..ff23109c5742d 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExports(module=nodenext).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt index fd89603b91a5c..ca1c1e73523f7 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt @@ -8,18 +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(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. +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) ==== @@ -84,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"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -98,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"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -112,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"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -126,11 +134,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -139,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"; @@ -146,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"; @@ -174,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/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).js b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).js index 5fe735dbc37b1..86bc3022ded2b 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).symbols b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).symbols index fd0ed5715baab..8f1e180a5ef7a 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).types b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).types index b94e493366d49..771efb560f498 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node16).types @@ -31,8 +31,8 @@ import * as cjsi2 from "inner/cjs/index"; > : ^^^^^^^^^^^^ 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 @@ -43,8 +43,8 @@ cjsi2; > : ^^^^^^^^^^^^ mjsi2; ->mjsi2 : typeof cjsi2.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^^ +>mjsi2 : typeof mjsi2 +> : ^^^^^^^^^^^^ typei2; >typei2 : typeof typei2 @@ -81,8 +81,8 @@ import * as cjsi2 from "inner/cjs/index"; > : ^^^^^^^^^^^^ 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 @@ -93,8 +93,8 @@ cjsi2; > : ^^^^^^^^^^^^ mjsi2; ->mjsi2 : typeof cjsi2.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^^ +>mjsi2 : typeof mjsi2 +> : ^^^^^^^^^^^^ typei2; >typei2 : typeof typei2 @@ -131,27 +131,35 @@ import * as cjsi2 from "inner/cjs/index"; > : ^^^^^^^^^^^^ 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 +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 > : ^^^ @@ -178,6 +186,14 @@ 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 > : ^^^ @@ -204,6 +220,14 @@ 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 > : ^^^ @@ -230,79 +254,103 @@ 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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt index fd89603b91a5c..ca1c1e73523f7 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt @@ -8,18 +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(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. +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) ==== @@ -84,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"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -98,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"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -112,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"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -126,11 +134,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -139,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"; @@ -146,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"; @@ -174,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/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).js b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).js index 5fe735dbc37b1..86bc3022ded2b 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).symbols b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).symbols index fd0ed5715baab..8f1e180a5ef7a 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).types b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).types index b94e493366d49..771efb560f498 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node18).types @@ -31,8 +31,8 @@ import * as cjsi2 from "inner/cjs/index"; > : ^^^^^^^^^^^^ 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 @@ -43,8 +43,8 @@ cjsi2; > : ^^^^^^^^^^^^ mjsi2; ->mjsi2 : typeof cjsi2.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^^ +>mjsi2 : typeof mjsi2 +> : ^^^^^^^^^^^^ typei2; >typei2 : typeof typei2 @@ -81,8 +81,8 @@ import * as cjsi2 from "inner/cjs/index"; > : ^^^^^^^^^^^^ 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 @@ -93,8 +93,8 @@ cjsi2; > : ^^^^^^^^^^^^ mjsi2; ->mjsi2 : typeof cjsi2.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^^ +>mjsi2 : typeof mjsi2 +> : ^^^^^^^^^^^^ typei2; >typei2 : typeof typei2 @@ -131,27 +131,35 @@ import * as cjsi2 from "inner/cjs/index"; > : ^^^^^^^^^^^^ 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 +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 > : ^^^ @@ -178,6 +186,14 @@ 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 > : ^^^ @@ -204,6 +220,14 @@ 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 > : ^^^ @@ -230,79 +254,103 @@ 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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt index 2c733359bbdea..2a889543f6da0 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt @@ -7,16 +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/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. +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) ==== @@ -79,7 +78,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -93,7 +95,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -107,7 +112,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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,17 +129,21 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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 }; 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"; @@ -140,6 +152,9 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -165,4 +180,5 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).js b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).js index 5fe735dbc37b1..86bc3022ded2b 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).js +++ b/tests/baselines/reference/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] // esm format file diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).symbols b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).symbols index fd0ed5715baab..8f1e180a5ef7a 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).types b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).types index b94e493366d49..771efb560f498 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=node20).types @@ -31,8 +31,8 @@ import * as cjsi2 from "inner/cjs/index"; > : ^^^^^^^^^^^^ 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 @@ -43,8 +43,8 @@ cjsi2; > : ^^^^^^^^^^^^ mjsi2; ->mjsi2 : typeof cjsi2.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^^ +>mjsi2 : typeof mjsi2 +> : ^^^^^^^^^^^^ typei2; >typei2 : typeof typei2 @@ -81,8 +81,8 @@ import * as cjsi2 from "inner/cjs/index"; > : ^^^^^^^^^^^^ 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 @@ -93,8 +93,8 @@ cjsi2; > : ^^^^^^^^^^^^ mjsi2; ->mjsi2 : typeof cjsi2.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^^ +>mjsi2 : typeof mjsi2 +> : ^^^^^^^^^^^^ typei2; >typei2 : typeof typei2 @@ -131,27 +131,35 @@ import * as cjsi2 from "inner/cjs/index"; > : ^^^^^^^^^^^^ 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 +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 > : ^^^ @@ -178,6 +186,14 @@ 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 > : ^^^ @@ -204,6 +220,14 @@ 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 > : ^^^ @@ -230,79 +254,103 @@ 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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt index 2c733359bbdea..2a889543f6da0 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt @@ -7,16 +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/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. +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) ==== @@ -79,7 +78,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -93,7 +95,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -107,7 +112,10 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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,17 +129,21 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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 (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 }; 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"; @@ -140,6 +152,9 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import 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"; @@ -165,4 +180,5 @@ node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).js b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).js index 5fe735dbc37b1..86bc3022ded2b 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols index fd0ed5715baab..8f1e180a5ef7a 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).types b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).types index b94e493366d49..771efb560f498 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsExclude(module=nodenext).types @@ -31,8 +31,8 @@ import * as cjsi2 from "inner/cjs/index"; > : ^^^^^^^^^^^^ 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 @@ -43,8 +43,8 @@ cjsi2; > : ^^^^^^^^^^^^ mjsi2; ->mjsi2 : typeof cjsi2.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^^ +>mjsi2 : typeof mjsi2 +> : ^^^^^^^^^^^^ typei2; >typei2 : typeof typei2 @@ -81,8 +81,8 @@ import * as cjsi2 from "inner/cjs/index"; > : ^^^^^^^^^^^^ 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 @@ -93,8 +93,8 @@ cjsi2; > : ^^^^^^^^^^^^ mjsi2; ->mjsi2 : typeof cjsi2.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^^ +>mjsi2 : typeof mjsi2 +> : ^^^^^^^^^^^^ typei2; >typei2 : typeof typei2 @@ -131,27 +131,35 @@ import * as cjsi2 from "inner/cjs/index"; > : ^^^^^^^^^^^^ 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 +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 > : ^^^ @@ -178,6 +186,14 @@ 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 > : ^^^ @@ -204,6 +220,14 @@ 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 > : ^^^ @@ -230,79 +254,103 @@ 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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt index 489a0cf39f787..df6aa2d2e6a6f 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt @@ -1,7 +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(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. +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) ==== @@ -30,11 +29,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -43,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"; @@ -50,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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).js b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).js index 7e40184e6af80..52eefeb46067f 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).symbols b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).symbols index 99d90e029a57c..c8615a5f47cdc 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json index 0650e44dbfdba..6304720179b1a 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json @@ -40,55 +40,78 @@ "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'. ========", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ========", + "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", + "======== 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'. ========", + "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", + "======== 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'. ========", + "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", + "======== 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'. ========", "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.", "File '/.src/node_modules/inner/index.cts' does not exist.", "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.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.", "File '/.src/node_modules/inner/index.mts' does not exist.", "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.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.", "File '/.src/node_modules/inner/index.ts' does not exist.", "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.mts'. ========", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ========", "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/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.", "File '/.src/node_modules/inner/index.cts' does not exist.", "File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result.", "======== 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/node_modules/inner/test.d.ts'. ========", "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/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.", "File '/.src/node_modules/inner/index.mts' does not exist.", "File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result.", "======== 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/node_modules/inner/test.d.ts'. ========", "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/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.", @@ -96,90 +119,41 @@ "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.", "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", - "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", - "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", - "======== 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.mts'. ========", "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.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", "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.", "File '/.src/node_modules/inner/index.cts' does not exist.", "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.mts'. ========", "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.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", "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.", "File '/.src/node_modules/inner/index.mts' does not exist.", "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.mts'. ========", "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.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", "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.", "File '/.src/node_modules/inner/index.ts' does not exist.", "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.ts'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", "======== 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/node_modules/inner/test.d.cts'. ========", "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", "======== 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/node_modules/inner/test.d.cts'. ========", "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", "======== 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/node_modules/inner/test.d.cts'. ========", "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", "File '/.ts/package.json' does not exist.", diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).types b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).types index c11fe2feb146f..91243a4b3e8b1 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node16).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt index 489a0cf39f787..df6aa2d2e6a6f 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt @@ -1,7 +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(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. +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) ==== @@ -30,11 +29,12 @@ 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 (2 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"; - ~~~ -!!! 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. @@ -43,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"; @@ -50,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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js index 7e40184e6af80..52eefeb46067f 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).symbols b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).symbols index 99d90e029a57c..c8615a5f47cdc 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json index 0650e44dbfdba..6304720179b1a 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json @@ -40,55 +40,78 @@ "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'. ========", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ========", + "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", + "======== 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'. ========", + "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", + "======== 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'. ========", + "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", + "======== 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'. ========", "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.", "File '/.src/node_modules/inner/index.cts' does not exist.", "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.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.", "File '/.src/node_modules/inner/index.mts' does not exist.", "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.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.", "File '/.src/node_modules/inner/index.ts' does not exist.", "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.mts'. ========", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ========", "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/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.", "File '/.src/node_modules/inner/index.cts' does not exist.", "File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result.", "======== 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/node_modules/inner/test.d.ts'. ========", "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/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.", "File '/.src/node_modules/inner/index.mts' does not exist.", "File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result.", "======== 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/node_modules/inner/test.d.ts'. ========", "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/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.", @@ -96,90 +119,41 @@ "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.", "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", - "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", - "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", - "======== 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.mts'. ========", "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.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", "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.", "File '/.src/node_modules/inner/index.cts' does not exist.", "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.mts'. ========", "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.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", "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.", "File '/.src/node_modules/inner/index.mts' does not exist.", "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.mts'. ========", "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.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", "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.", "File '/.src/node_modules/inner/index.ts' does not exist.", "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.ts'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", "======== 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/node_modules/inner/test.d.cts'. ========", "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", "======== 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/node_modules/inner/test.d.cts'. ========", "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", "======== 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/node_modules/inner/test.d.cts'. ========", "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", "File '/.ts/package.json' does not exist.", diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).types b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).types index c11fe2feb146f..91243a4b3e8b1 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node18).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt deleted file mode 100644 index 33adbe04581fb..0000000000000 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt +++ /dev/null @@ -1,70 +0,0 @@ -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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).js b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).js index 7e40184e6af80..52eefeb46067f 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).symbols b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).symbols index 99d90e029a57c..c8615a5f47cdc 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json index 842f64dc5dec9..bf93fbcf2b27d 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json @@ -40,55 +40,78 @@ "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'. ========", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ========", + "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", + "======== 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'. ========", + "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", + "======== 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'. ========", + "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", + "======== 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'. ========", "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, 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.", "File '/.src/node_modules/inner/index.cts' does not exist.", "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.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, 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.", "File '/.src/node_modules/inner/index.mts' does not exist.", "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.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, 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.", "File '/.src/node_modules/inner/index.ts' does not exist.", "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.mts'. ========", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ========", "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/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.", "File '/.src/node_modules/inner/index.cts' does not exist.", "File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result.", "======== 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/node_modules/inner/test.d.ts'. ========", "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/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.", "File '/.src/node_modules/inner/index.mts' does not exist.", "File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result.", "======== 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/node_modules/inner/test.d.ts'. ========", "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/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.", @@ -96,90 +119,41 @@ "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.", "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", - "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", - "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", - "======== 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.mts'. ========", "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, JSON.", - "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", "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.", "File '/.src/node_modules/inner/index.cts' does not exist.", "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.mts'. ========", "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, JSON.", - "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", "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.", "File '/.src/node_modules/inner/index.mts' does not exist.", "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.mts'. ========", "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, JSON.", - "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", "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.", "File '/.src/node_modules/inner/index.ts' does not exist.", "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.ts'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", "======== 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/node_modules/inner/test.d.cts'. ========", "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", "======== 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/node_modules/inner/test.d.cts'. ========", "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", "======== 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/node_modules/inner/test.d.cts'. ========", "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", "File '/.ts/package.json' does not exist.", diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).types b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).types index c11fe2feb146f..91243a4b3e8b1 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=node20).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt deleted file mode 100644 index 33adbe04581fb..0000000000000 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt +++ /dev/null @@ -1,70 +0,0 @@ -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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).js b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).js index 7e40184e6af80..52eefeb46067f 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).js +++ b/tests/baselines/reference/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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols index 99d90e029a57c..c8615a5f47cdc 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols +++ b/tests/baselines/reference/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(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(mjs.cjs.cjs.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(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(cjs.cjs.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/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json index e5ecdbd45d23d..6fc69895d9aec 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json @@ -40,55 +40,78 @@ "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'. ========", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ========", + "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", + "======== 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'. ========", + "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", + "======== 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'. ========", + "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", + "======== 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'. ========", "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, 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.", "File '/.src/node_modules/inner/index.cts' does not exist.", "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.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, 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.", "File '/.src/node_modules/inner/index.mts' does not exist.", "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.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, 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.", "File '/.src/node_modules/inner/index.ts' does not exist.", "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.mts'. ========", + "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", + "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ========", "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/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.", "File '/.src/node_modules/inner/index.cts' does not exist.", "File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result.", "======== 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/node_modules/inner/test.d.ts'. ========", "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/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.", "File '/.src/node_modules/inner/index.mts' does not exist.", "File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result.", "======== 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/node_modules/inner/test.d.ts'. ========", "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/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.", @@ -96,90 +119,41 @@ "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.", "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", - "File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups.", - "======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src'.", - "======== 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.mts'. ========", "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, JSON.", - "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", "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.", "File '/.src/node_modules/inner/index.cts' does not exist.", "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.mts'. ========", "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, JSON.", - "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", "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.", "File '/.src/node_modules/inner/index.mts' does not exist.", "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.mts'. ========", "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, JSON.", - "Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.", + "Resolving in ESM mode with conditions 'import', 'types', 'node'.", "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.", "File '/.src/node_modules/inner/index.ts' does not exist.", "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.ts'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", - "======== 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'. ========", - "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", "======== 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/node_modules/inner/test.d.cts'. ========", "Resolution for module 'inner/cjs/index.cjs' was found in cache from location '/.src/node_modules/inner'.", "======== 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/node_modules/inner/test.d.cts'. ========", "Resolution for module 'inner/mjs/index.mjs' was found in cache from location '/.src/node_modules/inner'.", "======== 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/node_modules/inner/test.d.cts'. ========", "Resolution for module 'inner/js/index.js' was found in cache from location '/.src/node_modules/inner'.", "======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ========", "File '/.ts/package.json' does not exist.", diff --git a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).types b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).types index c11fe2feb146f..91243a4b3e8b1 100644 --- a/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesPackagePatternExportsTrailers(module=nodenext).types @@ -7,8 +7,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -19,8 +19,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -33,8 +33,8 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 @@ -45,8 +45,8 @@ cjsi; > : ^^^^^^^^^^^ mjsi; ->mjsi : typeof cjsi.cjs.mjs -> : ^^^^^^^^^^^^^^^^^^^ +>mjsi : typeof mjsi +> : ^^^^^^^^^^^ typei; >typei : typeof typei @@ -59,100 +59,124 @@ import * as cjsi from "inner/cjs/index.cjs"; > : ^^^^^^^^^^^ 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 +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 : 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 +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 > : ^^^^^^^^^^ 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 +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 > : ^^^^^^^^^^ 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/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts index 8dec4f8c03dfc..88dd969050ed8 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts @@ -53,6 +53,9 @@ typei.implicitCjsSource; ts.cjsSource; // @filename: node_modules/inner/index.d.ts // cjs format file +export const implicitCjsSource = true; +// @filename: node_modules/inner/test.d.ts +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -61,9 +64,11 @@ export { cjs }; export { mjs }; export { type }; export { ts }; -export const implicitCjsSource = true; // @filename: node_modules/inner/index.d.mts // esm format file +export const mjsSource = true; +// @filename: node_modules/inner/test.d.mts +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -72,9 +77,11 @@ export { cjs }; export { mjs }; export { type }; export { ts }; -export const mjsSource = true; // @filename: node_modules/inner/index.d.cts // cjs format file +export const cjsSource = true; +// @filename: node_modules/inner/test.d.cts +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -83,7 +90,6 @@ export { cjs }; export { mjs }; export { type }; export { ts }; -export const cjsSource = true; // @filename: package.json { "name": "package", diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts index e985dbcdacd6e..bd9d567c31f67 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts @@ -47,6 +47,9 @@ mjsi; typei; // @filename: node_modules/inner/index.d.ts // cjs format file +export const implicitCjsSource = true; +// @filename: node_modules/inner/test.d.ts +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -55,6 +58,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.mts // esm format file +export const mjsSource = true; +// @filename: node_modules/inner/test.d.mts +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -63,6 +69,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.cts // cjs format file +export const cjsSource = true; +// @filename: node_modules/inner/test.d.cts +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -89,4 +98,4 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} \ No newline at end of file +} diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts index 773134138c81d..cbeb7a16f505b 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts @@ -29,6 +29,9 @@ mjsi; typei; // @filename: node_modules/inner/index.d.ts // cjs format file +export const implicitCjsSource = true; +// @filename: node_modules/inner/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"; @@ -37,6 +40,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.mts // esm format file +export const mjsSource = true; +// @filename: node_modules/inner/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"; @@ -45,6 +51,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.cts // cjs format file +export const cjsSource = true; +// @filename: node_modules/inner/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/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts index 957bdb902142b..b5461de76cf50 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts @@ -29,6 +29,9 @@ mjsi; typei; // @filename: node_modules/inner/index.d.ts // cjs format file +export const implicitCjsSource = true; +// @filename: node_modules/inner/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"; @@ -37,6 +40,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.mts // esm format file +export const mjsSource = true; +// @filename: node_modules/inner/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"; @@ -45,6 +51,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.cts // cjs format file +export const cjsSource = true; +// @filename: node_modules/inner/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/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts b/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts index 7f0867f8f4557..3b9b7b3246c80 100644 --- a/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts +++ b/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts @@ -51,6 +51,9 @@ typei.implicitCjsSource; ts.cjsSource; // @filename: node_modules/inner/index.d.ts // cjs format file +export const implicitCjsSource = true; +// @filename: node_modules/inner/test.d.ts +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -59,9 +62,11 @@ export { cjs }; export { mjs }; export { type }; export { ts }; -export const implicitCjsSource = true; // @filename: node_modules/inner/index.d.mts // esm format file +export const mjsSource = true; +// @filename: node_modules/inner/test.d.mts +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -70,9 +75,11 @@ export { cjs }; export { mjs }; export { type }; export { ts }; -export const mjsSource = true; // @filename: node_modules/inner/index.d.cts // cjs format file +export const cjsSource = true; +// @filename: node_modules/inner/test.d.cts +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -81,7 +88,6 @@ export { cjs }; export { mjs }; export { type }; export { ts }; -export const cjsSource = true; // @filename: package.json { "name": "package", diff --git a/tests/cases/conformance/node/nodeModulesPackageExports.ts b/tests/cases/conformance/node/nodeModulesPackageExports.ts index ca0a23fc20d7c..a6f2a7c3ff1ff 100644 --- a/tests/cases/conformance/node/nodeModulesPackageExports.ts +++ b/tests/cases/conformance/node/nodeModulesPackageExports.ts @@ -45,6 +45,9 @@ mjsi; typei; // @filename: node_modules/inner/index.d.ts // cjs format file +export const implicitCjsSource = true; +// @filename: node_modules/inner/test.d.ts +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -53,6 +56,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.mts // esm format file +export const mjsSource = true; +// @filename: node_modules/inner/test.d.mts +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -61,6 +67,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.cts // cjs format file +export const cjsSource = true; +// @filename: node_modules/inner/test.d.cts +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -87,4 +96,4 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} \ No newline at end of file +} diff --git a/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts b/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts index aa8169391c20f..27e429ee4e9b9 100644 --- a/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts +++ b/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts @@ -27,6 +27,9 @@ mjsi; typei; // @filename: node_modules/inner/index.d.ts // cjs format file +export const implicitCjsSource = true; +// @filename: node_modules/inner/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"; @@ -35,6 +38,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.mts // esm format file +export const mjsSource = true; +// @filename: node_modules/inner/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"; @@ -43,6 +49,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.cts // cjs format file +export const cjsSource = true; +// @filename: node_modules/inner/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/tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts b/tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts index 871dd8ea07a5f..5417ca83963a0 100644 --- a/tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts +++ b/tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts @@ -45,6 +45,9 @@ mjsi2; typei2; // @filename: node_modules/inner/exclude/index.d.ts // cjs format file +export const implicitCjsSource = true; +// @filename: node_modules/inner/exclude/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"; @@ -53,6 +56,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/exclude/index.d.mts // esm format file +export const mjsSource = true; +// @filename: node_modules/inner/exclude/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"; @@ -61,6 +67,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/exclude/index.d.cts // cjs format file +export const cjsSource = true; +// @filename: node_modules/inner/exclude/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"; @@ -69,6 +78,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.ts // cjs format file +export const implicitCjsSource = true; +// @filename: node_modules/inner/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"; @@ -77,6 +89,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.mts // esm format file +export const mjsSource = true; +// @filename: node_modules/inner/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"; @@ -85,6 +100,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.cts // cjs format file +export const cjsSource = true; +// @filename: node_modules/inner/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"; @@ -109,4 +127,4 @@ export { type }; "./js/*": "./*.js", "./js/exclude/*": null } -} \ No newline at end of file +} diff --git a/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts b/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts index 1ae84456455d5..3fd1c2066a216 100644 --- a/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts +++ b/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts @@ -28,6 +28,9 @@ mjsi; typei; // @filename: node_modules/inner/index.d.ts // cjs format file +export const implicitCjsSource = true; +// @filename: node_modules/inner/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"; @@ -36,6 +39,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.mts // esm format file +export const mjsSource = true; +// @filename: node_modules/inner/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"; @@ -44,6 +50,9 @@ export { mjs }; export { type }; // @filename: node_modules/inner/index.d.cts // cjs format file +export const cjsSource = true; +// @filename: node_modules/inner/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"; From 3c09df9d80ef614a61c38e4352b4e85bb5e900a1 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 8 Oct 2025 16:52:54 -0700 Subject: [PATCH 2/2] Set rootDir --- ...alPackageExports(module=node16).errors.txt | 2 - ...alPackageExports(module=node18).errors.txt | 2 - ...alPackageExports(module=node20).errors.txt | 132 ------------------ ...PackageExports(module=nodenext).errors.txt | 132 ------------------ ...JsPackageExports(module=node16).errors.txt | 2 - ...JsPackageExports(module=node18).errors.txt | 2 - ...JsPackageExports(module=node20).errors.txt | 101 -------------- ...PackageExports(module=nodenext).errors.txt | 101 -------------- ...alPackageExports(module=node16).errors.txt | 2 - ...alPackageExports(module=node18).errors.txt | 2 - ...alPackageExports(module=node20).errors.txt | 132 ------------------ ...PackageExports(module=nodenext).errors.txt | 132 ------------------ ...esPackageExports(module=node16).errors.txt | 2 - ...esPackageExports(module=node18).errors.txt | 2 - ...esPackageExports(module=node20).errors.txt | 101 -------------- ...PackageExports(module=nodenext).errors.txt | 101 -------------- ...ModulesAllowJsConditionalPackageExports.ts | 1 + .../nodeModulesAllowJsPackageExports.ts | 1 + ...nodeModulesAllowJsPackagePatternExports.ts | 1 + ...lesAllowJsPackagePatternExportsTrailers.ts | 1 + .../nodeModulesConditionalPackageExports.ts | 1 + .../node/nodeModulesPackageExports.ts | 1 + .../node/nodeModulesPackagePatternExports.ts | 1 + ...nodeModulesPackagePatternExportsExclude.ts | 1 + ...odeModulesPackagePatternExportsTrailers.ts | 1 + 25 files changed, 9 insertions(+), 948 deletions(-) delete mode 100644 tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesPackageExports(module=node20).errors.txt delete mode 100644 tests/baselines/reference/nodeModulesPackageExports(module=nodenext).errors.txt diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt index efad33826ef1f..3aa26eb8bd457 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt @@ -1,9 +1,7 @@ -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. -!!! 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"; diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt index efad33826ef1f..3aa26eb8bd457 100644 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt @@ -1,9 +1,7 @@ -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. -!!! 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"; diff --git a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt deleted file mode 100644 index 202998c89cff5..0000000000000 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,132 +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. - - -!!! 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) ==== - // 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"; - 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 - 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"; - import * as type from "inner"; - 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 (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 }; -==== 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"; - import * as type from "inner"; - 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/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 202998c89cff5..0000000000000 --- a/tests/baselines/reference/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,132 +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. - - -!!! 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) ==== - // 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"; - 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 - 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"; - import * as type from "inner"; - 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 (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 }; -==== 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"; - import * as type from "inner"; - 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/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).errors.txt index 4203bffd74dd5..da41d18ca9c70 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node16).errors.txt @@ -1,4 +1,3 @@ -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(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. @@ -6,7 +5,6 @@ node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJ 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 (0 errors) ==== // esm format file import * as cjs from "package/cjs"; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt index 4203bffd74dd5..da41d18ca9c70 100644 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node18).errors.txt @@ -1,4 +1,3 @@ -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(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. @@ -6,7 +5,6 @@ node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJ 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 (0 errors) ==== // esm format file import * as cjs from "package/cjs"; diff --git a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).errors.txt deleted file mode 100644 index 4fbcfb0ad4b8d..0000000000000 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,101 +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. - - -!!! 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) ==== - // 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 - 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/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 4fbcfb0ad4b8d..0000000000000 --- a/tests/baselines/reference/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,101 +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. - - -!!! 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) ==== - // 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 - 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/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).errors.txt b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).errors.txt index 87b0669f0d6ac..7400a788e2719 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node16).errors.txt @@ -1,9 +1,7 @@ -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. -!!! 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"; diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt index 87b0669f0d6ac..7400a788e2719 100644 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node18).errors.txt @@ -1,9 +1,7 @@ -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. -!!! 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"; diff --git a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).errors.txt b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).errors.txt deleted file mode 100644 index 5a05dbe061ea6..0000000000000 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,132 +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. - - -!!! 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) ==== - // 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"; - 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 - 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"; - import * as type from "inner"; - 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 (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 }; -==== 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"; - import * as type from "inner"; - 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/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 5a05dbe061ea6..0000000000000 --- a/tests/baselines/reference/nodeModulesConditionalPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,132 +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. - - -!!! 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) ==== - // 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"; - 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 - 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"; - import * as type from "inner"; - 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 (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 }; -==== 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"; - import * as type from "inner"; - 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/tests/baselines/reference/nodeModulesPackageExports(module=node16).errors.txt b/tests/baselines/reference/nodeModulesPackageExports(module=node16).errors.txt index b1e53a170ea67..4c1ba7fccee27 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node16).errors.txt @@ -1,4 +1,3 @@ -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(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. @@ -6,7 +5,6 @@ node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJ 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 (0 errors) ==== // esm format file import * as cjs from "package/cjs"; diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt b/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt index b1e53a170ea67..4c1ba7fccee27 100644 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesPackageExports(module=node18).errors.txt @@ -1,4 +1,3 @@ -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(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. @@ -6,7 +5,6 @@ node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJ 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 (0 errors) ==== // esm format file import * as cjs from "package/cjs"; diff --git a/tests/baselines/reference/nodeModulesPackageExports(module=node20).errors.txt b/tests/baselines/reference/nodeModulesPackageExports(module=node20).errors.txt deleted file mode 100644 index 89ff894be6644..0000000000000 --- a/tests/baselines/reference/nodeModulesPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,101 +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. - - -!!! 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) ==== - // 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 - 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/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 89ff894be6644..0000000000000 --- a/tests/baselines/reference/nodeModulesPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,101 +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. - - -!!! 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) ==== - // 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 - 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/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts index 88dd969050ed8..bc57fb936698c 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsConditionalPackageExports.ts @@ -4,6 +4,7 @@ // @checkJs: true // @outDir: out // @filename: index.js +// @rootDir: . // esm format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts index bd9d567c31f67..424d615600331 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackageExports.ts @@ -4,6 +4,7 @@ // @checkJs: true // @outDir: out // @filename: index.js +// @rootDir: . // esm format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts index cbeb7a16f505b..8e7ecd9249c85 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExports.ts @@ -4,6 +4,7 @@ // @checkJs: true // @outDir: out // @filename: index.js +// @rootDir: . // esm format file import * as cjsi from "inner/cjs/index"; import * as mjsi from "inner/mjs/index"; diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts index b5461de76cf50..d02e30cb46a6e 100644 --- a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsPackagePatternExportsTrailers.ts @@ -4,6 +4,7 @@ // @checkJs: true // @outDir: out // @filename: index.js +// @rootDir: . // esm format file import * as cjsi from "inner/cjs/index.cjs"; import * as mjsi from "inner/mjs/index.mjs"; diff --git a/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts b/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts index 3b9b7b3246c80..a202fb2b7207f 100644 --- a/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts +++ b/tests/cases/conformance/node/nodeModulesConditionalPackageExports.ts @@ -2,6 +2,7 @@ // @declaration: true // @outDir: out // @filename: index.ts +// @rootDir: . // esm format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; diff --git a/tests/cases/conformance/node/nodeModulesPackageExports.ts b/tests/cases/conformance/node/nodeModulesPackageExports.ts index a6f2a7c3ff1ff..4ec9614911ab9 100644 --- a/tests/cases/conformance/node/nodeModulesPackageExports.ts +++ b/tests/cases/conformance/node/nodeModulesPackageExports.ts @@ -2,6 +2,7 @@ // @declaration: true // @outDir: out // @filename: index.ts +// @rootDir: . // esm format file import * as cjs from "package/cjs"; import * as mjs from "package/mjs"; diff --git a/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts b/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts index 27e429ee4e9b9..3df678927c945 100644 --- a/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts +++ b/tests/cases/conformance/node/nodeModulesPackagePatternExports.ts @@ -2,6 +2,7 @@ // @declaration: true // @outDir: out // @filename: index.ts +// @rootDir: . // esm format file import * as cjsi from "inner/cjs/index"; import * as mjsi from "inner/mjs/index"; diff --git a/tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts b/tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts index 5417ca83963a0..33058b62ac758 100644 --- a/tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts +++ b/tests/cases/conformance/node/nodeModulesPackagePatternExportsExclude.ts @@ -2,6 +2,7 @@ // @declaration: true // @outDir: out // @filename: index.ts +// @rootDir: . // esm format file import * as cjsi from "inner/cjs/exclude/index"; import * as mjsi from "inner/mjs/exclude/index"; diff --git a/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts b/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts index 3fd1c2066a216..2d098108b188f 100644 --- a/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts +++ b/tests/cases/conformance/node/nodeModulesPackagePatternExportsTrailers.ts @@ -3,6 +3,7 @@ // @outDir: out // @filename: index.ts // @traceResolution: true +// @rootDir: . // esm format file import * as cjsi from "inner/cjs/index.cjs"; import * as mjsi from "inner/mjs/index.mjs";