Do not mark #imports and self-name imports as external library imports in module resolution (#60228)

This commit is contained in:
Andrew Branch
2024-10-15 10:53:32 -07:00
committed by GitHub
parent d61938d8a3
commit 31de163db7
19 changed files with 196 additions and 186 deletions
+20 -14
View File
@@ -1910,25 +1910,31 @@ function nodeModuleNameResolverWorker(
}
if (!isExternalModuleNameRelative(moduleName)) {
let resolved: SearchResult<Resolved> | undefined;
if (features & NodeResolutionFeatures.Imports && startsWith(moduleName, "#")) {
resolved = loadModuleFromImports(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
}
if (!resolved && features & NodeResolutionFeatures.SelfName) {
resolved = loadModuleFromSelfNameReference(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
}
if (!resolved) {
if (moduleName.includes(":")) {
if (traceEnabled) {
trace(host, Diagnostics.Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1, moduleName, formatExtensions(extensions));
}
return undefined;
const resolved = loadModuleFromImports(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
if (resolved) {
return resolved.value && { value: { resolved: resolved.value, isExternalLibraryImport: false } };
}
}
if (features & NodeResolutionFeatures.SelfName) {
const resolved = loadModuleFromSelfNameReference(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
if (resolved) {
return resolved.value && { value: { resolved: resolved.value, isExternalLibraryImport: false } };
}
}
if (moduleName.includes(":")) {
if (traceEnabled) {
trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1, moduleName, formatExtensions(extensions));
trace(host, Diagnostics.Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1, moduleName, formatExtensions(extensions));
}
resolved = loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
return undefined;
}
if (traceEnabled) {
trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1, moduleName, formatExtensions(extensions));
}
let resolved = loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
if (extensions & Extensions.Declaration) {
resolved ??= resolveFromTypeRoot(moduleName, state);
}
@@ -122,22 +122,6 @@ export const cjsSource = true;
}
}
//// [index.js]
// esm format file
import * as cjs from "package/cjs";
import * as mjs from "package/mjs";
import * as type from "package";
cjs;
mjs;
type;
import * as cjsi from "inner/a";
import * as mjsi from "inner/b";
import * as typei from "inner";
import * as ts from "inner/types";
cjsi.mjsSource;
mjsi.mjsSource;
typei.mjsSource;
ts.mjsSource;
//// [index.mjs]
// esm format file
import * as cjs from "package/cjs";
@@ -195,11 +179,27 @@ cjsi.cjsSource;
mjsi.cjsSource;
typei.implicitCjsSource;
ts.cjsSource;
//// [index.js]
// esm format file
import * as cjs from "package/cjs";
import * as mjs from "package/mjs";
import * as type from "package";
cjs;
mjs;
type;
import * as cjsi from "inner/a";
import * as mjsi from "inner/b";
import * as typei from "inner";
import * as ts from "inner/types";
cjsi.mjsSource;
mjsi.mjsSource;
typei.mjsSource;
ts.mjsSource;
//// [index.d.ts]
export {};
//// [index.d.mts]
export {};
//// [index.d.cts]
export {};
//// [index.d.ts]
export {};
@@ -122,22 +122,6 @@ export const cjsSource = true;
}
}
//// [index.js]
// esm format file
import * as cjs from "package/cjs";
import * as mjs from "package/mjs";
import * as type from "package";
cjs;
mjs;
type;
import * as cjsi from "inner/a";
import * as mjsi from "inner/b";
import * as typei from "inner";
import * as ts from "inner/types";
cjsi.mjsSource;
mjsi.mjsSource;
typei.mjsSource;
ts.mjsSource;
//// [index.mjs]
// esm format file
import * as cjs from "package/cjs";
@@ -195,11 +179,27 @@ cjsi.cjsSource;
mjsi.cjsSource;
typei.implicitCjsSource;
ts.cjsSource;
//// [index.js]
// esm format file
import * as cjs from "package/cjs";
import * as mjs from "package/mjs";
import * as type from "package";
cjs;
mjs;
type;
import * as cjsi from "inner/a";
import * as mjsi from "inner/b";
import * as typei from "inner";
import * as ts from "inner/types";
cjsi.mjsSource;
mjsi.mjsSource;
typei.mjsSource;
ts.mjsSource;
//// [index.d.ts]
export {};
//// [index.d.mts]
export {};
//// [index.d.cts]
export {};
//// [index.d.ts]
export {};
@@ -88,20 +88,6 @@ export { type };
}
}
//// [index.js]
// esm format file
import * as cjs from "package/cjs";
import * as mjs from "package/mjs";
import * as type from "package";
cjs;
mjs;
type;
import * as cjsi from "inner/cjs";
import * as mjsi from "inner/mjs";
import * as typei from "inner";
cjsi;
mjsi;
typei;
//// [index.mjs]
// esm format file
import * as cjs from "package/cjs";
@@ -155,11 +141,25 @@ const typei = __importStar(require("inner"));
cjsi;
mjsi;
typei;
//// [index.js]
// esm format file
import * as cjs from "package/cjs";
import * as mjs from "package/mjs";
import * as type from "package";
cjs;
mjs;
type;
import * as cjsi from "inner/cjs";
import * as mjsi from "inner/mjs";
import * as typei from "inner";
cjsi;
mjsi;
typei;
//// [index.d.ts]
export {};
//// [index.d.mts]
export {};
//// [index.d.cts]
export {};
//// [index.d.ts]
export {};
@@ -88,20 +88,6 @@ export { type };
}
}
//// [index.js]
// esm format file
import * as cjs from "package/cjs";
import * as mjs from "package/mjs";
import * as type from "package";
cjs;
mjs;
type;
import * as cjsi from "inner/cjs";
import * as mjsi from "inner/mjs";
import * as typei from "inner";
cjsi;
mjsi;
typei;
//// [index.mjs]
// esm format file
import * as cjs from "package/cjs";
@@ -155,11 +141,25 @@ const typei = __importStar(require("inner"));
cjsi;
mjsi;
typei;
//// [index.js]
// esm format file
import * as cjs from "package/cjs";
import * as mjs from "package/mjs";
import * as type from "package";
cjs;
mjs;
type;
import * as cjsi from "inner/cjs";
import * as mjsi from "inner/mjs";
import * as typei from "inner";
cjsi;
mjsi;
typei;
//// [index.d.ts]
export {};
//// [index.d.mts]
export {};
//// [index.d.cts]
export {};
//// [index.d.ts]
export {};
@@ -37,14 +37,6 @@ type;
}
}
//// [index.js]
// esm format file
import * as cjs from "#cjs";
import * as mjs from "#mjs";
import * as type from "#type";
cjs;
mjs;
type;
//// [index.mjs]
// esm format file
import * as cjs from "#cjs";
@@ -86,11 +78,19 @@ const type = __importStar(require("#type"));
cjs;
mjs;
type;
//// [index.js]
// esm format file
import * as cjs from "#cjs";
import * as mjs from "#mjs";
import * as type from "#type";
cjs;
mjs;
type;
//// [index.d.ts]
export {};
//// [index.d.mts]
export {};
//// [index.d.cts]
export {};
//// [index.d.ts]
export {};
@@ -37,14 +37,6 @@ type;
}
}
//// [index.js]
// esm format file
import * as cjs from "#cjs";
import * as mjs from "#mjs";
import * as type from "#type";
cjs;
mjs;
type;
//// [index.mjs]
// esm format file
import * as cjs from "#cjs";
@@ -86,11 +78,19 @@ const type = __importStar(require("#type"));
cjs;
mjs;
type;
//// [index.js]
// esm format file
import * as cjs from "#cjs";
import * as mjs from "#mjs";
import * as type from "#type";
cjs;
mjs;
type;
//// [index.d.ts]
export {};
//// [index.d.mts]
export {};
//// [index.d.cts]
export {};
//// [index.d.ts]
export {};
@@ -7,7 +7,6 @@
"Using 'imports' subpath '#cjs' with target './index.cjs'.",
"File name '/.src/index.cjs' has a '.cjs' extension - stripping it.",
"File '/.src/index.cts' exists - use it as a name resolution result.",
"Resolving real path for '/.src/index.cts', result '/.src/index.cts'.",
"======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ========",
"======== Resolving module '#mjs' from '/.src/index.ts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
@@ -16,7 +15,6 @@
"Using 'imports' subpath '#mjs' with target './index.mjs'.",
"File name '/.src/index.mjs' has a '.mjs' extension - stripping it.",
"File '/.src/index.mts' exists - use it as a name resolution result.",
"Resolving real path for '/.src/index.mts', result '/.src/index.mts'.",
"======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ========",
"======== Resolving module '#type' from '/.src/index.ts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
@@ -25,7 +23,6 @@
"Using 'imports' subpath '#type' with target './index.js'.",
"File name '/.src/index.js' has a '.js' extension - stripping it.",
"File '/.src/index.ts' exists - use it as a name resolution result.",
"Resolving real path for '/.src/index.ts', result '/.src/index.ts'.",
"======== Module name '#type' was successfully resolved to '/.src/index.ts'. ========",
"======== Resolving module '#cjs' from '/.src/index.cts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
@@ -34,7 +31,6 @@
"Using 'imports' subpath '#cjs' with target './index.cjs'.",
"File name '/.src/index.cjs' has a '.cjs' extension - stripping it.",
"File '/.src/index.cts' exists - use it as a name resolution result.",
"Resolving real path for '/.src/index.cts', result '/.src/index.cts'.",
"======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ========",
"======== Resolving module '#mjs' from '/.src/index.cts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
@@ -43,7 +39,6 @@
"Using 'imports' subpath '#mjs' with target './index.mjs'.",
"File name '/.src/index.mjs' has a '.mjs' extension - stripping it.",
"File '/.src/index.mts' exists - use it as a name resolution result.",
"Resolving real path for '/.src/index.mts', result '/.src/index.mts'.",
"======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ========",
"======== Resolving module '#type' from '/.src/index.cts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
@@ -52,7 +47,6 @@
"Using 'imports' subpath '#type' with target './index.js'.",
"File name '/.src/index.js' has a '.js' extension - stripping it.",
"File '/.src/index.ts' exists - use it as a name resolution result.",
"Resolving real path for '/.src/index.ts', result '/.src/index.ts'.",
"======== Module name '#type' was successfully resolved to '/.src/index.ts'. ========",
"======== Resolving module '#cjs' from '/.src/index.mts'. ========",
"Resolution for module '#cjs' was found in cache from location '/.src'.",
@@ -63,24 +57,6 @@
"======== Resolving module '#type' from '/.src/index.mts'. ========",
"Resolution for module '#type' was found in cache from location '/.src'.",
"======== Module name '#type' was successfully resolved to '/.src/index.ts'. ========",
"======== Resolving module '#cjs' from '/.src/index.mts'. ========",
"Resolution for module '#cjs' was found in cache from location '/.src'.",
"======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ========",
"======== Resolving module '#mjs' from '/.src/index.mts'. ========",
"Resolution for module '#mjs' was found in cache from location '/.src'.",
"======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ========",
"======== Resolving module '#type' from '/.src/index.mts'. ========",
"Resolution for module '#type' was found in cache from location '/.src'.",
"======== Module name '#type' was successfully resolved to '/.src/index.ts'. ========",
"======== Resolving module '#cjs' from '/.src/index.cts'. ========",
"Resolution for module '#cjs' was found in cache from location '/.src'.",
"======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ========",
"======== Resolving module '#mjs' from '/.src/index.cts'. ========",
"Resolution for module '#mjs' was found in cache from location '/.src'.",
"======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ========",
"======== Resolving module '#type' from '/.src/index.cts'. ========",
"Resolution for module '#type' was found in cache from location '/.src'.",
"======== Module name '#type' was successfully resolved to '/.src/index.ts'. ========",
"File '/.ts/package.json' does not exist.",
"File '/package.json' does not exist.",
"======== Resolving module '@typescript/lib-es2022' from '/.src/__lib_node_modules_lookup_lib.es2022.d.ts__.ts'. ========",
@@ -7,7 +7,6 @@
"Using 'imports' subpath '#cjs' with target './index.cjs'.",
"File name '/.src/index.cjs' has a '.cjs' extension - stripping it.",
"File '/.src/index.cts' exists - use it as a name resolution result.",
"Resolving real path for '/.src/index.cts', result '/.src/index.cts'.",
"======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ========",
"======== Resolving module '#mjs' from '/.src/index.ts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
@@ -16,7 +15,6 @@
"Using 'imports' subpath '#mjs' with target './index.mjs'.",
"File name '/.src/index.mjs' has a '.mjs' extension - stripping it.",
"File '/.src/index.mts' exists - use it as a name resolution result.",
"Resolving real path for '/.src/index.mts', result '/.src/index.mts'.",
"======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ========",
"======== Resolving module '#type' from '/.src/index.ts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
@@ -25,7 +23,6 @@
"Using 'imports' subpath '#type' with target './index.js'.",
"File name '/.src/index.js' has a '.js' extension - stripping it.",
"File '/.src/index.ts' exists - use it as a name resolution result.",
"Resolving real path for '/.src/index.ts', result '/.src/index.ts'.",
"======== Module name '#type' was successfully resolved to '/.src/index.ts'. ========",
"======== Resolving module '#cjs' from '/.src/index.cts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
@@ -34,7 +31,6 @@
"Using 'imports' subpath '#cjs' with target './index.cjs'.",
"File name '/.src/index.cjs' has a '.cjs' extension - stripping it.",
"File '/.src/index.cts' exists - use it as a name resolution result.",
"Resolving real path for '/.src/index.cts', result '/.src/index.cts'.",
"======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ========",
"======== Resolving module '#mjs' from '/.src/index.cts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
@@ -43,7 +39,6 @@
"Using 'imports' subpath '#mjs' with target './index.mjs'.",
"File name '/.src/index.mjs' has a '.mjs' extension - stripping it.",
"File '/.src/index.mts' exists - use it as a name resolution result.",
"Resolving real path for '/.src/index.mts', result '/.src/index.mts'.",
"======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ========",
"======== Resolving module '#type' from '/.src/index.cts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
@@ -52,7 +47,6 @@
"Using 'imports' subpath '#type' with target './index.js'.",
"File name '/.src/index.js' has a '.js' extension - stripping it.",
"File '/.src/index.ts' exists - use it as a name resolution result.",
"Resolving real path for '/.src/index.ts', result '/.src/index.ts'.",
"======== Module name '#type' was successfully resolved to '/.src/index.ts'. ========",
"======== Resolving module '#cjs' from '/.src/index.mts'. ========",
"Resolution for module '#cjs' was found in cache from location '/.src'.",
@@ -63,24 +57,6 @@
"======== Resolving module '#type' from '/.src/index.mts'. ========",
"Resolution for module '#type' was found in cache from location '/.src'.",
"======== Module name '#type' was successfully resolved to '/.src/index.ts'. ========",
"======== Resolving module '#cjs' from '/.src/index.mts'. ========",
"Resolution for module '#cjs' was found in cache from location '/.src'.",
"======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ========",
"======== Resolving module '#mjs' from '/.src/index.mts'. ========",
"Resolution for module '#mjs' was found in cache from location '/.src'.",
"======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ========",
"======== Resolving module '#type' from '/.src/index.mts'. ========",
"Resolution for module '#type' was found in cache from location '/.src'.",
"======== Module name '#type' was successfully resolved to '/.src/index.ts'. ========",
"======== Resolving module '#cjs' from '/.src/index.cts'. ========",
"Resolution for module '#cjs' was found in cache from location '/.src'.",
"======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ========",
"======== Resolving module '#mjs' from '/.src/index.cts'. ========",
"Resolution for module '#mjs' was found in cache from location '/.src'.",
"======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ========",
"======== Resolving module '#type' from '/.src/index.cts'. ========",
"Resolution for module '#type' was found in cache from location '/.src'.",
"======== Module name '#type' was successfully resolved to '/.src/index.ts'. ========",
"File '/.ts/package.json' does not exist.",
"File '/package.json' does not exist.",
"======== Resolving module '@typescript/lib-esnext' from '/.src/__lib_node_modules_lookup_lib.esnext.d.ts__.ts'. ========",
@@ -48,7 +48,6 @@
"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'. ========",
"Module resolution kind is not specified, using 'Node16'.",
@@ -58,7 +57,6 @@
"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'. ========",
"Module resolution kind is not specified, using 'Node16'.",
@@ -69,7 +67,6 @@
"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'. ========",
"Module resolution kind is not specified, using 'Node16'.",
@@ -79,7 +76,6 @@
"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.mts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
@@ -89,7 +85,6 @@
"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.mts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
@@ -100,7 +95,6 @@
"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'. ========",
"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'. ========",
@@ -170,15 +164,6 @@
"======== 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.mts'. ========",
"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'. ========",
"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'. ========",
"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'. ========",
@@ -188,6 +173,15 @@
"======== 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'. ========",
"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'. ========",
"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'. ========",
"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.",
"File '/package.json' does not exist.",
"======== Resolving module '@typescript/lib-es2022' from '/.src/__lib_node_modules_lookup_lib.es2022.d.ts__.ts'. ========",
@@ -48,7 +48,6 @@
"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'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
@@ -58,7 +57,6 @@
"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'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
@@ -69,7 +67,6 @@
"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'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
@@ -79,7 +76,6 @@
"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.mts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
@@ -89,7 +85,6 @@
"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.mts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
@@ -100,7 +95,6 @@
"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'. ========",
"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'. ========",
@@ -170,15 +164,6 @@
"======== 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.mts'. ========",
"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'. ========",
"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'. ========",
"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'. ========",
@@ -188,6 +173,15 @@
"======== 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'. ========",
"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'. ========",
"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'. ========",
"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.",
"File '/package.json' does not exist.",
"======== Resolving module '@typescript/lib-esnext' from '/.src/__lib_node_modules_lookup_lib.esnext.d.ts__.ts'. ========",
@@ -0,0 +1,34 @@
//// [tests/cases/compiler/selfNameAndImportsEmitInclusion.ts] ////
//// [package.json]
{
"name": "pkg",
"type": "module",
"imports": {
"#indirect1": "./src/indirect1.ts"
},
"exports": {
"./*": "./dist/*"
}
}
//// [indirect1.ts]
export const indirect1 = 0;
//// [indirect2.ts]
export const indirect2 = 0;
//// [main.ts]
import { indirect1 } from "#indirect1";
import { indirect2 } from "pkg/indirect2.js";
console.log(indirect1, indirect2);
//// [indirect1.js]
export const indirect1 = 0;
//// [indirect2.js]
export const indirect2 = 0;
//// [main.js]
import { indirect1 } from "#indirect1";
import { indirect2 } from "pkg/indirect2.js";
console.log(indirect1, indirect2);
@@ -23,7 +23,6 @@
"'package.json' does not have a 'peerDependencies' field.",
"Resolved under condition 'default'.",
"Exiting conditional exports.",
"Resolving real path for '/node_modules/acorn-walk/dist/walk.d.ts', result '/node_modules/acorn-walk/dist/walk.d.ts'.",
"======== Module name 'acorn-walk' was successfully resolved to '/node_modules/acorn-walk/dist/walk.d.ts' with Package ID 'acorn-walk/dist/walk.d.ts@8.2.0'. ========",
"======== Resolving module 'acorn-walk' from '/index.ts'. ========",
"Explicitly specified module resolution kind: 'Bundler'.",
@@ -103,7 +103,6 @@ File '/home/src/workspaces/project/packages/a/index.js' exists - use it as a nam
'package.json' does not have a 'peerDependencies' field.
Resolved under condition 'types'.
Exiting conditional exports.
Resolving real path for '/home/src/workspaces/project/packages/a/index.js', result '/home/src/workspaces/project/packages/a/index.js'.
======== Module name 'a' was successfully resolved to '/home/src/workspaces/project/packages/a/index.js' with Package ID 'a/index.js@0.0.0'. ========
File '/home/src/tslibs/TS/Lib/package.json' does not exist.
File '/home/src/tslibs/TS/package.json' does not exist.
@@ -115,6 +114,7 @@ File '/package.json' does not exist.
Default library for target 'esnext'
packages/a/index.js
Matched by default include pattern '**/*'
Imported via 'a' from file 'packages/a/test/index.js' with packageId 'a/index.js@0.0.0'
File is ECMAScript module because 'packages/a/package.json' has field "type" with value "module"
packages/a/test/index.js
Matched by default include pattern '**/*'
@@ -102,7 +102,6 @@ File '/home/src/workspaces/project/packages/a/index.js' exists - use it as a nam
'package.json' does not have a 'peerDependencies' field.
Resolved under condition 'types'.
Exiting conditional exports.
Resolving real path for '/home/src/workspaces/project/packages/a/index.js', result '/home/src/workspaces/project/packages/a/index.js'.
======== Module name 'a' was successfully resolved to '/home/src/workspaces/project/packages/a/index.js' with Package ID 'a/index.js@0.0.0'. ========
File '/home/src/tslibs/TS/Lib/package.json' does not exist.
File '/home/src/tslibs/TS/package.json' does not exist.
@@ -114,6 +113,7 @@ File '/package.json' does not exist.
Default library for target 'esnext'
packages/a/index.js
Matched by default include pattern '**/*'
Imported via 'a' from file 'packages/a/test/index.js' with packageId 'a/index.js@0.0.0'
File is ECMAScript module because 'packages/a/package.json' has field "type" with value "module"
packages/a/test/index.js
Matched by default include pattern '**/*'
@@ -59,7 +59,6 @@ File '/Users/name/projects/lib-boilerplate/package.json' exists according to ear
Using 'exports' subpath '.' with target './src/index.ts'.
File '/Users/name/projects/lib-boilerplate/src/index.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/Users/name/projects/lib-boilerplate/src/index.ts', result '/Users/name/projects/lib-boilerplate/src/index.ts'.
======== Module name 'lib-boilerplate' was successfully resolved to '/Users/name/projects/lib-boilerplate/src/index.ts' with Package ID 'lib-boilerplate/src/index.ts@0.0.2'. ========
File '/home/src/tslibs/TS/Lib/package.json' does not exist.
File '/home/src/tslibs/TS/package.json' does not exist.
@@ -55,7 +55,6 @@ Resolving in ESM mode with conditions 'import', 'types', 'node'.
File '/Users/name/projects/web/package.json' exists according to earlier cached lookups.
Using 'exports' subpath '.' with target './dist/index.js'.
File '/Users/name/projects/web/index.ts' exists - use it as a name resolution result.
Resolving real path for '/Users/name/projects/web/index.ts', result '/Users/name/projects/web/index.ts'.
======== Module name '@this/package' was successfully resolved to '/Users/name/projects/web/index.ts'. ========
File '/home/src/tslibs/TS/Lib/package.json' does not exist.
File '/home/src/tslibs/TS/package.json' does not exist.
@@ -64,7 +64,6 @@ Using 'exports' subpath '.' with target './dist/index.js'.
File '/user/username/projects/myproject/index.ts' exists - use it as a name resolution result.
Resolved under condition 'default'.
Exiting conditional exports.
Resolving real path for '/user/username/projects/myproject/index.ts', result '/user/username/projects/myproject/index.ts'.
======== Module name '@this/package' was successfully resolved to '/user/username/projects/myproject/index.ts'. ========
File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups.
File '/home/src/tslibs/TS/Lib/package.json' does not exist.
@@ -0,0 +1,34 @@
// @noTypesAndSymbols: true
// @Filename: /tsconfig.json
{
"compilerOptions": {
"module": "nodenext",
"outDir": "dist",
"rootDir": "src",
},
"files": ["src/main.ts"]
}
// @Filename: /package.json
{
"name": "pkg",
"type": "module",
"imports": {
"#indirect1": "./src/indirect1.ts"
},
"exports": {
"./*": "./dist/*"
}
}
// @Filename: /src/indirect1.ts
export const indirect1 = 0;
// @Filename: /src/indirect2.ts
export const indirect2 = 0;
// @Filename: /src/main.ts
import { indirect1 } from "#indirect1";
import { indirect2 } from "pkg/indirect2.js";
console.log(indirect1, indirect2);