package.json `exports` should have priority over `typesVersions` (#50890)

* package.json `exports` should have priority over `typesVersions`

* Test some versioned conditions too
This commit is contained in:
Andrew Branch 2022-09-21 17:21:51 -07:00 коммит произвёл GitHub
Родитель acb8977190
Коммит 221cf55a21
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
12 изменённых файлов: 1022 добавлений и 18 удалений

Просмотреть файл

@ -2437,12 +2437,7 @@ namespace ts {
}
}
const { packageName, rest } = parsePackageName(moduleName);
const loader: ResolutionKindSpecificLoader = (extensions, candidate, onlyRecordFailures, state) => {
// package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them)
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
return loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)?.value;
}
let pathAndExtension =
loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
loadNodeModuleFromDirectoryWorker(
@ -2466,20 +2461,24 @@ namespace ts {
return withPackageId(packageInfo, pathAndExtension);
};
if (rest !== "") { // If "rest" is empty, we just did this search above.
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
// Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings.
const { packageName, rest } = parsePackageName(moduleName);
const packageDirectory = combinePaths(nodeModulesDirectory, packageName);
if (rest !== "") {
// Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now.
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
if (packageInfo && packageInfo.contents.versionPaths) {
if (state.traceEnabled) {
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, version, rest);
}
const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state);
if (fromPaths) {
return fromPaths.value;
}
}
// package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them)
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
return loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)?.value;
}
if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) {
if (state.traceEnabled) {
trace(state.host, Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, version, rest);
}
const packageDirectoryExists = nodeModulesDirectoryExists && directoryProbablyExists(packageDirectory, state.host);
const fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state);
if (fromPaths) {
return fromPaths.value;
}
}

Просмотреть файл

@ -0,0 +1,92 @@
error TS6504: File '/node_modules/exports-and-types-versions/dist/foo.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?
The file is in the program because:
Root file specified for compilation
/main.cts(1,16): error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type.
If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';`
/main.cts(2,16): error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations.
/main.cts(5,16): error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations.
/main.mts(1,16): error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type.
If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';`
/main.mts(2,16): error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations.
/main.mts(5,16): error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations.
!!! error TS6504: File '/node_modules/exports-and-types-versions/dist/foo.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?
!!! error TS6504: The file is in the program because:
!!! error TS6504: Root file specified for compilation
==== /node_modules/exports-and-types-versions/package.json (0 errors) ====
{
"name": "exports-and-types-versions",
"version": "1.0.0",
"exports": {
"./foo": "./dist/foo.js",
"./yep": {
"types": "./types/foo.d.ts",
"default": "./dist/foo.js"
},
"./versioned-yep": {
"types@>=4": "./types/foo.d.ts"
},
"./versioned-nah": {
"types@<4": "./types/foo.d.ts"
}
},
"typesVersions": {
"*": {
"foo": ["./types/foo.d.ts"],
"nope": ["./types/foo.d.ts"],
"versioned-nah": ["./types/foo.d.ts"]
}
}
}
==== /node_modules/exports-and-types-versions/dist/foo.js (0 errors) ====
module.exports = {};
==== /node_modules/exports-and-types-versions/types/foo.d.ts (0 errors) ====
export {};
==== /node_modules/just-types-versions/package.json (0 errors) ====
{
"name": "just-types-versions",
"version": "1.0.0",
"typesVersions": {
"*": {
"foo": ["./types/foo.d.ts"]
}
}
}
==== /node_modules/just-types-versions/types/foo.d.ts (0 errors) ====
export {};
==== /main.cts (3 errors) ====
import {} from "exports-and-types-versions/foo";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type.
!!! error TS7016: If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';`
import {} from "exports-and-types-versions/nope";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations.
import {} from "exports-and-types-versions/yep";
import {} from "exports-and-types-versions/versioned-yep";
import {} from "exports-and-types-versions/versioned-nah";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations.
import {} from "just-types-versions/foo";
==== /main.mts (3 errors) ====
import {} from "exports-and-types-versions/foo";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type.
!!! error TS7016: If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';`
import {} from "exports-and-types-versions/nope";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations.
import {} from "exports-and-types-versions/yep";
import {} from "exports-and-types-versions/versioned-yep";
import {} from "exports-and-types-versions/versioned-nah";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations.
import {} from "just-types-versions/foo";

Просмотреть файл

@ -0,0 +1,70 @@
//// [tests/cases/conformance/node/nodeModulesExportsBlocksTypesVersions.ts] ////
//// [package.json]
{
"name": "exports-and-types-versions",
"version": "1.0.0",
"exports": {
"./foo": "./dist/foo.js",
"./yep": {
"types": "./types/foo.d.ts",
"default": "./dist/foo.js"
},
"./versioned-yep": {
"types@>=4": "./types/foo.d.ts"
},
"./versioned-nah": {
"types@<4": "./types/foo.d.ts"
}
},
"typesVersions": {
"*": {
"foo": ["./types/foo.d.ts"],
"nope": ["./types/foo.d.ts"],
"versioned-nah": ["./types/foo.d.ts"]
}
}
}
//// [foo.js]
module.exports = {};
//// [foo.d.ts]
export {};
//// [package.json]
{
"name": "just-types-versions",
"version": "1.0.0",
"typesVersions": {
"*": {
"foo": ["./types/foo.d.ts"]
}
}
}
//// [foo.d.ts]
export {};
//// [main.cts]
import {} from "exports-and-types-versions/foo";
import {} from "exports-and-types-versions/nope";
import {} from "exports-and-types-versions/yep";
import {} from "exports-and-types-versions/versioned-yep";
import {} from "exports-and-types-versions/versioned-nah";
import {} from "just-types-versions/foo";
//// [main.mts]
import {} from "exports-and-types-versions/foo";
import {} from "exports-and-types-versions/nope";
import {} from "exports-and-types-versions/yep";
import {} from "exports-and-types-versions/versioned-yep";
import {} from "exports-and-types-versions/versioned-nah";
import {} from "just-types-versions/foo";
//// [main.cjs]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//// [main.mjs]
export {};

Просмотреть файл

@ -0,0 +1,23 @@
=== /node_modules/exports-and-types-versions/types/foo.d.ts ===
export {};
No type information for this code.
No type information for this code.=== /node_modules/just-types-versions/types/foo.d.ts ===
export {};
No type information for this code.
No type information for this code.=== /main.cts ===
import {} from "exports-and-types-versions/foo";
No type information for this code.import {} from "exports-and-types-versions/nope";
No type information for this code.import {} from "exports-and-types-versions/yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-nah";
No type information for this code.import {} from "just-types-versions/foo";
No type information for this code.
No type information for this code.=== /main.mts ===
import {} from "exports-and-types-versions/foo";
No type information for this code.import {} from "exports-and-types-versions/nope";
No type information for this code.import {} from "exports-and-types-versions/yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-nah";
No type information for this code.import {} from "just-types-versions/foo";
No type information for this code.
No type information for this code.

Просмотреть файл

@ -0,0 +1,260 @@
[
"File '/node_modules/exports-and-types-versions/types/package.json' does not exist.",
"Found 'package.json' at '/node_modules/exports-and-types-versions/package.json'.",
"'package.json' has a 'typesVersions' field with version-specific path mappings.",
"File '/node_modules/just-types-versions/types/package.json' does not exist.",
"Found 'package.json' at '/node_modules/just-types-versions/package.json'.",
"'package.json' has a 'typesVersions' field with version-specific path mappings.",
"======== Resolving module 'exports-and-types-versions/foo' from '/main.cts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
"File '/package.json' does not exist.",
"Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.",
"File '/node_modules/exports-and-types-versions/dist/foo.ts' does not exist.",
"File '/node_modules/exports-and-types-versions/dist/foo.tsx' does not exist.",
"File '/node_modules/exports-and-types-versions/dist/foo.d.ts' does not exist.",
"Export specifier './foo' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.",
"File '/node_modules/exports-and-types-versions/dist/foo.js' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/exports-and-types-versions/dist/foo.js', result '/node_modules/exports-and-types-versions/dist/foo.js'.",
"======== Module name 'exports-and-types-versions/foo' was successfully resolved to '/node_modules/exports-and-types-versions/dist/foo.js' with Package ID 'exports-and-types-versions/dist/foo.js@1.0.0'. ========",
"======== Resolving module 'exports-and-types-versions/nope' from '/main.cts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"======== Module name 'exports-and-types-versions/nope' was not resolved. ========",
"======== Resolving module 'exports-and-types-versions/yep' from '/main.cts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/yep' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File '/node_modules/exports-and-types-versions/types/foo.d.ts' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.",
"======== Module name 'exports-and-types-versions/yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ========",
"======== Resolving module 'exports-and-types-versions/versioned-yep' from '/main.cts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/versioned-yep' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File '/node_modules/exports-and-types-versions/types/foo.d.ts' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.",
"======== Module name 'exports-and-types-versions/versioned-yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ========",
"======== Resolving module 'exports-and-types-versions/versioned-nah' from '/main.cts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"======== Module name 'exports-and-types-versions/versioned-nah' was not resolved. ========",
"======== Resolving module 'just-types-versions/foo' from '/main.cts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'just-types-versions/foo' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/just-types-versions/package.json' exists according to earlier cached lookups.",
"'package.json' has a 'typesVersions' entry '*' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'foo'.",
"Module name 'foo', matched pattern 'foo'.",
"Trying substitution './types/foo.d.ts', candidate module location: './types/foo.d.ts'.",
"File '/node_modules/just-types-versions/types/foo.d.ts' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/just-types-versions/types/foo.d.ts', result '/node_modules/just-types-versions/types/foo.d.ts'.",
"======== Module name 'just-types-versions/foo' was successfully resolved to '/node_modules/just-types-versions/types/foo.d.ts'. ========",
"======== Resolving module 'exports-and-types-versions/foo' from '/main.mts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.",
"File '/node_modules/exports-and-types-versions/dist/foo.ts' does not exist.",
"File '/node_modules/exports-and-types-versions/dist/foo.tsx' does not exist.",
"File '/node_modules/exports-and-types-versions/dist/foo.d.ts' does not exist.",
"Export specifier './foo' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.",
"File '/node_modules/exports-and-types-versions/dist/foo.js' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/exports-and-types-versions/dist/foo.js', result '/node_modules/exports-and-types-versions/dist/foo.js'.",
"======== Module name 'exports-and-types-versions/foo' was successfully resolved to '/node_modules/exports-and-types-versions/dist/foo.js' with Package ID 'exports-and-types-versions/dist/foo.js@1.0.0'. ========",
"======== Resolving module 'exports-and-types-versions/nope' from '/main.mts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"======== Module name 'exports-and-types-versions/nope' was not resolved. ========",
"======== Resolving module 'exports-and-types-versions/yep' from '/main.mts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/yep' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File '/node_modules/exports-and-types-versions/types/foo.d.ts' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.",
"======== Module name 'exports-and-types-versions/yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ========",
"======== Resolving module 'exports-and-types-versions/versioned-yep' from '/main.mts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/versioned-yep' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File '/node_modules/exports-and-types-versions/types/foo.d.ts' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.",
"======== Module name 'exports-and-types-versions/versioned-yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ========",
"======== Resolving module 'exports-and-types-versions/versioned-nah' from '/main.mts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"======== Module name 'exports-and-types-versions/versioned-nah' was not resolved. ========",
"======== Resolving module 'just-types-versions/foo' from '/main.mts'. ========",
"Module resolution kind is not specified, using 'Node16'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'just-types-versions/foo' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/just-types-versions/package.json' exists according to earlier cached lookups.",
"'package.json' has a 'typesVersions' entry '*' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'foo'.",
"Module name 'foo', matched pattern 'foo'.",
"Trying substitution './types/foo.d.ts', candidate module location: './types/foo.d.ts'.",
"File '/node_modules/just-types-versions/types/foo.d.ts' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/just-types-versions/types/foo.d.ts', result '/node_modules/just-types-versions/types/foo.d.ts'.",
"======== Module name 'just-types-versions/foo' was successfully resolved to '/node_modules/just-types-versions/types/foo.d.ts'. ========",
"File 'package.json' does not exist.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups."
]

Просмотреть файл

@ -0,0 +1,23 @@
=== /node_modules/exports-and-types-versions/types/foo.d.ts ===
export {};
No type information for this code.
No type information for this code.=== /node_modules/just-types-versions/types/foo.d.ts ===
export {};
No type information for this code.
No type information for this code.=== /main.cts ===
import {} from "exports-and-types-versions/foo";
No type information for this code.import {} from "exports-and-types-versions/nope";
No type information for this code.import {} from "exports-and-types-versions/yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-nah";
No type information for this code.import {} from "just-types-versions/foo";
No type information for this code.
No type information for this code.=== /main.mts ===
import {} from "exports-and-types-versions/foo";
No type information for this code.import {} from "exports-and-types-versions/nope";
No type information for this code.import {} from "exports-and-types-versions/yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-nah";
No type information for this code.import {} from "just-types-versions/foo";
No type information for this code.
No type information for this code.

Просмотреть файл

@ -0,0 +1,92 @@
error TS6504: File '/node_modules/exports-and-types-versions/dist/foo.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?
The file is in the program because:
Root file specified for compilation
/main.cts(1,16): error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type.
If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';`
/main.cts(2,16): error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations.
/main.cts(5,16): error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations.
/main.mts(1,16): error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type.
If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';`
/main.mts(2,16): error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations.
/main.mts(5,16): error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations.
!!! error TS6504: File '/node_modules/exports-and-types-versions/dist/foo.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?
!!! error TS6504: The file is in the program because:
!!! error TS6504: Root file specified for compilation
==== /node_modules/exports-and-types-versions/package.json (0 errors) ====
{
"name": "exports-and-types-versions",
"version": "1.0.0",
"exports": {
"./foo": "./dist/foo.js",
"./yep": {
"types": "./types/foo.d.ts",
"default": "./dist/foo.js"
},
"./versioned-yep": {
"types@>=4": "./types/foo.d.ts"
},
"./versioned-nah": {
"types@<4": "./types/foo.d.ts"
}
},
"typesVersions": {
"*": {
"foo": ["./types/foo.d.ts"],
"nope": ["./types/foo.d.ts"],
"versioned-nah": ["./types/foo.d.ts"]
}
}
}
==== /node_modules/exports-and-types-versions/dist/foo.js (0 errors) ====
module.exports = {};
==== /node_modules/exports-and-types-versions/types/foo.d.ts (0 errors) ====
export {};
==== /node_modules/just-types-versions/package.json (0 errors) ====
{
"name": "just-types-versions",
"version": "1.0.0",
"typesVersions": {
"*": {
"foo": ["./types/foo.d.ts"]
}
}
}
==== /node_modules/just-types-versions/types/foo.d.ts (0 errors) ====
export {};
==== /main.cts (3 errors) ====
import {} from "exports-and-types-versions/foo";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type.
!!! error TS7016: If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';`
import {} from "exports-and-types-versions/nope";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations.
import {} from "exports-and-types-versions/yep";
import {} from "exports-and-types-versions/versioned-yep";
import {} from "exports-and-types-versions/versioned-nah";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations.
import {} from "just-types-versions/foo";
==== /main.mts (3 errors) ====
import {} from "exports-and-types-versions/foo";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type.
!!! error TS7016: If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';`
import {} from "exports-and-types-versions/nope";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations.
import {} from "exports-and-types-versions/yep";
import {} from "exports-and-types-versions/versioned-yep";
import {} from "exports-and-types-versions/versioned-nah";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations.
import {} from "just-types-versions/foo";

Просмотреть файл

@ -0,0 +1,70 @@
//// [tests/cases/conformance/node/nodeModulesExportsBlocksTypesVersions.ts] ////
//// [package.json]
{
"name": "exports-and-types-versions",
"version": "1.0.0",
"exports": {
"./foo": "./dist/foo.js",
"./yep": {
"types": "./types/foo.d.ts",
"default": "./dist/foo.js"
},
"./versioned-yep": {
"types@>=4": "./types/foo.d.ts"
},
"./versioned-nah": {
"types@<4": "./types/foo.d.ts"
}
},
"typesVersions": {
"*": {
"foo": ["./types/foo.d.ts"],
"nope": ["./types/foo.d.ts"],
"versioned-nah": ["./types/foo.d.ts"]
}
}
}
//// [foo.js]
module.exports = {};
//// [foo.d.ts]
export {};
//// [package.json]
{
"name": "just-types-versions",
"version": "1.0.0",
"typesVersions": {
"*": {
"foo": ["./types/foo.d.ts"]
}
}
}
//// [foo.d.ts]
export {};
//// [main.cts]
import {} from "exports-and-types-versions/foo";
import {} from "exports-and-types-versions/nope";
import {} from "exports-and-types-versions/yep";
import {} from "exports-and-types-versions/versioned-yep";
import {} from "exports-and-types-versions/versioned-nah";
import {} from "just-types-versions/foo";
//// [main.mts]
import {} from "exports-and-types-versions/foo";
import {} from "exports-and-types-versions/nope";
import {} from "exports-and-types-versions/yep";
import {} from "exports-and-types-versions/versioned-yep";
import {} from "exports-and-types-versions/versioned-nah";
import {} from "just-types-versions/foo";
//// [main.cjs]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//// [main.mjs]
export {};

Просмотреть файл

@ -0,0 +1,23 @@
=== /node_modules/exports-and-types-versions/types/foo.d.ts ===
export {};
No type information for this code.
No type information for this code.=== /node_modules/just-types-versions/types/foo.d.ts ===
export {};
No type information for this code.
No type information for this code.=== /main.cts ===
import {} from "exports-and-types-versions/foo";
No type information for this code.import {} from "exports-and-types-versions/nope";
No type information for this code.import {} from "exports-and-types-versions/yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-nah";
No type information for this code.import {} from "just-types-versions/foo";
No type information for this code.
No type information for this code.=== /main.mts ===
import {} from "exports-and-types-versions/foo";
No type information for this code.import {} from "exports-and-types-versions/nope";
No type information for this code.import {} from "exports-and-types-versions/yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-nah";
No type information for this code.import {} from "just-types-versions/foo";
No type information for this code.
No type information for this code.

Просмотреть файл

@ -0,0 +1,264 @@
[
"File '/node_modules/exports-and-types-versions/types/package.json' does not exist.",
"Found 'package.json' at '/node_modules/exports-and-types-versions/package.json'.",
"'package.json' has a 'typesVersions' field with version-specific path mappings.",
"File '/node_modules/just-types-versions/types/package.json' does not exist.",
"Found 'package.json' at '/node_modules/just-types-versions/package.json'.",
"'package.json' has a 'typesVersions' field with version-specific path mappings.",
"======== Resolving module 'exports-and-types-versions/foo' from '/main.cts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
"File '/package.json' does not exist.",
"Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.",
"File '/node_modules/exports-and-types-versions/dist/foo.ts' does not exist.",
"File '/node_modules/exports-and-types-versions/dist/foo.tsx' does not exist.",
"File '/node_modules/exports-and-types-versions/dist/foo.d.ts' does not exist.",
"Export specifier './foo' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.",
"File '/node_modules/exports-and-types-versions/dist/foo.js' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/exports-and-types-versions/dist/foo.js', result '/node_modules/exports-and-types-versions/dist/foo.js'.",
"======== Module name 'exports-and-types-versions/foo' was successfully resolved to '/node_modules/exports-and-types-versions/dist/foo.js' with Package ID 'exports-and-types-versions/dist/foo.js@1.0.0'. ========",
"======== Resolving module 'exports-and-types-versions/nope' from '/main.cts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"======== Module name 'exports-and-types-versions/nope' was not resolved. ========",
"======== Resolving module 'exports-and-types-versions/yep' from '/main.cts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/yep' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File '/node_modules/exports-and-types-versions/types/foo.d.ts' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.",
"======== Module name 'exports-and-types-versions/yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ========",
"======== Resolving module 'exports-and-types-versions/versioned-yep' from '/main.cts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/versioned-yep' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File '/node_modules/exports-and-types-versions/types/foo.d.ts' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.",
"======== Module name 'exports-and-types-versions/versioned-yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ========",
"======== Resolving module 'exports-and-types-versions/versioned-nah' from '/main.cts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"======== Module name 'exports-and-types-versions/versioned-nah' was not resolved. ========",
"======== Resolving module 'just-types-versions/foo' from '/main.cts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'just-types-versions/foo' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/just-types-versions/package.json' exists according to earlier cached lookups.",
"'package.json' has a 'typesVersions' entry '*' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'foo'.",
"Module name 'foo', matched pattern 'foo'.",
"Trying substitution './types/foo.d.ts', candidate module location: './types/foo.d.ts'.",
"File '/node_modules/just-types-versions/types/foo.d.ts' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/just-types-versions/types/foo.d.ts', result '/node_modules/just-types-versions/types/foo.d.ts'.",
"======== Module name 'just-types-versions/foo' was successfully resolved to '/node_modules/just-types-versions/types/foo.d.ts'. ========",
"======== Resolving module 'exports-and-types-versions/foo' from '/main.mts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.",
"File '/node_modules/exports-and-types-versions/dist/foo.ts' does not exist.",
"File '/node_modules/exports-and-types-versions/dist/foo.tsx' does not exist.",
"File '/node_modules/exports-and-types-versions/dist/foo.d.ts' does not exist.",
"Export specifier './foo' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File name '/node_modules/exports-and-types-versions/dist/foo.js' has a '.js' extension - stripping it.",
"File '/node_modules/exports-and-types-versions/dist/foo.js' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/exports-and-types-versions/dist/foo.js', result '/node_modules/exports-and-types-versions/dist/foo.js'.",
"======== Module name 'exports-and-types-versions/foo' was successfully resolved to '/node_modules/exports-and-types-versions/dist/foo.js' with Package ID 'exports-and-types-versions/dist/foo.js@1.0.0'. ========",
"======== Resolving module 'exports-and-types-versions/nope' from '/main.mts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"======== Module name 'exports-and-types-versions/nope' was not resolved. ========",
"======== Resolving module 'exports-and-types-versions/yep' from '/main.mts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/yep' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File '/node_modules/exports-and-types-versions/types/foo.d.ts' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.",
"======== Module name 'exports-and-types-versions/yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ========",
"======== Resolving module 'exports-and-types-versions/versioned-yep' from '/main.mts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/versioned-yep' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"File '/node_modules/exports-and-types-versions/types/foo.d.ts' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'.",
"======== Module name 'exports-and-types-versions/versioned-yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ========",
"======== Resolving module 'exports-and-types-versions/versioned-nah' from '/main.mts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"Directory '/node_modules/@types' does not exist, skipping all lookups in it.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file type 'JavaScript'.",
"File '/node_modules/exports-and-types-versions/package.json' exists according to earlier cached lookups.",
"Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'.",
"======== Module name 'exports-and-types-versions/versioned-nah' was not resolved. ========",
"======== Resolving module 'just-types-versions/foo' from '/main.mts'. ========",
"Module resolution kind is not specified, using 'NodeNext'.",
"File '/package.json' does not exist according to earlier cached lookups.",
"Loading module 'just-types-versions/foo' from 'node_modules' folder, target file type 'TypeScript'.",
"File '/node_modules/just-types-versions/package.json' exists according to earlier cached lookups.",
"'package.json' has a 'typesVersions' entry '*' that matches compiler version '3.1.0-dev', looking for a pattern to match module name 'foo'.",
"Module name 'foo', matched pattern 'foo'.",
"Trying substitution './types/foo.d.ts', candidate module location: './types/foo.d.ts'.",
"File '/node_modules/just-types-versions/types/foo.d.ts' exist - use it as a name resolution result.",
"Resolving real path for '/node_modules/just-types-versions/types/foo.d.ts', result '/node_modules/just-types-versions/types/foo.d.ts'.",
"======== Module name 'just-types-versions/foo' was successfully resolved to '/node_modules/just-types-versions/types/foo.d.ts'. ========",
"File 'package.json' does not exist.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups.",
"File 'package.json' does not exist according to earlier cached lookups.",
"File '/package.json' does not exist according to earlier cached lookups."
]

Просмотреть файл

@ -0,0 +1,23 @@
=== /node_modules/exports-and-types-versions/types/foo.d.ts ===
export {};
No type information for this code.
No type information for this code.=== /node_modules/just-types-versions/types/foo.d.ts ===
export {};
No type information for this code.
No type information for this code.=== /main.cts ===
import {} from "exports-and-types-versions/foo";
No type information for this code.import {} from "exports-and-types-versions/nope";
No type information for this code.import {} from "exports-and-types-versions/yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-nah";
No type information for this code.import {} from "just-types-versions/foo";
No type information for this code.
No type information for this code.=== /main.mts ===
import {} from "exports-and-types-versions/foo";
No type information for this code.import {} from "exports-and-types-versions/nope";
No type information for this code.import {} from "exports-and-types-versions/yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-yep";
No type information for this code.import {} from "exports-and-types-versions/versioned-nah";
No type information for this code.import {} from "just-types-versions/foo";
No type information for this code.
No type information for this code.

Просмотреть файл

@ -0,0 +1,65 @@
// @module: node16,nodenext
// @traceResolution: true
// @noImplicitAny: true
// @Filename: /node_modules/exports-and-types-versions/package.json
{
"name": "exports-and-types-versions",
"version": "1.0.0",
"exports": {
"./foo": "./dist/foo.js",
"./yep": {
"types": "./types/foo.d.ts",
"default": "./dist/foo.js"
},
"./versioned-yep": {
"types@>=4": "./types/foo.d.ts"
},
"./versioned-nah": {
"types@<4": "./types/foo.d.ts"
}
},
"typesVersions": {
"*": {
"foo": ["./types/foo.d.ts"],
"nope": ["./types/foo.d.ts"],
"versioned-nah": ["./types/foo.d.ts"]
}
}
}
// @Filename: /node_modules/exports-and-types-versions/dist/foo.js
module.exports = {};
// @Filename: /node_modules/exports-and-types-versions/types/foo.d.ts
export {};
// @Filename: /node_modules/just-types-versions/package.json
{
"name": "just-types-versions",
"version": "1.0.0",
"typesVersions": {
"*": {
"foo": ["./types/foo.d.ts"]
}
}
}
// @Filename: /node_modules/just-types-versions/types/foo.d.ts
export {};
// @Filename: /main.cts
import {} from "exports-and-types-versions/foo";
import {} from "exports-and-types-versions/nope";
import {} from "exports-and-types-versions/yep";
import {} from "exports-and-types-versions/versioned-yep";
import {} from "exports-and-types-versions/versioned-nah";
import {} from "just-types-versions/foo";
// @Filename: /main.mts
import {} from "exports-and-types-versions/foo";
import {} from "exports-and-types-versions/nope";
import {} from "exports-and-types-versions/yep";
import {} from "exports-and-types-versions/versioned-yep";
import {} from "exports-and-types-versions/versioned-nah";
import {} from "just-types-versions/foo";