From 86dd5da43dd6da046a97bffa16faf0babaad4499 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 20 Oct 2022 10:04:25 -0700 Subject: [PATCH 01/23] Add options --- src/compiler/commandLineParser.ts | 33 +++++++++++++----- src/compiler/diagnosticMessages.json | 16 +++++++-- src/compiler/moduleNameResolver.ts | 51 +++++++++++++++++++++++----- src/compiler/types.ts | 5 +++ src/compiler/utilities.ts | 26 ++++++++++++++ 5 files changed, 113 insertions(+), 18 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 240c6ec346ff4..88ae140de05cc 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -841,6 +841,7 @@ namespace ts { classic: ModuleResolutionKind.Classic, node16: ModuleResolutionKind.Node16, nodenext: ModuleResolutionKind.NodeNext, + hybrid: ModuleResolutionKind.Hybrid, })), affectsModuleResolution: true, paramType: Diagnostics.STRATEGY, @@ -957,14 +958,30 @@ namespace ts { category: Diagnostics.Modules, description: Diagnostics.List_of_file_name_suffixes_to_search_when_resolving_a_module, }, - // { - // name: "allowImportingTsExtensions", - // type: "boolean", - // affectsModuleResolution: true, - // category: Diagnostics.Modules, - // description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_minimal_and_either_noEmit_or_emitDeclarationOnly_to_be_set, - // defaultValueDescription: false, - // }, + { + name: "allowImportingTsExtensions", + type: "boolean", + affectsModuleResolution: true, + category: Diagnostics.Modules, + description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_hybrid_and_either_noEmit_or_emitDeclarationOnly_to_be_set, + defaultValueDescription: false, + }, + { + name: "resolvePackageJsonExports", + type: "boolean", + affectsModuleResolution: true, + category: Diagnostics.Modules, + description: Diagnostics.Use_the_package_json_exports_field_when_resolving_package_imports, + defaultValueDescription: Diagnostics.true_when_moduleResolution_is_node16_nodenext_or_hybrid_otherwise_false, + }, + { + name: "resolvePackageJsonImports", + type: "boolean", + affectsModuleResolution: true, + category: Diagnostics.Modules, + description: Diagnostics.Use_the_package_json_imports_field_when_resolving_imports, + defaultValueDescription: Diagnostics.true_when_moduleResolution_is_node16_nodenext_or_hybrid_otherwise_false, + }, // Source Maps { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 077f66b163950..82b15b75f8bb6 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4225,7 +4225,7 @@ "category": "Error", "code": 5095 }, - "Option 'allowImportingTsExtensions' can only be used when 'moduleResolution' is set to 'minimal' and either 'noEmit' or 'emitDeclarationOnly' is set.": { + "Option 'allowImportingTsExtensions' can only be used when 'moduleResolution' is set to 'hybrid' and either 'noEmit' or 'emitDeclarationOnly' is set.": { "category": "Error", "code": 5096 }, @@ -5438,10 +5438,22 @@ "category": "Message", "code": 6406 }, - "Allow imports to include TypeScript file extensions. Requires '--moduleResolution minimal' and either '--noEmit' or '--emitDeclarationOnly' to be set.": { + "Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set.": { "category": "Message", "code": 6407 }, + "Use the package.json 'exports' field when resolving package imports.": { + "category": "Message", + "code": 6408 + }, + "Use the package.json 'imports' field when resolving imports.": { + "category": "Message", + "code": 6409 + }, + "`true` when 'moduleResolution' is 'node16', 'nodenext', or 'hybrid'; otherwise `false`.": { + "category": "Message", + "code": 6410 + }, "The expected type comes from property '{0}' which is declared here on type '{1}'": { "category": "Message", diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 36f6125455d6c..31b57152be587 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -365,7 +365,7 @@ namespace ts { const failedLookupLocations: string[] = []; const affectingLocations: string[] = []; - let features = getDefaultNodeResolutionFeatures(options); + let features = getNodeResolutionFeatures(options); // Unlike `import` statements, whose mode-calculating APIs are all guaranteed to return `undefined` if we're in an un-mode-ed module resolution // setting, type references will return their target mode regardless of options because of how the parser works, so we guard against the mode being // set in a non-modal module resolution setting here. Do note that our behavior is not particularly well defined when these mode-overriding imports @@ -480,10 +480,36 @@ namespace ts { } } - function getDefaultNodeResolutionFeatures(options: CompilerOptions) { - return getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default : - getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault : - NodeResolutionFeatures.None; + function getNodeResolutionFeatures(options: CompilerOptions) { + let features = NodeResolutionFeatures.None; + switch (getEmitModuleResolutionKind(options)) { + case ModuleResolutionKind.Node16: + features = NodeResolutionFeatures.Node16Default; + break; + case ModuleResolutionKind.NodeNext: + features = NodeResolutionFeatures.NodeNextDefault; + break; + case ModuleResolutionKind.Hybrid: + features = NodeResolutionFeatures.HybridDefault; + break; + } + if (options.resolvePackageJsonExports) { + features |= NodeResolutionFeatures.Exports; + } + else if (options.resolvePackageJsonExports === false) { + features &= ~NodeResolutionFeatures.Exports; + } + if (options.resolvePackageJsonImports) { + features |= NodeResolutionFeatures.Imports; + } + else if (options.resolvePackageJsonImports === false) { + features &= ~NodeResolutionFeatures.Imports; + } + return features; + } + + function getConditions(options: CompilerOptions, esmMode: boolean | undefined) { + const conditions = esmMode ? ["node", "import", "types"] : ["node", "require", "types"]; } /** @@ -1038,6 +1064,9 @@ namespace ts { case ModuleResolutionKind.Classic: result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference); break; + case ModuleResolutionKind.Hybrid: + result = hybridModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference); + break; default: return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`); } @@ -1293,6 +1322,8 @@ namespace ts { NodeNextDefault = AllFeatures, + HybridDefault = Imports | SelfName | Exports | ExportsPatternTrailers, + EsmMode = 1 << 5, } @@ -1346,6 +1377,10 @@ namespace ts { return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined); } + export function hybridModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations { + + } + export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; /* @internal */ export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, lookupConfig?: boolean): ResolvedModuleWithFailedLookupLocations; // eslint-disable-line @typescript-eslint/unified-signatures export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, lookupConfig?: boolean): ResolvedModuleWithFailedLookupLocations { @@ -1732,7 +1767,7 @@ namespace ts { let entrypoints: string[] | undefined; const extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript; - const features = getDefaultNodeResolutionFeatures(options); + const features = getNodeResolutionFeatures(options); const requireState = getTemporaryModuleResolutionState(cache?.getPackageJsonInfoCache(), host, options); requireState.conditions = ["node", "require", "types"]; requireState.requestContainingDirectory = packageJsonInfo.packageDirectory; @@ -2691,8 +2726,8 @@ namespace ts { } } - export function moduleResolutionSupportsResolvingTsExtensions(_compilerOptions: CompilerOptions) { - return false; + export function moduleResolutionSupportsResolvingTsExtensions(compilerOptions: CompilerOptions) { + return getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Hybrid; } // Program errors validate that `noEmit` or `emitDeclarationOnly` is also set, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5d98a5ca76c47..b7ebf46c4c5e1 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6494,6 +6494,8 @@ namespace ts { // In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target Node16 = 3, NodeNext = 99, // Not simply `Node16` so that compiled code linked against TS can use the `Next` value reliably (same as with `ModuleKind`) + + Hybrid = 100, } export enum ModuleDetectionKind { @@ -6570,6 +6572,7 @@ namespace ts { /* @internal */ configFilePath?: string; /** configFile is set as non enumerable property so as to avoid checking of json source files */ /* @internal */ readonly configFile?: TsConfigSourceFile; + customConditions?: string[]; declaration?: boolean; declarationMap?: boolean; emitDeclarationOnly?: boolean; @@ -6652,6 +6655,8 @@ namespace ts { incremental?: boolean; tsBuildInfoFile?: string; removeComments?: boolean; + resolvePackageJsonExports?: boolean; + resolvePackageJsonImports?: boolean; rootDir?: string; rootDirs?: string[]; skipLibCheck?: boolean; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 3641fef177d47..5dcfe061bcc59 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -6448,6 +6448,32 @@ namespace ts { moduleKind === ModuleKind.System; } + export function getResolvePackageJsonExports(compilerOptions: CompilerOptions) { + if (compilerOptions.resolvePackageJsonExports !== undefined) { + return compilerOptions.resolvePackageJsonExports; + } + switch (getEmitModuleResolutionKind(compilerOptions)) { + case ModuleResolutionKind.Node16: + case ModuleResolutionKind.NodeNext: + case ModuleResolutionKind.Hybrid: + return true; + } + return false; + } + + export function getResolvePackageJsonImports(compilerOptions: CompilerOptions) { + if (compilerOptions.resolvePackageJsonImports !== undefined) { + return compilerOptions.resolvePackageJsonImports; + } + switch (getEmitModuleResolutionKind(compilerOptions)) { + case ModuleResolutionKind.Node16: + case ModuleResolutionKind.NodeNext: + case ModuleResolutionKind.Hybrid: + return true; + } + return false; + } + export function getEmitDeclarations(compilerOptions: CompilerOptions): boolean { return !!(compilerOptions.declaration || compilerOptions.composite); } From 8846f31a2b7686cbe8f13e3a148d33f263fd9cb5 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 21 Oct 2022 15:16:44 -0700 Subject: [PATCH 02/23] Add customConditions option --- src/compiler/checker.ts | 2 +- src/compiler/commandLineParser.ts | 11 ++++++++++ src/compiler/diagnosticMessages.json | 10 +++++++++- src/compiler/moduleNameResolver.ts | 30 +++++++++++++++++----------- src/compiler/program.ts | 17 +++++++++++++--- src/compiler/utilities.ts | 30 +++++++++++++++++++++++----- src/services/completions.ts | 2 +- src/services/stringCompletions.ts | 2 +- src/services/utilities.ts | 4 ---- 9 files changed, 80 insertions(+), 28 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index dc4ecdbab9c15..cee39c59e572e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3808,7 +3808,7 @@ namespace ts { if (tsExtension) { errorOnTSExtensionImport(tsExtension); } - else if (!compilerOptions.resolveJsonModule && + else if (!getResolveJsonModule(compilerOptions) && fileExtensionIs(moduleReference, Extension.Json) && moduleResolutionKind !== ModuleResolutionKind.Classic && hasJsonModuleEmitEnabled(compilerOptions)) { diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 88ae140de05cc..d360e005aa5fc 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -982,6 +982,17 @@ namespace ts { description: Diagnostics.Use_the_package_json_imports_field_when_resolving_imports, defaultValueDescription: Diagnostics.true_when_moduleResolution_is_node16_nodenext_or_hybrid_otherwise_false, }, + { + name: "customConditions", + type: "list", + element: { + name: "condition", + type: "string", + }, + affectsModuleResolution: true, + category: Diagnostics.Modules, + description: Diagnostics.Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports, + }, // Source Maps { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 82b15b75f8bb6..4e66f092b3699 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4233,6 +4233,10 @@ "category": "Error", "code": 5097 }, + "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'.": { + "category": "Error", + "code": 5098 + }, "Generates a sourcemap for each corresponding '.d.ts' file.": { "category": "Message", @@ -5450,10 +5454,14 @@ "category": "Message", "code": 6409 }, - "`true` when 'moduleResolution' is 'node16', 'nodenext', or 'hybrid'; otherwise `false`.": { + "Conditions to set in addition to the resolver-specific defaults when resolving imports.": { "category": "Message", "code": 6410 }, + "`true` when 'moduleResolution' is 'node16', 'nodenext', or 'hybrid'; otherwise `false`.": { + "category": "Message", + "code": 6411 + }, "The expected type comes from property '{0}' which is declared here on type '{1}'": { "category": "Message", diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 31b57152be587..d0089b5500f07 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -509,7 +509,13 @@ namespace ts { } function getConditions(options: CompilerOptions, esmMode: boolean | undefined) { - const conditions = esmMode ? ["node", "import", "types"] : ["node", "require", "types"]; + // conditions are only used by the node16/nodenext/hybrid resolvers - there's no priority order in the list, + // it's essentially a set (priority is determined by object insertion order in the object we look at). + const conditions = esmMode ? ["node", "import"] : ["node", "require"]; + if (!options.noDtsResolution) { + conditions.push("types"); + } + return concatenate(conditions, options.customConditions); } /** @@ -1367,7 +1373,7 @@ namespace ts { // es module file or cjs-like input file, use a variant of the legacy cjs resolver that supports the selected modern features const esmMode = resolutionMode === ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0; let extensions = compilerOptions.noDtsResolution ? [Extensions.TsOnly, Extensions.JavaScript] : tsExtensions; - if (compilerOptions.resolveJsonModule) { + if (getResolveJsonModule(compilerOptions)) { extensions = [...extensions, Extensions.Json]; } return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference); @@ -1378,7 +1384,12 @@ namespace ts { } export function hybridModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations { - + const containingDirectory = getDirectoryPath(containingFile); + let extensions = compilerOptions.noDtsResolution ? [Extensions.TsOnly, Extensions.JavaScript] : tsExtensions; + if (getResolveJsonModule(compilerOptions)) { + extensions = [...extensions, Extensions.Json]; + } + return nodeModuleNameResolverWorker(NodeResolutionFeatures.HybridDefault, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference); } export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; @@ -1391,10 +1402,10 @@ namespace ts { else if (compilerOptions.noDtsResolution) { extensions = [Extensions.TsOnly]; if (compilerOptions.allowJs) extensions.push(Extensions.JavaScript); - if (compilerOptions.resolveJsonModule) extensions.push(Extensions.Json); + if (getResolveJsonModule(compilerOptions)) extensions.push(Extensions.Json); } else { - extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions; + extensions = getResolveJsonModule(compilerOptions) ? tsPlusJsonExtensions : tsExtensions; } return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference); } @@ -1404,12 +1415,7 @@ namespace ts { const failedLookupLocations: string[] = []; const affectingLocations: string[] = []; - // conditions are only used by the node16/nodenext resolver - there's no priority order in the list, - //it's essentially a set (priority is determined by object insertion order in the object we look at). - const conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]; - if (compilerOptions.noDtsResolution) { - conditions.pop(); - } + const conditions = getConditions(compilerOptions, !!(features & NodeResolutionFeatures.EsmMode)); const diagnostics: Diagnostic[] = []; const state: ModuleResolutionState = { @@ -1617,7 +1623,7 @@ namespace ts { // If that didn't work, try stripping a ".js" or ".jsx" extension and replacing it with a TypeScript one; // e.g. "./foo.js" can be matched by "./foo.ts" or "./foo.d.ts" if (hasJSFileExtension(candidate) || - (state.compilerOptions.resolveJsonModule && fileExtensionIs(candidate, Extension.Json)) || + (getResolveJsonModule(state.compilerOptions) && fileExtensionIs(candidate, Extension.Json)) || (moduleResolutionSupportsResolvingTsExtensions(state.compilerOptions) && fileExtensionIsOneOf(candidate, supportedTSExtensionsFlat)) ) { const extensionless = removeFileExtension(candidate); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index e92a130ec19a9..43dfbe80695ce 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -3602,7 +3602,7 @@ namespace ts { } } - if (options.resolveJsonModule) { + if (getResolveJsonModule(options)) { if (getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeJs && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeNext) { @@ -3697,7 +3697,18 @@ namespace ts { } if (options.allowImportingTsExtensions && !(moduleResolutionSupportsResolvingTsExtensions(options) && (options.noEmit || options.emitDeclarationOnly))) { - createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_moduleResolution_is_set_to_minimal_and_either_noEmit_or_emitDeclarationOnly_is_set); + createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_moduleResolution_is_set_to_hybrid_and_either_noEmit_or_emitDeclarationOnly_is_set); + } + + const moduleResolution = getEmitModuleResolutionKind(options); + if (options.resolvePackageJsonExports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { + createOptionValueDiagnostic("resolvePackageJsonExports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_hybrid, "resolvePackageJsonExports"); + } + if (options.resolvePackageJsonImports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { + createOptionValueDiagnostic("resolvePackageJsonImports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_hybrid, "resolvePackageJsonExports"); + } + if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { + createOptionValueDiagnostic("customConditions", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_hybrid, "customConditions"); } // If the emit is enabled make sure that every output file is unique and not overwriting any of the input files @@ -4394,7 +4405,7 @@ namespace ts { return getAllowJSCompilerOption(options) || !getStrictOptionValue(options, "noImplicitAny") ? undefined : Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type; } function needResolveJsonModule() { - return options.resolveJsonModule ? undefined : Diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used; + return getResolveJsonModule(options) ? undefined : Diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used; } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 5dcfe061bcc59..82ba813f0b92c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -6448,11 +6448,20 @@ namespace ts { moduleKind === ModuleKind.System; } + export function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution: ModuleResolutionKind): boolean { + return moduleResolution >= ModuleResolutionKind.Node16 && moduleResolution <= ModuleResolutionKind.NodeNext + || moduleResolution === ModuleResolutionKind.Hybrid; + } + export function getResolvePackageJsonExports(compilerOptions: CompilerOptions) { + const moduleResolution = getEmitModuleResolutionKind(compilerOptions); + if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { + return false; + } if (compilerOptions.resolvePackageJsonExports !== undefined) { return compilerOptions.resolvePackageJsonExports; } - switch (getEmitModuleResolutionKind(compilerOptions)) { + switch (moduleResolution) { case ModuleResolutionKind.Node16: case ModuleResolutionKind.NodeNext: case ModuleResolutionKind.Hybrid: @@ -6462,10 +6471,14 @@ namespace ts { } export function getResolvePackageJsonImports(compilerOptions: CompilerOptions) { - if (compilerOptions.resolvePackageJsonImports !== undefined) { - return compilerOptions.resolvePackageJsonImports; + const moduleResolution = getEmitModuleResolutionKind(compilerOptions); + if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { + return false; } - switch (getEmitModuleResolutionKind(compilerOptions)) { + if (compilerOptions.resolvePackageJsonExports !== undefined) { + return compilerOptions.resolvePackageJsonExports; + } + switch (moduleResolution) { case ModuleResolutionKind.Node16: case ModuleResolutionKind.NodeNext: case ModuleResolutionKind.Hybrid: @@ -6474,6 +6487,13 @@ namespace ts { return false; } + export function getResolveJsonModule(compilerOptions: CompilerOptions) { + if (compilerOptions.resolveJsonModule !== undefined) { + return compilerOptions.resolveJsonModule; + } + return getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Hybrid; + } + export function getEmitDeclarations(compilerOptions: CompilerOptions): boolean { return !!(compilerOptions.declaration || compilerOptions.composite); } @@ -7055,7 +7075,7 @@ namespace ts { export function getSupportedExtensionsWithJsonIfResolveJsonModule(options: CompilerOptions | undefined, supportedExtensions: readonly Extension[][]): readonly Extension[][]; export function getSupportedExtensionsWithJsonIfResolveJsonModule(options: CompilerOptions | undefined, supportedExtensions: readonly string[][]): readonly string[][]; export function getSupportedExtensionsWithJsonIfResolveJsonModule(options: CompilerOptions | undefined, supportedExtensions: readonly string[][]): readonly string[][] { - if (!options || !options.resolveJsonModule) return supportedExtensions; + if (!options || !getResolveJsonModule(options)) return supportedExtensions; if (supportedExtensions === allSupportedExtensions) return allSupportedExtensionsWithJson; if (supportedExtensions === supportedTSExtensions) return supportedTSExtensionsWithJson; return [...supportedExtensions, [Extension.Json]]; diff --git a/src/services/completions.ts b/src/services/completions.ts index 0462274d18dd6..639acdfabaf7b 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -198,7 +198,7 @@ namespace ts.Completions { // relative path into node_modules), and we want to filter those completions out entirely. // Import statement completions always need specifier resolution because the module specifier is // part of their `insertText`, not the `codeActions` creating edits away from the cursor. - const needsFullResolution = isForImportStatementCompletion || moduleResolutionRespectsExports(getEmitModuleResolutionKind(program.getCompilerOptions())); + const needsFullResolution = isForImportStatementCompletion || moduleResolutionSupportsPackageJsonExportsAndImports(getEmitModuleResolutionKind(program.getCompilerOptions())); let skippedAny = false; let ambientCount = 0; let resolvedCount = 0; diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index 8a07910bb3ebf..a9ff0027db686 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -674,7 +674,7 @@ namespace ts.Completions.StringCompletions { getCompletionEntriesForDirectoryFragment(fragment, nodeModules, extensionOptions, host, /*moduleSpecifierIsRelative*/ false, /*exclude*/ undefined, result); } }; - if (fragmentDirectory && moduleResolutionRespectsExports(moduleResolution)) { + if (fragmentDirectory && getResolvePackageJsonExports(compilerOptions)) { const nodeModulesDirectoryLookup = ancestorLookup; ancestorLookup = ancestor => { const components = getPathComponents(fragment); diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 9943d04307fb5..a71764120e724 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1943,10 +1943,6 @@ namespace ts { }; } - export function moduleResolutionRespectsExports(moduleResolution: ModuleResolutionKind): boolean { - return moduleResolution >= ModuleResolutionKind.Node16 && moduleResolution <= ModuleResolutionKind.NodeNext; - } - export function moduleResolutionUsesNodeModules(moduleResolution: ModuleResolutionKind): boolean { return moduleResolution === ModuleResolutionKind.NodeJs || moduleResolution >= ModuleResolutionKind.Node16 && moduleResolution <= ModuleResolutionKind.NodeNext; } From 9bc0f07fd2585253d04531ed81f5b1d0991cce08 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 24 Oct 2022 15:06:02 -0700 Subject: [PATCH 03/23] Add first tests --- src/compiler/moduleNameResolver.ts | 32 +++++--- src/compiler/utilities.ts | 11 +-- .../reference/hybridRelative1.errors.txt | 41 ++++++++++ tests/baselines/reference/hybridRelative1.js | 47 +++++++++++ .../reference/hybridRelative1.symbols | 47 +++++++++++ .../reference/hybridRelative1.trace.json | 80 +++++++++++++++++++ .../baselines/reference/hybridRelative1.types | 49 ++++++++++++ .../hybrid/hybridRelative1.ts | 33 ++++++++ 8 files changed, 322 insertions(+), 18 deletions(-) create mode 100644 tests/baselines/reference/hybridRelative1.errors.txt create mode 100644 tests/baselines/reference/hybridRelative1.js create mode 100644 tests/baselines/reference/hybridRelative1.symbols create mode 100644 tests/baselines/reference/hybridRelative1.trace.json create mode 100644 tests/baselines/reference/hybridRelative1.types create mode 100644 tests/cases/conformance/moduleResolution/hybrid/hybridRelative1.ts diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index d0089b5500f07..ac8f7c240873c 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -376,7 +376,7 @@ namespace ts { if (resolutionMode === ModuleKind.ESNext && (getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node16 || getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeNext)) { features |= NodeResolutionFeatures.EsmMode; } - const conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : []; + const conditions = features & NodeResolutionFeatures.Exports ? getConditions(options, !!(features & NodeResolutionFeatures.EsmMode)) : []; const diagnostics: Diagnostic[] = []; const moduleResolutionState: ModuleResolutionState = { compilerOptions: options, @@ -508,10 +508,12 @@ namespace ts { return features; } - function getConditions(options: CompilerOptions, esmMode: boolean | undefined) { + function getConditions(options: CompilerOptions, esmMode?: boolean) { // conditions are only used by the node16/nodenext/hybrid resolvers - there's no priority order in the list, // it's essentially a set (priority is determined by object insertion order in the object we look at). - const conditions = esmMode ? ["node", "import"] : ["node", "require"]; + const conditions = esmMode || getEmitModuleResolutionKind(options) === ModuleResolutionKind.Hybrid + ? ["node", "import"] + : ["node", "require"]; if (!options.noDtsResolution) { conditions.push("types"); } @@ -1546,7 +1548,7 @@ namespace ts { } } // esm mode relative imports shouldn't do any directory lookups (either inside `package.json` - // files or implicit `index.js`es). This is a notable depature from cjs norms, where `./foo/pkg` + // files or implicit `index.js`es). This is a notable departure from cjs norms, where `./foo/pkg` // could have been redirected by `./foo/pkg/package.json` to an arbitrary location! if (!(state.features & NodeResolutionFeatures.EsmMode)) { return loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson); @@ -1774,25 +1776,29 @@ namespace ts { let entrypoints: string[] | undefined; const extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript; const features = getNodeResolutionFeatures(options); - const requireState = getTemporaryModuleResolutionState(cache?.getPackageJsonInfoCache(), host, options); - requireState.conditions = ["node", "require", "types"]; - requireState.requestContainingDirectory = packageJsonInfo.packageDirectory; - const requireResolution = loadNodeModuleFromDirectoryWorker( + const loadPackageJsonMainState = getTemporaryModuleResolutionState(cache?.getPackageJsonInfoCache(), host, options); + loadPackageJsonMainState.conditions = getConditions(options); + loadPackageJsonMainState.requestContainingDirectory = packageJsonInfo.packageDirectory; + const mainResolution = loadNodeModuleFromDirectoryWorker( extensions, packageJsonInfo.packageDirectory, /*onlyRecordFailures*/ false, - requireState, + loadPackageJsonMainState, packageJsonInfo.contents.packageJsonContent, packageJsonInfo.contents.versionPaths); - entrypoints = append(entrypoints, requireResolution?.path); + entrypoints = append(entrypoints, mainResolution?.path); if (features & NodeResolutionFeatures.Exports && packageJsonInfo.contents.packageJsonContent.exports) { - for (const conditions of [["node", "import", "types"], ["node", "require", "types"]]) { - const exportState = { ...requireState, failedLookupLocations: [], conditions }; + const conditionSets = deduplicate( + [getConditions(options, /*esmMode*/ true), getConditions(options, /*esmMode*/ false)], + arrayIsEqualTo + ); + for (const conditions of conditionSets) { + const loadPackageJsonExportsState = { ...loadPackageJsonMainState, failedLookupLocations: [], conditions }; const exportResolutions = loadEntrypointsFromExportMap( packageJsonInfo, packageJsonInfo.contents.packageJsonContent.exports, - exportState, + loadPackageJsonExportsState, extensions); if (exportResolutions) { for (const resolution of exportResolutions) { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 82ba813f0b92c..592b9790a2306 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -6441,11 +6441,12 @@ namespace ts { } export function getAllowSyntheticDefaultImports(compilerOptions: CompilerOptions) { - const moduleKind = getEmitModuleKind(compilerOptions); - return compilerOptions.allowSyntheticDefaultImports !== undefined - ? compilerOptions.allowSyntheticDefaultImports - : getESModuleInterop(compilerOptions) || - moduleKind === ModuleKind.System; + if (compilerOptions.allowSyntheticDefaultImports !== undefined) { + return compilerOptions.allowSyntheticDefaultImports; + } + return getESModuleInterop(compilerOptions) + || getEmitModuleKind(compilerOptions) === ModuleKind.System + || getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Hybrid; } export function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution: ModuleResolutionKind): boolean { diff --git a/tests/baselines/reference/hybridRelative1.errors.txt b/tests/baselines/reference/hybridRelative1.errors.txt new file mode 100644 index 0000000000000..2381787fbc254 --- /dev/null +++ b/tests/baselines/reference/hybridRelative1.errors.txt @@ -0,0 +1,41 @@ +error TS5070: Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy. +/main.ts(4,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. +/main.ts(7,16): error TS2307: Cannot find module './redirect/index' or its corresponding type declarations. + + +!!! error TS5070: Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy. +==== /dir/index.ts (0 errors) ==== + export const x = 0; + +==== /redirect/package.json (0 errors) ==== + { "main": "../foo" } + +==== /foo/index.ts (0 errors) ==== + export const y = 0; + +==== /types/esm.d.ts (0 errors) ==== + declare const _: string; + export default _; + +==== /types/cjs.d.ts (0 errors) ==== + declare const _: string; + export = _; + +==== /main.ts (2 errors) ==== + import { x } from "./dir"; + import {} from "./dir/index"; + import {} from "./dir/index.js"; + import {} from "./dir/index.ts"; + ~~~~~~~~~~~~~~~~ +!!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. + + import { y } from "./redirect"; + import {} from "./redirect/index"; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './redirect/index' or its corresponding type declarations. + + import a from "./types/esm"; + import * as esm from "./types/esm"; + import b from "./types/cjs"; + import * as cjs from "./types/cjs"; + \ No newline at end of file diff --git a/tests/baselines/reference/hybridRelative1.js b/tests/baselines/reference/hybridRelative1.js new file mode 100644 index 0000000000000..3c009b0588bcd --- /dev/null +++ b/tests/baselines/reference/hybridRelative1.js @@ -0,0 +1,47 @@ +//// [tests/cases/conformance/moduleResolution/hybrid/hybridRelative1.ts] //// + +//// [index.ts] +export const x = 0; + +//// [package.json] +{ "main": "../foo" } + +//// [index.ts] +export const y = 0; + +//// [esm.d.ts] +declare const _: string; +export default _; + +//// [cjs.d.ts] +declare const _: string; +export = _; + +//// [main.ts] +import { x } from "./dir"; +import {} from "./dir/index"; +import {} from "./dir/index.js"; +import {} from "./dir/index.ts"; + +import { y } from "./redirect"; +import {} from "./redirect/index"; + +import a from "./types/esm"; +import * as esm from "./types/esm"; +import b from "./types/cjs"; +import * as cjs from "./types/cjs"; + + +//// [index.js] +"use strict"; +exports.__esModule = true; +exports.x = void 0; +exports.x = 0; +//// [index.js] +"use strict"; +exports.__esModule = true; +exports.y = void 0; +exports.y = 0; +//// [main.js] +"use strict"; +exports.__esModule = true; diff --git a/tests/baselines/reference/hybridRelative1.symbols b/tests/baselines/reference/hybridRelative1.symbols new file mode 100644 index 0000000000000..4bbdf732a77c6 --- /dev/null +++ b/tests/baselines/reference/hybridRelative1.symbols @@ -0,0 +1,47 @@ +=== /dir/index.ts === +export const x = 0; +>x : Symbol(x, Decl(index.ts, 0, 12)) + +=== /foo/index.ts === +export const y = 0; +>y : Symbol(y, Decl(index.ts, 0, 12)) + +=== /types/esm.d.ts === +declare const _: string; +>_ : Symbol(_, Decl(esm.d.ts, 0, 13)) + +export default _; +>_ : Symbol(_, Decl(esm.d.ts, 0, 13)) + +=== /types/cjs.d.ts === +declare const _: string; +>_ : Symbol(_, Decl(cjs.d.ts, 0, 13)) + +export = _; +>_ : Symbol(_, Decl(cjs.d.ts, 0, 13)) + +=== /main.ts === +import { x } from "./dir"; +>x : Symbol(x, Decl(main.ts, 0, 8)) + +import {} from "./dir/index"; +import {} from "./dir/index.js"; +import {} from "./dir/index.ts"; + +import { y } from "./redirect"; +>y : Symbol(y, Decl(main.ts, 5, 8)) + +import {} from "./redirect/index"; + +import a from "./types/esm"; +>a : Symbol(a, Decl(main.ts, 8, 6)) + +import * as esm from "./types/esm"; +>esm : Symbol(esm, Decl(main.ts, 9, 6)) + +import b from "./types/cjs"; +>b : Symbol(b, Decl(main.ts, 10, 6)) + +import * as cjs from "./types/cjs"; +>cjs : Symbol(cjs, Decl(main.ts, 11, 6)) + diff --git a/tests/baselines/reference/hybridRelative1.trace.json b/tests/baselines/reference/hybridRelative1.trace.json new file mode 100644 index 0000000000000..75cb1a973184e --- /dev/null +++ b/tests/baselines/reference/hybridRelative1.trace.json @@ -0,0 +1,80 @@ +[ + "======== Resolving module './dir' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/dir', target file type 'TypeScript'.", + "File '/dir.ts' does not exist.", + "File '/dir.tsx' does not exist.", + "File '/dir.d.ts' does not exist.", + "File '/dir/package.json' does not exist.", + "File '/dir/index.ts' exist - use it as a name resolution result.", + "======== Module name './dir' was successfully resolved to '/dir/index.ts'. ========", + "======== Resolving module './dir/index' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/dir/index', target file type 'TypeScript'.", + "File '/dir/index.ts' exist - use it as a name resolution result.", + "======== Module name './dir/index' was successfully resolved to '/dir/index.ts'. ========", + "======== Resolving module './dir/index.js' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/dir/index.js', target file type 'TypeScript'.", + "File '/dir/index.js.ts' does not exist.", + "File '/dir/index.js.tsx' does not exist.", + "File '/dir/index.js.d.ts' does not exist.", + "File name '/dir/index.js' has a '.js' extension - stripping it.", + "File '/dir/index.ts' exist - use it as a name resolution result.", + "======== Module name './dir/index.js' was successfully resolved to '/dir/index.ts'. ========", + "======== Resolving module './dir/index.ts' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/dir/index.ts', target file type 'TypeScript'.", + "File '/dir/index.ts.ts' does not exist.", + "File '/dir/index.ts.tsx' does not exist.", + "File '/dir/index.ts.d.ts' does not exist.", + "File name '/dir/index.ts' has a '.ts' extension - stripping it.", + "File '/dir/index.ts' exist - use it as a name resolution result.", + "======== Module name './dir/index.ts' was successfully resolved to '/dir/index.ts'. ========", + "======== Resolving module './redirect' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/redirect', target file type 'TypeScript'.", + "File '/redirect.ts' does not exist.", + "File '/redirect.tsx' does not exist.", + "File '/redirect.d.ts' does not exist.", + "Found 'package.json' at '/redirect/package.json'.", + "'package.json' does not have a 'typesVersions' field.", + "'package.json' does not have a 'typings' field.", + "'package.json' does not have a 'types' field.", + "'package.json' has 'main' field '../foo' that references '/foo'.", + "File '/foo' does not exist.", + "Loading module as file / folder, candidate module location '/foo', target file type 'TypeScript'.", + "File '/foo.ts' does not exist.", + "File '/foo.tsx' does not exist.", + "File '/foo.d.ts' does not exist.", + "File '/foo/index.ts' exist - use it as a name resolution result.", + "======== Module name './redirect' was successfully resolved to '/foo/index.ts'. ========", + "======== Resolving module './redirect/index' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/redirect/index', target file type 'TypeScript'.", + "File '/redirect/index.ts' does not exist.", + "File '/redirect/index.tsx' does not exist.", + "File '/redirect/index.d.ts' does not exist.", + "Directory '/redirect/index' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/redirect/index', target file type 'JavaScript'.", + "File '/redirect/index.js' does not exist.", + "File '/redirect/index.jsx' does not exist.", + "Directory '/redirect/index' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/redirect/index', target file type 'Json'.", + "Directory '/redirect/index' does not exist, skipping all lookups in it.", + "======== Module name './redirect/index' was not resolved. ========", + "======== Resolving module './types/esm' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/types/esm', target file type 'TypeScript'.", + "File '/types/esm.ts' does not exist.", + "File '/types/esm.tsx' does not exist.", + "File '/types/esm.d.ts' exist - use it as a name resolution result.", + "======== Module name './types/esm' was successfully resolved to '/types/esm.d.ts'. ========", + "======== Resolving module './types/cjs' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/types/cjs', target file type 'TypeScript'.", + "File '/types/cjs.ts' does not exist.", + "File '/types/cjs.tsx' does not exist.", + "File '/types/cjs.d.ts' exist - use it as a name resolution result.", + "======== Module name './types/cjs' was successfully resolved to '/types/cjs.d.ts'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/hybridRelative1.types b/tests/baselines/reference/hybridRelative1.types new file mode 100644 index 0000000000000..7e1e3e5e865c7 --- /dev/null +++ b/tests/baselines/reference/hybridRelative1.types @@ -0,0 +1,49 @@ +=== /dir/index.ts === +export const x = 0; +>x : 0 +>0 : 0 + +=== /foo/index.ts === +export const y = 0; +>y : 0 +>0 : 0 + +=== /types/esm.d.ts === +declare const _: string; +>_ : string + +export default _; +>_ : string + +=== /types/cjs.d.ts === +declare const _: string; +>_ : string + +export = _; +>_ : string + +=== /main.ts === +import { x } from "./dir"; +>x : 0 + +import {} from "./dir/index"; +import {} from "./dir/index.js"; +import {} from "./dir/index.ts"; + +import { y } from "./redirect"; +>y : 0 + +import {} from "./redirect/index"; + +import a from "./types/esm"; +>a : string + +import * as esm from "./types/esm"; +>esm : typeof esm + +import b from "./types/cjs"; +>b : string + +import * as cjs from "./types/cjs"; +>cjs : string + diff --git a/tests/cases/conformance/moduleResolution/hybrid/hybridRelative1.ts b/tests/cases/conformance/moduleResolution/hybrid/hybridRelative1.ts new file mode 100644 index 0000000000000..b560bf5462709 --- /dev/null +++ b/tests/cases/conformance/moduleResolution/hybrid/hybridRelative1.ts @@ -0,0 +1,33 @@ +// @moduleResolution: hybrid +// @traceResolution: true + +// @Filename: /dir/index.ts +export const x = 0; + +// @Filename: /redirect/package.json +{ "main": "../foo" } + +// @Filename: /foo/index.ts +export const y = 0; + +// @Filename: /types/esm.d.ts +declare const _: string; +export default _; + +// @Filename: /types/cjs.d.ts +declare const _: string; +export = _; + +// @Filename: /main.ts +import { x } from "./dir"; +import {} from "./dir/index"; +import {} from "./dir/index.js"; +import {} from "./dir/index.ts"; + +import { y } from "./redirect"; +import {} from "./redirect/index"; + +import a from "./types/esm"; +import * as esm from "./types/esm"; +import b from "./types/cjs"; +import * as cjs from "./types/cjs"; From 4545afbe8f932b29e33cf0eb4bb714335b410e96 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 24 Oct 2022 16:17:20 -0700 Subject: [PATCH 04/23] CJS constructs are not allowed --- src/compiler/checker.ts | 6 +++ src/compiler/diagnosticMessages.json | 8 ++++ src/compiler/program.ts | 3 +- .../hybridSyntaxRestrictions.errors.txt | 24 ++++++++++++ .../reference/hybridSyntaxRestrictions.js | 25 ++++++++++++ .../hybridSyntaxRestrictions.symbols | 17 +++++++++ .../reference/hybridSyntaxRestrictions.types | 19 ++++++++++ .../hybrid/hybridNodeModules1.ts | 38 +++++++++++++++++++ .../hybrid/hybridSyntaxRestrictions.ts | 20 ++++++++++ 9 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/hybridSyntaxRestrictions.errors.txt create mode 100644 tests/baselines/reference/hybridSyntaxRestrictions.js create mode 100644 tests/baselines/reference/hybridSyntaxRestrictions.symbols create mode 100644 tests/baselines/reference/hybridSyntaxRestrictions.types create mode 100644 tests/cases/conformance/moduleResolution/hybrid/hybridNodeModules1.ts create mode 100644 tests/cases/conformance/moduleResolution/hybrid/hybridSyntaxRestrictions.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index cee39c59e572e..5733785412542 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -41733,6 +41733,9 @@ namespace ts { // Import equals declaration is deprecated in es6 or above grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } + else if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Hybrid) { + grammarErrorOnNode(node, Diagnostics.Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_hybrid_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); + } } } } @@ -41955,6 +41958,9 @@ namespace ts { // system modules does not support export assignment grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); } + else if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Hybrid) { + grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_hybrid_Consider_using_export_default_or_another_module_format_instead); + } } } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 4e66f092b3699..082433b1b094b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4237,6 +4237,14 @@ "category": "Error", "code": 5098 }, + "Import assignment is not allowed when 'moduleResolution' is set to 'hybrid'. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead.": { + "category": "Error", + "code": 5099 + }, + "Export assignment cannot be used when 'moduleResolution' is set to 'hybrid'. Consider using 'export default' or another module format instead.": { + "category": "Error", + "code": 5100 + }, "Generates a sourcemap for each corresponding '.d.ts' file.": { "category": "Message", diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 43dfbe80695ce..e25dcc2708ee2 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -3605,7 +3605,8 @@ namespace ts { if (getResolveJsonModule(options)) { if (getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeJs && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Node16 && - getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeNext) { + getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeNext && + getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Hybrid) { createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule"); } // Any emit other than common js, amd, es2015 or esnext is error diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.errors.txt b/tests/baselines/reference/hybridSyntaxRestrictions.errors.txt new file mode 100644 index 0000000000000..0a3970e0fc647 --- /dev/null +++ b/tests/baselines/reference/hybridSyntaxRestrictions.errors.txt @@ -0,0 +1,24 @@ +/main.ts(2,1): error TS5099: Import assignment is not allowed when 'moduleResolution' is set to 'hybrid'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. +/main.ts(3,1): error TS5100: Export assignment cannot be used when 'moduleResolution' is set to 'hybrid'. Consider using 'export default' or another module format instead. + + +==== /main.ts (2 errors) ==== + import {} from "./a"; + import _ = require("./a"); // Error + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS5099: Import assignment is not allowed when 'moduleResolution' is set to 'hybrid'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. + export = {}; // Error + ~~~~~~~~~~~~ +!!! error TS5100: Export assignment cannot be used when 'moduleResolution' is set to 'hybrid'. Consider using 'export default' or another module format instead. + export {}; + +==== /node_modules/@types/node/index.d.ts (0 errors) ==== + declare var require: (...args: any[]) => any; + +==== /a.ts (0 errors) ==== + export {}; + +==== /mainJs.js (0 errors) ==== + import {} from "./a"; + const _ = require("./a"); // No resolution + \ No newline at end of file diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.js b/tests/baselines/reference/hybridSyntaxRestrictions.js new file mode 100644 index 0000000000000..7776065ee35f2 --- /dev/null +++ b/tests/baselines/reference/hybridSyntaxRestrictions.js @@ -0,0 +1,25 @@ +//// [tests/cases/conformance/moduleResolution/hybrid/hybridSyntaxRestrictions.ts] //// + +//// [index.d.ts] +declare var require: (...args: any[]) => any; + +//// [a.ts] +export {}; + +//// [mainJs.js] +import {} from "./a"; +const _ = require("./a"); // No resolution + +//// [main.ts] +import {} from "./a"; +import _ = require("./a"); // Error +export = {}; // Error +export {}; + + +//// [a.js] +"use strict"; +exports.__esModule = true; +//// [main.js] +"use strict"; +module.exports = {}; diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.symbols b/tests/baselines/reference/hybridSyntaxRestrictions.symbols new file mode 100644 index 0000000000000..d92eb6ffe04b4 --- /dev/null +++ b/tests/baselines/reference/hybridSyntaxRestrictions.symbols @@ -0,0 +1,17 @@ +=== /main.ts === +import {} from "./a"; +import _ = require("./a"); // Error +>_ : Symbol(_, Decl(main.ts, 0, 21)) + +export = {}; // Error +export {}; + +=== /node_modules/@types/node/index.d.ts === +declare var require: (...args: any[]) => any; +>require : Symbol(require, Decl(index.d.ts, 0, 11)) +>args : Symbol(args, Decl(index.d.ts, 0, 22)) + +=== /a.ts === +export {}; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.types b/tests/baselines/reference/hybridSyntaxRestrictions.types new file mode 100644 index 0000000000000..16066a8493dcc --- /dev/null +++ b/tests/baselines/reference/hybridSyntaxRestrictions.types @@ -0,0 +1,19 @@ +=== /main.ts === +import {} from "./a"; +import _ = require("./a"); // Error +>_ : typeof _ + +export = {}; // Error +>{} : {} + +export {}; + +=== /node_modules/@types/node/index.d.ts === +declare var require: (...args: any[]) => any; +>require : (...args: any[]) => any +>args : any[] + +=== /a.ts === +export {}; +No type information for this code. +No type information for this code. \ No newline at end of file diff --git a/tests/cases/conformance/moduleResolution/hybrid/hybridNodeModules1.ts b/tests/cases/conformance/moduleResolution/hybrid/hybridNodeModules1.ts new file mode 100644 index 0000000000000..c1f35a255db6c --- /dev/null +++ b/tests/cases/conformance/moduleResolution/hybrid/hybridNodeModules1.ts @@ -0,0 +1,38 @@ +// @moduleResolution: hybrid +// @traceResolution: true + +// @Filename: /node_modules/dual/package.json +{ + "name": "dual", + "version": "1.0.0", + "type": "module", + "main": "index.cjs", + "types": "index.d.cts", + "exports": { + ".": { + "import": "./index.js", + "require": "./index.cjs" + } + } +} + +// @Filename: /node_modules/dual/index.js +export const esm = 0; + +// @Filename: /node_modules/dual/index.d.ts +export const esm: number; + +// @Filename: /node_modules/dual/index.cjs +exports.cjs = 0; + +// @Filename: /node_modules/dual/index.d.cts +export const cjs: number; + +// @Filename: /main.ts +import { esm, cjs } from "dual"; + +// @Filename: /main.mts +import { esm, cjs } from "dual"; + +// @Filename: /main.cts +import { esm, cjs } from "dual"; diff --git a/tests/cases/conformance/moduleResolution/hybrid/hybridSyntaxRestrictions.ts b/tests/cases/conformance/moduleResolution/hybrid/hybridSyntaxRestrictions.ts new file mode 100644 index 0000000000000..123c0c6348402 --- /dev/null +++ b/tests/cases/conformance/moduleResolution/hybrid/hybridSyntaxRestrictions.ts @@ -0,0 +1,20 @@ +// @moduleResolution: hybrid +// @checkJs: true +// @allowJs: true +// @outDir: out + +// @Filename: /node_modules/@types/node/index.d.ts +declare var require: (...args: any[]) => any; + +// @Filename: /a.ts +export {}; + +// @Filename: /mainJs.js +import {} from "./a"; +const _ = require("./a"); // No resolution + +// @Filename: /main.ts +import {} from "./a"; +import _ = require("./a"); // Error +export = {}; // Error +export {}; From e82e61da9440cbf85ea9b39c1f26f323df18a005 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 24 Oct 2022 16:43:58 -0700 Subject: [PATCH 05/23] Add another test --- tests/baselines/reference/hybridImportESM.js | 26 +++++++++++++++++++ .../reference/hybridImportESM.symbols | 12 +++++++++ .../baselines/reference/hybridImportESM.types | 13 ++++++++++ .../hybrid/hybridImportESM.ts | 13 ++++++++++ 4 files changed, 64 insertions(+) create mode 100644 tests/baselines/reference/hybridImportESM.js create mode 100644 tests/baselines/reference/hybridImportESM.symbols create mode 100644 tests/baselines/reference/hybridImportESM.types create mode 100644 tests/cases/conformance/moduleResolution/hybrid/hybridImportESM.ts diff --git a/tests/baselines/reference/hybridImportESM.js b/tests/baselines/reference/hybridImportESM.js new file mode 100644 index 0000000000000..266e72301eaa5 --- /dev/null +++ b/tests/baselines/reference/hybridImportESM.js @@ -0,0 +1,26 @@ +//// [tests/cases/conformance/moduleResolution/hybrid/hybridImportESM.ts] //// + +//// [esm.mts] +export const esm = 0; + +//// [not-actually-cjs.cts] +import { esm } from "./esm.mjs"; + +//// [package.json] +{ "type": "commonjs" } + +//// [still-not-cjs.ts] +import { esm } from "./esm.mjs"; + + +//// [esm.mjs] +"use strict"; +exports.__esModule = true; +exports.esm = void 0; +exports.esm = 0; +//// [not-actually-cjs.cjs] +"use strict"; +exports.__esModule = true; +//// [still-not-cjs.js] +"use strict"; +exports.__esModule = true; diff --git a/tests/baselines/reference/hybridImportESM.symbols b/tests/baselines/reference/hybridImportESM.symbols new file mode 100644 index 0000000000000..de03eed56fdc2 --- /dev/null +++ b/tests/baselines/reference/hybridImportESM.symbols @@ -0,0 +1,12 @@ +=== /esm.mts === +export const esm = 0; +>esm : Symbol(esm, Decl(esm.mts, 0, 12)) + +=== /not-actually-cjs.cts === +import { esm } from "./esm.mjs"; +>esm : Symbol(esm, Decl(not-actually-cjs.cts, 0, 8)) + +=== /still-not-cjs.ts === +import { esm } from "./esm.mjs"; +>esm : Symbol(esm, Decl(still-not-cjs.ts, 0, 8)) + diff --git a/tests/baselines/reference/hybridImportESM.types b/tests/baselines/reference/hybridImportESM.types new file mode 100644 index 0000000000000..3ffcb432c7bff --- /dev/null +++ b/tests/baselines/reference/hybridImportESM.types @@ -0,0 +1,13 @@ +=== /esm.mts === +export const esm = 0; +>esm : 0 +>0 : 0 + +=== /not-actually-cjs.cts === +import { esm } from "./esm.mjs"; +>esm : 0 + +=== /still-not-cjs.ts === +import { esm } from "./esm.mjs"; +>esm : 0 + diff --git a/tests/cases/conformance/moduleResolution/hybrid/hybridImportESM.ts b/tests/cases/conformance/moduleResolution/hybrid/hybridImportESM.ts new file mode 100644 index 0000000000000..fcd14153c4c16 --- /dev/null +++ b/tests/cases/conformance/moduleResolution/hybrid/hybridImportESM.ts @@ -0,0 +1,13 @@ +// @moduleResolution: hybrid + +// @Filename: /esm.mts +export const esm = 0; + +// @Filename: /not-actually-cjs.cts +import { esm } from "./esm.mjs"; + +// @Filename: /package.json +{ "type": "commonjs" } + +// @Filename: /still-not-cjs.ts +import { esm } from "./esm.mjs"; From 038783d679f80a4606bdb23ec70d2daa1a5897f9 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 25 Oct 2022 16:12:13 -0700 Subject: [PATCH 06/23] Fix extension adding/replacing priority --- src/compiler/moduleNameResolver.ts | 10 +- .../reference/api/tsserverlibrary.d.ts | 9 +- tests/baselines/reference/api/typescript.d.ts | 9 +- ...rse empty options of --moduleResolution.js | 2 +- .../tsconfig.json | 4 + .../tsconfig.json | 4 + .../tsconfig.json | 4 + .../tsconfig.json | 4 + .../tsconfig.json | 4 + .../tsconfig.json | 4 + .../tsconfig.json | 4 + .../tsconfig.json | 4 + .../tsconfig.json | 4 + .../tsconfig.json | 4 + .../tsconfig.json | 4 + .../allowImportingTsExtensions/tsconfig.json | 5 + .../customConditions/tsconfig.json | 5 + .../resolvePackageJsonExports/tsconfig.json | 5 + .../resolvePackageJsonImports/tsconfig.json | 5 + ...Priority(moduleresolution=classic).symbols | 12 + ...ngPriority(moduleresolution=classic).types | 12 + ...gPriority(moduleresolution=hybrid).symbols | 12 + ...ingPriority(moduleresolution=hybrid).types | 12 + ...ingPriority(moduleresolution=node).symbols | 12 + ...adingPriority(moduleresolution=node).types | 12 + ...gPriority(moduleresolution=node16).symbols | 12 + ...ingPriority(moduleresolution=node16).types | 12 + ...riority(moduleresolution=nodenext).symbols | 12 + ...gPriority(moduleresolution=nodenext).types | 12 + ...sextensions=false,noemit=false).errors.txt | 84 +++ ...portingtsextensions=false,noemit=false).js | 66 ++ ...ngtsextensions=false,noemit=false).symbols | 58 ++ ...sextensions=false,noemit=false).trace.json | 101 +++ ...tingtsextensions=false,noemit=false).types | 58 ++ ...tsextensions=false,noemit=true).errors.txt | 80 ++ ...ingtsextensions=false,noemit=true).symbols | 58 ++ ...tsextensions=false,noemit=true).trace.json | 101 +++ ...rtingtsextensions=false,noemit=true).types | 58 ++ ...tsextensions=true,noemit=false).errors.txt | 71 ++ ...mportingtsextensions=true,noemit=false).js | 66 ++ ...ingtsextensions=true,noemit=false).symbols | 58 ++ ...tsextensions=true,noemit=false).trace.json | 101 +++ ...rtingtsextensions=true,noemit=false).types | 58 ++ ...gtsextensions=true,noemit=true).errors.txt | 65 ++ ...tingtsextensions=true,noemit=true).symbols | 58 ++ ...gtsextensions=true,noemit=true).trace.json | 101 +++ ...ortingtsextensions=true,noemit=true).types | 58 ++ .../reference/hybridNodeModules1.errors.txt | 59 ++ .../baselines/reference/hybridNodeModules1.js | 48 ++ .../reference/hybridNodeModules1.symbols | 23 + .../reference/hybridNodeModules1.trace.json | 22 + .../reference/hybridNodeModules1.types | 23 + .../reference/hybridRelative1.errors.txt | 2 - .../reference/hybridRelative1.trace.json | 6 - .../hybridSyntaxRestrictions.symbols | 4 +- .../reference/hybridSyntaxRestrictions.types | 4 +- .../moduleResolutionWithExtensions.trace.json | 6 - ...utionWithExtensions_unexpected2.trace.json | 6 +- ...olutionWithExtensions_withPaths.trace.json | 6 - ...es_one_externalModule_withPaths.trace.json | 3 - ...lutionWithSuffixes_one_jsModule.trace.json | 8 +- ...tionWithSuffixes_one_jsonModule.trace.json | 6 +- ...ageRoot_mainFieldInSubDirectory.trace.json | 3 - .../reference/packageJsonMain.trace.json | 6 +- ...eResolution_withExtensionInName.trace.json | 6 +- ...ithExtension_MapedToNodeModules.trace.json | 14 +- .../requireOfJsonFile_PathMapping.trace.json | 10 +- ...project-correctly-with-preserveSymlinks.js | 3 - ...-file-from-referenced-project-correctly.js | 3 - ...for-changes-to-package-json-main-fields.js | 18 - ...t-correctly-with-cts-and-mts-extensions.js | 15 - ...age-with-indirect-link-moduleCaseChange.js | 3 - ...er-symlinked-package-with-indirect-link.js | 3 - ...en-package-json-with-type-module-exists.js | 20 +- .../package-json-file-is-edited.js | 30 +- ...for-changes-to-package-json-main-fields.js | 15 - ...en-package-json-with-type-module-exists.js | 592 +++++++-------- .../package-json-file-is-edited.js | 710 ++++++++---------- .../extensionLoadingPriority.ts | 13 + .../hybrid/hybridImportTsExtensions.ts | 60 ++ 80 files changed, 2364 insertions(+), 900 deletions(-) create mode 100644 tests/baselines/reference/config/showConfig/Shows tsconfig for single option/allowImportingTsExtensions/tsconfig.json create mode 100644 tests/baselines/reference/config/showConfig/Shows tsconfig for single option/customConditions/tsconfig.json create mode 100644 tests/baselines/reference/config/showConfig/Shows tsconfig for single option/resolvePackageJsonExports/tsconfig.json create mode 100644 tests/baselines/reference/config/showConfig/Shows tsconfig for single option/resolvePackageJsonImports/tsconfig.json create mode 100644 tests/baselines/reference/extensionLoadingPriority(moduleresolution=classic).symbols create mode 100644 tests/baselines/reference/extensionLoadingPriority(moduleresolution=classic).types create mode 100644 tests/baselines/reference/extensionLoadingPriority(moduleresolution=hybrid).symbols create mode 100644 tests/baselines/reference/extensionLoadingPriority(moduleresolution=hybrid).types create mode 100644 tests/baselines/reference/extensionLoadingPriority(moduleresolution=node).symbols create mode 100644 tests/baselines/reference/extensionLoadingPriority(moduleresolution=node).types create mode 100644 tests/baselines/reference/extensionLoadingPriority(moduleresolution=node16).symbols create mode 100644 tests/baselines/reference/extensionLoadingPriority(moduleresolution=node16).types create mode 100644 tests/baselines/reference/extensionLoadingPriority(moduleresolution=nodenext).symbols create mode 100644 tests/baselines/reference/extensionLoadingPriority(moduleresolution=nodenext).types create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).types create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).types create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).types create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json create mode 100644 tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).types create mode 100644 tests/baselines/reference/hybridNodeModules1.errors.txt create mode 100644 tests/baselines/reference/hybridNodeModules1.js create mode 100644 tests/baselines/reference/hybridNodeModules1.symbols create mode 100644 tests/baselines/reference/hybridNodeModules1.trace.json create mode 100644 tests/baselines/reference/hybridNodeModules1.types create mode 100644 tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts create mode 100644 tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index ac8f7c240873c..727ad7509dce2 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1609,7 +1609,13 @@ namespace ts { return (extensionLess === undefined && extensions === Extensions.Json) ? undefined : tryAddingExtensions(extensionLess || candidate, extensions, extension, onlyRecordFailures, state); } - // esm mode resolutions don't include automatic extension lookup (without additional flags, at least) + // ./foo.js -> ./foo.ts + const resolvedByReplacingExtension = loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state); + if (resolvedByReplacingExtension) { + return resolvedByReplacingExtension; + } + + // ./foo -> ./foo.ts if (!(state.features & NodeResolutionFeatures.EsmMode)) { // First, try adding an extension. An import of "foo" could be matched by a file "foo.ts", or "foo.js" by "foo.js.ts" const resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, "", onlyRecordFailures, state); @@ -1617,8 +1623,6 @@ namespace ts { return resolvedByAddingExtension; } } - - return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state); } function loadModuleFromFileNoImplicitExtensions(extensions: Extensions, candidate: string, onlyRecordFailures: boolean, state: ModuleResolutionState): PathAndExtension | undefined { diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 5e9cde7f7bd51..a4506bc8200ce 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2944,7 +2944,8 @@ declare namespace ts { Classic = 1, NodeJs = 2, Node16 = 3, - NodeNext = 99 + NodeNext = 99, + Hybrid = 100 } export enum ModuleDetectionKind { /** @@ -3005,6 +3006,7 @@ declare namespace ts { baseUrl?: string; charset?: string; checkJs?: boolean; + customConditions?: string[]; declaration?: boolean; declarationMap?: boolean; emitDeclarationOnly?: boolean; @@ -3069,6 +3071,8 @@ declare namespace ts { incremental?: boolean; tsBuildInfoFile?: string; removeComments?: boolean; + resolvePackageJsonExports?: boolean; + resolvePackageJsonImports?: boolean; rootDir?: string; rootDirs?: string[]; skipLibCheck?: boolean; @@ -5064,9 +5068,10 @@ declare namespace ts { export function createTypeReferenceDirectiveResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache): TypeReferenceDirectiveResolutionCache; export function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache, mode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations | undefined; export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations; + export function hybridModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; - export function moduleResolutionSupportsResolvingTsExtensions(_compilerOptions: CompilerOptions): boolean; + export function moduleResolutionSupportsResolvingTsExtensions(compilerOptions: CompilerOptions): boolean; export function shouldAllowImportingTsExtension(compilerOptions: CompilerOptions, fromFileName?: string): boolean | "" | undefined; export {}; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index c96746b914b44..c2aab049d05b1 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2944,7 +2944,8 @@ declare namespace ts { Classic = 1, NodeJs = 2, Node16 = 3, - NodeNext = 99 + NodeNext = 99, + Hybrid = 100 } export enum ModuleDetectionKind { /** @@ -3005,6 +3006,7 @@ declare namespace ts { baseUrl?: string; charset?: string; checkJs?: boolean; + customConditions?: string[]; declaration?: boolean; declarationMap?: boolean; emitDeclarationOnly?: boolean; @@ -3069,6 +3071,8 @@ declare namespace ts { incremental?: boolean; tsBuildInfoFile?: string; removeComments?: boolean; + resolvePackageJsonExports?: boolean; + resolvePackageJsonImports?: boolean; rootDir?: string; rootDirs?: string[]; skipLibCheck?: boolean; @@ -5064,9 +5068,10 @@ declare namespace ts { export function createTypeReferenceDirectiveResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache): TypeReferenceDirectiveResolutionCache; export function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache, mode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations | undefined; export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations; + export function hybridModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; - export function moduleResolutionSupportsResolvingTsExtensions(_compilerOptions: CompilerOptions): boolean; + export function moduleResolutionSupportsResolvingTsExtensions(compilerOptions: CompilerOptions): boolean; export function shouldAllowImportingTsExtension(compilerOptions: CompilerOptions, fromFileName?: string): boolean | "" | undefined; export {}; } diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --moduleResolution.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --moduleResolution.js index fb361238364f5..2bcff8882d32d 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --moduleResolution.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --moduleResolution.js @@ -7,4 +7,4 @@ FileNames:: 0.ts Errors:: error TS6044: Compiler option 'moduleResolution' expects an argument. -error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext'. +error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext', 'hybrid'. diff --git a/tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json index 19844ec8065fc..6c441a8d09dc3 100644 --- a/tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json @@ -35,6 +35,10 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ // "resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --help/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --help/tsconfig.json index 19844ec8065fc..6c441a8d09dc3 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --help/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --help/tsconfig.json @@ -35,6 +35,10 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ // "resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --watch/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --watch/tsconfig.json index 19844ec8065fc..6c441a8d09dc3 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --watch/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --watch/tsconfig.json @@ -35,6 +35,10 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ // "resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with advanced options/tsconfig.json index 6e28e016bd11d..51189f709b334 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -35,6 +35,10 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ // "resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index d73dbd191a220..73cfaeb1e2781 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -35,6 +35,10 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ // "resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index c4c554e65dffb..0ea88943dc980 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -35,6 +35,10 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ // "resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with files options/tsconfig.json index 2368ed9c35291..9977c19ffc059 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with files options/tsconfig.json @@ -35,6 +35,10 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ // "resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index 195f29bcb8708..8564d1f1c2aa8 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -35,6 +35,10 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ // "resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index 19844ec8065fc..6c441a8d09dc3 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -35,6 +35,10 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ // "resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index fe6fd06aa610a..2b4eafb70befb 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -35,6 +35,10 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ // "resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options/tsconfig.json index 12daecbe8ed51..4a2a162913e21 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -35,6 +35,10 @@ "types": ["jquery","mocha"], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ // "resolveJsonModule": true, /* Enable importing .json files. */ // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/allowImportingTsExtensions/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/allowImportingTsExtensions/tsconfig.json new file mode 100644 index 0000000000000..88c95f9eb8307 --- /dev/null +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/allowImportingTsExtensions/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "allowImportingTsExtensions": true + } +} diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/customConditions/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/customConditions/tsconfig.json new file mode 100644 index 0000000000000..e121ee76bc105 --- /dev/null +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/customConditions/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "customConditions": [] + } +} diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/resolvePackageJsonExports/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/resolvePackageJsonExports/tsconfig.json new file mode 100644 index 0000000000000..4dc0efaa783ba --- /dev/null +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/resolvePackageJsonExports/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "resolvePackageJsonExports": true + } +} diff --git a/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/resolvePackageJsonImports/tsconfig.json b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/resolvePackageJsonImports/tsconfig.json new file mode 100644 index 0000000000000..a9e8a0f9e1faa --- /dev/null +++ b/tests/baselines/reference/config/showConfig/Shows tsconfig for single option/resolvePackageJsonImports/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "resolvePackageJsonImports": true + } +} diff --git a/tests/baselines/reference/extensionLoadingPriority(moduleresolution=classic).symbols b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=classic).symbols new file mode 100644 index 0000000000000..1851abea3894c --- /dev/null +++ b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=classic).symbols @@ -0,0 +1,12 @@ +=== /project/a.js === + +export default "a.js"; + +=== /project/a.js.js === + +export default "a.js.js"; + +=== /project/b.ts === +import a from "./a.js"; +>a : Symbol(a, Decl(b.ts, 0, 6)) + diff --git a/tests/baselines/reference/extensionLoadingPriority(moduleresolution=classic).types b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=classic).types new file mode 100644 index 0000000000000..b442294d98f6a --- /dev/null +++ b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=classic).types @@ -0,0 +1,12 @@ +=== /project/a.js === + +export default "a.js"; + +=== /project/a.js.js === + +export default "a.js.js"; + +=== /project/b.ts === +import a from "./a.js"; +>a : "a.js" + diff --git a/tests/baselines/reference/extensionLoadingPriority(moduleresolution=hybrid).symbols b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=hybrid).symbols new file mode 100644 index 0000000000000..1851abea3894c --- /dev/null +++ b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=hybrid).symbols @@ -0,0 +1,12 @@ +=== /project/a.js === + +export default "a.js"; + +=== /project/a.js.js === + +export default "a.js.js"; + +=== /project/b.ts === +import a from "./a.js"; +>a : Symbol(a, Decl(b.ts, 0, 6)) + diff --git a/tests/baselines/reference/extensionLoadingPriority(moduleresolution=hybrid).types b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=hybrid).types new file mode 100644 index 0000000000000..b442294d98f6a --- /dev/null +++ b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=hybrid).types @@ -0,0 +1,12 @@ +=== /project/a.js === + +export default "a.js"; + +=== /project/a.js.js === + +export default "a.js.js"; + +=== /project/b.ts === +import a from "./a.js"; +>a : "a.js" + diff --git a/tests/baselines/reference/extensionLoadingPriority(moduleresolution=node).symbols b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=node).symbols new file mode 100644 index 0000000000000..1851abea3894c --- /dev/null +++ b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=node).symbols @@ -0,0 +1,12 @@ +=== /project/a.js === + +export default "a.js"; + +=== /project/a.js.js === + +export default "a.js.js"; + +=== /project/b.ts === +import a from "./a.js"; +>a : Symbol(a, Decl(b.ts, 0, 6)) + diff --git a/tests/baselines/reference/extensionLoadingPriority(moduleresolution=node).types b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=node).types new file mode 100644 index 0000000000000..b442294d98f6a --- /dev/null +++ b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=node).types @@ -0,0 +1,12 @@ +=== /project/a.js === + +export default "a.js"; + +=== /project/a.js.js === + +export default "a.js.js"; + +=== /project/b.ts === +import a from "./a.js"; +>a : "a.js" + diff --git a/tests/baselines/reference/extensionLoadingPriority(moduleresolution=node16).symbols b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=node16).symbols new file mode 100644 index 0000000000000..1851abea3894c --- /dev/null +++ b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=node16).symbols @@ -0,0 +1,12 @@ +=== /project/a.js === + +export default "a.js"; + +=== /project/a.js.js === + +export default "a.js.js"; + +=== /project/b.ts === +import a from "./a.js"; +>a : Symbol(a, Decl(b.ts, 0, 6)) + diff --git a/tests/baselines/reference/extensionLoadingPriority(moduleresolution=node16).types b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=node16).types new file mode 100644 index 0000000000000..b442294d98f6a --- /dev/null +++ b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=node16).types @@ -0,0 +1,12 @@ +=== /project/a.js === + +export default "a.js"; + +=== /project/a.js.js === + +export default "a.js.js"; + +=== /project/b.ts === +import a from "./a.js"; +>a : "a.js" + diff --git a/tests/baselines/reference/extensionLoadingPriority(moduleresolution=nodenext).symbols b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=nodenext).symbols new file mode 100644 index 0000000000000..1851abea3894c --- /dev/null +++ b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=nodenext).symbols @@ -0,0 +1,12 @@ +=== /project/a.js === + +export default "a.js"; + +=== /project/a.js.js === + +export default "a.js.js"; + +=== /project/b.ts === +import a from "./a.js"; +>a : Symbol(a, Decl(b.ts, 0, 6)) + diff --git a/tests/baselines/reference/extensionLoadingPriority(moduleresolution=nodenext).types b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=nodenext).types new file mode 100644 index 0000000000000..b442294d98f6a --- /dev/null +++ b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=nodenext).types @@ -0,0 +1,12 @@ +=== /project/a.js === + +export default "a.js"; + +=== /project/a.js.js === + +export default "a.js.js"; + +=== /project/b.ts === +import a from "./a.js"; +>a : "a.js" + diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt new file mode 100644 index 0000000000000..b88b3f78bb7a3 --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt @@ -0,0 +1,84 @@ +error TS5056: Cannot write file 'out/b.js' because it would be overwritten by multiple input files. +error TS5056: Cannot write file 'out/c.js' because it would be overwritten by multiple input files. +/project/main.ts(3,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. +/project/main.ts(7,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. +/project/main.ts(8,16): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './b' instead? +/project/main.ts(11,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. +/project/main.ts(12,16): error TS5097: An import path can only end with a '.tsx' extension when 'allowImportingTsExtensions' is enabled. +/project/main.ts(12,16): error TS6142: Module './c.tsx' was resolved to '/project/c.tsx', but '--jsx' is not set. +/project/main.ts(16,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. +/project/types.d.ts(2,16): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. +/project/types.d.ts(3,21): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. + + +!!! error TS5056: Cannot write file 'out/b.js' because it would be overwritten by multiple input files. +!!! error TS5056: Cannot write file 'out/c.js' because it would be overwritten by multiple input files. +==== /project/a.ts (0 errors) ==== + export {}; + +==== /project/b.ts (0 errors) ==== + export {}; + +==== /project/b.js (0 errors) ==== + export {}; + +==== /project/b.d.ts (0 errors) ==== + export {}; + +==== /project/c.ts (0 errors) ==== + export {}; + +==== /project/c.tsx (0 errors) ==== + export {}; + +==== /project/d/index.ts (0 errors) ==== + export {}; + +==== /project/e (0 errors) ==== + WOMP WOMP BINARY DATA + +==== /project/e.ts (0 errors) ==== + export {}; + +==== /project/main.ts (7 errors) ==== + import {} from "./a"; + import {} from "./a.js"; + import {} from "./a.ts"; + ~~~~~~~~ +!!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. + + import {} from "./b"; + import {} from "./b.js"; + import {} from "./b.ts"; + ~~~~~~~~ +!!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. + import {} from "./b.d.ts"; + ~~~~~~~~~~ +!!! error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './b' instead? + import type {} from "./b.d.ts"; + + import {} from "./c.ts"; + ~~~~~~~~ +!!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. + import {} from "./c.tsx"; + ~~~~~~~~~ +!!! error TS5097: An import path can only end with a '.tsx' extension when 'allowImportingTsExtensions' is enabled. + ~~~~~~~~~ +!!! error TS6142: Module './c.tsx' was resolved to '/project/c.tsx', but '--jsx' is not set. + + import {} from "./d"; + import {} from "./d/index"; + import {} from "./d/index.ts"; + ~~~~~~~~~~~~~~ +!!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. + + import {} from "./e"; + +==== /project/types.d.ts (2 errors) ==== + import {} from "./a.ts"; + import {} from "./a.d.ts"; + ~~~~~~~~~~ +!!! error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. + import type {} from "./a.d.ts"; + ~~~~~~~~~~ +!!! error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js new file mode 100644 index 0000000000000..f946ec9557b55 --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js @@ -0,0 +1,66 @@ +//// [tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts] //// + +//// [a.ts] +export {}; + +//// [b.ts] +export {}; + +//// [b.js] +export {}; + +//// [b.d.ts] +export {}; + +//// [c.ts] +export {}; + +//// [c.tsx] +export {}; + +//// [index.ts] +export {}; + +//// [e] +WOMP WOMP BINARY DATA + +//// [e.ts] +export {}; + +//// [main.ts] +import {} from "./a"; +import {} from "./a.js"; +import {} from "./a.ts"; + +import {} from "./b"; +import {} from "./b.js"; +import {} from "./b.ts"; +import {} from "./b.d.ts"; +import type {} from "./b.d.ts"; + +import {} from "./c.ts"; +import {} from "./c.tsx"; + +import {} from "./d"; +import {} from "./d/index"; +import {} from "./d/index.ts"; + +import {} from "./e"; + +//// [types.d.ts] +import {} from "./a.ts"; +import {} from "./a.d.ts"; +import type {} from "./a.d.ts"; + +//// [a.js] +"use strict"; +exports.__esModule = true; +//// [index.js] +"use strict"; +exports.__esModule = true; +//// [e.js] +"use strict"; +exports.__esModule = true; +//// [main.js] +"use strict"; +exports.__esModule = true; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols new file mode 100644 index 0000000000000..bcf03f8d9917e --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols @@ -0,0 +1,58 @@ +=== /project/a.ts === + +export {}; + +=== /project/b.ts === + +export {}; + +=== /project/b.js === + +export {}; + +=== /project/b.d.ts === + +export {}; + +=== /project/c.ts === + +export {}; + +=== /project/c.tsx === + +export {}; + +=== /project/d/index.ts === + +export {}; + +=== /project/e.ts === + +export {}; + +=== /project/main.ts === + +import {} from "./a"; +import {} from "./a.js"; +import {} from "./a.ts"; + +import {} from "./b"; +import {} from "./b.js"; +import {} from "./b.ts"; +import {} from "./b.d.ts"; +import type {} from "./b.d.ts"; + +import {} from "./c.ts"; +import {} from "./c.tsx"; + +import {} from "./d"; +import {} from "./d/index"; +import {} from "./d/index.ts"; + +import {} from "./e"; + +=== /project/types.d.ts === + +import {} from "./a.ts"; +import {} from "./a.d.ts"; +import type {} from "./a.d.ts"; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json new file mode 100644 index 0000000000000..1c0a228b1841f --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json @@ -0,0 +1,101 @@ +[ + "======== Resolving module './a' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a', target file type 'TypeScript'.", + "File '/project/a.ts' exist - use it as a name resolution result.", + "======== Module name './a' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './a.js' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a.js', target file type 'TypeScript'.", + "File name '/project/a.js' has a '.js' extension - stripping it.", + "File '/project/a.ts' exist - use it as a name resolution result.", + "======== Module name './a.js' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './a.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a.ts', target file type 'TypeScript'.", + "File name '/project/a.ts' has a '.ts' extension - stripping it.", + "File '/project/a.ts' exist - use it as a name resolution result.", + "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './b' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b', target file type 'TypeScript'.", + "File '/project/b.ts' exist - use it as a name resolution result.", + "======== Module name './b' was successfully resolved to '/project/b.ts'. ========", + "======== Resolving module './b.js' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b.js', target file type 'TypeScript'.", + "File name '/project/b.js' has a '.js' extension - stripping it.", + "File '/project/b.ts' exist - use it as a name resolution result.", + "======== Module name './b.js' was successfully resolved to '/project/b.ts'. ========", + "======== Resolving module './b.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b.ts', target file type 'TypeScript'.", + "File name '/project/b.ts' has a '.ts' extension - stripping it.", + "File '/project/b.ts' exist - use it as a name resolution result.", + "======== Module name './b.ts' was successfully resolved to '/project/b.ts'. ========", + "======== Resolving module './b.d.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b.d.ts', target file type 'TypeScript'.", + "File name '/project/b.d.ts' has a '.d.ts' extension - stripping it.", + "File '/project/b.d.ts' exist - use it as a name resolution result.", + "======== Module name './b.d.ts' was successfully resolved to '/project/b.d.ts'. ========", + "======== Resolving module './c.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/c.ts', target file type 'TypeScript'.", + "File name '/project/c.ts' has a '.ts' extension - stripping it.", + "File '/project/c.ts' exist - use it as a name resolution result.", + "======== Module name './c.ts' was successfully resolved to '/project/c.ts'. ========", + "======== Resolving module './c.tsx' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/c.tsx', target file type 'TypeScript'.", + "File name '/project/c.tsx' has a '.tsx' extension - stripping it.", + "File '/project/c.tsx' exist - use it as a name resolution result.", + "======== Module name './c.tsx' was successfully resolved to '/project/c.tsx'. ========", + "======== Resolving module './d' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/d', target file type 'TypeScript'.", + "File '/project/d.ts' does not exist.", + "File '/project/d.tsx' does not exist.", + "File '/project/d.d.ts' does not exist.", + "File '/project/d/package.json' does not exist.", + "File '/project/d/index.ts' exist - use it as a name resolution result.", + "======== Module name './d' was successfully resolved to '/project/d/index.ts'. ========", + "======== Resolving module './d/index' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/d/index', target file type 'TypeScript'.", + "File '/project/d/index.ts' exist - use it as a name resolution result.", + "======== Module name './d/index' was successfully resolved to '/project/d/index.ts'. ========", + "======== Resolving module './d/index.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/d/index.ts', target file type 'TypeScript'.", + "File name '/project/d/index.ts' has a '.ts' extension - stripping it.", + "File '/project/d/index.ts' exist - use it as a name resolution result.", + "======== Module name './d/index.ts' was successfully resolved to '/project/d/index.ts'. ========", + "======== Resolving module './e' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/e', target file type 'TypeScript'.", + "File '/project/e.ts' exist - use it as a name resolution result.", + "======== Module name './e' was successfully resolved to '/project/e.ts'. ========", + "======== Resolving module './a.ts' from '/project/types.d.ts'. ========", + "Resolution for module './a.ts' was found in cache from location '/project'.", + "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './a.d.ts' from '/project/types.d.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a.d.ts', target file type 'TypeScript'.", + "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", + "File '/project/a.d.ts' does not exist.", + "File '/project/a.d.ts.ts' does not exist.", + "File '/project/a.d.ts.tsx' does not exist.", + "File '/project/a.d.ts.d.ts' does not exist.", + "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/project/a.d.ts', target file type 'JavaScript'.", + "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", + "File '/project/a.js' does not exist.", + "File '/project/a.jsx' does not exist.", + "File '/project/a.d.ts.js' does not exist.", + "File '/project/a.d.ts.jsx' does not exist.", + "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/project/a.d.ts', target file type 'Json'.", + "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", + "======== Module name './a.d.ts' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).types b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).types new file mode 100644 index 0000000000000..bcf03f8d9917e --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).types @@ -0,0 +1,58 @@ +=== /project/a.ts === + +export {}; + +=== /project/b.ts === + +export {}; + +=== /project/b.js === + +export {}; + +=== /project/b.d.ts === + +export {}; + +=== /project/c.ts === + +export {}; + +=== /project/c.tsx === + +export {}; + +=== /project/d/index.ts === + +export {}; + +=== /project/e.ts === + +export {}; + +=== /project/main.ts === + +import {} from "./a"; +import {} from "./a.js"; +import {} from "./a.ts"; + +import {} from "./b"; +import {} from "./b.js"; +import {} from "./b.ts"; +import {} from "./b.d.ts"; +import type {} from "./b.d.ts"; + +import {} from "./c.ts"; +import {} from "./c.tsx"; + +import {} from "./d"; +import {} from "./d/index"; +import {} from "./d/index.ts"; + +import {} from "./e"; + +=== /project/types.d.ts === + +import {} from "./a.ts"; +import {} from "./a.d.ts"; +import type {} from "./a.d.ts"; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt new file mode 100644 index 0000000000000..cc93517215702 --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt @@ -0,0 +1,80 @@ +/project/main.ts(3,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. +/project/main.ts(7,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. +/project/main.ts(8,16): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './b' instead? +/project/main.ts(11,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. +/project/main.ts(12,16): error TS5097: An import path can only end with a '.tsx' extension when 'allowImportingTsExtensions' is enabled. +/project/main.ts(12,16): error TS6142: Module './c.tsx' was resolved to '/project/c.tsx', but '--jsx' is not set. +/project/main.ts(16,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. +/project/types.d.ts(2,16): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. +/project/types.d.ts(3,21): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. + + +==== /project/a.ts (0 errors) ==== + export {}; + +==== /project/b.ts (0 errors) ==== + export {}; + +==== /project/b.js (0 errors) ==== + export {}; + +==== /project/b.d.ts (0 errors) ==== + export {}; + +==== /project/c.ts (0 errors) ==== + export {}; + +==== /project/c.tsx (0 errors) ==== + export {}; + +==== /project/d/index.ts (0 errors) ==== + export {}; + +==== /project/e (0 errors) ==== + WOMP WOMP BINARY DATA + +==== /project/e.ts (0 errors) ==== + export {}; + +==== /project/main.ts (7 errors) ==== + import {} from "./a"; + import {} from "./a.js"; + import {} from "./a.ts"; + ~~~~~~~~ +!!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. + + import {} from "./b"; + import {} from "./b.js"; + import {} from "./b.ts"; + ~~~~~~~~ +!!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. + import {} from "./b.d.ts"; + ~~~~~~~~~~ +!!! error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './b' instead? + import type {} from "./b.d.ts"; + + import {} from "./c.ts"; + ~~~~~~~~ +!!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. + import {} from "./c.tsx"; + ~~~~~~~~~ +!!! error TS5097: An import path can only end with a '.tsx' extension when 'allowImportingTsExtensions' is enabled. + ~~~~~~~~~ +!!! error TS6142: Module './c.tsx' was resolved to '/project/c.tsx', but '--jsx' is not set. + + import {} from "./d"; + import {} from "./d/index"; + import {} from "./d/index.ts"; + ~~~~~~~~~~~~~~ +!!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. + + import {} from "./e"; + +==== /project/types.d.ts (2 errors) ==== + import {} from "./a.ts"; + import {} from "./a.d.ts"; + ~~~~~~~~~~ +!!! error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. + import type {} from "./a.d.ts"; + ~~~~~~~~~~ +!!! error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols new file mode 100644 index 0000000000000..bcf03f8d9917e --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols @@ -0,0 +1,58 @@ +=== /project/a.ts === + +export {}; + +=== /project/b.ts === + +export {}; + +=== /project/b.js === + +export {}; + +=== /project/b.d.ts === + +export {}; + +=== /project/c.ts === + +export {}; + +=== /project/c.tsx === + +export {}; + +=== /project/d/index.ts === + +export {}; + +=== /project/e.ts === + +export {}; + +=== /project/main.ts === + +import {} from "./a"; +import {} from "./a.js"; +import {} from "./a.ts"; + +import {} from "./b"; +import {} from "./b.js"; +import {} from "./b.ts"; +import {} from "./b.d.ts"; +import type {} from "./b.d.ts"; + +import {} from "./c.ts"; +import {} from "./c.tsx"; + +import {} from "./d"; +import {} from "./d/index"; +import {} from "./d/index.ts"; + +import {} from "./e"; + +=== /project/types.d.ts === + +import {} from "./a.ts"; +import {} from "./a.d.ts"; +import type {} from "./a.d.ts"; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json new file mode 100644 index 0000000000000..1c0a228b1841f --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json @@ -0,0 +1,101 @@ +[ + "======== Resolving module './a' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a', target file type 'TypeScript'.", + "File '/project/a.ts' exist - use it as a name resolution result.", + "======== Module name './a' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './a.js' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a.js', target file type 'TypeScript'.", + "File name '/project/a.js' has a '.js' extension - stripping it.", + "File '/project/a.ts' exist - use it as a name resolution result.", + "======== Module name './a.js' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './a.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a.ts', target file type 'TypeScript'.", + "File name '/project/a.ts' has a '.ts' extension - stripping it.", + "File '/project/a.ts' exist - use it as a name resolution result.", + "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './b' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b', target file type 'TypeScript'.", + "File '/project/b.ts' exist - use it as a name resolution result.", + "======== Module name './b' was successfully resolved to '/project/b.ts'. ========", + "======== Resolving module './b.js' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b.js', target file type 'TypeScript'.", + "File name '/project/b.js' has a '.js' extension - stripping it.", + "File '/project/b.ts' exist - use it as a name resolution result.", + "======== Module name './b.js' was successfully resolved to '/project/b.ts'. ========", + "======== Resolving module './b.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b.ts', target file type 'TypeScript'.", + "File name '/project/b.ts' has a '.ts' extension - stripping it.", + "File '/project/b.ts' exist - use it as a name resolution result.", + "======== Module name './b.ts' was successfully resolved to '/project/b.ts'. ========", + "======== Resolving module './b.d.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b.d.ts', target file type 'TypeScript'.", + "File name '/project/b.d.ts' has a '.d.ts' extension - stripping it.", + "File '/project/b.d.ts' exist - use it as a name resolution result.", + "======== Module name './b.d.ts' was successfully resolved to '/project/b.d.ts'. ========", + "======== Resolving module './c.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/c.ts', target file type 'TypeScript'.", + "File name '/project/c.ts' has a '.ts' extension - stripping it.", + "File '/project/c.ts' exist - use it as a name resolution result.", + "======== Module name './c.ts' was successfully resolved to '/project/c.ts'. ========", + "======== Resolving module './c.tsx' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/c.tsx', target file type 'TypeScript'.", + "File name '/project/c.tsx' has a '.tsx' extension - stripping it.", + "File '/project/c.tsx' exist - use it as a name resolution result.", + "======== Module name './c.tsx' was successfully resolved to '/project/c.tsx'. ========", + "======== Resolving module './d' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/d', target file type 'TypeScript'.", + "File '/project/d.ts' does not exist.", + "File '/project/d.tsx' does not exist.", + "File '/project/d.d.ts' does not exist.", + "File '/project/d/package.json' does not exist.", + "File '/project/d/index.ts' exist - use it as a name resolution result.", + "======== Module name './d' was successfully resolved to '/project/d/index.ts'. ========", + "======== Resolving module './d/index' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/d/index', target file type 'TypeScript'.", + "File '/project/d/index.ts' exist - use it as a name resolution result.", + "======== Module name './d/index' was successfully resolved to '/project/d/index.ts'. ========", + "======== Resolving module './d/index.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/d/index.ts', target file type 'TypeScript'.", + "File name '/project/d/index.ts' has a '.ts' extension - stripping it.", + "File '/project/d/index.ts' exist - use it as a name resolution result.", + "======== Module name './d/index.ts' was successfully resolved to '/project/d/index.ts'. ========", + "======== Resolving module './e' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/e', target file type 'TypeScript'.", + "File '/project/e.ts' exist - use it as a name resolution result.", + "======== Module name './e' was successfully resolved to '/project/e.ts'. ========", + "======== Resolving module './a.ts' from '/project/types.d.ts'. ========", + "Resolution for module './a.ts' was found in cache from location '/project'.", + "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './a.d.ts' from '/project/types.d.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a.d.ts', target file type 'TypeScript'.", + "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", + "File '/project/a.d.ts' does not exist.", + "File '/project/a.d.ts.ts' does not exist.", + "File '/project/a.d.ts.tsx' does not exist.", + "File '/project/a.d.ts.d.ts' does not exist.", + "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/project/a.d.ts', target file type 'JavaScript'.", + "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", + "File '/project/a.js' does not exist.", + "File '/project/a.jsx' does not exist.", + "File '/project/a.d.ts.js' does not exist.", + "File '/project/a.d.ts.jsx' does not exist.", + "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/project/a.d.ts', target file type 'Json'.", + "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", + "======== Module name './a.d.ts' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).types b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).types new file mode 100644 index 0000000000000..bcf03f8d9917e --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).types @@ -0,0 +1,58 @@ +=== /project/a.ts === + +export {}; + +=== /project/b.ts === + +export {}; + +=== /project/b.js === + +export {}; + +=== /project/b.d.ts === + +export {}; + +=== /project/c.ts === + +export {}; + +=== /project/c.tsx === + +export {}; + +=== /project/d/index.ts === + +export {}; + +=== /project/e.ts === + +export {}; + +=== /project/main.ts === + +import {} from "./a"; +import {} from "./a.js"; +import {} from "./a.ts"; + +import {} from "./b"; +import {} from "./b.js"; +import {} from "./b.ts"; +import {} from "./b.d.ts"; +import type {} from "./b.d.ts"; + +import {} from "./c.ts"; +import {} from "./c.tsx"; + +import {} from "./d"; +import {} from "./d/index"; +import {} from "./d/index.ts"; + +import {} from "./e"; + +=== /project/types.d.ts === + +import {} from "./a.ts"; +import {} from "./a.d.ts"; +import type {} from "./a.d.ts"; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt new file mode 100644 index 0000000000000..1e93929f4b534 --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt @@ -0,0 +1,71 @@ +error TS5056: Cannot write file 'out/b.js' because it would be overwritten by multiple input files. +error TS5056: Cannot write file 'out/c.js' because it would be overwritten by multiple input files. +error TS5096: Option 'allowImportingTsExtensions' can only be used when 'moduleResolution' is set to 'hybrid' and either 'noEmit' or 'emitDeclarationOnly' is set. +/project/main.ts(8,16): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './b' instead? +/project/main.ts(12,16): error TS6142: Module './c.tsx' was resolved to '/project/c.tsx', but '--jsx' is not set. +/project/types.d.ts(2,16): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. +/project/types.d.ts(3,21): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. + + +!!! error TS5056: Cannot write file 'out/b.js' because it would be overwritten by multiple input files. +!!! error TS5056: Cannot write file 'out/c.js' because it would be overwritten by multiple input files. +!!! error TS5096: Option 'allowImportingTsExtensions' can only be used when 'moduleResolution' is set to 'hybrid' and either 'noEmit' or 'emitDeclarationOnly' is set. +==== /project/a.ts (0 errors) ==== + export {}; + +==== /project/b.ts (0 errors) ==== + export {}; + +==== /project/b.js (0 errors) ==== + export {}; + +==== /project/b.d.ts (0 errors) ==== + export {}; + +==== /project/c.ts (0 errors) ==== + export {}; + +==== /project/c.tsx (0 errors) ==== + export {}; + +==== /project/d/index.ts (0 errors) ==== + export {}; + +==== /project/e (0 errors) ==== + WOMP WOMP BINARY DATA + +==== /project/e.ts (0 errors) ==== + export {}; + +==== /project/main.ts (2 errors) ==== + import {} from "./a"; + import {} from "./a.js"; + import {} from "./a.ts"; + + import {} from "./b"; + import {} from "./b.js"; + import {} from "./b.ts"; + import {} from "./b.d.ts"; + ~~~~~~~~~~ +!!! error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './b' instead? + import type {} from "./b.d.ts"; + + import {} from "./c.ts"; + import {} from "./c.tsx"; + ~~~~~~~~~ +!!! error TS6142: Module './c.tsx' was resolved to '/project/c.tsx', but '--jsx' is not set. + + import {} from "./d"; + import {} from "./d/index"; + import {} from "./d/index.ts"; + + import {} from "./e"; + +==== /project/types.d.ts (2 errors) ==== + import {} from "./a.ts"; + import {} from "./a.d.ts"; + ~~~~~~~~~~ +!!! error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. + import type {} from "./a.d.ts"; + ~~~~~~~~~~ +!!! error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js new file mode 100644 index 0000000000000..f946ec9557b55 --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js @@ -0,0 +1,66 @@ +//// [tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts] //// + +//// [a.ts] +export {}; + +//// [b.ts] +export {}; + +//// [b.js] +export {}; + +//// [b.d.ts] +export {}; + +//// [c.ts] +export {}; + +//// [c.tsx] +export {}; + +//// [index.ts] +export {}; + +//// [e] +WOMP WOMP BINARY DATA + +//// [e.ts] +export {}; + +//// [main.ts] +import {} from "./a"; +import {} from "./a.js"; +import {} from "./a.ts"; + +import {} from "./b"; +import {} from "./b.js"; +import {} from "./b.ts"; +import {} from "./b.d.ts"; +import type {} from "./b.d.ts"; + +import {} from "./c.ts"; +import {} from "./c.tsx"; + +import {} from "./d"; +import {} from "./d/index"; +import {} from "./d/index.ts"; + +import {} from "./e"; + +//// [types.d.ts] +import {} from "./a.ts"; +import {} from "./a.d.ts"; +import type {} from "./a.d.ts"; + +//// [a.js] +"use strict"; +exports.__esModule = true; +//// [index.js] +"use strict"; +exports.__esModule = true; +//// [e.js] +"use strict"; +exports.__esModule = true; +//// [main.js] +"use strict"; +exports.__esModule = true; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols new file mode 100644 index 0000000000000..bcf03f8d9917e --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols @@ -0,0 +1,58 @@ +=== /project/a.ts === + +export {}; + +=== /project/b.ts === + +export {}; + +=== /project/b.js === + +export {}; + +=== /project/b.d.ts === + +export {}; + +=== /project/c.ts === + +export {}; + +=== /project/c.tsx === + +export {}; + +=== /project/d/index.ts === + +export {}; + +=== /project/e.ts === + +export {}; + +=== /project/main.ts === + +import {} from "./a"; +import {} from "./a.js"; +import {} from "./a.ts"; + +import {} from "./b"; +import {} from "./b.js"; +import {} from "./b.ts"; +import {} from "./b.d.ts"; +import type {} from "./b.d.ts"; + +import {} from "./c.ts"; +import {} from "./c.tsx"; + +import {} from "./d"; +import {} from "./d/index"; +import {} from "./d/index.ts"; + +import {} from "./e"; + +=== /project/types.d.ts === + +import {} from "./a.ts"; +import {} from "./a.d.ts"; +import type {} from "./a.d.ts"; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json new file mode 100644 index 0000000000000..1c0a228b1841f --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json @@ -0,0 +1,101 @@ +[ + "======== Resolving module './a' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a', target file type 'TypeScript'.", + "File '/project/a.ts' exist - use it as a name resolution result.", + "======== Module name './a' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './a.js' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a.js', target file type 'TypeScript'.", + "File name '/project/a.js' has a '.js' extension - stripping it.", + "File '/project/a.ts' exist - use it as a name resolution result.", + "======== Module name './a.js' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './a.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a.ts', target file type 'TypeScript'.", + "File name '/project/a.ts' has a '.ts' extension - stripping it.", + "File '/project/a.ts' exist - use it as a name resolution result.", + "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './b' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b', target file type 'TypeScript'.", + "File '/project/b.ts' exist - use it as a name resolution result.", + "======== Module name './b' was successfully resolved to '/project/b.ts'. ========", + "======== Resolving module './b.js' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b.js', target file type 'TypeScript'.", + "File name '/project/b.js' has a '.js' extension - stripping it.", + "File '/project/b.ts' exist - use it as a name resolution result.", + "======== Module name './b.js' was successfully resolved to '/project/b.ts'. ========", + "======== Resolving module './b.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b.ts', target file type 'TypeScript'.", + "File name '/project/b.ts' has a '.ts' extension - stripping it.", + "File '/project/b.ts' exist - use it as a name resolution result.", + "======== Module name './b.ts' was successfully resolved to '/project/b.ts'. ========", + "======== Resolving module './b.d.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b.d.ts', target file type 'TypeScript'.", + "File name '/project/b.d.ts' has a '.d.ts' extension - stripping it.", + "File '/project/b.d.ts' exist - use it as a name resolution result.", + "======== Module name './b.d.ts' was successfully resolved to '/project/b.d.ts'. ========", + "======== Resolving module './c.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/c.ts', target file type 'TypeScript'.", + "File name '/project/c.ts' has a '.ts' extension - stripping it.", + "File '/project/c.ts' exist - use it as a name resolution result.", + "======== Module name './c.ts' was successfully resolved to '/project/c.ts'. ========", + "======== Resolving module './c.tsx' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/c.tsx', target file type 'TypeScript'.", + "File name '/project/c.tsx' has a '.tsx' extension - stripping it.", + "File '/project/c.tsx' exist - use it as a name resolution result.", + "======== Module name './c.tsx' was successfully resolved to '/project/c.tsx'. ========", + "======== Resolving module './d' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/d', target file type 'TypeScript'.", + "File '/project/d.ts' does not exist.", + "File '/project/d.tsx' does not exist.", + "File '/project/d.d.ts' does not exist.", + "File '/project/d/package.json' does not exist.", + "File '/project/d/index.ts' exist - use it as a name resolution result.", + "======== Module name './d' was successfully resolved to '/project/d/index.ts'. ========", + "======== Resolving module './d/index' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/d/index', target file type 'TypeScript'.", + "File '/project/d/index.ts' exist - use it as a name resolution result.", + "======== Module name './d/index' was successfully resolved to '/project/d/index.ts'. ========", + "======== Resolving module './d/index.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/d/index.ts', target file type 'TypeScript'.", + "File name '/project/d/index.ts' has a '.ts' extension - stripping it.", + "File '/project/d/index.ts' exist - use it as a name resolution result.", + "======== Module name './d/index.ts' was successfully resolved to '/project/d/index.ts'. ========", + "======== Resolving module './e' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/e', target file type 'TypeScript'.", + "File '/project/e.ts' exist - use it as a name resolution result.", + "======== Module name './e' was successfully resolved to '/project/e.ts'. ========", + "======== Resolving module './a.ts' from '/project/types.d.ts'. ========", + "Resolution for module './a.ts' was found in cache from location '/project'.", + "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './a.d.ts' from '/project/types.d.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a.d.ts', target file type 'TypeScript'.", + "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", + "File '/project/a.d.ts' does not exist.", + "File '/project/a.d.ts.ts' does not exist.", + "File '/project/a.d.ts.tsx' does not exist.", + "File '/project/a.d.ts.d.ts' does not exist.", + "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/project/a.d.ts', target file type 'JavaScript'.", + "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", + "File '/project/a.js' does not exist.", + "File '/project/a.jsx' does not exist.", + "File '/project/a.d.ts.js' does not exist.", + "File '/project/a.d.ts.jsx' does not exist.", + "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/project/a.d.ts', target file type 'Json'.", + "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", + "======== Module name './a.d.ts' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).types b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).types new file mode 100644 index 0000000000000..bcf03f8d9917e --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).types @@ -0,0 +1,58 @@ +=== /project/a.ts === + +export {}; + +=== /project/b.ts === + +export {}; + +=== /project/b.js === + +export {}; + +=== /project/b.d.ts === + +export {}; + +=== /project/c.ts === + +export {}; + +=== /project/c.tsx === + +export {}; + +=== /project/d/index.ts === + +export {}; + +=== /project/e.ts === + +export {}; + +=== /project/main.ts === + +import {} from "./a"; +import {} from "./a.js"; +import {} from "./a.ts"; + +import {} from "./b"; +import {} from "./b.js"; +import {} from "./b.ts"; +import {} from "./b.d.ts"; +import type {} from "./b.d.ts"; + +import {} from "./c.ts"; +import {} from "./c.tsx"; + +import {} from "./d"; +import {} from "./d/index"; +import {} from "./d/index.ts"; + +import {} from "./e"; + +=== /project/types.d.ts === + +import {} from "./a.ts"; +import {} from "./a.d.ts"; +import type {} from "./a.d.ts"; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt new file mode 100644 index 0000000000000..cdf02ebb53120 --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt @@ -0,0 +1,65 @@ +/project/main.ts(8,16): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './b' instead? +/project/main.ts(12,16): error TS6142: Module './c.tsx' was resolved to '/project/c.tsx', but '--jsx' is not set. +/project/types.d.ts(2,16): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. +/project/types.d.ts(3,21): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. + + +==== /project/a.ts (0 errors) ==== + export {}; + +==== /project/b.ts (0 errors) ==== + export {}; + +==== /project/b.js (0 errors) ==== + export {}; + +==== /project/b.d.ts (0 errors) ==== + export {}; + +==== /project/c.ts (0 errors) ==== + export {}; + +==== /project/c.tsx (0 errors) ==== + export {}; + +==== /project/d/index.ts (0 errors) ==== + export {}; + +==== /project/e (0 errors) ==== + WOMP WOMP BINARY DATA + +==== /project/e.ts (0 errors) ==== + export {}; + +==== /project/main.ts (2 errors) ==== + import {} from "./a"; + import {} from "./a.js"; + import {} from "./a.ts"; + + import {} from "./b"; + import {} from "./b.js"; + import {} from "./b.ts"; + import {} from "./b.d.ts"; + ~~~~~~~~~~ +!!! error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './b' instead? + import type {} from "./b.d.ts"; + + import {} from "./c.ts"; + import {} from "./c.tsx"; + ~~~~~~~~~ +!!! error TS6142: Module './c.tsx' was resolved to '/project/c.tsx', but '--jsx' is not set. + + import {} from "./d"; + import {} from "./d/index"; + import {} from "./d/index.ts"; + + import {} from "./e"; + +==== /project/types.d.ts (2 errors) ==== + import {} from "./a.ts"; + import {} from "./a.d.ts"; + ~~~~~~~~~~ +!!! error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. + import type {} from "./a.d.ts"; + ~~~~~~~~~~ +!!! error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols new file mode 100644 index 0000000000000..bcf03f8d9917e --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols @@ -0,0 +1,58 @@ +=== /project/a.ts === + +export {}; + +=== /project/b.ts === + +export {}; + +=== /project/b.js === + +export {}; + +=== /project/b.d.ts === + +export {}; + +=== /project/c.ts === + +export {}; + +=== /project/c.tsx === + +export {}; + +=== /project/d/index.ts === + +export {}; + +=== /project/e.ts === + +export {}; + +=== /project/main.ts === + +import {} from "./a"; +import {} from "./a.js"; +import {} from "./a.ts"; + +import {} from "./b"; +import {} from "./b.js"; +import {} from "./b.ts"; +import {} from "./b.d.ts"; +import type {} from "./b.d.ts"; + +import {} from "./c.ts"; +import {} from "./c.tsx"; + +import {} from "./d"; +import {} from "./d/index"; +import {} from "./d/index.ts"; + +import {} from "./e"; + +=== /project/types.d.ts === + +import {} from "./a.ts"; +import {} from "./a.d.ts"; +import type {} from "./a.d.ts"; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json new file mode 100644 index 0000000000000..1c0a228b1841f --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json @@ -0,0 +1,101 @@ +[ + "======== Resolving module './a' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a', target file type 'TypeScript'.", + "File '/project/a.ts' exist - use it as a name resolution result.", + "======== Module name './a' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './a.js' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a.js', target file type 'TypeScript'.", + "File name '/project/a.js' has a '.js' extension - stripping it.", + "File '/project/a.ts' exist - use it as a name resolution result.", + "======== Module name './a.js' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './a.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a.ts', target file type 'TypeScript'.", + "File name '/project/a.ts' has a '.ts' extension - stripping it.", + "File '/project/a.ts' exist - use it as a name resolution result.", + "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './b' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b', target file type 'TypeScript'.", + "File '/project/b.ts' exist - use it as a name resolution result.", + "======== Module name './b' was successfully resolved to '/project/b.ts'. ========", + "======== Resolving module './b.js' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b.js', target file type 'TypeScript'.", + "File name '/project/b.js' has a '.js' extension - stripping it.", + "File '/project/b.ts' exist - use it as a name resolution result.", + "======== Module name './b.js' was successfully resolved to '/project/b.ts'. ========", + "======== Resolving module './b.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b.ts', target file type 'TypeScript'.", + "File name '/project/b.ts' has a '.ts' extension - stripping it.", + "File '/project/b.ts' exist - use it as a name resolution result.", + "======== Module name './b.ts' was successfully resolved to '/project/b.ts'. ========", + "======== Resolving module './b.d.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/b.d.ts', target file type 'TypeScript'.", + "File name '/project/b.d.ts' has a '.d.ts' extension - stripping it.", + "File '/project/b.d.ts' exist - use it as a name resolution result.", + "======== Module name './b.d.ts' was successfully resolved to '/project/b.d.ts'. ========", + "======== Resolving module './c.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/c.ts', target file type 'TypeScript'.", + "File name '/project/c.ts' has a '.ts' extension - stripping it.", + "File '/project/c.ts' exist - use it as a name resolution result.", + "======== Module name './c.ts' was successfully resolved to '/project/c.ts'. ========", + "======== Resolving module './c.tsx' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/c.tsx', target file type 'TypeScript'.", + "File name '/project/c.tsx' has a '.tsx' extension - stripping it.", + "File '/project/c.tsx' exist - use it as a name resolution result.", + "======== Module name './c.tsx' was successfully resolved to '/project/c.tsx'. ========", + "======== Resolving module './d' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/d', target file type 'TypeScript'.", + "File '/project/d.ts' does not exist.", + "File '/project/d.tsx' does not exist.", + "File '/project/d.d.ts' does not exist.", + "File '/project/d/package.json' does not exist.", + "File '/project/d/index.ts' exist - use it as a name resolution result.", + "======== Module name './d' was successfully resolved to '/project/d/index.ts'. ========", + "======== Resolving module './d/index' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/d/index', target file type 'TypeScript'.", + "File '/project/d/index.ts' exist - use it as a name resolution result.", + "======== Module name './d/index' was successfully resolved to '/project/d/index.ts'. ========", + "======== Resolving module './d/index.ts' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/d/index.ts', target file type 'TypeScript'.", + "File name '/project/d/index.ts' has a '.ts' extension - stripping it.", + "File '/project/d/index.ts' exist - use it as a name resolution result.", + "======== Module name './d/index.ts' was successfully resolved to '/project/d/index.ts'. ========", + "======== Resolving module './e' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/e', target file type 'TypeScript'.", + "File '/project/e.ts' exist - use it as a name resolution result.", + "======== Module name './e' was successfully resolved to '/project/e.ts'. ========", + "======== Resolving module './a.ts' from '/project/types.d.ts'. ========", + "Resolution for module './a.ts' was found in cache from location '/project'.", + "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", + "======== Resolving module './a.d.ts' from '/project/types.d.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/a.d.ts', target file type 'TypeScript'.", + "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", + "File '/project/a.d.ts' does not exist.", + "File '/project/a.d.ts.ts' does not exist.", + "File '/project/a.d.ts.tsx' does not exist.", + "File '/project/a.d.ts.d.ts' does not exist.", + "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/project/a.d.ts', target file type 'JavaScript'.", + "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", + "File '/project/a.js' does not exist.", + "File '/project/a.jsx' does not exist.", + "File '/project/a.d.ts.js' does not exist.", + "File '/project/a.d.ts.jsx' does not exist.", + "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", + "Loading module as file / folder, candidate module location '/project/a.d.ts', target file type 'Json'.", + "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", + "======== Module name './a.d.ts' was not resolved. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).types b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).types new file mode 100644 index 0000000000000..bcf03f8d9917e --- /dev/null +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).types @@ -0,0 +1,58 @@ +=== /project/a.ts === + +export {}; + +=== /project/b.ts === + +export {}; + +=== /project/b.js === + +export {}; + +=== /project/b.d.ts === + +export {}; + +=== /project/c.ts === + +export {}; + +=== /project/c.tsx === + +export {}; + +=== /project/d/index.ts === + +export {}; + +=== /project/e.ts === + +export {}; + +=== /project/main.ts === + +import {} from "./a"; +import {} from "./a.js"; +import {} from "./a.ts"; + +import {} from "./b"; +import {} from "./b.js"; +import {} from "./b.ts"; +import {} from "./b.d.ts"; +import type {} from "./b.d.ts"; + +import {} from "./c.ts"; +import {} from "./c.tsx"; + +import {} from "./d"; +import {} from "./d/index"; +import {} from "./d/index.ts"; + +import {} from "./e"; + +=== /project/types.d.ts === + +import {} from "./a.ts"; +import {} from "./a.d.ts"; +import type {} from "./a.d.ts"; diff --git a/tests/baselines/reference/hybridNodeModules1.errors.txt b/tests/baselines/reference/hybridNodeModules1.errors.txt new file mode 100644 index 0000000000000..69921a8ce1425 --- /dev/null +++ b/tests/baselines/reference/hybridNodeModules1.errors.txt @@ -0,0 +1,59 @@ +error TS6504: File '/node_modules/dual/index.cjs' is a JavaScript file. Did you mean to enable the 'allowJs' option? + The file is in the program because: + Root file specified for compilation +error TS6504: File '/node_modules/dual/index.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,15): error TS2305: Module '"dual"' has no exported member 'cjs'. +/main.mts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. +/main.ts(1,15): error TS2305: Module '"dual"' has no exported member 'cjs'. + + +!!! error TS6504: File '/node_modules/dual/index.cjs' 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 +!!! error TS6504: File '/node_modules/dual/index.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/dual/package.json (0 errors) ==== + { + "name": "dual", + "version": "1.0.0", + "type": "module", + "main": "index.cjs", + "types": "index.d.cts", + "exports": { + ".": { + "import": "./index.js", + "require": "./index.cjs" + } + } + } + +==== /node_modules/dual/index.js (0 errors) ==== + export const esm = 0; + +==== /node_modules/dual/index.d.ts (0 errors) ==== + export const esm: number; + +==== /node_modules/dual/index.cjs (0 errors) ==== + exports.cjs = 0; + +==== /node_modules/dual/index.d.cts (0 errors) ==== + export const cjs: number; + +==== /main.ts (1 errors) ==== + import { esm, cjs } from "dual"; + ~~~ +!!! error TS2305: Module '"dual"' has no exported member 'cjs'. + +==== /main.mts (1 errors) ==== + import { esm, cjs } from "dual"; + ~~~ +!!! error TS2305: Module '"dual"' has no exported member 'cjs'. + +==== /main.cts (1 errors) ==== + import { esm, cjs } from "dual"; + ~~~ +!!! error TS2305: Module '"dual"' has no exported member 'cjs'. + \ No newline at end of file diff --git a/tests/baselines/reference/hybridNodeModules1.js b/tests/baselines/reference/hybridNodeModules1.js new file mode 100644 index 0000000000000..03ed212a2f875 --- /dev/null +++ b/tests/baselines/reference/hybridNodeModules1.js @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/moduleResolution/hybrid/hybridNodeModules1.ts] //// + +//// [package.json] +{ + "name": "dual", + "version": "1.0.0", + "type": "module", + "main": "index.cjs", + "types": "index.d.cts", + "exports": { + ".": { + "import": "./index.js", + "require": "./index.cjs" + } + } +} + +//// [index.js] +export const esm = 0; + +//// [index.d.ts] +export const esm: number; + +//// [index.cjs] +exports.cjs = 0; + +//// [index.d.cts] +export const cjs: number; + +//// [main.ts] +import { esm, cjs } from "dual"; + +//// [main.mts] +import { esm, cjs } from "dual"; + +//// [main.cts] +import { esm, cjs } from "dual"; + + +//// [main.js] +"use strict"; +exports.__esModule = true; +//// [main.mjs] +"use strict"; +exports.__esModule = true; +//// [main.cjs] +"use strict"; +exports.__esModule = true; diff --git a/tests/baselines/reference/hybridNodeModules1.symbols b/tests/baselines/reference/hybridNodeModules1.symbols new file mode 100644 index 0000000000000..d19c2e18f2c4d --- /dev/null +++ b/tests/baselines/reference/hybridNodeModules1.symbols @@ -0,0 +1,23 @@ +=== /node_modules/dual/index.d.ts === +export const esm: number; +>esm : Symbol(esm, Decl(index.d.ts, 0, 12)) + +=== /node_modules/dual/index.d.cts === +export const cjs: number; +>cjs : Symbol(cjs, Decl(index.d.cts, 0, 12)) + +=== /main.ts === +import { esm, cjs } from "dual"; +>esm : Symbol(esm, Decl(main.ts, 0, 8)) +>cjs : Symbol(cjs, Decl(main.ts, 0, 13)) + +=== /main.mts === +import { esm, cjs } from "dual"; +>esm : Symbol(esm, Decl(main.mts, 0, 8)) +>cjs : Symbol(cjs, Decl(main.mts, 0, 13)) + +=== /main.cts === +import { esm, cjs } from "dual"; +>esm : Symbol(esm, Decl(main.cts, 0, 8)) +>cjs : Symbol(cjs, Decl(main.cts, 0, 13)) + diff --git a/tests/baselines/reference/hybridNodeModules1.trace.json b/tests/baselines/reference/hybridNodeModules1.trace.json new file mode 100644 index 0000000000000..0064397011c9f --- /dev/null +++ b/tests/baselines/reference/hybridNodeModules1.trace.json @@ -0,0 +1,22 @@ +[ + "======== Resolving module 'dual' from '/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "File '/package.json' does not exist.", + "Loading module 'dual' from 'node_modules' folder, target file type 'TypeScript'.", + "Found 'package.json' at '/node_modules/dual/package.json'.", + "'package.json' does not have a 'typesVersions' field.", + "Matched 'exports' condition 'import'.", + "Using 'exports' subpath '.' with target './index.js'.", + "File name '/node_modules/dual/index.js' has a '.js' extension - stripping it.", + "File '/node_modules/dual/index.ts' does not exist.", + "File '/node_modules/dual/index.tsx' does not exist.", + "File '/node_modules/dual/index.d.ts' exist - use it as a name resolution result.", + "Resolving real path for '/node_modules/dual/index.d.ts', result '/node_modules/dual/index.d.ts'.", + "======== Module name 'dual' was successfully resolved to '/node_modules/dual/index.d.ts' with Package ID 'dual/index.d.ts@1.0.0'. ========", + "======== Resolving module 'dual' from '/main.mts'. ========", + "Resolution for module 'dual' was found in cache from location '/'.", + "======== Module name 'dual' was successfully resolved to '/node_modules/dual/index.d.ts' with Package ID 'dual/index.d.ts@1.0.0'. ========", + "======== Resolving module 'dual' from '/main.cts'. ========", + "Resolution for module 'dual' was found in cache from location '/'.", + "======== Module name 'dual' was successfully resolved to '/node_modules/dual/index.d.ts' with Package ID 'dual/index.d.ts@1.0.0'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/hybridNodeModules1.types b/tests/baselines/reference/hybridNodeModules1.types new file mode 100644 index 0000000000000..038aac71d8928 --- /dev/null +++ b/tests/baselines/reference/hybridNodeModules1.types @@ -0,0 +1,23 @@ +=== /node_modules/dual/index.d.ts === +export const esm: number; +>esm : number + +=== /node_modules/dual/index.d.cts === +export const cjs: number; +>cjs : number + +=== /main.ts === +import { esm, cjs } from "dual"; +>esm : number +>cjs : any + +=== /main.mts === +import { esm, cjs } from "dual"; +>esm : number +>cjs : any + +=== /main.cts === +import { esm, cjs } from "dual"; +>esm : number +>cjs : any + diff --git a/tests/baselines/reference/hybridRelative1.errors.txt b/tests/baselines/reference/hybridRelative1.errors.txt index 2381787fbc254..738eafa19304f 100644 --- a/tests/baselines/reference/hybridRelative1.errors.txt +++ b/tests/baselines/reference/hybridRelative1.errors.txt @@ -1,9 +1,7 @@ -error TS5070: Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy. /main.ts(4,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. /main.ts(7,16): error TS2307: Cannot find module './redirect/index' or its corresponding type declarations. -!!! error TS5070: Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy. ==== /dir/index.ts (0 errors) ==== export const x = 0; diff --git a/tests/baselines/reference/hybridRelative1.trace.json b/tests/baselines/reference/hybridRelative1.trace.json index 75cb1a973184e..77923b457c67a 100644 --- a/tests/baselines/reference/hybridRelative1.trace.json +++ b/tests/baselines/reference/hybridRelative1.trace.json @@ -16,18 +16,12 @@ "======== Resolving module './dir/index.js' from '/main.ts'. ========", "Explicitly specified module resolution kind: 'Hybrid'.", "Loading module as file / folder, candidate module location '/dir/index.js', target file type 'TypeScript'.", - "File '/dir/index.js.ts' does not exist.", - "File '/dir/index.js.tsx' does not exist.", - "File '/dir/index.js.d.ts' does not exist.", "File name '/dir/index.js' has a '.js' extension - stripping it.", "File '/dir/index.ts' exist - use it as a name resolution result.", "======== Module name './dir/index.js' was successfully resolved to '/dir/index.ts'. ========", "======== Resolving module './dir/index.ts' from '/main.ts'. ========", "Explicitly specified module resolution kind: 'Hybrid'.", "Loading module as file / folder, candidate module location '/dir/index.ts', target file type 'TypeScript'.", - "File '/dir/index.ts.ts' does not exist.", - "File '/dir/index.ts.tsx' does not exist.", - "File '/dir/index.ts.d.ts' does not exist.", "File name '/dir/index.ts' has a '.ts' extension - stripping it.", "File '/dir/index.ts' exist - use it as a name resolution result.", "======== Module name './dir/index.ts' was successfully resolved to '/dir/index.ts'. ========", diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.symbols b/tests/baselines/reference/hybridSyntaxRestrictions.symbols index d92eb6ffe04b4..5f06564f2a083 100644 --- a/tests/baselines/reference/hybridSyntaxRestrictions.symbols +++ b/tests/baselines/reference/hybridSyntaxRestrictions.symbols @@ -12,6 +12,6 @@ declare var require: (...args: any[]) => any; >args : Symbol(args, Decl(index.d.ts, 0, 22)) === /a.ts === + export {}; -No type information for this code. -No type information for this code. \ No newline at end of file + diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.types b/tests/baselines/reference/hybridSyntaxRestrictions.types index 16066a8493dcc..82fbd016666b3 100644 --- a/tests/baselines/reference/hybridSyntaxRestrictions.types +++ b/tests/baselines/reference/hybridSyntaxRestrictions.types @@ -14,6 +14,6 @@ declare var require: (...args: any[]) => any; >args : any[] === /a.ts === + export {}; -No type information for this code. -No type information for this code. \ No newline at end of file + diff --git a/tests/baselines/reference/moduleResolutionWithExtensions.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions.trace.json index 104853f8aa3f5..6ba563f31c74d 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions.trace.json @@ -7,18 +7,12 @@ "======== Resolving module './a.js' from '/src/d.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module as file / folder, candidate module location '/src/a.js', target file type 'TypeScript'.", - "File '/src/a.js.ts' does not exist.", - "File '/src/a.js.tsx' does not exist.", - "File '/src/a.js.d.ts' does not exist.", "File name '/src/a.js' has a '.js' extension - stripping it.", "File '/src/a.ts' exist - use it as a name resolution result.", "======== Module name './a.js' was successfully resolved to '/src/a.ts'. ========", "======== Resolving module './jquery.js' from '/src/jquery_user_1.ts'. ========", "Module resolution kind is not specified, using 'NodeJs'.", "Loading module as file / folder, candidate module location '/src/jquery.js', target file type 'TypeScript'.", - "File '/src/jquery.js.ts' does not exist.", - "File '/src/jquery.js.tsx' does not exist.", - "File '/src/jquery.js.d.ts' does not exist.", "File name '/src/jquery.js' has a '.js' extension - stripping it.", "File '/src/jquery.ts' does not exist.", "File '/src/jquery.tsx' does not exist.", diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json index 7c988b2ceec64..0dd18e2ff4e91 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json @@ -12,13 +12,13 @@ "File '/node_modules/foo/foo.js' exist - use it as a name resolution result.", "File '/node_modules/foo/foo.js' has an unsupported extension, so skipping it.", "Loading module as file / folder, candidate module location '/node_modules/foo/foo.js', target file type 'TypeScript'.", - "File '/node_modules/foo/foo.js.ts' does not exist.", - "File '/node_modules/foo/foo.js.tsx' does not exist.", - "File '/node_modules/foo/foo.js.d.ts' does not exist.", "File name '/node_modules/foo/foo.js' has a '.js' extension - stripping it.", "File '/node_modules/foo/foo.ts' does not exist.", "File '/node_modules/foo/foo.tsx' does not exist.", "File '/node_modules/foo/foo.d.ts' does not exist.", + "File '/node_modules/foo/foo.js.ts' does not exist.", + "File '/node_modules/foo/foo.js.tsx' does not exist.", + "File '/node_modules/foo/foo.js.d.ts' does not exist.", "Directory '/node_modules/foo/foo.js' does not exist, skipping all lookups in it.", "File '/node_modules/foo/index.ts' does not exist.", "File '/node_modules/foo/index.tsx' does not exist.", diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_withPaths.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_withPaths.trace.json index 85fa415976b99..5801adea97844 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_withPaths.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_withPaths.trace.json @@ -6,9 +6,6 @@ "Module name 'foo/test.js', matched pattern 'foo/*'.", "Trying substitution 'node_modules/foo/lib/*', candidate module location: 'node_modules/foo/lib/test.js'.", "Loading module as file / folder, candidate module location '/node_modules/foo/lib/test.js', target file type 'TypeScript'.", - "File '/node_modules/foo/lib/test.js.ts' does not exist.", - "File '/node_modules/foo/lib/test.js.tsx' does not exist.", - "File '/node_modules/foo/lib/test.js.d.ts' does not exist.", "File name '/node_modules/foo/lib/test.js' has a '.js' extension - stripping it.", "File '/node_modules/foo/lib/test.ts' does not exist.", "File '/node_modules/foo/lib/test.tsx' does not exist.", @@ -30,9 +27,6 @@ "======== Resolving module './relative.js' from '/test.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", "Loading module as file / folder, candidate module location '/relative.js', target file type 'TypeScript'.", - "File '/relative.js.ts' does not exist.", - "File '/relative.js.tsx' does not exist.", - "File '/relative.js.d.ts' does not exist.", "File name '/relative.js' has a '.js' extension - stripping it.", "File '/relative.ts' does not exist.", "File '/relative.tsx' does not exist.", diff --git a/tests/baselines/reference/moduleResolutionWithSuffixes_one_externalModule_withPaths.trace.json b/tests/baselines/reference/moduleResolutionWithSuffixes_one_externalModule_withPaths.trace.json index bb8df8b026651..13e30fece8208 100644 --- a/tests/baselines/reference/moduleResolutionWithSuffixes_one_externalModule_withPaths.trace.json +++ b/tests/baselines/reference/moduleResolutionWithSuffixes_one_externalModule_withPaths.trace.json @@ -33,9 +33,6 @@ "Module name 'some-library/index.js', matched pattern 'some-library/*'.", "Trying substitution 'node_modules/some-library/lib/*', candidate module location: 'node_modules/some-library/lib/index.js'.", "Loading module as file / folder, candidate module location '/node_modules/some-library/lib/index.js', target file type 'TypeScript'.", - "File '/node_modules/some-library/lib/index.js.ios.ts' does not exist.", - "File '/node_modules/some-library/lib/index.js.ios.tsx' does not exist.", - "File '/node_modules/some-library/lib/index.js.ios.d.ts' does not exist.", "File name '/node_modules/some-library/lib/index.js' has a '.js' extension - stripping it.", "File '/node_modules/some-library/lib/index.ios.ts' does not exist.", "File '/node_modules/some-library/lib/index.ios.tsx' does not exist.", diff --git a/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsModule.trace.json b/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsModule.trace.json index 473007233e556..943605d358b3b 100644 --- a/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsModule.trace.json +++ b/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsModule.trace.json @@ -2,17 +2,15 @@ "======== Resolving module './foo.js' from '/index.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", "Loading module as file / folder, candidate module location '/foo.js', target file type 'TypeScript'.", - "File '/foo.js.ios.ts' does not exist.", - "File '/foo.js.ios.tsx' does not exist.", - "File '/foo.js.ios.d.ts' does not exist.", "File name '/foo.js' has a '.js' extension - stripping it.", "File '/foo.ios.ts' does not exist.", "File '/foo.ios.tsx' does not exist.", "File '/foo.ios.d.ts' does not exist.", + "File '/foo.js.ios.ts' does not exist.", + "File '/foo.js.ios.tsx' does not exist.", + "File '/foo.js.ios.d.ts' does not exist.", "Directory '/foo.js' does not exist, skipping all lookups in it.", "Loading module as file / folder, candidate module location '/foo.js', target file type 'JavaScript'.", - "File '/foo.js.ios.js' does not exist.", - "File '/foo.js.ios.jsx' does not exist.", "File name '/foo.js' has a '.js' extension - stripping it.", "File '/foo.ios.js' exist - use it as a name resolution result.", "======== Module name './foo.js' was successfully resolved to '/foo.ios.js'. ========" diff --git a/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsonModule.trace.json b/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsonModule.trace.json index ed1b58abf25e5..c0a4ed04d5a6a 100644 --- a/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsonModule.trace.json +++ b/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsonModule.trace.json @@ -2,15 +2,13 @@ "======== Resolving module './foo.json' from '/index.ts'. ========", "Explicitly specified module resolution kind: 'NodeJs'.", "Loading module as file / folder, candidate module location '/foo.json', target file type 'TypeScript'.", + "File name '/foo.json' has a '.json' extension - stripping it.", + "File '/foo.json.ios.d.ts' does not exist.", "File '/foo.json.ios.ts' does not exist.", "File '/foo.json.ios.tsx' does not exist.", "File '/foo.json.ios.d.ts' does not exist.", - "File name '/foo.json' has a '.json' extension - stripping it.", - "File '/foo.json.ios.d.ts' does not exist.", "Directory '/foo.json' does not exist, skipping all lookups in it.", "Loading module as file / folder, candidate module location '/foo.json', target file type 'JavaScript'.", - "File '/foo.json.ios.js' does not exist.", - "File '/foo.json.ios.jsx' does not exist.", "File name '/foo.json' has a '.json' extension - stripping it.", "File '/foo.ios.json' exist - use it as a name resolution result.", "======== Module name './foo.json' was successfully resolved to '/foo.ios.json'. ========" diff --git a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json index cf2b1082bf88f..7b4a32446f05f 100644 --- a/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json +++ b/tests/baselines/reference/moduleResolution_packageJson_yesAtPackageRoot_mainFieldInSubDirectory.trace.json @@ -12,9 +12,6 @@ "'package.json' has 'main' field 'src/index.js' that references '/node_modules/foo/src/index.js'.", "File '/node_modules/foo/src/index.js' does not exist.", "Loading module as file / folder, candidate module location '/node_modules/foo/src/index.js', target file type 'TypeScript'.", - "File '/node_modules/foo/src/index.js.ts' does not exist.", - "File '/node_modules/foo/src/index.js.tsx' does not exist.", - "File '/node_modules/foo/src/index.js.d.ts' does not exist.", "File name '/node_modules/foo/src/index.js' has a '.js' extension - stripping it.", "File '/node_modules/foo/src/index.ts' does not exist.", "File '/node_modules/foo/src/index.tsx' does not exist.", diff --git a/tests/baselines/reference/packageJsonMain.trace.json b/tests/baselines/reference/packageJsonMain.trace.json index e5ae23f1d011a..3047b8a92325a 100644 --- a/tests/baselines/reference/packageJsonMain.trace.json +++ b/tests/baselines/reference/packageJsonMain.trace.json @@ -44,13 +44,13 @@ "File '/node_modules/bar/rab.js' exist - use it as a name resolution result.", "File '/node_modules/bar/rab.js' has an unsupported extension, so skipping it.", "Loading module as file / folder, candidate module location '/node_modules/bar/rab.js', target file type 'TypeScript'.", - "File '/node_modules/bar/rab.js.ts' does not exist.", - "File '/node_modules/bar/rab.js.tsx' does not exist.", - "File '/node_modules/bar/rab.js.d.ts' does not exist.", "File name '/node_modules/bar/rab.js' has a '.js' extension - stripping it.", "File '/node_modules/bar/rab.ts' does not exist.", "File '/node_modules/bar/rab.tsx' does not exist.", "File '/node_modules/bar/rab.d.ts' does not exist.", + "File '/node_modules/bar/rab.js.ts' does not exist.", + "File '/node_modules/bar/rab.js.tsx' does not exist.", + "File '/node_modules/bar/rab.js.d.ts' does not exist.", "Directory '/node_modules/bar/rab.js' does not exist, skipping all lookups in it.", "File '/node_modules/bar/index.ts' does not exist.", "File '/node_modules/bar/index.tsx' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtensionInName.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtensionInName.trace.json index c23f61c1c3e2c..ae357af395c40 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtensionInName.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtensionInName.trace.json @@ -6,13 +6,13 @@ "Module name 'zone.js', matched pattern '*'.", "Trying substitution 'foo/*', candidate module location: 'foo/zone.js'.", "Loading module as file / folder, candidate module location '/foo/zone.js', target file type 'TypeScript'.", - "File '/foo/zone.js.ts' does not exist.", - "File '/foo/zone.js.tsx' does not exist.", - "File '/foo/zone.js.d.ts' does not exist.", "File name '/foo/zone.js' has a '.js' extension - stripping it.", "File '/foo/zone.ts' does not exist.", "File '/foo/zone.tsx' does not exist.", "File '/foo/zone.d.ts' does not exist.", + "File '/foo/zone.js.ts' does not exist.", + "File '/foo/zone.js.tsx' does not exist.", + "File '/foo/zone.js.d.ts' does not exist.", "File '/foo/zone.js/package.json' does not exist.", "File '/foo/zone.js/index.ts' does not exist.", "File '/foo/zone.js/index.tsx' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.trace.json index 2597e6ac2eb84..8dc54639e8c5c 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.trace.json @@ -6,25 +6,25 @@ "Module name 'foo/bar/foobar.js', matched pattern '*'.", "Trying substitution 'node_modules/*', candidate module location: 'node_modules/foo/bar/foobar.js'.", "Loading module as file / folder, candidate module location '/node_modules/foo/bar/foobar.js', target file type 'TypeScript'.", - "File '/node_modules/foo/bar/foobar.js.ts' does not exist.", - "File '/node_modules/foo/bar/foobar.js.tsx' does not exist.", - "File '/node_modules/foo/bar/foobar.js.d.ts' does not exist.", "File name '/node_modules/foo/bar/foobar.js' has a '.js' extension - stripping it.", "File '/node_modules/foo/bar/foobar.ts' does not exist.", "File '/node_modules/foo/bar/foobar.tsx' does not exist.", "File '/node_modules/foo/bar/foobar.d.ts' does not exist.", + "File '/node_modules/foo/bar/foobar.js.ts' does not exist.", + "File '/node_modules/foo/bar/foobar.js.tsx' does not exist.", + "File '/node_modules/foo/bar/foobar.js.d.ts' does not exist.", "Directory '/node_modules/foo/bar/foobar.js' does not exist, skipping all lookups in it.", "Trying substitution 'src/types', candidate module location: 'src/types'.", "Loading module as file / folder, candidate module location '/src/types', target file type 'TypeScript'.", "Loading module 'foo/bar/foobar.js' from 'node_modules' folder, target file type 'TypeScript'.", "File '/node_modules/foo/package.json' does not exist.", - "File '/node_modules/foo/bar/foobar.js.ts' does not exist.", - "File '/node_modules/foo/bar/foobar.js.tsx' does not exist.", - "File '/node_modules/foo/bar/foobar.js.d.ts' does not exist.", "File name '/node_modules/foo/bar/foobar.js' has a '.js' extension - stripping it.", "File '/node_modules/foo/bar/foobar.ts' does not exist.", "File '/node_modules/foo/bar/foobar.tsx' does not exist.", "File '/node_modules/foo/bar/foobar.d.ts' does not exist.", + "File '/node_modules/foo/bar/foobar.js.ts' does not exist.", + "File '/node_modules/foo/bar/foobar.js.tsx' does not exist.", + "File '/node_modules/foo/bar/foobar.js.d.ts' does not exist.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", "File name '/node_modules/@types/foo/bar/foobar.js' has a '.js' extension - stripping it.", "'baseUrl' option is set to '/', using this value to resolve non-relative module name 'foo/bar/foobar.js'.", @@ -32,8 +32,6 @@ "Module name 'foo/bar/foobar.js', matched pattern '*'.", "Trying substitution 'node_modules/*', candidate module location: 'node_modules/foo/bar/foobar.js'.", "Loading module as file / folder, candidate module location '/node_modules/foo/bar/foobar.js', target file type 'JavaScript'.", - "File '/node_modules/foo/bar/foobar.js.js' does not exist.", - "File '/node_modules/foo/bar/foobar.js.jsx' does not exist.", "File name '/node_modules/foo/bar/foobar.js' has a '.js' extension - stripping it.", "File '/node_modules/foo/bar/foobar.js' exist - use it as a name resolution result.", "File '/node_modules/foo/package.json' does not exist according to earlier cached lookups.", diff --git a/tests/baselines/reference/requireOfJsonFile_PathMapping.trace.json b/tests/baselines/reference/requireOfJsonFile_PathMapping.trace.json index e13cc91a3da29..8744a83f6b5a1 100644 --- a/tests/baselines/reference/requireOfJsonFile_PathMapping.trace.json +++ b/tests/baselines/reference/requireOfJsonFile_PathMapping.trace.json @@ -6,21 +6,21 @@ "Module name 'foo/bar/foobar.json', matched pattern '*'.", "Trying substitution 'node_modules/*', candidate module location: 'node_modules/foo/bar/foobar.json'.", "Loading module as file / folder, candidate module location '/node_modules/foo/bar/foobar.json', target file type 'TypeScript'.", + "File name '/node_modules/foo/bar/foobar.json' has a '.json' extension - stripping it.", + "File '/node_modules/foo/bar/foobar.json.d.ts' does not exist.", "File '/node_modules/foo/bar/foobar.json.ts' does not exist.", "File '/node_modules/foo/bar/foobar.json.tsx' does not exist.", "File '/node_modules/foo/bar/foobar.json.d.ts' does not exist.", - "File name '/node_modules/foo/bar/foobar.json' has a '.json' extension - stripping it.", - "File '/node_modules/foo/bar/foobar.json.d.ts' does not exist.", "Directory '/node_modules/foo/bar/foobar.json' does not exist, skipping all lookups in it.", "Trying substitution 'src/types', candidate module location: 'src/types'.", "Loading module as file / folder, candidate module location '/src/types', target file type 'TypeScript'.", "Loading module 'foo/bar/foobar.json' from 'node_modules' folder, target file type 'TypeScript'.", "File '/node_modules/foo/package.json' does not exist.", + "File name '/node_modules/foo/bar/foobar.json' has a '.json' extension - stripping it.", + "File '/node_modules/foo/bar/foobar.json.d.ts' does not exist.", "File '/node_modules/foo/bar/foobar.json.ts' does not exist.", "File '/node_modules/foo/bar/foobar.json.tsx' does not exist.", "File '/node_modules/foo/bar/foobar.json.d.ts' does not exist.", - "File name '/node_modules/foo/bar/foobar.json' has a '.json' extension - stripping it.", - "File '/node_modules/foo/bar/foobar.json.d.ts' does not exist.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", "File name '/node_modules/@types/foo/bar/foobar.json' has a '.json' extension - stripping it.", "'baseUrl' option is set to '/', using this value to resolve non-relative module name 'foo/bar/foobar.json'.", @@ -28,8 +28,6 @@ "Module name 'foo/bar/foobar.json', matched pattern '*'.", "Trying substitution 'node_modules/*', candidate module location: 'node_modules/foo/bar/foobar.json'.", "Loading module as file / folder, candidate module location '/node_modules/foo/bar/foobar.json', target file type 'JavaScript'.", - "File '/node_modules/foo/bar/foobar.json.js' does not exist.", - "File '/node_modules/foo/bar/foobar.json.jsx' does not exist.", "File name '/node_modules/foo/bar/foobar.json' has a '.json' extension - stripping it.", "File '/node_modules/foo/bar/foobar.json' exist - use it as a name resolution result.", "File '/node_modules/foo/package.json' does not exist according to earlier cached lookups.", diff --git a/tests/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-preserveSymlinks.js b/tests/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-preserveSymlinks.js index 7b22f14418075..341ad7d5c6f1c 100644 --- a/tests/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-preserveSymlinks.js @@ -70,9 +70,6 @@ File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' exist - use it as a name resolution result. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has an unsupported extension, so skipping it. Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/index.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.ts' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.tsx' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.d.ts' does not exist. File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist. diff --git a/tests/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly.js b/tests/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly.js index 9f0d8d6ff0532..abfe669f3dabe 100644 --- a/tests/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly.js +++ b/tests/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly.js @@ -70,9 +70,6 @@ File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' exist - use it as a name resolution result. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has an unsupported extension, so skipping it. Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/index.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.ts' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.tsx' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.d.ts' does not exist. File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist. diff --git a/tests/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js b/tests/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js index f56626112030d..a83b038320a17 100644 --- a/tests/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js +++ b/tests/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js @@ -55,9 +55,6 @@ Output:: ======== Resolving module './const.js' from '/user/username/projects/myproject/packages/pkg2/index.ts'. ======== Module resolution kind is not specified, using 'NodeJs'. Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/const.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/packages/pkg2/const.js.ts' does not exist. -File '/user/username/projects/myproject/packages/pkg2/const.js.tsx' does not exist. -File '/user/username/projects/myproject/packages/pkg2/const.js.d.ts' does not exist. File name '/user/username/projects/myproject/packages/pkg2/const.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/packages/pkg2/const.ts' exist - use it as a name resolution result. ======== Module name './const.js' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/const.ts'. ======== @@ -81,9 +78,6 @@ File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' exist - use it as a name resolution result. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has an unsupported extension, so skipping it. Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/index.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.ts' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.tsx' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.d.ts' does not exist. File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist. @@ -94,9 +88,6 @@ Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/bui Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'. Module resolution kind is not specified, using 'NodeJs'. Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/build/const.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/packages/pkg2/build/const.js.ts' does not exist. -File '/user/username/projects/myproject/packages/pkg2/build/const.js.tsx' does not exist. -File '/user/username/projects/myproject/packages/pkg2/build/const.js.d.ts' does not exist. File name '/user/username/projects/myproject/packages/pkg2/build/const.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/packages/pkg2/build/const.ts' does not exist. File '/user/username/projects/myproject/packages/pkg2/build/const.tsx' does not exist. @@ -318,9 +309,6 @@ File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/other.js' exist - use it as a name resolution result. File '/user/username/projects/myproject/node_modules/pkg2/build/other.js' has an unsupported extension, so skipping it. Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/other.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/node_modules/pkg2/build/other.js.ts' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/other.js.tsx' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/other.js.d.ts' does not exist. File name '/user/username/projects/myproject/node_modules/pkg2/build/other.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/node_modules/pkg2/build/other.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/other.tsx' does not exist. @@ -410,9 +398,6 @@ File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' exist - use it as a name resolution result. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has an unsupported extension, so skipping it. Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/index.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.ts' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.tsx' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.d.ts' does not exist. File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist. @@ -423,9 +408,6 @@ Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/bui Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'. Module resolution kind is not specified, using 'NodeJs'. Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/build/const.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/packages/pkg2/build/const.js.ts' does not exist. -File '/user/username/projects/myproject/packages/pkg2/build/const.js.tsx' does not exist. -File '/user/username/projects/myproject/packages/pkg2/build/const.js.d.ts' does not exist. File name '/user/username/projects/myproject/packages/pkg2/build/const.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/packages/pkg2/build/const.ts' does not exist. File '/user/username/projects/myproject/packages/pkg2/build/const.tsx' does not exist. diff --git a/tests/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js b/tests/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js index b6c00656975f4..7859cbeee8291 100644 --- a/tests/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js +++ b/tests/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js @@ -311,9 +311,6 @@ File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' exist - use it as a name resolution result. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has an unsupported extension, so skipping it. Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/index.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.ts' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.tsx' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.d.ts' does not exist. File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist. @@ -538,9 +535,6 @@ File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' exist - use it as a name resolution result. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has an unsupported extension, so skipping it. Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/index.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.ts' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.tsx' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.d.ts' does not exist. File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist. @@ -645,9 +639,6 @@ Output:: Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'node', 'require', 'types'. Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/const.cjs', target file type 'TypeScript'. -File '/user/username/projects/myproject/packages/pkg2/const.cjs.ts' does not exist. -File '/user/username/projects/myproject/packages/pkg2/const.cjs.tsx' does not exist. -File '/user/username/projects/myproject/packages/pkg2/const.cjs.d.ts' does not exist. File name '/user/username/projects/myproject/packages/pkg2/const.cjs' has a '.cjs' extension - stripping it. File '/user/username/projects/myproject/packages/pkg2/const.cts' exist - use it as a name resolution result. ======== Module name './const.cjs' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/const.cts'. ======== @@ -678,9 +669,6 @@ File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.cjs' exist - use it as a name resolution result. File '/user/username/projects/myproject/node_modules/pkg2/build/index.cjs' has an unsupported extension, so skipping it. Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/index.cjs', target file type 'TypeScript'. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.cjs.ts' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.cjs.tsx' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.cjs.d.ts' does not exist. File name '/user/username/projects/myproject/node_modules/pkg2/build/index.cjs' has a '.cjs' extension - stripping it. File '/user/username/projects/myproject/node_modules/pkg2/build/index.cts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.cts' exist - use it as a name resolution result. @@ -691,9 +679,6 @@ Using compiler options of project reference redirect '/user/username/projects/my Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'node', 'require', 'types'. Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/build/const.cjs', target file type 'TypeScript'. -File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.ts' does not exist. -File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.tsx' does not exist. -File '/user/username/projects/myproject/packages/pkg2/build/const.cjs.d.ts' does not exist. File name '/user/username/projects/myproject/packages/pkg2/build/const.cjs' has a '.cjs' extension - stripping it. File '/user/username/projects/myproject/packages/pkg2/build/const.cts' does not exist. File '/user/username/projects/myproject/packages/pkg2/build/const.d.cts' exist - use it as a name resolution result. diff --git a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link-moduleCaseChange.js b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link-moduleCaseChange.js index 49ea0557cde35..a3742f5625ac6 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link-moduleCaseChange.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link-moduleCaseChange.js @@ -102,9 +102,6 @@ File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two.d.ts' 'package.json' has 'main' field 'dist/commonjs/index.js' that references '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js'. File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js' does not exist. Loading module as file / folder, candidate module location '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js.ts' does not exist. -File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js.tsx' does not exist. -File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js.d.ts' does not exist. File name '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.ts' does not exist. File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.tsx' does not exist. diff --git a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js index 5a03c9782e184..3c0f60dc3b9f8 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js @@ -102,9 +102,6 @@ File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two.d.ts' 'package.json' has 'main' field 'dist/commonjs/index.js' that references '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js'. File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js' does not exist. Loading module as file / folder, candidate module location '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js.ts' does not exist. -File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js.tsx' does not exist. -File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js.d.ts' does not exist. File name '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.ts' does not exist. File '/user/username/projects/myproject/plugin-one/node_modules/plugin-two/dist/commonjs/index.tsx' does not exist. diff --git a/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js b/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js index 14cf44aff96ae..4186759ac07ed 100644 --- a/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js +++ b/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js @@ -161,18 +161,18 @@ File '/user/username/projects/myproject/package.json' exists according to earlie Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'node', 'require', 'types'. Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. -File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. File '/user/username/projects/myproject/src/fileB.mts' does not exist. File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'JavaScript'. -File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. File '/user/username/projects/myproject/src/fileB.mjs' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations @@ -381,18 +381,18 @@ File '/package.json' does not exist according to earlier cached lookups. Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'node', 'require', 'types'. Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. -File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. File '/user/username/projects/myproject/src/fileB.mts' does not exist. File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'JavaScript'. -File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. File '/user/username/projects/myproject/src/fileB.mjs' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations diff --git a/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited.js b/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited.js index 8144af275245e..5ac2efe576b13 100644 --- a/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited.js +++ b/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited.js @@ -47,18 +47,18 @@ FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileA.ts Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'node', 'require', 'types'. Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. -File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. File '/user/username/projects/myproject/src/fileB.mts' does not exist. File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'JavaScript'. -File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. File '/user/username/projects/myproject/src/fileB.mjs' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations @@ -275,18 +275,18 @@ File '/user/username/projects/myproject/package.json' exists according to earlie Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'node', 'require', 'types'. Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. -File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. File '/user/username/projects/myproject/src/fileB.mts' does not exist. File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'JavaScript'. -File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. File '/user/username/projects/myproject/src/fileB.mjs' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations @@ -588,18 +588,18 @@ File '/package.json' does not exist according to earlier cached lookups. Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'node', 'require', 'types'. Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. -File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. File '/user/username/projects/myproject/src/fileB.mts' does not exist. File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'JavaScript'. -File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. File '/user/username/projects/myproject/src/fileB.mjs' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. +File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations diff --git a/tests/baselines/reference/tscWatch/moduleResolution/watches-for-changes-to-package-json-main-fields.js b/tests/baselines/reference/tscWatch/moduleResolution/watches-for-changes-to-package-json-main-fields.js index 93c3f3fcb4802..692ee22aaf07e 100644 --- a/tests/baselines/reference/tscWatch/moduleResolution/watches-for-changes-to-package-json-main-fields.js +++ b/tests/baselines/reference/tscWatch/moduleResolution/watches-for-changes-to-package-json-main-fields.js @@ -56,9 +56,6 @@ File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. 'package.json' has 'main' field 'build/index.js' that references '/user/username/projects/myproject/node_modules/pkg2/build/index.js'. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' does not exist. Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/index.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.ts' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.tsx' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.d.ts' does not exist. File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist. @@ -68,9 +65,6 @@ Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/bui ======== Resolving module './const.js' from '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'. ======== Module resolution kind is not specified, using 'NodeJs'. Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/build/const.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/packages/pkg2/build/const.js.ts' does not exist. -File '/user/username/projects/myproject/packages/pkg2/build/const.js.tsx' does not exist. -File '/user/username/projects/myproject/packages/pkg2/build/const.js.d.ts' does not exist. File name '/user/username/projects/myproject/packages/pkg2/build/const.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/packages/pkg2/build/const.ts' does not exist. File '/user/username/projects/myproject/packages/pkg2/build/const.tsx' does not exist. @@ -171,9 +165,6 @@ File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. 'package.json' has 'main' field 'build/other.js' that references '/user/username/projects/myproject/node_modules/pkg2/build/other.js'. File '/user/username/projects/myproject/node_modules/pkg2/build/other.js' does not exist. Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/other.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/node_modules/pkg2/build/other.js.ts' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/other.js.tsx' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/other.js.d.ts' does not exist. File name '/user/username/projects/myproject/node_modules/pkg2/build/other.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/node_modules/pkg2/build/other.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/other.tsx' does not exist. @@ -265,9 +256,6 @@ File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. 'package.json' has 'main' field 'build/index.js' that references '/user/username/projects/myproject/node_modules/pkg2/build/index.js'. File '/user/username/projects/myproject/node_modules/pkg2/build/index.js' does not exist. Loading module as file / folder, candidate module location '/user/username/projects/myproject/node_modules/pkg2/build/index.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.ts' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.tsx' does not exist. -File '/user/username/projects/myproject/node_modules/pkg2/build/index.js.d.ts' does not exist. File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist. File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist. @@ -277,9 +265,6 @@ Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/bui ======== Resolving module './const.js' from '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'. ======== Module resolution kind is not specified, using 'NodeJs'. Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/build/const.js', target file type 'TypeScript'. -File '/user/username/projects/myproject/packages/pkg2/build/const.js.ts' does not exist. -File '/user/username/projects/myproject/packages/pkg2/build/const.js.tsx' does not exist. -File '/user/username/projects/myproject/packages/pkg2/build/const.js.d.ts' does not exist. File name '/user/username/projects/myproject/packages/pkg2/build/const.js' has a '.js' extension - stripping it. File '/user/username/projects/myproject/packages/pkg2/build/const.ts' does not exist. File '/user/username/projects/myproject/packages/pkg2/build/const.tsx' does not exist. diff --git a/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js b/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js index 79b1043dc47be..aea638ed4f748 100644 --- a/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js +++ b/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js @@ -246,38 +246,33 @@ Info 60 [00:01:36.000] ======== Resolving module './fileB.mjs' from '/user/use Info 61 [00:01:37.000] Module resolution kind is not specified, using 'Node16'. Info 62 [00:01:38.000] Resolving in CJS mode with conditions 'node', 'require', 'types'. Info 63 [00:01:39.000] Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. -Info 64 [00:01:40.000] File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. -Info 65 [00:01:41.000] File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. -Info 66 [00:01:42.000] File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. -Info 67 [00:01:43.000] File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -Info 68 [00:01:44.000] File '/user/username/projects/myproject/src/fileB.mts' exist - use it as a name resolution result. -Info 69 [00:01:45.000] ======== Module name './fileB.mjs' was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. ======== -Info 70 [00:01:46.000] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 0 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Failed Lookup Locations -Info 71 [00:01:47.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 0 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Failed Lookup Locations -Info 72 [00:01:48.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 73 [00:01:49.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 74 [00:01:50.000] File '/package.json' does not exist according to earlier cached lookups. -Info 75 [00:01:51.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 2 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms -Info 76 [00:01:52.000] Different program with same set of files -Info 77 [00:01:53.000] Running: *ensureProjectForOpenFiles* -Info 78 [00:01:54.000] Before ensureProjectForOpenFiles: -Info 79 [00:01:55.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 79 [00:01:56.000] Files (3) - -Info 79 [00:01:57.000] ----------------------------------------------- -Info 79 [00:01:58.000] Open files: -Info 79 [00:01:59.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 79 [00:02:00.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 79 [00:02:01.000] After ensureProjectForOpenFiles: -Info 80 [00:02:02.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 80 [00:02:03.000] Files (3) - -Info 80 [00:02:04.000] ----------------------------------------------- -Info 80 [00:02:05.000] Open files: -Info 80 [00:02:06.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 80 [00:02:07.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 80 [00:02:08.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts -Info 81 [00:02:09.000] event: +Info 64 [00:01:40.000] File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. +Info 65 [00:01:41.000] File '/user/username/projects/myproject/src/fileB.mts' exist - use it as a name resolution result. +Info 66 [00:01:42.000] ======== Module name './fileB.mjs' was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. ======== +Info 67 [00:01:43.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 68 [00:01:44.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 69 [00:01:45.000] File '/package.json' does not exist according to earlier cached lookups. +Info 70 [00:01:46.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 2 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms +Info 71 [00:01:47.000] Different program with same set of files +Info 72 [00:01:48.000] Running: *ensureProjectForOpenFiles* +Info 73 [00:01:49.000] Before ensureProjectForOpenFiles: +Info 74 [00:01:50.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 74 [00:01:51.000] Files (3) + +Info 74 [00:01:52.000] ----------------------------------------------- +Info 74 [00:01:53.000] Open files: +Info 74 [00:01:54.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 74 [00:01:55.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 74 [00:01:56.000] After ensureProjectForOpenFiles: +Info 75 [00:01:57.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 75 [00:01:58.000] Files (3) + +Info 75 [00:01:59.000] ----------------------------------------------- +Info 75 [00:02:00.000] Open files: +Info 75 [00:02:01.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 75 [00:02:02.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 75 [00:02:03.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts +Info 76 [00:02:04.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/user/username/projects/myproject/src/fileA.ts"]}} After running timeout callbacks @@ -298,14 +293,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 82 [00:02:10.000] request: +Info 77 [00:02:05.000] request: { "command": "geterr", "arguments": { @@ -336,8 +329,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -362,14 +353,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 83 [00:02:11.000] response: +Info 78 [00:02:06.000] response: { "responseRequired": false } @@ -392,14 +381,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 84 [00:02:12.000] event: +Info 79 [00:02:07.000] event: {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} After checking timeout queue length (1) and running @@ -420,8 +407,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -446,14 +431,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 85 [00:02:13.000] event: +Info 80 [00:02:08.000] event: {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[{"start":{"line":1,"offset":21},"end":{"line":1,"offset":34},"text":"The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"./fileB.mjs\")' call instead.\n To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field `\"type\": \"module\"` to '/user/username/projects/myproject/package.json'.","code":1479,"category":"error"}]}} Before running immediate callbacks and checking length (1) @@ -474,8 +457,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -500,16 +481,14 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 86 [00:02:14.000] event: +Info 81 [00:02:09.000] event: {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} -Info 87 [00:02:15.000] event: +Info 82 [00:02:10.000] event: {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":1}} Before running immediate callbacks and checking length (1) @@ -530,19 +509,17 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 88 [00:02:16.000] Modify package json file to add type module -Info 89 [00:02:20.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 90 [00:02:21.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 91 [00:02:22.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 92 [00:02:23.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file -Info 93 [00:02:24.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file +Info 83 [00:02:11.000] Modify package json file to add type module +Info 84 [00:02:15.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 85 [00:02:16.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 86 [00:02:17.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 87 [00:02:18.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file +Info 88 [00:02:19.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file Before running timeout callbacks //// [/user/username/projects/myproject/package.json] {"name":"app","version":"1.0.0","type":"module"} @@ -565,16 +542,14 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 94 [00:02:25.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 95 [00:02:26.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json -Info 96 [00:02:27.000] Scheduled: *ensureProjectForOpenFiles* +Info 89 [00:02:20.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 90 [00:02:21.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json +Info 91 [00:02:22.000] Scheduled: *ensureProjectForOpenFiles* After running timeout callbacks PolledWatches:: @@ -594,8 +569,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -620,56 +593,52 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 97 [00:02:28.000] Running: /user/username/projects/myproject/src/tsconfig.json -Info 98 [00:02:29.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json -Info 99 [00:02:30.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 100 [00:02:31.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 101 [00:02:32.000] File '/package.json' does not exist according to earlier cached lookups. -Info 102 [00:02:33.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 103 [00:02:34.000] Found 'package.json' at '/user/username/projects/myproject/package.json'. -Info 104 [00:02:35.000] 'package.json' does not have a 'typesVersions' field. -Info 105 [00:02:36.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 106 [00:02:37.000] File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups. -Info 107 [00:02:38.000] ======== Resolving module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts'. ======== -Info 108 [00:02:39.000] Module resolution kind is not specified, using 'Node16'. -Info 109 [00:02:40.000] Resolving in ESM mode with conditions 'node', 'import', 'types'. -Info 110 [00:02:41.000] Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. -Info 111 [00:02:42.000] File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -Info 112 [00:02:43.000] File '/user/username/projects/myproject/src/fileB.mts' exist - use it as a name resolution result. -Info 113 [00:02:44.000] ======== Module name './fileB.mjs' was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. ======== -Info 114 [00:02:45.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 115 [00:02:46.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 116 [00:02:47.000] File '/package.json' does not exist according to earlier cached lookups. -Info 117 [00:02:48.000] DirectoryWatcher:: Close:: WatchInfo: /user/username/projects/myproject/src 0 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Failed Lookup Locations -Info 118 [00:02:49.000] Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /user/username/projects/myproject/src 0 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Failed Lookup Locations -Info 119 [00:02:50.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 3 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms -Info 120 [00:02:51.000] Different program with same set of files -Info 121 [00:02:52.000] Running: *ensureProjectForOpenFiles* -Info 122 [00:02:53.000] Before ensureProjectForOpenFiles: -Info 123 [00:02:54.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 123 [00:02:55.000] Files (3) - -Info 123 [00:02:56.000] ----------------------------------------------- -Info 123 [00:02:57.000] Open files: -Info 123 [00:02:58.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 123 [00:02:59.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 123 [00:03:00.000] After ensureProjectForOpenFiles: -Info 124 [00:03:01.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 124 [00:03:02.000] Files (3) - -Info 124 [00:03:03.000] ----------------------------------------------- -Info 124 [00:03:04.000] Open files: -Info 124 [00:03:05.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 124 [00:03:06.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 124 [00:03:07.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts -Info 125 [00:03:08.000] event: +Info 92 [00:02:23.000] Running: /user/username/projects/myproject/src/tsconfig.json +Info 93 [00:02:24.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json +Info 94 [00:02:25.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 95 [00:02:26.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 96 [00:02:27.000] File '/package.json' does not exist according to earlier cached lookups. +Info 97 [00:02:28.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 98 [00:02:29.000] Found 'package.json' at '/user/username/projects/myproject/package.json'. +Info 99 [00:02:30.000] 'package.json' does not have a 'typesVersions' field. +Info 100 [00:02:31.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 101 [00:02:32.000] File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups. +Info 102 [00:02:33.000] ======== Resolving module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts'. ======== +Info 103 [00:02:34.000] Module resolution kind is not specified, using 'Node16'. +Info 104 [00:02:35.000] Resolving in ESM mode with conditions 'node', 'import', 'types'. +Info 105 [00:02:36.000] Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. +Info 106 [00:02:37.000] File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. +Info 107 [00:02:38.000] File '/user/username/projects/myproject/src/fileB.mts' exist - use it as a name resolution result. +Info 108 [00:02:39.000] ======== Module name './fileB.mjs' was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. ======== +Info 109 [00:02:40.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 110 [00:02:41.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 111 [00:02:42.000] File '/package.json' does not exist according to earlier cached lookups. +Info 112 [00:02:43.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 3 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms +Info 113 [00:02:44.000] Different program with same set of files +Info 114 [00:02:45.000] Running: *ensureProjectForOpenFiles* +Info 115 [00:02:46.000] Before ensureProjectForOpenFiles: +Info 116 [00:02:47.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 116 [00:02:48.000] Files (3) + +Info 116 [00:02:49.000] ----------------------------------------------- +Info 116 [00:02:50.000] Open files: +Info 116 [00:02:51.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 116 [00:02:52.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 116 [00:02:53.000] After ensureProjectForOpenFiles: +Info 117 [00:02:54.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 117 [00:02:55.000] Files (3) + +Info 117 [00:02:56.000] ----------------------------------------------- +Info 117 [00:02:57.000] Open files: +Info 117 [00:02:58.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 117 [00:02:59.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 117 [00:03:00.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts +Info 118 [00:03:01.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/user/username/projects/myproject/src/fileA.ts"]}} After running timeout callbacks @@ -695,7 +664,7 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 126 [00:03:09.000] request: +Info 119 [00:03:02.000] request: { "command": "geterr", "arguments": { @@ -755,7 +724,7 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 127 [00:03:10.000] response: +Info 120 [00:03:03.000] response: { "responseRequired": false } @@ -783,7 +752,7 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 128 [00:03:11.000] event: +Info 121 [00:03:04.000] event: {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} After checking timeout queue length (1) and running @@ -833,7 +802,7 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 129 [00:03:12.000] event: +Info 122 [00:03:05.000] event: {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} Before running immediate callbacks and checking length (1) @@ -883,9 +852,9 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 130 [00:03:13.000] event: +Info 123 [00:03:06.000] event: {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} -Info 131 [00:03:14.000] event: +Info 124 [00:03:07.000] event: {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":2}} Before running immediate callbacks and checking length (1) @@ -911,13 +880,13 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 132 [00:03:15.000] Delete package.json -Info 133 [00:03:17.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 134 [00:03:18.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 135 [00:03:19.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 136 [00:03:20.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file -Info 137 [00:03:21.000] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file -Info 138 [00:03:22.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file +Info 125 [00:03:08.000] Delete package.json +Info 126 [00:03:10.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 127 [00:03:11.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 128 [00:03:12.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 129 [00:03:13.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file +Info 130 [00:03:14.000] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file +Info 131 [00:03:15.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file Before running timeout callbacks //// [/user/username/projects/myproject/package.json] deleted @@ -943,9 +912,9 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 139 [00:03:23.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 140 [00:03:24.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json -Info 141 [00:03:25.000] Scheduled: *ensureProjectForOpenFiles* +Info 132 [00:03:16.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 133 [00:03:17.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json +Info 134 [00:03:18.000] Scheduled: *ensureProjectForOpenFiles* After running timeout callbacks PolledWatches:: @@ -994,48 +963,48 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 142 [00:03:26.000] Running: /user/username/projects/myproject/src/tsconfig.json -Info 143 [00:03:27.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json -Info 144 [00:03:28.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 145 [00:03:29.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 146 [00:03:30.000] File '/package.json' does not exist according to earlier cached lookups. -Info 147 [00:03:31.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 148 [00:03:32.000] File '/user/username/projects/myproject/package.json' does not exist. -Info 149 [00:03:33.000] File '/user/username/projects/package.json' does not exist. -Info 150 [00:03:34.000] File '/user/username/package.json' does not exist. -Info 151 [00:03:35.000] File '/user/package.json' does not exist. -Info 152 [00:03:36.000] File '/package.json' does not exist according to earlier cached lookups. -Info 153 [00:03:37.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 154 [00:03:38.000] File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. -Info 155 [00:03:39.000] File '/user/username/projects/package.json' does not exist according to earlier cached lookups. -Info 156 [00:03:40.000] File '/user/username/package.json' does not exist according to earlier cached lookups. -Info 157 [00:03:41.000] File '/user/package.json' does not exist according to earlier cached lookups. -Info 158 [00:03:42.000] File '/package.json' does not exist according to earlier cached lookups. -Info 159 [00:03:43.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 160 [00:03:44.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 161 [00:03:45.000] File '/package.json' does not exist according to earlier cached lookups. -Info 162 [00:03:46.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 163 [00:03:47.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 4 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms -Info 164 [00:03:48.000] Different program with same set of files -Info 165 [00:03:49.000] Running: *ensureProjectForOpenFiles* -Info 166 [00:03:50.000] Before ensureProjectForOpenFiles: -Info 167 [00:03:51.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 167 [00:03:52.000] Files (3) - -Info 167 [00:03:53.000] ----------------------------------------------- -Info 167 [00:03:54.000] Open files: -Info 167 [00:03:55.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 167 [00:03:56.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 167 [00:03:57.000] After ensureProjectForOpenFiles: -Info 168 [00:03:58.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 168 [00:03:59.000] Files (3) - -Info 168 [00:04:00.000] ----------------------------------------------- -Info 168 [00:04:01.000] Open files: -Info 168 [00:04:02.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 168 [00:04:03.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 168 [00:04:04.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts -Info 169 [00:04:05.000] event: +Info 135 [00:03:19.000] Running: /user/username/projects/myproject/src/tsconfig.json +Info 136 [00:03:20.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json +Info 137 [00:03:21.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 138 [00:03:22.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 139 [00:03:23.000] File '/package.json' does not exist according to earlier cached lookups. +Info 140 [00:03:24.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 141 [00:03:25.000] File '/user/username/projects/myproject/package.json' does not exist. +Info 142 [00:03:26.000] File '/user/username/projects/package.json' does not exist. +Info 143 [00:03:27.000] File '/user/username/package.json' does not exist. +Info 144 [00:03:28.000] File '/user/package.json' does not exist. +Info 145 [00:03:29.000] File '/package.json' does not exist according to earlier cached lookups. +Info 146 [00:03:30.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 147 [00:03:31.000] File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. +Info 148 [00:03:32.000] File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +Info 149 [00:03:33.000] File '/user/username/package.json' does not exist according to earlier cached lookups. +Info 150 [00:03:34.000] File '/user/package.json' does not exist according to earlier cached lookups. +Info 151 [00:03:35.000] File '/package.json' does not exist according to earlier cached lookups. +Info 152 [00:03:36.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 153 [00:03:37.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 154 [00:03:38.000] File '/package.json' does not exist according to earlier cached lookups. +Info 155 [00:03:39.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 156 [00:03:40.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 4 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms +Info 157 [00:03:41.000] Different program with same set of files +Info 158 [00:03:42.000] Running: *ensureProjectForOpenFiles* +Info 159 [00:03:43.000] Before ensureProjectForOpenFiles: +Info 160 [00:03:44.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 160 [00:03:45.000] Files (3) + +Info 160 [00:03:46.000] ----------------------------------------------- +Info 160 [00:03:47.000] Open files: +Info 160 [00:03:48.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 160 [00:03:49.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 160 [00:03:50.000] After ensureProjectForOpenFiles: +Info 161 [00:03:51.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 161 [00:03:52.000] Files (3) + +Info 161 [00:03:53.000] ----------------------------------------------- +Info 161 [00:03:54.000] Open files: +Info 161 [00:03:55.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 161 [00:03:56.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 161 [00:03:57.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts +Info 162 [00:03:58.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/user/username/projects/myproject/src/fileA.ts"]}} After running timeout callbacks @@ -1063,7 +1032,7 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 170 [00:04:06.000] request: +Info 163 [00:03:59.000] request: { "command": "geterr", "arguments": { @@ -1127,7 +1096,7 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 171 [00:04:07.000] response: +Info 164 [00:04:00.000] response: { "responseRequired": false } @@ -1157,7 +1126,7 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 172 [00:04:08.000] event: +Info 165 [00:04:01.000] event: {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} After checking timeout queue length (1) and running @@ -1211,7 +1180,7 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 173 [00:04:09.000] event: +Info 166 [00:04:02.000] event: {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[{"start":{"line":1,"offset":21},"end":{"line":1,"offset":34},"text":"The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"./fileB.mjs\")' call instead.\n To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ \"type\": \"module\" }`.","code":1479,"category":"error"}]}} Before running immediate callbacks and checking length (1) @@ -1265,9 +1234,9 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 174 [00:04:10.000] event: +Info 167 [00:04:03.000] event: {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} -Info 175 [00:04:11.000] event: +Info 168 [00:04:04.000] event: {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":3}} Before running immediate callbacks and checking length (1) @@ -1295,10 +1264,10 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 176 [00:04:12.000] Modify package json file to without type module -Info 177 [00:04:15.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 0:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 178 [00:04:16.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 179 [00:04:17.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 0:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 169 [00:04:05.000] Modify package json file to without type module +Info 170 [00:04:08.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 0:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 171 [00:04:09.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 172 [00:04:10.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 0:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution Before running timeout callbacks //// [/user/username/projects/myproject/package.json] {"name":"app","version":"1.0.0"} @@ -1328,9 +1297,9 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 180 [00:04:18.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 181 [00:04:19.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json -Info 182 [00:04:20.000] Scheduled: *ensureProjectForOpenFiles* +Info 173 [00:04:11.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 174 [00:04:12.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json +Info 175 [00:04:13.000] Scheduled: *ensureProjectForOpenFiles* After running timeout callbacks PolledWatches:: @@ -1383,53 +1352,48 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 183 [00:04:21.000] Running: /user/username/projects/myproject/src/tsconfig.json -Info 184 [00:04:22.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json -Info 185 [00:04:23.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 186 [00:04:24.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 187 [00:04:25.000] File '/package.json' does not exist according to earlier cached lookups. -Info 188 [00:04:26.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 189 [00:04:27.000] Found 'package.json' at '/user/username/projects/myproject/package.json'. -Info 190 [00:04:28.000] 'package.json' does not have a 'typesVersions' field. -Info 191 [00:04:29.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 192 [00:04:30.000] File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups. -Info 193 [00:04:31.000] ======== Resolving module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts'. ======== -Info 194 [00:04:32.000] Module resolution kind is not specified, using 'Node16'. -Info 195 [00:04:33.000] Resolving in CJS mode with conditions 'node', 'require', 'types'. -Info 196 [00:04:34.000] Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. -Info 197 [00:04:35.000] File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. -Info 198 [00:04:36.000] File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. -Info 199 [00:04:37.000] File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. -Info 200 [00:04:38.000] File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -Info 201 [00:04:39.000] File '/user/username/projects/myproject/src/fileB.mts' exist - use it as a name resolution result. -Info 202 [00:04:40.000] ======== Module name './fileB.mjs' was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. ======== -Info 203 [00:04:41.000] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 0 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Failed Lookup Locations -Info 204 [00:04:42.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 0 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Failed Lookup Locations -Info 205 [00:04:43.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 206 [00:04:44.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 207 [00:04:45.000] File '/package.json' does not exist according to earlier cached lookups. -Info 208 [00:04:46.000] FileWatcher:: Close:: WatchInfo: /user/username/projects/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 209 [00:04:47.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 5 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms -Info 210 [00:04:48.000] Different program with same set of files -Info 211 [00:04:49.000] Running: *ensureProjectForOpenFiles* -Info 212 [00:04:50.000] Before ensureProjectForOpenFiles: -Info 213 [00:04:51.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 213 [00:04:52.000] Files (3) - -Info 213 [00:04:53.000] ----------------------------------------------- -Info 213 [00:04:54.000] Open files: -Info 213 [00:04:55.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 213 [00:04:56.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 213 [00:04:57.000] After ensureProjectForOpenFiles: -Info 214 [00:04:58.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 214 [00:04:59.000] Files (3) - -Info 214 [00:05:00.000] ----------------------------------------------- -Info 214 [00:05:01.000] Open files: -Info 214 [00:05:02.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 214 [00:05:03.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 214 [00:05:04.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts -Info 215 [00:05:05.000] event: +Info 176 [00:04:14.000] Running: /user/username/projects/myproject/src/tsconfig.json +Info 177 [00:04:15.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json +Info 178 [00:04:16.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 179 [00:04:17.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 180 [00:04:18.000] File '/package.json' does not exist according to earlier cached lookups. +Info 181 [00:04:19.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 182 [00:04:20.000] Found 'package.json' at '/user/username/projects/myproject/package.json'. +Info 183 [00:04:21.000] 'package.json' does not have a 'typesVersions' field. +Info 184 [00:04:22.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 185 [00:04:23.000] File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups. +Info 186 [00:04:24.000] ======== Resolving module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts'. ======== +Info 187 [00:04:25.000] Module resolution kind is not specified, using 'Node16'. +Info 188 [00:04:26.000] Resolving in CJS mode with conditions 'node', 'require', 'types'. +Info 189 [00:04:27.000] Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. +Info 190 [00:04:28.000] File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. +Info 191 [00:04:29.000] File '/user/username/projects/myproject/src/fileB.mts' exist - use it as a name resolution result. +Info 192 [00:04:30.000] ======== Module name './fileB.mjs' was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. ======== +Info 193 [00:04:31.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 194 [00:04:32.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 195 [00:04:33.000] File '/package.json' does not exist according to earlier cached lookups. +Info 196 [00:04:34.000] FileWatcher:: Close:: WatchInfo: /user/username/projects/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 197 [00:04:35.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 5 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms +Info 198 [00:04:36.000] Different program with same set of files +Info 199 [00:04:37.000] Running: *ensureProjectForOpenFiles* +Info 200 [00:04:38.000] Before ensureProjectForOpenFiles: +Info 201 [00:04:39.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 201 [00:04:40.000] Files (3) + +Info 201 [00:04:41.000] ----------------------------------------------- +Info 201 [00:04:42.000] Open files: +Info 201 [00:04:43.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 201 [00:04:44.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 201 [00:04:45.000] After ensureProjectForOpenFiles: +Info 202 [00:04:46.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 202 [00:04:47.000] Files (3) + +Info 202 [00:04:48.000] ----------------------------------------------- +Info 202 [00:04:49.000] Open files: +Info 202 [00:04:50.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 202 [00:04:51.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 202 [00:04:52.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts +Info 203 [00:04:53.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/user/username/projects/myproject/src/fileA.ts"]}} After running timeout callbacks @@ -1450,14 +1414,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 216 [00:05:06.000] request: +Info 204 [00:04:54.000] request: { "command": "geterr", "arguments": { @@ -1488,8 +1450,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1514,14 +1474,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 217 [00:05:07.000] response: +Info 205 [00:04:55.000] response: { "responseRequired": false } @@ -1544,14 +1502,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 218 [00:05:08.000] event: +Info 206 [00:04:56.000] event: {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} After checking timeout queue length (1) and running @@ -1572,8 +1528,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1598,14 +1552,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 219 [00:05:09.000] event: +Info 207 [00:04:57.000] event: {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[{"start":{"line":1,"offset":21},"end":{"line":1,"offset":34},"text":"The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"./fileB.mjs\")' call instead.\n To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field `\"type\": \"module\"` to '/user/username/projects/myproject/package.json'.","code":1479,"category":"error"}]}} Before running immediate callbacks and checking length (1) @@ -1626,8 +1578,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1652,16 +1602,14 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 220 [00:05:10.000] event: +Info 208 [00:04:58.000] event: {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} -Info 221 [00:05:11.000] event: +Info 209 [00:04:59.000] event: {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":4}} Before running immediate callbacks and checking length (1) @@ -1682,17 +1630,15 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 222 [00:05:12.000] Delete package.json -Info 223 [00:05:14.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 224 [00:05:15.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 225 [00:05:16.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 210 [00:05:00.000] Delete package.json +Info 211 [00:05:02.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 212 [00:05:03.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 213 [00:05:04.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution Before running timeout callbacks //// [/user/username/projects/myproject/package.json] deleted @@ -1713,16 +1659,14 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 226 [00:05:17.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 227 [00:05:18.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json -Info 228 [00:05:19.000] Scheduled: *ensureProjectForOpenFiles* +Info 214 [00:05:05.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 215 [00:05:06.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json +Info 216 [00:05:07.000] Scheduled: *ensureProjectForOpenFiles* After running timeout callbacks PolledWatches:: @@ -1742,8 +1686,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1768,56 +1710,54 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 229 [00:05:20.000] Running: /user/username/projects/myproject/src/tsconfig.json -Info 230 [00:05:21.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json -Info 231 [00:05:22.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 232 [00:05:23.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 217 [00:05:08.000] Running: /user/username/projects/myproject/src/tsconfig.json +Info 218 [00:05:09.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json +Info 219 [00:05:10.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 220 [00:05:11.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 221 [00:05:12.000] File '/package.json' does not exist according to earlier cached lookups. +Info 222 [00:05:13.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 223 [00:05:14.000] File '/user/username/projects/myproject/package.json' does not exist. +Info 224 [00:05:15.000] File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +Info 225 [00:05:16.000] File '/user/username/package.json' does not exist according to earlier cached lookups. +Info 226 [00:05:17.000] File '/user/package.json' does not exist according to earlier cached lookups. +Info 227 [00:05:18.000] File '/package.json' does not exist according to earlier cached lookups. +Info 228 [00:05:19.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 229 [00:05:20.000] File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. +Info 230 [00:05:21.000] File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +Info 231 [00:05:22.000] File '/user/username/package.json' does not exist according to earlier cached lookups. +Info 232 [00:05:23.000] File '/user/package.json' does not exist according to earlier cached lookups. Info 233 [00:05:24.000] File '/package.json' does not exist according to earlier cached lookups. -Info 234 [00:05:25.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 235 [00:05:26.000] File '/user/username/projects/myproject/package.json' does not exist. -Info 236 [00:05:27.000] File '/user/username/projects/package.json' does not exist according to earlier cached lookups. -Info 237 [00:05:28.000] File '/user/username/package.json' does not exist according to earlier cached lookups. -Info 238 [00:05:29.000] File '/user/package.json' does not exist according to earlier cached lookups. -Info 239 [00:05:30.000] File '/package.json' does not exist according to earlier cached lookups. -Info 240 [00:05:31.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 241 [00:05:32.000] File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. -Info 242 [00:05:33.000] File '/user/username/projects/package.json' does not exist according to earlier cached lookups. -Info 243 [00:05:34.000] File '/user/username/package.json' does not exist according to earlier cached lookups. -Info 244 [00:05:35.000] File '/user/package.json' does not exist according to earlier cached lookups. -Info 245 [00:05:36.000] File '/package.json' does not exist according to earlier cached lookups. -Info 246 [00:05:37.000] Reusing resolution of module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. -Info 247 [00:05:38.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 248 [00:05:39.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 249 [00:05:40.000] File '/package.json' does not exist according to earlier cached lookups. -Info 250 [00:05:41.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 251 [00:05:42.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 6 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms -Info 252 [00:05:43.000] Different program with same set of files -Info 253 [00:05:44.000] Running: *ensureProjectForOpenFiles* -Info 254 [00:05:45.000] Before ensureProjectForOpenFiles: -Info 255 [00:05:46.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 255 [00:05:47.000] Files (3) - -Info 255 [00:05:48.000] ----------------------------------------------- -Info 255 [00:05:49.000] Open files: -Info 255 [00:05:50.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 255 [00:05:51.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 255 [00:05:52.000] After ensureProjectForOpenFiles: -Info 256 [00:05:53.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 256 [00:05:54.000] Files (3) - -Info 256 [00:05:55.000] ----------------------------------------------- -Info 256 [00:05:56.000] Open files: -Info 256 [00:05:57.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 256 [00:05:58.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 256 [00:05:59.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts -Info 257 [00:06:00.000] event: +Info 234 [00:05:25.000] Reusing resolution of module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. +Info 235 [00:05:26.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 236 [00:05:27.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 237 [00:05:28.000] File '/package.json' does not exist according to earlier cached lookups. +Info 238 [00:05:29.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 239 [00:05:30.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 6 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms +Info 240 [00:05:31.000] Different program with same set of files +Info 241 [00:05:32.000] Running: *ensureProjectForOpenFiles* +Info 242 [00:05:33.000] Before ensureProjectForOpenFiles: +Info 243 [00:05:34.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 243 [00:05:35.000] Files (3) + +Info 243 [00:05:36.000] ----------------------------------------------- +Info 243 [00:05:37.000] Open files: +Info 243 [00:05:38.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 243 [00:05:39.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 243 [00:05:40.000] After ensureProjectForOpenFiles: +Info 244 [00:05:41.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 244 [00:05:42.000] Files (3) + +Info 244 [00:05:43.000] ----------------------------------------------- +Info 244 [00:05:44.000] Open files: +Info 244 [00:05:45.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 244 [00:05:46.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 244 [00:05:47.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts +Info 245 [00:05:48.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/user/username/projects/myproject/src/fileA.ts"]}} After running timeout callbacks @@ -1840,14 +1780,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 258 [00:06:01.000] request: +Info 246 [00:05:49.000] request: { "command": "geterr", "arguments": { @@ -1880,8 +1818,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1908,14 +1844,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 259 [00:06:02.000] response: +Info 247 [00:05:50.000] response: { "responseRequired": false } @@ -1940,14 +1874,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 260 [00:06:03.000] event: +Info 248 [00:05:51.000] event: {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} After checking timeout queue length (1) and running @@ -1970,8 +1902,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1998,14 +1928,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 261 [00:06:04.000] event: +Info 249 [00:05:52.000] event: {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[{"start":{"line":1,"offset":21},"end":{"line":1,"offset":34},"text":"The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"./fileB.mjs\")' call instead.\n To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ \"type\": \"module\" }`.","code":1479,"category":"error"}]}} Before running immediate callbacks and checking length (1) @@ -2028,8 +1956,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -2056,16 +1982,14 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 262 [00:06:05.000] event: +Info 250 [00:05:53.000] event: {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} -Info 263 [00:06:06.000] event: +Info 251 [00:05:54.000] event: {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":5}} Before running immediate callbacks and checking length (1) @@ -2088,8 +2012,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: diff --git a/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited.js b/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited.js index e5bc763d8120c..3dcb8f377362e 100644 --- a/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited.js +++ b/tests/baselines/reference/tsserver/moduleResolution/package-json-file-is-edited.js @@ -75,27 +75,22 @@ Info 15 [00:00:42.000] ======== Resolving module './fileB.mjs' from '/user/use Info 16 [00:00:43.000] Module resolution kind is not specified, using 'Node16'. Info 17 [00:00:44.000] Resolving in CJS mode with conditions 'node', 'require', 'types'. Info 18 [00:00:45.000] Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. -Info 19 [00:00:46.000] File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. -Info 20 [00:00:47.000] File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. -Info 21 [00:00:48.000] File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. -Info 22 [00:00:49.000] File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -Info 23 [00:00:50.000] File '/user/username/projects/myproject/src/fileB.mts' exist - use it as a name resolution result. -Info 24 [00:00:51.000] ======== Module name './fileB.mjs' was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. ======== -Info 25 [00:00:52.000] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 0 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Failed Lookup Locations -Info 26 [00:00:53.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 0 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Failed Lookup Locations -Info 27 [00:00:54.000] File '/a/lib/package.json' does not exist. -Info 28 [00:00:55.000] File '/a/package.json' does not exist. -Info 29 [00:00:56.000] File '/package.json' does not exist. -Info 30 [00:00:57.000] FileWatcher:: Added:: WatchInfo: /a/lib/lib.es2016.full.d.ts 500 undefined WatchType: Closed Script info -Info 31 [00:00:58.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 32 [00:00:59.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 33 [00:01:00.000] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/node_modules/@types 1 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Type roots -Info 34 [00:01:01.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/node_modules/@types 1 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Type roots -Info 35 [00:01:02.000] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Type roots -Info 36 [00:01:03.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Type roots -Info 37 [00:01:04.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms -Info 38 [00:01:05.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 39 [00:01:06.000] Files (3) +Info 19 [00:00:46.000] File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. +Info 20 [00:00:47.000] File '/user/username/projects/myproject/src/fileB.mts' exist - use it as a name resolution result. +Info 21 [00:00:48.000] ======== Module name './fileB.mjs' was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. ======== +Info 22 [00:00:49.000] File '/a/lib/package.json' does not exist. +Info 23 [00:00:50.000] File '/a/package.json' does not exist. +Info 24 [00:00:51.000] File '/package.json' does not exist. +Info 25 [00:00:52.000] FileWatcher:: Added:: WatchInfo: /a/lib/lib.es2016.full.d.ts 500 undefined WatchType: Closed Script info +Info 26 [00:00:53.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 27 [00:00:54.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 28 [00:00:55.000] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/node_modules/@types 1 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Type roots +Info 29 [00:00:56.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/node_modules/@types 1 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Type roots +Info 30 [00:00:57.000] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Type roots +Info 31 [00:00:58.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Type roots +Info 32 [00:00:59.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 1 structureChanged: true structureIsReused:: Not Elapsed:: *ms +Info 33 [00:01:00.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 34 [00:01:01.000] Files (3) /a/lib/lib.es2016.full.d.ts /user/username/projects/myproject/src/fileB.mts /user/username/projects/myproject/src/fileA.ts @@ -110,21 +105,21 @@ Info 39 [00:01:06.000] Files (3) Matched by default include pattern '**/*' File is CommonJS module because '../package.json' does not have field "type" -Info 40 [00:01:07.000] ----------------------------------------------- -Info 41 [00:01:08.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file -Info 42 [00:01:09.000] event: +Info 35 [00:01:02.000] ----------------------------------------------- +Info 36 [00:01:03.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file +Info 37 [00:01:04.000] event: {"seq":0,"type":"event","event":"projectLoadingFinish","body":{"projectName":"/user/username/projects/myproject/src/tsconfig.json"}} -Info 43 [00:01:10.000] event: +Info 38 [00:01:05.000] event: {"seq":0,"type":"event","event":"telemetry","body":{"telemetryEventName":"projectInfo","payload":{"projectId":"f026568af42c61ce0537de8ee0fa07c9359a76dcfb046248ed49dc76c91e4a37","fileStats":{"js":0,"jsSize":0,"jsx":0,"jsxSize":0,"ts":2,"tsSize":68,"tsx":0,"tsxSize":0,"dts":1,"dtsSize":334,"deferred":0,"deferredSize":0},"compilerOptions":{"target":"es2016","module":"node16","outDir":"","traceResolution":true},"typeAcquisition":{"enable":false,"include":false,"exclude":false},"extends":false,"files":false,"include":false,"exclude":false,"compileOnSave":false,"configFileName":"tsconfig.json","projectType":"configured","languageServiceEnabled":true,"version":"FakeVersion"}}} -Info 44 [00:01:11.000] event: +Info 39 [00:01:06.000] event: {"seq":0,"type":"event","event":"configFileDiag","body":{"triggerFile":"/user/username/projects/myproject/src/fileA.ts","configFile":"/user/username/projects/myproject/src/tsconfig.json","diagnostics":[]}} -Info 45 [00:01:12.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 45 [00:01:13.000] Files (3) +Info 40 [00:01:07.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 40 [00:01:08.000] Files (3) -Info 45 [00:01:14.000] ----------------------------------------------- -Info 45 [00:01:15.000] Open files: -Info 45 [00:01:16.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 45 [00:01:17.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 40 [00:01:09.000] ----------------------------------------------- +Info 40 [00:01:10.000] Open files: +Info 40 [00:01:11.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 40 [00:01:12.000] Projects: /user/username/projects/myproject/src/tsconfig.json After request PolledWatches:: @@ -140,8 +135,6 @@ FsWatches:: {} /user/username/projects/myproject/src/fileb.mts: {} -/user/username/projects/myproject/src: - {} /a/lib/lib.es2016.full.d.ts: {} /user/username/projects/myproject/package.json: @@ -151,16 +144,16 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 45 [00:01:18.000] response: +Info 40 [00:01:13.000] response: { "responseRequired": false } -Info 46 [00:01:19.000] Modify package json file to add type module -Info 47 [00:01:23.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 48 [00:01:24.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 49 [00:01:25.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 50 [00:01:26.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file -Info 51 [00:01:27.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file +Info 41 [00:01:14.000] Modify package json file to add type module +Info 42 [00:01:18.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 43 [00:01:19.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 44 [00:01:20.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 45 [00:01:21.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file +Info 46 [00:01:22.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file Before running timeout callbacks //// [/user/username/projects/myproject/package.json] {"name":"app","version":"1.0.0","type":"module"} @@ -179,8 +172,6 @@ FsWatches:: {} /user/username/projects/myproject/src/fileb.mts: {} -/user/username/projects/myproject/src: - {} /a/lib/lib.es2016.full.d.ts: {} /user/username/projects/myproject/package.json: @@ -190,9 +181,9 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 52 [00:01:28.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 53 [00:01:29.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json -Info 54 [00:01:30.000] Scheduled: *ensureProjectForOpenFiles* +Info 47 [00:01:23.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 48 [00:01:24.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json +Info 49 [00:01:25.000] Scheduled: *ensureProjectForOpenFiles* After running timeout callbacks PolledWatches:: @@ -208,8 +199,6 @@ FsWatches:: {} /user/username/projects/myproject/src/fileb.mts: {} -/user/username/projects/myproject/src: - {} /a/lib/lib.es2016.full.d.ts: {} /user/username/projects/myproject/package.json: @@ -234,8 +223,6 @@ FsWatches:: {} /user/username/projects/myproject/src/fileb.mts: {} -/user/username/projects/myproject/src: - {} /a/lib/lib.es2016.full.d.ts: {} /user/username/projects/myproject/package.json: @@ -245,49 +232,47 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 55 [00:01:31.000] Running: /user/username/projects/myproject/src/tsconfig.json -Info 56 [00:01:32.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json -Info 57 [00:01:33.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 58 [00:01:34.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 59 [00:01:35.000] File '/package.json' does not exist according to earlier cached lookups. -Info 60 [00:01:36.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 61 [00:01:37.000] Found 'package.json' at '/user/username/projects/myproject/package.json'. -Info 62 [00:01:38.000] 'package.json' does not have a 'typesVersions' field. -Info 63 [00:01:39.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 64 [00:01:40.000] File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups. -Info 65 [00:01:41.000] ======== Resolving module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts'. ======== -Info 66 [00:01:42.000] Module resolution kind is not specified, using 'Node16'. -Info 67 [00:01:43.000] Resolving in ESM mode with conditions 'node', 'import', 'types'. -Info 68 [00:01:44.000] Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. -Info 69 [00:01:45.000] File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -Info 70 [00:01:46.000] File '/user/username/projects/myproject/src/fileB.mts' exist - use it as a name resolution result. -Info 71 [00:01:47.000] ======== Module name './fileB.mjs' was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. ======== -Info 72 [00:01:48.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 73 [00:01:49.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 74 [00:01:50.000] File '/package.json' does not exist according to earlier cached lookups. -Info 75 [00:01:51.000] DirectoryWatcher:: Close:: WatchInfo: /user/username/projects/myproject/src 0 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Failed Lookup Locations -Info 76 [00:01:52.000] Elapsed:: *ms DirectoryWatcher:: Close:: WatchInfo: /user/username/projects/myproject/src 0 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Failed Lookup Locations -Info 77 [00:01:53.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 2 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms -Info 78 [00:01:54.000] Different program with same set of files -Info 79 [00:01:55.000] Running: *ensureProjectForOpenFiles* -Info 80 [00:01:56.000] Before ensureProjectForOpenFiles: -Info 81 [00:01:57.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 81 [00:01:58.000] Files (3) - -Info 81 [00:01:59.000] ----------------------------------------------- -Info 81 [00:02:00.000] Open files: -Info 81 [00:02:01.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 81 [00:02:02.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 81 [00:02:03.000] After ensureProjectForOpenFiles: -Info 82 [00:02:04.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 82 [00:02:05.000] Files (3) - -Info 82 [00:02:06.000] ----------------------------------------------- -Info 82 [00:02:07.000] Open files: -Info 82 [00:02:08.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 82 [00:02:09.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 82 [00:02:10.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts -Info 83 [00:02:11.000] event: +Info 50 [00:01:26.000] Running: /user/username/projects/myproject/src/tsconfig.json +Info 51 [00:01:27.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json +Info 52 [00:01:28.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 53 [00:01:29.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 54 [00:01:30.000] File '/package.json' does not exist according to earlier cached lookups. +Info 55 [00:01:31.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 56 [00:01:32.000] Found 'package.json' at '/user/username/projects/myproject/package.json'. +Info 57 [00:01:33.000] 'package.json' does not have a 'typesVersions' field. +Info 58 [00:01:34.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 59 [00:01:35.000] File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups. +Info 60 [00:01:36.000] ======== Resolving module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts'. ======== +Info 61 [00:01:37.000] Module resolution kind is not specified, using 'Node16'. +Info 62 [00:01:38.000] Resolving in ESM mode with conditions 'node', 'import', 'types'. +Info 63 [00:01:39.000] Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. +Info 64 [00:01:40.000] File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. +Info 65 [00:01:41.000] File '/user/username/projects/myproject/src/fileB.mts' exist - use it as a name resolution result. +Info 66 [00:01:42.000] ======== Module name './fileB.mjs' was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. ======== +Info 67 [00:01:43.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 68 [00:01:44.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 69 [00:01:45.000] File '/package.json' does not exist according to earlier cached lookups. +Info 70 [00:01:46.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 2 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms +Info 71 [00:01:47.000] Different program with same set of files +Info 72 [00:01:48.000] Running: *ensureProjectForOpenFiles* +Info 73 [00:01:49.000] Before ensureProjectForOpenFiles: +Info 74 [00:01:50.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 74 [00:01:51.000] Files (3) + +Info 74 [00:01:52.000] ----------------------------------------------- +Info 74 [00:01:53.000] Open files: +Info 74 [00:01:54.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 74 [00:01:55.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 74 [00:01:56.000] After ensureProjectForOpenFiles: +Info 75 [00:01:57.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 75 [00:01:58.000] Files (3) + +Info 75 [00:01:59.000] ----------------------------------------------- +Info 75 [00:02:00.000] Open files: +Info 75 [00:02:01.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 75 [00:02:02.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 75 [00:02:03.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts +Info 76 [00:02:04.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/user/username/projects/myproject/src/fileA.ts"]}} After running timeout callbacks @@ -313,7 +298,7 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 84 [00:02:12.000] request: +Info 77 [00:02:05.000] request: { "command": "geterr", "arguments": { @@ -373,7 +358,7 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 85 [00:02:13.000] response: +Info 78 [00:02:06.000] response: { "responseRequired": false } @@ -401,7 +386,7 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 86 [00:02:14.000] event: +Info 79 [00:02:07.000] event: {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} After checking timeout queue length (1) and running @@ -451,7 +436,7 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 87 [00:02:15.000] event: +Info 80 [00:02:08.000] event: {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} Before running immediate callbacks and checking length (1) @@ -501,9 +486,9 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 88 [00:02:16.000] event: +Info 81 [00:02:09.000] event: {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} -Info 89 [00:02:17.000] event: +Info 82 [00:02:10.000] event: {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":1}} Before running immediate callbacks and checking length (1) @@ -529,12 +514,12 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 90 [00:02:18.000] Modify package json file to remove type module -Info 91 [00:02:22.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 92 [00:02:23.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 93 [00:02:24.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 94 [00:02:25.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file -Info 95 [00:02:26.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file +Info 83 [00:02:11.000] Modify package json file to remove type module +Info 84 [00:02:15.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 85 [00:02:16.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 86 [00:02:17.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 87 [00:02:18.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file +Info 88 [00:02:19.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 1:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file Before running timeout callbacks //// [/user/username/projects/myproject/package.json] {"name":"app","version":"1.0.0"} @@ -562,9 +547,9 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 96 [00:02:27.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 97 [00:02:28.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json -Info 98 [00:02:29.000] Scheduled: *ensureProjectForOpenFiles* +Info 89 [00:02:20.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 90 [00:02:21.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json +Info 91 [00:02:22.000] Scheduled: *ensureProjectForOpenFiles* After running timeout callbacks PolledWatches:: @@ -613,52 +598,47 @@ FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 99 [00:02:30.000] Running: /user/username/projects/myproject/src/tsconfig.json -Info 100 [00:02:31.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json -Info 101 [00:02:32.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 102 [00:02:33.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 103 [00:02:34.000] File '/package.json' does not exist according to earlier cached lookups. -Info 104 [00:02:35.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 105 [00:02:36.000] Found 'package.json' at '/user/username/projects/myproject/package.json'. -Info 106 [00:02:37.000] 'package.json' does not have a 'typesVersions' field. -Info 107 [00:02:38.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 108 [00:02:39.000] File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups. -Info 109 [00:02:40.000] ======== Resolving module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts'. ======== -Info 110 [00:02:41.000] Module resolution kind is not specified, using 'Node16'. -Info 111 [00:02:42.000] Resolving in CJS mode with conditions 'node', 'require', 'types'. -Info 112 [00:02:43.000] Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. -Info 113 [00:02:44.000] File '/user/username/projects/myproject/src/fileB.mjs.ts' does not exist. -Info 114 [00:02:45.000] File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. -Info 115 [00:02:46.000] File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. -Info 116 [00:02:47.000] File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -Info 117 [00:02:48.000] File '/user/username/projects/myproject/src/fileB.mts' exist - use it as a name resolution result. -Info 118 [00:02:49.000] ======== Module name './fileB.mjs' was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. ======== -Info 119 [00:02:50.000] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 0 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Failed Lookup Locations -Info 120 [00:02:51.000] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 0 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: Failed Lookup Locations -Info 121 [00:02:52.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 122 [00:02:53.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 123 [00:02:54.000] File '/package.json' does not exist according to earlier cached lookups. -Info 124 [00:02:55.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 3 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms -Info 125 [00:02:56.000] Different program with same set of files -Info 126 [00:02:57.000] Running: *ensureProjectForOpenFiles* -Info 127 [00:02:58.000] Before ensureProjectForOpenFiles: -Info 128 [00:02:59.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 128 [00:03:00.000] Files (3) - -Info 128 [00:03:01.000] ----------------------------------------------- -Info 128 [00:03:02.000] Open files: -Info 128 [00:03:03.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 128 [00:03:04.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 128 [00:03:05.000] After ensureProjectForOpenFiles: -Info 129 [00:03:06.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 129 [00:03:07.000] Files (3) - -Info 129 [00:03:08.000] ----------------------------------------------- -Info 129 [00:03:09.000] Open files: -Info 129 [00:03:10.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 129 [00:03:11.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 129 [00:03:12.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts -Info 130 [00:03:13.000] event: +Info 92 [00:02:23.000] Running: /user/username/projects/myproject/src/tsconfig.json +Info 93 [00:02:24.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json +Info 94 [00:02:25.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 95 [00:02:26.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 96 [00:02:27.000] File '/package.json' does not exist according to earlier cached lookups. +Info 97 [00:02:28.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 98 [00:02:29.000] Found 'package.json' at '/user/username/projects/myproject/package.json'. +Info 99 [00:02:30.000] 'package.json' does not have a 'typesVersions' field. +Info 100 [00:02:31.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 101 [00:02:32.000] File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups. +Info 102 [00:02:33.000] ======== Resolving module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts'. ======== +Info 103 [00:02:34.000] Module resolution kind is not specified, using 'Node16'. +Info 104 [00:02:35.000] Resolving in CJS mode with conditions 'node', 'require', 'types'. +Info 105 [00:02:36.000] Loading module as file / folder, candidate module location '/user/username/projects/myproject/src/fileB.mjs', target file type 'TypeScript'. +Info 106 [00:02:37.000] File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. +Info 107 [00:02:38.000] File '/user/username/projects/myproject/src/fileB.mts' exist - use it as a name resolution result. +Info 108 [00:02:39.000] ======== Module name './fileB.mjs' was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. ======== +Info 109 [00:02:40.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 110 [00:02:41.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 111 [00:02:42.000] File '/package.json' does not exist according to earlier cached lookups. +Info 112 [00:02:43.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 3 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms +Info 113 [00:02:44.000] Different program with same set of files +Info 114 [00:02:45.000] Running: *ensureProjectForOpenFiles* +Info 115 [00:02:46.000] Before ensureProjectForOpenFiles: +Info 116 [00:02:47.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 116 [00:02:48.000] Files (3) + +Info 116 [00:02:49.000] ----------------------------------------------- +Info 116 [00:02:50.000] Open files: +Info 116 [00:02:51.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 116 [00:02:52.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 116 [00:02:53.000] After ensureProjectForOpenFiles: +Info 117 [00:02:54.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 117 [00:02:55.000] Files (3) + +Info 117 [00:02:56.000] ----------------------------------------------- +Info 117 [00:02:57.000] Open files: +Info 117 [00:02:58.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 117 [00:02:59.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 117 [00:03:00.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts +Info 118 [00:03:01.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/user/username/projects/myproject/src/fileA.ts"]}} After running timeout callbacks @@ -679,14 +659,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 131 [00:03:14.000] request: +Info 119 [00:03:02.000] request: { "command": "geterr", "arguments": { @@ -717,8 +695,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -743,14 +719,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 132 [00:03:15.000] response: +Info 120 [00:03:03.000] response: { "responseRequired": false } @@ -773,14 +747,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 133 [00:03:16.000] event: +Info 121 [00:03:04.000] event: {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} After checking timeout queue length (1) and running @@ -801,8 +773,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -827,14 +797,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 134 [00:03:17.000] event: +Info 122 [00:03:05.000] event: {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[{"start":{"line":1,"offset":21},"end":{"line":1,"offset":34},"text":"The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"./fileB.mjs\")' call instead.\n To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field `\"type\": \"module\"` to '/user/username/projects/myproject/package.json'.","code":1479,"category":"error"}]}} Before running immediate callbacks and checking length (1) @@ -855,8 +823,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -881,16 +847,14 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 135 [00:03:18.000] event: +Info 123 [00:03:06.000] event: {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} -Info 136 [00:03:19.000] event: +Info 124 [00:03:07.000] event: {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":2}} Before running immediate callbacks and checking length (1) @@ -911,20 +875,18 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 137 [00:03:20.000] Delete package.json -Info 138 [00:03:22.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 139 [00:03:23.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 140 [00:03:24.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 141 [00:03:25.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file -Info 142 [00:03:26.000] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file -Info 143 [00:03:27.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file +Info 125 [00:03:08.000] Delete package.json +Info 126 [00:03:10.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 127 [00:03:11.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 128 [00:03:12.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 129 [00:03:13.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file +Info 130 [00:03:14.000] FileWatcher:: Close:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file +Info 131 [00:03:15.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 250 undefined WatchType: package.json file Before running timeout callbacks //// [/user/username/projects/myproject/package.json] deleted @@ -945,16 +907,14 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 144 [00:03:28.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 145 [00:03:29.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json -Info 146 [00:03:30.000] Scheduled: *ensureProjectForOpenFiles* +Info 132 [00:03:16.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 133 [00:03:17.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json +Info 134 [00:03:18.000] Scheduled: *ensureProjectForOpenFiles* After running timeout callbacks PolledWatches:: @@ -974,8 +934,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1000,56 +958,54 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 147 [00:03:31.000] Running: /user/username/projects/myproject/src/tsconfig.json -Info 148 [00:03:32.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json -Info 149 [00:03:33.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 150 [00:03:34.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 135 [00:03:19.000] Running: /user/username/projects/myproject/src/tsconfig.json +Info 136 [00:03:20.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json +Info 137 [00:03:21.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 138 [00:03:22.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 139 [00:03:23.000] File '/package.json' does not exist according to earlier cached lookups. +Info 140 [00:03:24.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 141 [00:03:25.000] File '/user/username/projects/myproject/package.json' does not exist. +Info 142 [00:03:26.000] File '/user/username/projects/package.json' does not exist. +Info 143 [00:03:27.000] File '/user/username/package.json' does not exist. +Info 144 [00:03:28.000] File '/user/package.json' does not exist. +Info 145 [00:03:29.000] File '/package.json' does not exist according to earlier cached lookups. +Info 146 [00:03:30.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 147 [00:03:31.000] File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. +Info 148 [00:03:32.000] File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +Info 149 [00:03:33.000] File '/user/username/package.json' does not exist according to earlier cached lookups. +Info 150 [00:03:34.000] File '/user/package.json' does not exist according to earlier cached lookups. Info 151 [00:03:35.000] File '/package.json' does not exist according to earlier cached lookups. -Info 152 [00:03:36.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 153 [00:03:37.000] File '/user/username/projects/myproject/package.json' does not exist. -Info 154 [00:03:38.000] File '/user/username/projects/package.json' does not exist. -Info 155 [00:03:39.000] File '/user/username/package.json' does not exist. -Info 156 [00:03:40.000] File '/user/package.json' does not exist. -Info 157 [00:03:41.000] File '/package.json' does not exist according to earlier cached lookups. -Info 158 [00:03:42.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 159 [00:03:43.000] File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. -Info 160 [00:03:44.000] File '/user/username/projects/package.json' does not exist according to earlier cached lookups. -Info 161 [00:03:45.000] File '/user/username/package.json' does not exist according to earlier cached lookups. -Info 162 [00:03:46.000] File '/user/package.json' does not exist according to earlier cached lookups. -Info 163 [00:03:47.000] File '/package.json' does not exist according to earlier cached lookups. -Info 164 [00:03:48.000] Reusing resolution of module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. -Info 165 [00:03:49.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 166 [00:03:50.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 167 [00:03:51.000] File '/package.json' does not exist according to earlier cached lookups. -Info 168 [00:03:52.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 169 [00:03:53.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 4 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms -Info 170 [00:03:54.000] Different program with same set of files -Info 171 [00:03:55.000] Running: *ensureProjectForOpenFiles* -Info 172 [00:03:56.000] Before ensureProjectForOpenFiles: -Info 173 [00:03:57.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 173 [00:03:58.000] Files (3) - -Info 173 [00:03:59.000] ----------------------------------------------- -Info 173 [00:04:00.000] Open files: -Info 173 [00:04:01.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 173 [00:04:02.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 173 [00:04:03.000] After ensureProjectForOpenFiles: -Info 174 [00:04:04.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 174 [00:04:05.000] Files (3) - -Info 174 [00:04:06.000] ----------------------------------------------- -Info 174 [00:04:07.000] Open files: -Info 174 [00:04:08.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 174 [00:04:09.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 174 [00:04:10.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts -Info 175 [00:04:11.000] event: +Info 152 [00:03:36.000] Reusing resolution of module './fileB.mjs' from '/user/username/projects/myproject/src/fileA.ts' of old program, it was successfully resolved to '/user/username/projects/myproject/src/fileB.mts'. +Info 153 [00:03:37.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 154 [00:03:38.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 155 [00:03:39.000] File '/package.json' does not exist according to earlier cached lookups. +Info 156 [00:03:40.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 157 [00:03:41.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 4 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms +Info 158 [00:03:42.000] Different program with same set of files +Info 159 [00:03:43.000] Running: *ensureProjectForOpenFiles* +Info 160 [00:03:44.000] Before ensureProjectForOpenFiles: +Info 161 [00:03:45.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 161 [00:03:46.000] Files (3) + +Info 161 [00:03:47.000] ----------------------------------------------- +Info 161 [00:03:48.000] Open files: +Info 161 [00:03:49.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 161 [00:03:50.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 161 [00:03:51.000] After ensureProjectForOpenFiles: +Info 162 [00:03:52.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 162 [00:03:53.000] Files (3) + +Info 162 [00:03:54.000] ----------------------------------------------- +Info 162 [00:03:55.000] Open files: +Info 162 [00:03:56.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 162 [00:03:57.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 162 [00:03:58.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts +Info 163 [00:03:59.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/user/username/projects/myproject/src/fileA.ts"]}} After running timeout callbacks @@ -1072,14 +1028,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 176 [00:04:12.000] request: +Info 164 [00:04:00.000] request: { "command": "geterr", "arguments": { @@ -1112,8 +1066,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1140,14 +1092,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 177 [00:04:13.000] response: +Info 165 [00:04:01.000] response: { "responseRequired": false } @@ -1172,14 +1122,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 178 [00:04:14.000] event: +Info 166 [00:04:02.000] event: {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} After checking timeout queue length (1) and running @@ -1202,8 +1150,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1230,14 +1176,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 179 [00:04:15.000] event: +Info 167 [00:04:03.000] event: {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[{"start":{"line":1,"offset":21},"end":{"line":1,"offset":34},"text":"The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"./fileB.mjs\")' call instead.\n To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ \"type\": \"module\" }`.","code":1479,"category":"error"}]}} Before running immediate callbacks and checking length (1) @@ -1260,8 +1204,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1288,16 +1230,14 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 180 [00:04:16.000] event: +Info 168 [00:04:04.000] event: {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} -Info 181 [00:04:17.000] event: +Info 169 [00:04:05.000] event: {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":3}} Before running immediate callbacks and checking length (1) @@ -1320,17 +1260,15 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 182 [00:04:18.000] Modify package json file to add type module -Info 183 [00:04:21.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 0:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 184 [00:04:22.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 185 [00:04:23.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 0:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 170 [00:04:06.000] Modify package json file to add type module +Info 171 [00:04:09.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 0:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 172 [00:04:10.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 173 [00:04:11.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 0:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution Before running timeout callbacks //// [/user/username/projects/myproject/package.json] {"name":"app","version":"1.0.0","type":"module"} @@ -1355,16 +1293,14 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 186 [00:04:24.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 187 [00:04:25.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json -Info 188 [00:04:26.000] Scheduled: *ensureProjectForOpenFiles* +Info 174 [00:04:12.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 175 [00:04:13.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json +Info 176 [00:04:14.000] Scheduled: *ensureProjectForOpenFiles* After running timeout callbacks PolledWatches:: @@ -1386,8 +1322,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1414,48 +1348,46 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 189 [00:04:27.000] Running: /user/username/projects/myproject/src/tsconfig.json -Info 190 [00:04:28.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json -Info 191 [00:04:29.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 192 [00:04:30.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 193 [00:04:31.000] File '/package.json' does not exist according to earlier cached lookups. -Info 194 [00:04:32.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 195 [00:04:33.000] Found 'package.json' at '/user/username/projects/myproject/package.json'. -Info 196 [00:04:34.000] 'package.json' does not have a 'typesVersions' field. -Info 197 [00:04:35.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 198 [00:04:36.000] File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups. -Info 199 [00:04:37.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 200 [00:04:38.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 201 [00:04:39.000] File '/package.json' does not exist according to earlier cached lookups. -Info 202 [00:04:40.000] FileWatcher:: Close:: WatchInfo: /user/username/projects/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 203 [00:04:41.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 5 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms -Info 204 [00:04:42.000] Different program with same set of files -Info 205 [00:04:43.000] Running: *ensureProjectForOpenFiles* -Info 206 [00:04:44.000] Before ensureProjectForOpenFiles: -Info 207 [00:04:45.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 207 [00:04:46.000] Files (3) - -Info 207 [00:04:47.000] ----------------------------------------------- -Info 207 [00:04:48.000] Open files: -Info 207 [00:04:49.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 207 [00:04:50.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 207 [00:04:51.000] After ensureProjectForOpenFiles: -Info 208 [00:04:52.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 208 [00:04:53.000] Files (3) - -Info 208 [00:04:54.000] ----------------------------------------------- -Info 208 [00:04:55.000] Open files: -Info 208 [00:04:56.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 208 [00:04:57.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 208 [00:04:58.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts -Info 209 [00:04:59.000] event: +Info 177 [00:04:15.000] Running: /user/username/projects/myproject/src/tsconfig.json +Info 178 [00:04:16.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json +Info 179 [00:04:17.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 180 [00:04:18.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 181 [00:04:19.000] File '/package.json' does not exist according to earlier cached lookups. +Info 182 [00:04:20.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 183 [00:04:21.000] Found 'package.json' at '/user/username/projects/myproject/package.json'. +Info 184 [00:04:22.000] 'package.json' does not have a 'typesVersions' field. +Info 185 [00:04:23.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 186 [00:04:24.000] File '/user/username/projects/myproject/package.json' exists according to earlier cached lookups. +Info 187 [00:04:25.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 188 [00:04:26.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 189 [00:04:27.000] File '/package.json' does not exist according to earlier cached lookups. +Info 190 [00:04:28.000] FileWatcher:: Close:: WatchInfo: /user/username/projects/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 191 [00:04:29.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 5 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms +Info 192 [00:04:30.000] Different program with same set of files +Info 193 [00:04:31.000] Running: *ensureProjectForOpenFiles* +Info 194 [00:04:32.000] Before ensureProjectForOpenFiles: +Info 195 [00:04:33.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 195 [00:04:34.000] Files (3) + +Info 195 [00:04:35.000] ----------------------------------------------- +Info 195 [00:04:36.000] Open files: +Info 195 [00:04:37.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 195 [00:04:38.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 195 [00:04:39.000] After ensureProjectForOpenFiles: +Info 196 [00:04:40.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 196 [00:04:41.000] Files (3) + +Info 196 [00:04:42.000] ----------------------------------------------- +Info 196 [00:04:43.000] Open files: +Info 196 [00:04:44.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 196 [00:04:45.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 196 [00:04:46.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts +Info 197 [00:04:47.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/user/username/projects/myproject/src/fileA.ts"]}} After running timeout callbacks @@ -1476,14 +1408,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 210 [00:05:00.000] request: +Info 198 [00:04:48.000] request: { "command": "geterr", "arguments": { @@ -1514,8 +1444,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1540,14 +1468,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 211 [00:05:01.000] response: +Info 199 [00:04:49.000] response: { "responseRequired": false } @@ -1570,14 +1496,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 212 [00:05:02.000] event: +Info 200 [00:04:50.000] event: {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} After checking timeout queue length (1) and running @@ -1598,8 +1522,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1624,14 +1546,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 213 [00:05:03.000] event: +Info 201 [00:04:51.000] event: {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} Before running immediate callbacks and checking length (1) @@ -1652,8 +1572,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1678,16 +1596,14 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 214 [00:05:04.000] event: +Info 202 [00:04:52.000] event: {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} -Info 215 [00:05:05.000] event: +Info 203 [00:04:53.000] event: {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":4}} Before running immediate callbacks and checking length (1) @@ -1708,17 +1624,15 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 216 [00:05:06.000] Delete package.json -Info 217 [00:05:08.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 218 [00:05:09.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 219 [00:05:10.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 204 [00:04:54.000] Delete package.json +Info 205 [00:04:56.000] FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 206 [00:04:57.000] Scheduled: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 207 [00:04:58.000] Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/package.json 2:: WatchInfo: /user/username/projects/myproject/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution Before running timeout callbacks //// [/user/username/projects/myproject/package.json] deleted @@ -1739,16 +1653,14 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 220 [00:05:11.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation -Info 221 [00:05:12.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json -Info 222 [00:05:13.000] Scheduled: *ensureProjectForOpenFiles* +Info 208 [00:04:59.000] Running: /user/username/projects/myproject/src/tsconfig.jsonFailedLookupInvalidation +Info 209 [00:05:00.000] Scheduled: /user/username/projects/myproject/src/tsconfig.json +Info 210 [00:05:01.000] Scheduled: *ensureProjectForOpenFiles* After running timeout callbacks PolledWatches:: @@ -1768,8 +1680,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1794,55 +1704,53 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 223 [00:05:14.000] Running: /user/username/projects/myproject/src/tsconfig.json -Info 224 [00:05:15.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json -Info 225 [00:05:16.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 226 [00:05:17.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 211 [00:05:02.000] Running: /user/username/projects/myproject/src/tsconfig.json +Info 212 [00:05:03.000] Starting updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json +Info 213 [00:05:04.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 214 [00:05:05.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 215 [00:05:06.000] File '/package.json' does not exist according to earlier cached lookups. +Info 216 [00:05:07.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 217 [00:05:08.000] File '/user/username/projects/myproject/package.json' does not exist. +Info 218 [00:05:09.000] File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +Info 219 [00:05:10.000] File '/user/username/package.json' does not exist according to earlier cached lookups. +Info 220 [00:05:11.000] File '/user/package.json' does not exist according to earlier cached lookups. +Info 221 [00:05:12.000] File '/package.json' does not exist according to earlier cached lookups. +Info 222 [00:05:13.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. +Info 223 [00:05:14.000] File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. +Info 224 [00:05:15.000] File '/user/username/projects/package.json' does not exist according to earlier cached lookups. +Info 225 [00:05:16.000] File '/user/username/package.json' does not exist according to earlier cached lookups. +Info 226 [00:05:17.000] File '/user/package.json' does not exist according to earlier cached lookups. Info 227 [00:05:18.000] File '/package.json' does not exist according to earlier cached lookups. -Info 228 [00:05:19.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 229 [00:05:20.000] File '/user/username/projects/myproject/package.json' does not exist. -Info 230 [00:05:21.000] File '/user/username/projects/package.json' does not exist according to earlier cached lookups. -Info 231 [00:05:22.000] File '/user/username/package.json' does not exist according to earlier cached lookups. -Info 232 [00:05:23.000] File '/user/package.json' does not exist according to earlier cached lookups. -Info 233 [00:05:24.000] File '/package.json' does not exist according to earlier cached lookups. -Info 234 [00:05:25.000] File '/user/username/projects/myproject/src/package.json' does not exist according to earlier cached lookups. -Info 235 [00:05:26.000] File '/user/username/projects/myproject/package.json' does not exist according to earlier cached lookups. -Info 236 [00:05:27.000] File '/user/username/projects/package.json' does not exist according to earlier cached lookups. -Info 237 [00:05:28.000] File '/user/username/package.json' does not exist according to earlier cached lookups. -Info 238 [00:05:29.000] File '/user/package.json' does not exist according to earlier cached lookups. -Info 239 [00:05:30.000] File '/package.json' does not exist according to earlier cached lookups. -Info 240 [00:05:31.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. -Info 241 [00:05:32.000] File '/a/package.json' does not exist according to earlier cached lookups. -Info 242 [00:05:33.000] File '/package.json' does not exist according to earlier cached lookups. -Info 243 [00:05:34.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution -Info 244 [00:05:35.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 6 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms -Info 245 [00:05:36.000] Different program with same set of files -Info 246 [00:05:37.000] Running: *ensureProjectForOpenFiles* -Info 247 [00:05:38.000] Before ensureProjectForOpenFiles: -Info 248 [00:05:39.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 248 [00:05:40.000] Files (3) - -Info 248 [00:05:41.000] ----------------------------------------------- -Info 248 [00:05:42.000] Open files: -Info 248 [00:05:43.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 248 [00:05:44.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 248 [00:05:45.000] After ensureProjectForOpenFiles: -Info 249 [00:05:46.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) -Info 249 [00:05:47.000] Files (3) - -Info 249 [00:05:48.000] ----------------------------------------------- -Info 249 [00:05:49.000] Open files: -Info 249 [00:05:50.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined -Info 249 [00:05:51.000] Projects: /user/username/projects/myproject/src/tsconfig.json -Info 249 [00:05:52.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts -Info 250 [00:05:53.000] event: +Info 228 [00:05:19.000] File '/a/lib/package.json' does not exist according to earlier cached lookups. +Info 229 [00:05:20.000] File '/a/package.json' does not exist according to earlier cached lookups. +Info 230 [00:05:21.000] File '/package.json' does not exist according to earlier cached lookups. +Info 231 [00:05:22.000] FileWatcher:: Added:: WatchInfo: /user/username/projects/package.json 2000 undefined Project: /user/username/projects/myproject/src/tsconfig.json WatchType: File location affecting resolution +Info 232 [00:05:23.000] Finishing updateGraphWorker: Project: /user/username/projects/myproject/src/tsconfig.json Version: 6 structureChanged: true structureIsReused:: SafeModules Elapsed:: *ms +Info 233 [00:05:24.000] Different program with same set of files +Info 234 [00:05:25.000] Running: *ensureProjectForOpenFiles* +Info 235 [00:05:26.000] Before ensureProjectForOpenFiles: +Info 236 [00:05:27.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 236 [00:05:28.000] Files (3) + +Info 236 [00:05:29.000] ----------------------------------------------- +Info 236 [00:05:30.000] Open files: +Info 236 [00:05:31.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 236 [00:05:32.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 236 [00:05:33.000] After ensureProjectForOpenFiles: +Info 237 [00:05:34.000] Project '/user/username/projects/myproject/src/tsconfig.json' (Configured) +Info 237 [00:05:35.000] Files (3) + +Info 237 [00:05:36.000] ----------------------------------------------- +Info 237 [00:05:37.000] Open files: +Info 237 [00:05:38.000] FileName: /user/username/projects/myproject/src/fileA.ts ProjectRootPath: undefined +Info 237 [00:05:39.000] Projects: /user/username/projects/myproject/src/tsconfig.json +Info 237 [00:05:40.000] got projects updated in background, updating diagnostics for /user/username/projects/myproject/src/fileA.ts +Info 238 [00:05:41.000] event: {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":["/user/username/projects/myproject/src/fileA.ts"]}} After running timeout callbacks @@ -1865,14 +1773,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 251 [00:05:54.000] request: +Info 239 [00:05:42.000] request: { "command": "geterr", "arguments": { @@ -1905,8 +1811,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -1933,14 +1837,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 252 [00:05:55.000] response: +Info 240 [00:05:43.000] response: { "responseRequired": false } @@ -1965,14 +1867,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 253 [00:05:56.000] event: +Info 241 [00:05:44.000] event: {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} After checking timeout queue length (1) and running @@ -1995,8 +1895,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -2023,14 +1921,12 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 254 [00:05:57.000] event: +Info 242 [00:05:45.000] event: {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[{"start":{"line":1,"offset":21},"end":{"line":1,"offset":34},"text":"The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"./fileB.mjs\")' call instead.\n To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ \"type\": \"module\" }`.","code":1479,"category":"error"}]}} Before running immediate callbacks and checking length (1) @@ -2053,8 +1949,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: @@ -2081,16 +1975,14 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: {} -Info 255 [00:05:58.000] event: +Info 243 [00:05:46.000] event: {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"/user/username/projects/myproject/src/fileA.ts","diagnostics":[]}} -Info 256 [00:05:59.000] event: +Info 244 [00:05:47.000] event: {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":5}} Before running immediate callbacks and checking length (1) @@ -2113,8 +2005,6 @@ FsWatches:: {} /user/username/projects/myproject/package.json: {} -/user/username/projects/myproject/src: - {} FsWatchesRecursive:: /user/username/projects/myproject/src: diff --git a/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts b/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts new file mode 100644 index 0000000000000..e486baa1b58ea --- /dev/null +++ b/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts @@ -0,0 +1,13 @@ +// @moduleResolution: classic,node,node16,nodenext,hybrid +// @allowJs: true +// @checkJs: true +// @noEmit: true + +// @Filename: /project/a.js +export default "a.js"; + +// @Filename: /project/a.js.js +export default "a.js.js"; + +// @Filename: /project/b.ts +import a from "./a.js"; diff --git a/tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts b/tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts new file mode 100644 index 0000000000000..c68d2b7bf2b6b --- /dev/null +++ b/tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts @@ -0,0 +1,60 @@ +// @moduleResolution: hybrid +// @outDir: dist +// @allowJs: true +// @checkJs: true +// @outDir: out +// @noEmit: true,false +// @allowImportingTsExtensions: true,false +// @traceResolution: true + +// @Filename: /project/a.ts +export {}; + +// @Filename: /project/b.ts +export {}; + +// @Filename: /project/b.js +export {}; + +// @Filename: /project/b.d.ts +export {}; + +// @Filename: /project/c.ts +export {}; + +// @Filename: /project/c.tsx +export {}; + +// @Filename: /project/d/index.ts +export {}; + +// @Filename: /project/e +WOMP WOMP BINARY DATA + +// @Filename: /project/e.ts +export {}; + +// @Filename: /project/main.ts +import {} from "./a"; +import {} from "./a.js"; +import {} from "./a.ts"; + +import {} from "./b"; +import {} from "./b.js"; +import {} from "./b.ts"; +import {} from "./b.d.ts"; +import type {} from "./b.d.ts"; + +import {} from "./c.ts"; +import {} from "./c.tsx"; + +import {} from "./d"; +import {} from "./d/index"; +import {} from "./d/index.ts"; + +import {} from "./e"; + +// @Filename: /project/types.d.ts +import {} from "./a.ts"; +import {} from "./a.d.ts"; +import type {} from "./a.d.ts"; \ No newline at end of file From 89bcd0174acbb9dffd4d388e4fb1ea2d5e5ff10a Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 16 Nov 2022 11:57:43 -0800 Subject: [PATCH 07/23] Update test to reflect the choice not to block on unrecognized extensions --- ...sextensions=false,noemit=false).errors.txt | 19 +++++++++++++++++++ ...portingtsextensions=false,noemit=false).js | 16 ++++++++++++++++ ...ngtsextensions=false,noemit=false).symbols | 8 ++++++++ ...sextensions=false,noemit=false).trace.json | 5 +++++ ...tingtsextensions=false,noemit=false).types | 8 ++++++++ ...tsextensions=false,noemit=true).errors.txt | 19 +++++++++++++++++++ ...ingtsextensions=false,noemit=true).symbols | 8 ++++++++ ...tsextensions=false,noemit=true).trace.json | 5 +++++ ...rtingtsextensions=false,noemit=true).types | 8 ++++++++ ...tsextensions=true,noemit=false).errors.txt | 19 +++++++++++++++++++ ...mportingtsextensions=true,noemit=false).js | 16 ++++++++++++++++ ...ingtsextensions=true,noemit=false).symbols | 8 ++++++++ ...tsextensions=true,noemit=false).trace.json | 5 +++++ ...rtingtsextensions=true,noemit=false).types | 8 ++++++++ ...gtsextensions=true,noemit=true).errors.txt | 19 +++++++++++++++++++ ...tingtsextensions=true,noemit=true).symbols | 8 ++++++++ ...gtsextensions=true,noemit=true).trace.json | 5 +++++ ...ortingtsextensions=true,noemit=true).types | 8 ++++++++ .../hybrid/hybridImportTsExtensions.ts | 13 +++++++++++++ 19 files changed, 205 insertions(+) diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt index b88b3f78bb7a3..e679c61f21d2e 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt @@ -1,5 +1,8 @@ error TS5056: Cannot write file 'out/b.js' because it would be overwritten by multiple input files. error TS5056: Cannot write file 'out/c.js' because it would be overwritten by multiple input files. +error TS6054: File '/project/e.txt' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'. + The file is in the program because: + Root file specified for compilation /project/main.ts(3,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. /project/main.ts(7,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. /project/main.ts(8,16): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './b' instead? @@ -13,6 +16,9 @@ error TS5056: Cannot write file 'out/c.js' because it would be overwritten by mu !!! error TS5056: Cannot write file 'out/b.js' because it would be overwritten by multiple input files. !!! error TS5056: Cannot write file 'out/c.js' because it would be overwritten by multiple input files. +!!! error TS6054: File '/project/e.txt' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'. +!!! error TS6054: The file is in the program because: +!!! error TS6054: Root file specified for compilation ==== /project/a.ts (0 errors) ==== export {}; @@ -40,6 +46,15 @@ error TS5056: Cannot write file 'out/c.js' because it would be overwritten by mu ==== /project/e.ts (0 errors) ==== export {}; +==== /project/e.txt (0 errors) ==== + The letter e is for elephant + This poem is not about elephants + It is about the letter e + - Authored by GitHub Copilot, Nov 2022 + +==== /project/e.txt.ts (0 errors) ==== + export {}; + ==== /project/main.ts (7 errors) ==== import {} from "./a"; import {} from "./a.js"; @@ -72,7 +87,11 @@ error TS5056: Cannot write file 'out/c.js' because it would be overwritten by mu ~~~~~~~~~~~~~~ !!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. + // These should not resolve, but preventing them has + // relatively little utility compared to the cost of + // the filesystem hits. import {} from "./e"; + import {} from "./e.txt"; ==== /project/types.d.ts (2 errors) ==== import {} from "./a.ts"; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js index f946ec9557b55..82f75ee374412 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js @@ -27,6 +27,15 @@ WOMP WOMP BINARY DATA //// [e.ts] export {}; +//// [e.txt] +The letter e is for elephant +This poem is not about elephants +It is about the letter e +- Authored by GitHub Copilot, Nov 2022 + +//// [e.txt.ts] +export {}; + //// [main.ts] import {} from "./a"; import {} from "./a.js"; @@ -45,7 +54,11 @@ import {} from "./d"; import {} from "./d/index"; import {} from "./d/index.ts"; +// These should not resolve, but preventing them has +// relatively little utility compared to the cost of +// the filesystem hits. import {} from "./e"; +import {} from "./e.txt"; //// [types.d.ts] import {} from "./a.ts"; @@ -61,6 +74,9 @@ exports.__esModule = true; //// [e.js] "use strict"; exports.__esModule = true; +//// [e.txt.js] +"use strict"; +exports.__esModule = true; //// [main.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols index bcf03f8d9917e..3c1dc17c50c28 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols @@ -30,6 +30,10 @@ export {}; export {}; +=== /project/e.txt.ts === + +export {}; + === /project/main.ts === import {} from "./a"; @@ -49,7 +53,11 @@ import {} from "./d"; import {} from "./d/index"; import {} from "./d/index.ts"; +// These should not resolve, but preventing them has +// relatively little utility compared to the cost of +// the filesystem hits. import {} from "./e"; +import {} from "./e.txt"; === /project/types.d.ts === diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json index 07d7414565e53..c248542bacc88 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json @@ -78,6 +78,11 @@ "Loading module as file / folder, candidate module location '/project/e', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/e.ts' exist - use it as a name resolution result.", "======== Module name './e' was successfully resolved to '/project/e.ts'. ========", + "======== Resolving module './e.txt' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/e.txt', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File '/project/e.txt.ts' exist - use it as a name resolution result.", + "======== Module name './e.txt' was successfully resolved to '/project/e.txt.ts'. ========", "======== Resolving module './a.ts' from '/project/types.d.ts'. ========", "Resolution for module './a.ts' was found in cache from location '/project'.", "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).types b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).types index bcf03f8d9917e..3c1dc17c50c28 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).types +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).types @@ -30,6 +30,10 @@ export {}; export {}; +=== /project/e.txt.ts === + +export {}; + === /project/main.ts === import {} from "./a"; @@ -49,7 +53,11 @@ import {} from "./d"; import {} from "./d/index"; import {} from "./d/index.ts"; +// These should not resolve, but preventing them has +// relatively little utility compared to the cost of +// the filesystem hits. import {} from "./e"; +import {} from "./e.txt"; === /project/types.d.ts === diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt index cc93517215702..a90647850052e 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt @@ -1,3 +1,6 @@ +error TS6054: File '/project/e.txt' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'. + The file is in the program because: + Root file specified for compilation /project/main.ts(3,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. /project/main.ts(7,16): error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. /project/main.ts(8,16): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './b' instead? @@ -9,6 +12,9 @@ /project/types.d.ts(3,21): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. +!!! error TS6054: File '/project/e.txt' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'. +!!! error TS6054: The file is in the program because: +!!! error TS6054: Root file specified for compilation ==== /project/a.ts (0 errors) ==== export {}; @@ -36,6 +42,15 @@ ==== /project/e.ts (0 errors) ==== export {}; +==== /project/e.txt (0 errors) ==== + The letter e is for elephant + This poem is not about elephants + It is about the letter e + - Authored by GitHub Copilot, Nov 2022 + +==== /project/e.txt.ts (0 errors) ==== + export {}; + ==== /project/main.ts (7 errors) ==== import {} from "./a"; import {} from "./a.js"; @@ -68,7 +83,11 @@ ~~~~~~~~~~~~~~ !!! error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled. + // These should not resolve, but preventing them has + // relatively little utility compared to the cost of + // the filesystem hits. import {} from "./e"; + import {} from "./e.txt"; ==== /project/types.d.ts (2 errors) ==== import {} from "./a.ts"; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols index bcf03f8d9917e..3c1dc17c50c28 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols @@ -30,6 +30,10 @@ export {}; export {}; +=== /project/e.txt.ts === + +export {}; + === /project/main.ts === import {} from "./a"; @@ -49,7 +53,11 @@ import {} from "./d"; import {} from "./d/index"; import {} from "./d/index.ts"; +// These should not resolve, but preventing them has +// relatively little utility compared to the cost of +// the filesystem hits. import {} from "./e"; +import {} from "./e.txt"; === /project/types.d.ts === diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json index 07d7414565e53..c248542bacc88 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json @@ -78,6 +78,11 @@ "Loading module as file / folder, candidate module location '/project/e', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/e.ts' exist - use it as a name resolution result.", "======== Module name './e' was successfully resolved to '/project/e.ts'. ========", + "======== Resolving module './e.txt' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/e.txt', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File '/project/e.txt.ts' exist - use it as a name resolution result.", + "======== Module name './e.txt' was successfully resolved to '/project/e.txt.ts'. ========", "======== Resolving module './a.ts' from '/project/types.d.ts'. ========", "Resolution for module './a.ts' was found in cache from location '/project'.", "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).types b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).types index bcf03f8d9917e..3c1dc17c50c28 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).types +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).types @@ -30,6 +30,10 @@ export {}; export {}; +=== /project/e.txt.ts === + +export {}; + === /project/main.ts === import {} from "./a"; @@ -49,7 +53,11 @@ import {} from "./d"; import {} from "./d/index"; import {} from "./d/index.ts"; +// These should not resolve, but preventing them has +// relatively little utility compared to the cost of +// the filesystem hits. import {} from "./e"; +import {} from "./e.txt"; === /project/types.d.ts === diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt index 1e93929f4b534..d8c5a67083615 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt @@ -1,6 +1,9 @@ error TS5056: Cannot write file 'out/b.js' because it would be overwritten by multiple input files. error TS5056: Cannot write file 'out/c.js' because it would be overwritten by multiple input files. error TS5096: Option 'allowImportingTsExtensions' can only be used when 'moduleResolution' is set to 'hybrid' and either 'noEmit' or 'emitDeclarationOnly' is set. +error TS6054: File '/project/e.txt' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'. + The file is in the program because: + Root file specified for compilation /project/main.ts(8,16): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './b' instead? /project/main.ts(12,16): error TS6142: Module './c.tsx' was resolved to '/project/c.tsx', but '--jsx' is not set. /project/types.d.ts(2,16): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. @@ -10,6 +13,9 @@ error TS5096: Option 'allowImportingTsExtensions' can only be used when 'moduleR !!! error TS5056: Cannot write file 'out/b.js' because it would be overwritten by multiple input files. !!! error TS5056: Cannot write file 'out/c.js' because it would be overwritten by multiple input files. !!! error TS5096: Option 'allowImportingTsExtensions' can only be used when 'moduleResolution' is set to 'hybrid' and either 'noEmit' or 'emitDeclarationOnly' is set. +!!! error TS6054: File '/project/e.txt' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'. +!!! error TS6054: The file is in the program because: +!!! error TS6054: Root file specified for compilation ==== /project/a.ts (0 errors) ==== export {}; @@ -37,6 +43,15 @@ error TS5096: Option 'allowImportingTsExtensions' can only be used when 'moduleR ==== /project/e.ts (0 errors) ==== export {}; +==== /project/e.txt (0 errors) ==== + The letter e is for elephant + This poem is not about elephants + It is about the letter e + - Authored by GitHub Copilot, Nov 2022 + +==== /project/e.txt.ts (0 errors) ==== + export {}; + ==== /project/main.ts (2 errors) ==== import {} from "./a"; import {} from "./a.js"; @@ -59,7 +74,11 @@ error TS5096: Option 'allowImportingTsExtensions' can only be used when 'moduleR import {} from "./d/index"; import {} from "./d/index.ts"; + // These should not resolve, but preventing them has + // relatively little utility compared to the cost of + // the filesystem hits. import {} from "./e"; + import {} from "./e.txt"; ==== /project/types.d.ts (2 errors) ==== import {} from "./a.ts"; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js index f946ec9557b55..82f75ee374412 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js @@ -27,6 +27,15 @@ WOMP WOMP BINARY DATA //// [e.ts] export {}; +//// [e.txt] +The letter e is for elephant +This poem is not about elephants +It is about the letter e +- Authored by GitHub Copilot, Nov 2022 + +//// [e.txt.ts] +export {}; + //// [main.ts] import {} from "./a"; import {} from "./a.js"; @@ -45,7 +54,11 @@ import {} from "./d"; import {} from "./d/index"; import {} from "./d/index.ts"; +// These should not resolve, but preventing them has +// relatively little utility compared to the cost of +// the filesystem hits. import {} from "./e"; +import {} from "./e.txt"; //// [types.d.ts] import {} from "./a.ts"; @@ -61,6 +74,9 @@ exports.__esModule = true; //// [e.js] "use strict"; exports.__esModule = true; +//// [e.txt.js] +"use strict"; +exports.__esModule = true; //// [main.js] "use strict"; exports.__esModule = true; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols index bcf03f8d9917e..3c1dc17c50c28 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols @@ -30,6 +30,10 @@ export {}; export {}; +=== /project/e.txt.ts === + +export {}; + === /project/main.ts === import {} from "./a"; @@ -49,7 +53,11 @@ import {} from "./d"; import {} from "./d/index"; import {} from "./d/index.ts"; +// These should not resolve, but preventing them has +// relatively little utility compared to the cost of +// the filesystem hits. import {} from "./e"; +import {} from "./e.txt"; === /project/types.d.ts === diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json index 07d7414565e53..c248542bacc88 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json @@ -78,6 +78,11 @@ "Loading module as file / folder, candidate module location '/project/e', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/e.ts' exist - use it as a name resolution result.", "======== Module name './e' was successfully resolved to '/project/e.ts'. ========", + "======== Resolving module './e.txt' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/e.txt', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File '/project/e.txt.ts' exist - use it as a name resolution result.", + "======== Module name './e.txt' was successfully resolved to '/project/e.txt.ts'. ========", "======== Resolving module './a.ts' from '/project/types.d.ts'. ========", "Resolution for module './a.ts' was found in cache from location '/project'.", "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).types b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).types index bcf03f8d9917e..3c1dc17c50c28 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).types +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).types @@ -30,6 +30,10 @@ export {}; export {}; +=== /project/e.txt.ts === + +export {}; + === /project/main.ts === import {} from "./a"; @@ -49,7 +53,11 @@ import {} from "./d"; import {} from "./d/index"; import {} from "./d/index.ts"; +// These should not resolve, but preventing them has +// relatively little utility compared to the cost of +// the filesystem hits. import {} from "./e"; +import {} from "./e.txt"; === /project/types.d.ts === diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt index cdf02ebb53120..394208e16ad02 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt @@ -1,9 +1,15 @@ +error TS6054: File '/project/e.txt' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'. + The file is in the program because: + Root file specified for compilation /project/main.ts(8,16): error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file './b' instead? /project/main.ts(12,16): error TS6142: Module './c.tsx' was resolved to '/project/c.tsx', but '--jsx' is not set. /project/types.d.ts(2,16): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. /project/types.d.ts(3,21): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './a' instead. +!!! error TS6054: File '/project/e.txt' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'. +!!! error TS6054: The file is in the program because: +!!! error TS6054: Root file specified for compilation ==== /project/a.ts (0 errors) ==== export {}; @@ -31,6 +37,15 @@ ==== /project/e.ts (0 errors) ==== export {}; +==== /project/e.txt (0 errors) ==== + The letter e is for elephant + This poem is not about elephants + It is about the letter e + - Authored by GitHub Copilot, Nov 2022 + +==== /project/e.txt.ts (0 errors) ==== + export {}; + ==== /project/main.ts (2 errors) ==== import {} from "./a"; import {} from "./a.js"; @@ -53,7 +68,11 @@ import {} from "./d/index"; import {} from "./d/index.ts"; + // These should not resolve, but preventing them has + // relatively little utility compared to the cost of + // the filesystem hits. import {} from "./e"; + import {} from "./e.txt"; ==== /project/types.d.ts (2 errors) ==== import {} from "./a.ts"; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols index bcf03f8d9917e..3c1dc17c50c28 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols @@ -30,6 +30,10 @@ export {}; export {}; +=== /project/e.txt.ts === + +export {}; + === /project/main.ts === import {} from "./a"; @@ -49,7 +53,11 @@ import {} from "./d"; import {} from "./d/index"; import {} from "./d/index.ts"; +// These should not resolve, but preventing them has +// relatively little utility compared to the cost of +// the filesystem hits. import {} from "./e"; +import {} from "./e.txt"; === /project/types.d.ts === diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json index 07d7414565e53..c248542bacc88 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json @@ -78,6 +78,11 @@ "Loading module as file / folder, candidate module location '/project/e', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/e.ts' exist - use it as a name resolution result.", "======== Module name './e' was successfully resolved to '/project/e.ts'. ========", + "======== Resolving module './e.txt' from '/project/main.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "Loading module as file / folder, candidate module location '/project/e.txt', target file types: TypeScript, JavaScript, Declaration, JSON.", + "File '/project/e.txt.ts' exist - use it as a name resolution result.", + "======== Module name './e.txt' was successfully resolved to '/project/e.txt.ts'. ========", "======== Resolving module './a.ts' from '/project/types.d.ts'. ========", "Resolution for module './a.ts' was found in cache from location '/project'.", "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).types b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).types index bcf03f8d9917e..3c1dc17c50c28 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).types +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).types @@ -30,6 +30,10 @@ export {}; export {}; +=== /project/e.txt.ts === + +export {}; + === /project/main.ts === import {} from "./a"; @@ -49,7 +53,11 @@ import {} from "./d"; import {} from "./d/index"; import {} from "./d/index.ts"; +// These should not resolve, but preventing them has +// relatively little utility compared to the cost of +// the filesystem hits. import {} from "./e"; +import {} from "./e.txt"; === /project/types.d.ts === diff --git a/tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts b/tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts index c68d2b7bf2b6b..8cb7141e5c409 100644 --- a/tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts +++ b/tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts @@ -34,6 +34,15 @@ WOMP WOMP BINARY DATA // @Filename: /project/e.ts export {}; +// @Filename: /project/e.txt +The letter e is for elephant +This poem is not about elephants +It is about the letter e +- Authored by GitHub Copilot, Nov 2022 + +// @Filename: /project/e.txt.ts +export {}; + // @Filename: /project/main.ts import {} from "./a"; import {} from "./a.js"; @@ -52,7 +61,11 @@ import {} from "./d"; import {} from "./d/index"; import {} from "./d/index.ts"; +// These should not resolve, but preventing them has +// relatively little utility compared to the cost of +// the filesystem hits. import {} from "./e"; +import {} from "./e.txt"; // @Filename: /project/types.d.ts import {} from "./a.ts"; From 60746617661f78b640184b4186ae4066122fcbdb Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 16 Nov 2022 17:16:44 -0800 Subject: [PATCH 08/23] Add auto-imports and string completions tests --- src/compiler/moduleSpecifiers.ts | 3 +- src/services/stringCompletions.ts | 10 +++--- .../autoImportAllowTsExtensions1.baseline.md | 36 +++++++++++++++++++ .../autoImportAllowTsExtensions2.baseline.md | 36 +++++++++++++++++++ .../autoImportAllowTsExtensions3.baseline.md | 16 +++++++++ .../fourslash/autoImportAllowTsExtensions1.ts | 22 ++++++++++++ .../fourslash/autoImportAllowTsExtensions2.ts | 22 ++++++++++++ .../fourslash/autoImportAllowTsExtensions3.ts | 17 +++++++++ .../pathCompletionsAllowTsExtensions.ts | 34 ++++++++++++++++++ 9 files changed, 190 insertions(+), 6 deletions(-) create mode 100644 tests/baselines/reference/autoImportAllowTsExtensions1.baseline.md create mode 100644 tests/baselines/reference/autoImportAllowTsExtensions2.baseline.md create mode 100644 tests/baselines/reference/autoImportAllowTsExtensions3.baseline.md create mode 100644 tests/cases/fourslash/autoImportAllowTsExtensions1.ts create mode 100644 tests/cases/fourslash/autoImportAllowTsExtensions2.ts create mode 100644 tests/cases/fourslash/autoImportAllowTsExtensions3.ts create mode 100644 tests/cases/fourslash/pathCompletionsAllowTsExtensions.ts diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 9218f31031fb3..4505f83bbfd8f 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -458,7 +458,8 @@ export function countPathComponents(path: string): number { return count; } -function usesExtensionsOnImports({ imports }: SourceFile): boolean { +/** @internal */ +export function usesExtensionsOnImports({ imports }: SourceFile): boolean { return firstDefined(imports, ({ text }) => pathIsRelative(text) ? (hasJSFileExtension(text) || hasTSFileExtension(text)) : undefined) || false; } diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index bedf79a2b19f8..70c9d6099001e 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -1,3 +1,4 @@ +import { usesExtensionsOnImports } from "../compiler/moduleSpecifiers"; import { addToSeen, altDirectorySeparator, arrayFrom, CallLikeExpression, CancellationToken, changeExtension, CharacterCodes, combinePaths, comparePaths, comparePatternKeys, compareStringsCaseSensitive, compareValues, Comparison, @@ -409,12 +410,11 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile: SourceFile : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, getIncludeExtensionOption(), typeChecker); function getIncludeExtensionOption() { - if (shouldAllowImportingTsExtension(compilerOptions)) { - return IncludeExtensionsOption.Include; - } const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : undefined; - return preferences.importModuleSpecifierEnding === "js" || mode === ModuleKind.ESNext - ? IncludeExtensionsOption.ModuleSpecifierCompletion + return preferences.importModuleSpecifierEnding === "js" || mode === ModuleKind.ESNext || usesExtensionsOnImports(sourceFile) + ? shouldAllowImportingTsExtension(compilerOptions) + ? IncludeExtensionsOption.Include + : IncludeExtensionsOption.ModuleSpecifierCompletion : IncludeExtensionsOption.Exclude; } } diff --git a/tests/baselines/reference/autoImportAllowTsExtensions1.baseline.md b/tests/baselines/reference/autoImportAllowTsExtensions1.baseline.md new file mode 100644 index 0000000000000..0e3c27ce7e96a --- /dev/null +++ b/tests/baselines/reference/autoImportAllowTsExtensions1.baseline.md @@ -0,0 +1,36 @@ +```ts +// @Filename: /main.ts +/*|*/ +``` + +## From completions + +- `Component` from `"./Component"` +- `fromAtTypesFoo` from `"foo"` +- `fromBar` from `"bar"` +- `fromLocal` from `"./local"` + +```ts +import { Component } from "./Component"; + +Component +``` + +```ts +import { fromAtTypesFoo } from "foo"; + +fromAtTypesFoo +``` + +```ts +import { fromBar } from "bar"; + +fromBar +``` + +```ts +import { fromLocal } from "./local"; + +fromLocal +``` + diff --git a/tests/baselines/reference/autoImportAllowTsExtensions2.baseline.md b/tests/baselines/reference/autoImportAllowTsExtensions2.baseline.md new file mode 100644 index 0000000000000..1117148b1877d --- /dev/null +++ b/tests/baselines/reference/autoImportAllowTsExtensions2.baseline.md @@ -0,0 +1,36 @@ +```ts +// @Filename: /main.ts +/*|*/ +``` + +## From completions + +- `Component` from `"./Component.tsx"` +- `fromAtTypesFoo` from `"foo"` +- `fromBar` from `"bar"` +- `fromLocal` from `"./local.ts"` + +```ts +import { Component } from "./Component.tsx"; + +Component +``` + +```ts +import { fromAtTypesFoo } from "foo"; + +fromAtTypesFoo +``` + +```ts +import { fromBar } from "bar"; + +fromBar +``` + +```ts +import { fromLocal } from "./local.ts"; + +fromLocal +``` + diff --git a/tests/baselines/reference/autoImportAllowTsExtensions3.baseline.md b/tests/baselines/reference/autoImportAllowTsExtensions3.baseline.md new file mode 100644 index 0000000000000..77fea133b581f --- /dev/null +++ b/tests/baselines/reference/autoImportAllowTsExtensions3.baseline.md @@ -0,0 +1,16 @@ +```ts +// @Filename: /main.ts +import { Component } from "./Component.tsx"; +/*|*/ +``` + +## From completions + +- `fromLocal` from `"./local.ts"` + +```ts +import { Component } from "./Component.tsx"; +import { fromLocal } from "./local.ts"; +fromLocal +``` + diff --git a/tests/cases/fourslash/autoImportAllowTsExtensions1.ts b/tests/cases/fourslash/autoImportAllowTsExtensions1.ts new file mode 100644 index 0000000000000..882ab404669b9 --- /dev/null +++ b/tests/cases/fourslash/autoImportAllowTsExtensions1.ts @@ -0,0 +1,22 @@ +/// + +// @moduleResolution: hybrid +// @allowImportingTsExtensions: true +// @noEmit: true + +// @Filename: /node_modules/@types/foo/index.d.ts +//// export const fromAtTypesFoo: number; + +// @Filename: /node_modules/bar/index.d.ts +//// export const fromBar: number; + +// @Filename: /local.ts +//// export const fromLocal: number; + +// @Filename: /Component.tsx +//// export function Component() { return null; } + +// @Filename: /main.ts +//// /**/ + +verify.baselineAutoImports(""); diff --git a/tests/cases/fourslash/autoImportAllowTsExtensions2.ts b/tests/cases/fourslash/autoImportAllowTsExtensions2.ts new file mode 100644 index 0000000000000..84eda57047a35 --- /dev/null +++ b/tests/cases/fourslash/autoImportAllowTsExtensions2.ts @@ -0,0 +1,22 @@ +/// + +// @moduleResolution: hybrid +// @allowImportingTsExtensions: true +// @noEmit: true + +// @Filename: /node_modules/@types/foo/index.d.ts +//// export const fromAtTypesFoo: number; + +// @Filename: /node_modules/bar/index.d.ts +//// export const fromBar: number; + +// @Filename: /local.ts +//// export const fromLocal: number; + +// @Filename: /Component.tsx +//// export function Component() { return null; } + +// @Filename: /main.ts +//// /**/ + +verify.baselineAutoImports("", { importModuleSpecifierEnding: "js" }); diff --git a/tests/cases/fourslash/autoImportAllowTsExtensions3.ts b/tests/cases/fourslash/autoImportAllowTsExtensions3.ts new file mode 100644 index 0000000000000..9fcfbc53a0fbe --- /dev/null +++ b/tests/cases/fourslash/autoImportAllowTsExtensions3.ts @@ -0,0 +1,17 @@ +/// + +// @moduleResolution: hybrid +// @allowImportingTsExtensions: true +// @noEmit: true + +// @Filename: /local.ts +//// export const fromLocal: number; + +// @Filename: /Component.tsx +//// export function Component() { return null; } + +// @Filename: /main.ts +//// import { Component } from "./Component.tsx"; +//// /**/ + +verify.baselineAutoImports(""); diff --git a/tests/cases/fourslash/pathCompletionsAllowTsExtensions.ts b/tests/cases/fourslash/pathCompletionsAllowTsExtensions.ts new file mode 100644 index 0000000000000..f0dccd98e71b4 --- /dev/null +++ b/tests/cases/fourslash/pathCompletionsAllowTsExtensions.ts @@ -0,0 +1,34 @@ +/// + +// @moduleResolution: hybrid +// @allowImportingTsExtensions: true +// @noEmit: true + +// @Filename: /project/foo.ts +//// export const foo = 0; + +// @Filename: /project/main.ts +//// import {} from ".//**/" + +verify.completions({ + marker: "", + isNewIdentifierLocation: true, + exact: ["foo"], +}); + +verify.completions({ + marker: "", + isNewIdentifierLocation: true, + exact: ["foo.ts"], + preferences: { + importModuleSpecifierEnding: "js", + }, +}); + +edit.insert(`foo.ts"\nimport {} from "./`); + +verify.completions({ + marker: "", + isNewIdentifierLocation: true, + exact: ["foo.ts"], +}); From c4320a2fb2352fad550b872673ad817dcaf1cf1b Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 18 Nov 2022 13:35:04 -0800 Subject: [PATCH 09/23] Comment test --- tests/cases/fourslash/pathCompletionsAllowTsExtensions.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/cases/fourslash/pathCompletionsAllowTsExtensions.ts b/tests/cases/fourslash/pathCompletionsAllowTsExtensions.ts index f0dccd98e71b4..32b566f0839e6 100644 --- a/tests/cases/fourslash/pathCompletionsAllowTsExtensions.ts +++ b/tests/cases/fourslash/pathCompletionsAllowTsExtensions.ts @@ -10,12 +10,14 @@ // @Filename: /project/main.ts //// import {} from ".//**/" +// Extensionless by default verify.completions({ marker: "", isNewIdentifierLocation: true, exact: ["foo"], }); +// .ts extension when allowImportingTsExtensions is true and setting is js... verify.completions({ marker: "", isNewIdentifierLocation: true, @@ -25,8 +27,8 @@ verify.completions({ }, }); +// ...or when another import uses .ts extension edit.insert(`foo.ts"\nimport {} from "./`); - verify.completions({ marker: "", isNewIdentifierLocation: true, From f04f1b5ce2eae4355f4a775de4e6899de910c153 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 17 Nov 2022 16:29:08 -0800 Subject: [PATCH 10/23] Auto-imports of declaration files cannot use .ts extension --- src/compiler/moduleSpecifiers.ts | 29 +++++++++++++------ .../autoImportAllowTsExtensions3.baseline.md | 7 +++++ .../autoImportAllowTsExtensions4.baseline.md | 22 ++++++++++++++ .../fourslash/autoImportAllowTsExtensions3.ts | 3 ++ .../fourslash/autoImportAllowTsExtensions4.ts | 20 +++++++++++++ 5 files changed, 72 insertions(+), 9 deletions(-) create mode 100644 tests/baselines/reference/autoImportAllowTsExtensions4.baseline.md create mode 100644 tests/cases/fourslash/autoImportAllowTsExtensions4.ts diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index d7aabf497ce85..ab9dc8bc0cdb1 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -16,7 +16,7 @@ import { ModuleSpecifierResolutionHost, NodeFlags, NodeModulePathParts, normalizePath, Path, pathContainsNodeModules, pathIsBareSpecifier, pathIsRelative, PropertyAccessExpression, removeFileExtension, removeSuffix, resolvePath, ScriptKind, some, SourceFile, startsWith, startsWithDirectory, stringContains, StringLiteral, Symbol, SymbolFlags, - toPath, tryGetExtensionFromPath, tryParsePatterns, TypeChecker, UserPreferences, shouldAllowImportingTsExtension, ResolutionMode, ModuleSpecifierEnding, getModuleSpecifierEndingPreference, + toPath, tryGetExtensionFromPath, tryParsePatterns, TypeChecker, UserPreferences, shouldAllowImportingTsExtension, ResolutionMode, ModuleSpecifierEnding, getModuleSpecifierEndingPreference, isDeclarationFileName, } from "./_namespaces/ts"; // Used by importFixes, getEditsForFileRename, and declaration emit to synthesize import module specifiers. @@ -74,10 +74,10 @@ function getPreferences( if (endsWith(oldImportSpecifier, "/index")) return ModuleSpecifierEnding.Index; } return getModuleSpecifierEndingPreference( - importModuleSpecifierEnding, - importingSourceFile.impliedNodeFormat, - compilerOptions, - importingSourceFile); + importModuleSpecifierEnding, + importingSourceFile.impliedNodeFormat, + compilerOptions, + importingSourceFile); } } @@ -937,10 +937,19 @@ function getPathsRelativeToRootDirs(path: string, rootDirs: readonly string[], g } function processEnding(fileName: string, ending: ModuleSpecifierEnding, options: CompilerOptions, host?: ModuleSpecifierResolutionHost): string { - if (fileExtensionIsOneOf(fileName, [Extension.Json, Extension.Mjs, Extension.Cjs])) return fileName; + if (fileExtensionIsOneOf(fileName, [Extension.Json, Extension.Mjs, Extension.Cjs])) { + return fileName; + } + const noExtension = removeFileExtension(fileName); - if (fileName === noExtension) return fileName; - if (fileExtensionIsOneOf(fileName, [Extension.Dmts, Extension.Mts, Extension.Dcts, Extension.Cts])) return noExtension + getJSExtensionForFile(fileName, options); + if (fileName === noExtension) { + return fileName; + } + + if (fileExtensionIsOneOf(fileName, [Extension.Dmts, Extension.Mts, Extension.Dcts, Extension.Cts])) { + return noExtension + getJSExtensionForFile(fileName, options); + } + switch (ending) { case ModuleSpecifierEnding.Minimal: const withoutIndex = removeSuffix(noExtension, "/index"); @@ -955,7 +964,9 @@ function processEnding(fileName: string, ending: ModuleSpecifierEnding, options: case ModuleSpecifierEnding.JsExtension: return noExtension + getJSExtensionForFile(fileName, options); case ModuleSpecifierEnding.TsExtension: - return fileName; + // For now, we don't know if this import is going to be type-only, which means we don't + // know if a .d.ts extension is valid, so use the .js extension. + return isDeclarationFileName(fileName) ? noExtension + getJSExtensionForFile(fileName, options) : fileName; default: return Debug.assertNever(ending); } diff --git a/tests/baselines/reference/autoImportAllowTsExtensions3.baseline.md b/tests/baselines/reference/autoImportAllowTsExtensions3.baseline.md index 77fea133b581f..0a2ced8c8ffd1 100644 --- a/tests/baselines/reference/autoImportAllowTsExtensions3.baseline.md +++ b/tests/baselines/reference/autoImportAllowTsExtensions3.baseline.md @@ -6,8 +6,15 @@ import { Component } from "./Component.tsx"; ## From completions +- `fromDecl` from `"./decl.js"` - `fromLocal` from `"./local.ts"` +```ts +import { Component } from "./Component.tsx"; +import { fromDecl } from "./decl.js"; +fromDecl +``` + ```ts import { Component } from "./Component.tsx"; import { fromLocal } from "./local.ts"; diff --git a/tests/baselines/reference/autoImportAllowTsExtensions4.baseline.md b/tests/baselines/reference/autoImportAllowTsExtensions4.baseline.md new file mode 100644 index 0000000000000..cdae3c5eaa40b --- /dev/null +++ b/tests/baselines/reference/autoImportAllowTsExtensions4.baseline.md @@ -0,0 +1,22 @@ +```ts +// @Filename: /main.ts +import { Component } from "./local.js"; +/*|*/ +``` + +## From completions + +- `fromDecl` from `"./decl.js"` +- `fromLocal` from `"./local.js"` + +```ts +import { fromDecl } from "./decl.js"; +import { Component } from "./local.js"; +fromDecl +``` + +```ts +import { Component, fromLocal } from "./local.js"; +fromLocal +``` + diff --git a/tests/cases/fourslash/autoImportAllowTsExtensions3.ts b/tests/cases/fourslash/autoImportAllowTsExtensions3.ts index 9fcfbc53a0fbe..f46128644c6bd 100644 --- a/tests/cases/fourslash/autoImportAllowTsExtensions3.ts +++ b/tests/cases/fourslash/autoImportAllowTsExtensions3.ts @@ -7,6 +7,9 @@ // @Filename: /local.ts //// export const fromLocal: number; +// @Filename: /decl.d.ts +//// export const fromDecl: number; + // @Filename: /Component.tsx //// export function Component() { return null; } diff --git a/tests/cases/fourslash/autoImportAllowTsExtensions4.ts b/tests/cases/fourslash/autoImportAllowTsExtensions4.ts new file mode 100644 index 0000000000000..bc6235658c2bc --- /dev/null +++ b/tests/cases/fourslash/autoImportAllowTsExtensions4.ts @@ -0,0 +1,20 @@ +/// + +// @moduleResolution: hybrid +// @allowImportingTsExtensions: true +// @noEmit: true + +// @Filename: /local.ts +//// export const fromLocal: number; + +// @Filename: /decl.d.ts +//// export const fromDecl: number; + +// @Filename: /Component.tsx +//// export function Component() { return null; } + +// @Filename: /main.ts +//// import { Component } from "./local.js"; +//// /**/ + +verify.baselineAutoImports(""); From 29039dec4e8eb101e09070a33d6fe2b45111b248 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Thu, 17 Nov 2022 16:49:40 -0800 Subject: [PATCH 11/23] Have declaration file auto imports default to extensionless instead --- src/compiler/moduleSpecifiers.ts | 31 ++++++++++++------- .../autoImportAllowTsExtensions3.baseline.md | 4 +-- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index ab9dc8bc0cdb1..66ec3a24deb39 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -60,7 +60,7 @@ function getPreferences( } switch (preferredEnding) { case ModuleSpecifierEnding.JsExtension: return [ModuleSpecifierEnding.JsExtension, ModuleSpecifierEnding.Minimal, ModuleSpecifierEnding.Index]; - case ModuleSpecifierEnding.TsExtension: return [ModuleSpecifierEnding.TsExtension, ModuleSpecifierEnding.TsExtension, ModuleSpecifierEnding.Minimal, ModuleSpecifierEnding.Index]; + case ModuleSpecifierEnding.TsExtension: return [ModuleSpecifierEnding.TsExtension, ModuleSpecifierEnding.Minimal, ModuleSpecifierEnding.JsExtension, ModuleSpecifierEnding.Index]; case ModuleSpecifierEnding.Index: return [ModuleSpecifierEnding.Index, ModuleSpecifierEnding.Minimal, ModuleSpecifierEnding.JsExtension]; case ModuleSpecifierEnding.Minimal: return [ModuleSpecifierEnding.Minimal, ModuleSpecifierEnding.Index, ModuleSpecifierEnding.JsExtension]; default: Debug.assertNever(preferredEnding); @@ -367,7 +367,7 @@ function getLocalModuleSpecifier(moduleFileName: string, info: Info, compilerOpt return fromPaths; } - const maybeNonRelative = fromPaths === undefined && baseUrl !== undefined ? processEnding(relativeToBaseUrl, ending, compilerOptions) : fromPaths; + const maybeNonRelative = fromPaths === undefined && baseUrl !== undefined ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths; if (!maybeNonRelative) { return relativePath; } @@ -655,7 +655,7 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl: string, paths: MapLike ({ ending, - value: processEnding(relativeToBaseUrl, ending, compilerOptions) + value: processEnding(relativeToBaseUrl, [ending], compilerOptions) })); if (tryGetExtensionFromPath(pattern)) { candidates.push({ ending: undefined, value: relativeToBaseUrl }); @@ -692,7 +692,7 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl: string, paths: MapLike string, ending: ModuleSpecifierEnding, compilerOptions: CompilerOptions): string | undefined { +function tryGetModuleNameFromRootDirs(rootDirs: readonly string[], moduleFileName: string, sourceDirectory: string, getCanonicalFileName: (file: string) => string, allowedEndings: readonly ModuleSpecifierEnding[], compilerOptions: CompilerOptions): string | undefined { const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); if (normalizedTargetPaths === undefined) { return undefined; @@ -781,7 +781,7 @@ function tryGetModuleNameFromRootDirs(rootDirs: readonly string[], moduleFileNam if (!shortest) { return undefined; } - return processEnding(shortest, ending, compilerOptions); + return processEnding(shortest, allowedEndings, compilerOptions); } function tryGetModuleNameAsNodeModule({ path, isRedirect }: ModulePath, { getCanonicalFileName, sourceDirectory }: Info, importingSourceFile: SourceFile, host: ModuleSpecifierResolutionHost, options: CompilerOptions, userPreferences: UserPreferences, packageNameOnly?: boolean, overrideMode?: ResolutionMode): string | undefined { @@ -823,7 +823,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }: ModulePath, { getCan // try with next level of directory packageRootIndex = path.indexOf(directorySeparator, packageRootIndex + 1); if (packageRootIndex === -1) { - moduleSpecifier = processEnding(moduleFileName, allowedEndings[0], options, host); + moduleSpecifier = processEnding(moduleFileName, allowedEndings, options, host); break; } } @@ -936,7 +936,7 @@ function getPathsRelativeToRootDirs(path: string, rootDirs: readonly string[], g }); } -function processEnding(fileName: string, ending: ModuleSpecifierEnding, options: CompilerOptions, host?: ModuleSpecifierResolutionHost): string { +function processEnding(fileName: string, allowedEndings: readonly ModuleSpecifierEnding[], options: CompilerOptions, host?: ModuleSpecifierResolutionHost): string { if (fileExtensionIsOneOf(fileName, [Extension.Json, Extension.Mjs, Extension.Cjs])) { return fileName; } @@ -950,7 +950,7 @@ function processEnding(fileName: string, ending: ModuleSpecifierEnding, options: return noExtension + getJSExtensionForFile(fileName, options); } - switch (ending) { + switch (allowedEndings[0]) { case ModuleSpecifierEnding.Minimal: const withoutIndex = removeSuffix(noExtension, "/index"); if (host && withoutIndex !== noExtension && tryGetAnyFileFromPath(host, withoutIndex)) { @@ -965,10 +965,17 @@ function processEnding(fileName: string, ending: ModuleSpecifierEnding, options: return noExtension + getJSExtensionForFile(fileName, options); case ModuleSpecifierEnding.TsExtension: // For now, we don't know if this import is going to be type-only, which means we don't - // know if a .d.ts extension is valid, so use the .js extension. - return isDeclarationFileName(fileName) ? noExtension + getJSExtensionForFile(fileName, options) : fileName; + // know if a .d.ts extension is valid, so use no extension or a .js extension + if (isDeclarationFileName(fileName)) { + const extensionlessPriority = allowedEndings.findIndex(e => e === ModuleSpecifierEnding.Minimal || e === ModuleSpecifierEnding.Index); + const jsPriority = allowedEndings.indexOf(ModuleSpecifierEnding.JsExtension); + return extensionlessPriority !== -1 && extensionlessPriority < jsPriority + ? noExtension + : noExtension + getJSExtensionForFile(fileName, options); + } + return fileName; default: - return Debug.assertNever(ending); + return Debug.assertNever(allowedEndings[0]); } } diff --git a/tests/baselines/reference/autoImportAllowTsExtensions3.baseline.md b/tests/baselines/reference/autoImportAllowTsExtensions3.baseline.md index 0a2ced8c8ffd1..551ff404a6a33 100644 --- a/tests/baselines/reference/autoImportAllowTsExtensions3.baseline.md +++ b/tests/baselines/reference/autoImportAllowTsExtensions3.baseline.md @@ -6,12 +6,12 @@ import { Component } from "./Component.tsx"; ## From completions -- `fromDecl` from `"./decl.js"` +- `fromDecl` from `"./decl"` - `fromLocal` from `"./local.ts"` ```ts import { Component } from "./Component.tsx"; -import { fromDecl } from "./decl.js"; +import { fromDecl } from "./decl"; fromDecl ``` From f98730abf6c94327ea86e9e68fad17a16b1aa878 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 18 Nov 2022 15:16:55 -0800 Subject: [PATCH 12/23] Add test for custom conditions --- src/compiler/moduleNameResolver.ts | 2 +- src/testRunner/compilerRunner.ts | 2 ++ ...itions(resolvepackagejsonexports=false).js | 33 +++++++++++++++++++ ...s(resolvepackagejsonexports=false).symbols | 25 ++++++++++++++ ...esolvepackagejsonexports=false).trace.json | 22 +++++++++++++ ...ons(resolvepackagejsonexports=false).types | 25 ++++++++++++++ ...ditions(resolvepackagejsonexports=true).js | 33 +++++++++++++++++++ ...ns(resolvepackagejsonexports=true).symbols | 25 ++++++++++++++ ...resolvepackagejsonexports=true).trace.json | 17 ++++++++++ ...ions(resolvepackagejsonexports=true).types | 25 ++++++++++++++ .../moduleResolution/customConditions.ts | 31 +++++++++++++++++ 11 files changed, 239 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/customConditions(resolvepackagejsonexports=false).js create mode 100644 tests/baselines/reference/customConditions(resolvepackagejsonexports=false).symbols create mode 100644 tests/baselines/reference/customConditions(resolvepackagejsonexports=false).trace.json create mode 100644 tests/baselines/reference/customConditions(resolvepackagejsonexports=false).types create mode 100644 tests/baselines/reference/customConditions(resolvepackagejsonexports=true).js create mode 100644 tests/baselines/reference/customConditions(resolvepackagejsonexports=true).symbols create mode 100644 tests/baselines/reference/customConditions(resolvepackagejsonexports=true).trace.json create mode 100644 tests/baselines/reference/customConditions(resolvepackagejsonexports=true).types create mode 100644 tests/cases/conformance/moduleResolution/customConditions.ts diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index c393baf01af3b..1ba764947bff7 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1524,7 +1524,7 @@ export function hybridModuleNameResolver(moduleName: string, containingFile: str if (getResolveJsonModule(compilerOptions)) { extensions |= Extensions.Json; } - return nodeModuleNameResolverWorker(NodeResolutionFeatures.HybridDefault, moduleName, containingDirectory, compilerOptions, host, cache, extensions, /*isConfigLookup*/ false, redirectedReference); + return nodeModuleNameResolverWorker(getNodeResolutionFeatures(compilerOptions), moduleName, containingDirectory, compilerOptions, host, cache, extensions, /*isConfigLookup*/ false, redirectedReference); } export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; diff --git a/src/testRunner/compilerRunner.ts b/src/testRunner/compilerRunner.ts index 8bd62f4f62e64..33d01f4c24953 100644 --- a/src/testRunner/compilerRunner.ts +++ b/src/testRunner/compilerRunner.ts @@ -163,6 +163,8 @@ class CompilerTest { "useUnknownInCatchVariables", "noUncheckedIndexedAccess", "noPropertyAccessFromIndexSignature", + "resolvePackageJsonExports", + "resolvePackageJsonImports", ]; private fileName: string; private justName: string; diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).js b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).js new file mode 100644 index 0000000000000..8f831b27639a6 --- /dev/null +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/moduleResolution/customConditions.ts] //// + +//// [package.json] +{ + "name": "lodash", + "version": "1.0.0", + "main": "index.js", + "exports": { + "browser": "./browser.js", + "webpack": "./webpack.js", + "default": "./index.js" + } +} + +//// [index.d.ts] +declare const _: "index"; +export = _; + +//// [browser.d.ts] +declare const _: "browser"; +export default _; + +//// [webpack.d.ts] +declare const _: "webpack"; +export = _; + +//// [index.ts] +import _ from "lodash"; + + +//// [index.js] +"use strict"; +exports.__esModule = true; diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).symbols b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).symbols new file mode 100644 index 0000000000000..2b8cae85a8c11 --- /dev/null +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).symbols @@ -0,0 +1,25 @@ +=== /node_modules/lodash/index.d.ts === +declare const _: "index"; +>_ : Symbol(_, Decl(index.d.ts, 0, 13)) + +export = _; +>_ : Symbol(_, Decl(index.d.ts, 0, 13)) + +=== /node_modules/lodash/browser.d.ts === +declare const _: "browser"; +>_ : Symbol(_, Decl(browser.d.ts, 0, 13)) + +export default _; +>_ : Symbol(_, Decl(browser.d.ts, 0, 13)) + +=== /node_modules/lodash/webpack.d.ts === +declare const _: "webpack"; +>_ : Symbol(_, Decl(webpack.d.ts, 0, 13)) + +export = _; +>_ : Symbol(_, Decl(webpack.d.ts, 0, 13)) + +=== /index.ts === +import _ from "lodash"; +>_ : Symbol(_, Decl(index.ts, 0, 6)) + diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).trace.json b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).trace.json new file mode 100644 index 0000000000000..922234fe125a0 --- /dev/null +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).trace.json @@ -0,0 +1,22 @@ +[ + "======== Resolving module 'lodash' from '/index.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "File '/package.json' does not exist.", + "Loading module 'lodash' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", + "Found 'package.json' at '/node_modules/lodash/package.json'.", + "'package.json' does not have a 'typesVersions' field.", + "File '/node_modules/lodash.ts' does not exist.", + "File '/node_modules/lodash.tsx' does not exist.", + "File '/node_modules/lodash.d.ts' does not exist.", + "'package.json' does not have a 'typings' field.", + "'package.json' does not have a 'types' field.", + "'package.json' has 'main' field 'index.js' that references '/node_modules/lodash/index.js'.", + "File '/node_modules/lodash/index.js' does not exist.", + "Loading module as file / folder, candidate module location '/node_modules/lodash/index.js', target file types: TypeScript, Declaration.", + "File name '/node_modules/lodash/index.js' has a '.js' extension - stripping it.", + "File '/node_modules/lodash/index.ts' does not exist.", + "File '/node_modules/lodash/index.tsx' does not exist.", + "File '/node_modules/lodash/index.d.ts' exist - use it as a name resolution result.", + "Resolving real path for '/node_modules/lodash/index.d.ts', result '/node_modules/lodash/index.d.ts'.", + "======== Module name 'lodash' was successfully resolved to '/node_modules/lodash/index.d.ts' with Package ID 'lodash/index.d.ts@1.0.0'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).types b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).types new file mode 100644 index 0000000000000..fd913f77aaf75 --- /dev/null +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).types @@ -0,0 +1,25 @@ +=== /node_modules/lodash/index.d.ts === +declare const _: "index"; +>_ : "index" + +export = _; +>_ : "index" + +=== /node_modules/lodash/browser.d.ts === +declare const _: "browser"; +>_ : "browser" + +export default _; +>_ : "browser" + +=== /node_modules/lodash/webpack.d.ts === +declare const _: "webpack"; +>_ : "webpack" + +export = _; +>_ : "webpack" + +=== /index.ts === +import _ from "lodash"; +>_ : "index" + diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).js b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).js new file mode 100644 index 0000000000000..8f831b27639a6 --- /dev/null +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).js @@ -0,0 +1,33 @@ +//// [tests/cases/conformance/moduleResolution/customConditions.ts] //// + +//// [package.json] +{ + "name": "lodash", + "version": "1.0.0", + "main": "index.js", + "exports": { + "browser": "./browser.js", + "webpack": "./webpack.js", + "default": "./index.js" + } +} + +//// [index.d.ts] +declare const _: "index"; +export = _; + +//// [browser.d.ts] +declare const _: "browser"; +export default _; + +//// [webpack.d.ts] +declare const _: "webpack"; +export = _; + +//// [index.ts] +import _ from "lodash"; + + +//// [index.js] +"use strict"; +exports.__esModule = true; diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).symbols b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).symbols new file mode 100644 index 0000000000000..2b8cae85a8c11 --- /dev/null +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).symbols @@ -0,0 +1,25 @@ +=== /node_modules/lodash/index.d.ts === +declare const _: "index"; +>_ : Symbol(_, Decl(index.d.ts, 0, 13)) + +export = _; +>_ : Symbol(_, Decl(index.d.ts, 0, 13)) + +=== /node_modules/lodash/browser.d.ts === +declare const _: "browser"; +>_ : Symbol(_, Decl(browser.d.ts, 0, 13)) + +export default _; +>_ : Symbol(_, Decl(browser.d.ts, 0, 13)) + +=== /node_modules/lodash/webpack.d.ts === +declare const _: "webpack"; +>_ : Symbol(_, Decl(webpack.d.ts, 0, 13)) + +export = _; +>_ : Symbol(_, Decl(webpack.d.ts, 0, 13)) + +=== /index.ts === +import _ from "lodash"; +>_ : Symbol(_, Decl(index.ts, 0, 6)) + diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).trace.json b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).trace.json new file mode 100644 index 0000000000000..dd46403892a5a --- /dev/null +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).trace.json @@ -0,0 +1,17 @@ +[ + "======== Resolving module 'lodash' from '/index.ts'. ========", + "Explicitly specified module resolution kind: 'Hybrid'.", + "File '/package.json' does not exist.", + "Loading module 'lodash' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", + "Found 'package.json' at '/node_modules/lodash/package.json'.", + "'package.json' does not have a 'typesVersions' field.", + "Saw non-matching condition 'browser'.", + "Matched 'exports' condition 'webpack'.", + "Using 'exports' subpath '.' with target './webpack.js'.", + "File name '/node_modules/lodash/webpack.js' has a '.js' extension - stripping it.", + "File '/node_modules/lodash/webpack.ts' does not exist.", + "File '/node_modules/lodash/webpack.tsx' does not exist.", + "File '/node_modules/lodash/webpack.d.ts' exist - use it as a name resolution result.", + "Resolving real path for '/node_modules/lodash/webpack.d.ts', result '/node_modules/lodash/webpack.d.ts'.", + "======== Module name 'lodash' was successfully resolved to '/node_modules/lodash/webpack.d.ts' with Package ID 'lodash/webpack.d.ts@1.0.0'. ========" +] \ No newline at end of file diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).types b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).types new file mode 100644 index 0000000000000..4ab420533b366 --- /dev/null +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).types @@ -0,0 +1,25 @@ +=== /node_modules/lodash/index.d.ts === +declare const _: "index"; +>_ : "index" + +export = _; +>_ : "index" + +=== /node_modules/lodash/browser.d.ts === +declare const _: "browser"; +>_ : "browser" + +export default _; +>_ : "browser" + +=== /node_modules/lodash/webpack.d.ts === +declare const _: "webpack"; +>_ : "webpack" + +export = _; +>_ : "webpack" + +=== /index.ts === +import _ from "lodash"; +>_ : "webpack" + diff --git a/tests/cases/conformance/moduleResolution/customConditions.ts b/tests/cases/conformance/moduleResolution/customConditions.ts new file mode 100644 index 0000000000000..1205a9860f07d --- /dev/null +++ b/tests/cases/conformance/moduleResolution/customConditions.ts @@ -0,0 +1,31 @@ +// @moduleResolution: hybrid +// @customConditions: webpack, browser +// @resolvePackageJsonExports: true, false +// @traceResolution: true + +// @Filename: /node_modules/lodash/package.json +{ + "name": "lodash", + "version": "1.0.0", + "main": "index.js", + "exports": { + "browser": "./browser.js", + "webpack": "./webpack.js", + "default": "./index.js" + } +} + +// @Filename: /node_modules/lodash/index.d.ts +declare const _: "index"; +export = _; + +// @Filename: /node_modules/lodash/browser.d.ts +declare const _: "browser"; +export default _; + +// @Filename: /node_modules/lodash/webpack.d.ts +declare const _: "webpack"; +export = _; + +// @Filename: /index.ts +import _ from "lodash"; From 5a01dd66206638122beff7dbf232d2293dfa103a Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 18 Nov 2022 15:25:52 -0800 Subject: [PATCH 13/23] Fix indentation --- src/compiler/commandLineParser.ts | 54 +++++++++++++++--------------- src/compiler/moduleNameResolver.ts | 6 ++-- src/compiler/moduleSpecifiers.ts | 18 +++++----- src/services/stringCompletions.ts | 2 +- 4 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index aca25bb08babe..b4b98453ea204 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -1088,34 +1088,34 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ category: Diagnostics.Modules, description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_hybrid_and_either_noEmit_or_emitDeclarationOnly_to_be_set, defaultValueDescription: false, + }, + { + name: "resolvePackageJsonExports", + type: "boolean", + affectsModuleResolution: true, + category: Diagnostics.Modules, + description: Diagnostics.Use_the_package_json_exports_field_when_resolving_package_imports, + defaultValueDescription: Diagnostics.true_when_moduleResolution_is_node16_nodenext_or_hybrid_otherwise_false, + }, + { + name: "resolvePackageJsonImports", + type: "boolean", + affectsModuleResolution: true, + category: Diagnostics.Modules, + description: Diagnostics.Use_the_package_json_imports_field_when_resolving_imports, + defaultValueDescription: Diagnostics.true_when_moduleResolution_is_node16_nodenext_or_hybrid_otherwise_false, + }, + { + name: "customConditions", + type: "list", + element: { + name: "condition", + type: "string", }, - { - name: "resolvePackageJsonExports", - type: "boolean", - affectsModuleResolution: true, - category: Diagnostics.Modules, - description: Diagnostics.Use_the_package_json_exports_field_when_resolving_package_imports, - defaultValueDescription: Diagnostics.true_when_moduleResolution_is_node16_nodenext_or_hybrid_otherwise_false, - }, - { - name: "resolvePackageJsonImports", - type: "boolean", - affectsModuleResolution: true, - category: Diagnostics.Modules, - description: Diagnostics.Use_the_package_json_imports_field_when_resolving_imports, - defaultValueDescription: Diagnostics.true_when_moduleResolution_is_node16_nodenext_or_hybrid_otherwise_false, - }, - { - name: "customConditions", - type: "list", - element: { - name: "condition", - type: "string", - }, - affectsModuleResolution: true, - category: Diagnostics.Modules, - description: Diagnostics.Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports, - }, + affectsModuleResolution: true, + category: Diagnostics.Modules, + description: Diagnostics.Conditions_to_set_in_addition_to_the_resolver_specific_defaults_when_resolving_imports, + }, // Source Maps { diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 1ba764947bff7..3f9b892752af2 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -612,12 +612,12 @@ function getNodeResolutionFeatures(options: CompilerOptions) { switch (getEmitModuleResolutionKind(options)) { case ModuleResolutionKind.Node16: features = NodeResolutionFeatures.Node16Default; - break; + break; case ModuleResolutionKind.NodeNext: features = NodeResolutionFeatures.NodeNextDefault; break; case ModuleResolutionKind.Hybrid: - features = NodeResolutionFeatures.HybridDefault; + features = NodeResolutionFeatures.HybridDefault; break; } if (options.resolvePackageJsonExports) { @@ -2036,7 +2036,7 @@ export interface PackageJsonInfoContents { * * @internal */ - export function getPackageScopeForPath(fileName: string, state: ModuleResolutionState): PackageJsonInfo | undefined { +export function getPackageScopeForPath(fileName: string, state: ModuleResolutionState): PackageJsonInfo | undefined { const parts = getPathComponents(fileName); parts.pop(); while (parts.length > 0) { diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 460da22cfc5dc..db509d2c74ce3 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -860,16 +860,16 @@ function tryGetModuleNameFromRootDirs(rootDirs: readonly string[], moduleFileNam return undefined; } - const normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); - const relativePaths = flatMap(normalizedSourcePaths, sourcePath => { - return map(normalizedTargetPaths, targetPath => ensurePathIsNonModuleName(getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName))); - }); - const shortest = min(relativePaths, compareNumberOfDirectorySeparators); - if (!shortest) { - return undefined; - } - return processEnding(shortest, allowedEndings, compilerOptions); + const normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); + const relativePaths = flatMap(normalizedSourcePaths, sourcePath => { + return map(normalizedTargetPaths, targetPath => ensurePathIsNonModuleName(getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName))); + }); + const shortest = min(relativePaths, compareNumberOfDirectorySeparators); + if (!shortest) { + return undefined; } + return processEnding(shortest, allowedEndings, compilerOptions); +} function tryGetModuleNameAsNodeModule({ path, isRedirect }: ModulePath, { getCanonicalFileName, sourceDirectory }: Info, importingSourceFile: SourceFile, host: ModuleSpecifierResolutionHost, options: CompilerOptions, userPreferences: UserPreferences, packageNameOnly?: boolean, overrideMode?: ResolutionMode): string | undefined { if (!host.fileExists || !host.readFile) { diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index 867aa0648d1a7..18f8e17750e2c 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -545,7 +545,7 @@ interface ExtensionOptions { } function getExtensionOptions(compilerOptions: CompilerOptions, referenceKind: ReferenceKind, importingSourceFile: SourceFile, preferences?: UserPreferences, resolutionMode?: ResolutionMode): ExtensionOptions { -return { + return { extensionsToSearch: flatten(getSupportedExtensionsForModuleResolution(compilerOptions)), referenceKind, importingSourceFile, From 4dd6d01831ad961270b933022e849e63abc1cc04 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 18 Nov 2022 15:29:56 -0800 Subject: [PATCH 14/23] Add baseline showing resolvePackageJsonImports/Exports compatibility --- src/compiler/program.ts | 2 +- ...portsOptionCompat(moduleresolution=classic).errors.txt | 8 ++++++++ ...sExportsOptionCompat(moduleresolution=node).errors.txt | 8 ++++++++ .../packageJsonImportsExportsOptionCompat.ts | 7 +++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=classic).errors.txt create mode 100644 tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=node).errors.txt create mode 100644 tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 69ade50ce9ec2..974525793519c 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -4123,7 +4123,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg createOptionValueDiagnostic("resolvePackageJsonExports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_hybrid, "resolvePackageJsonExports"); } if (options.resolvePackageJsonImports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { - createOptionValueDiagnostic("resolvePackageJsonImports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_hybrid, "resolvePackageJsonExports"); + createOptionValueDiagnostic("resolvePackageJsonImports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_hybrid, "resolvePackageJsonImports"); } if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { createOptionValueDiagnostic("customConditions", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_hybrid, "customConditions"); diff --git a/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=classic).errors.txt b/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=classic).errors.txt new file mode 100644 index 0000000000000..023c4dc8610ad --- /dev/null +++ b/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=classic).errors.txt @@ -0,0 +1,8 @@ +error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. +error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. + + +!!! error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. +!!! error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. +==== tests/cases/conformance/moduleResolution/index.ts (0 errors) ==== + \ No newline at end of file diff --git a/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=node).errors.txt b/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=node).errors.txt new file mode 100644 index 0000000000000..023c4dc8610ad --- /dev/null +++ b/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=node).errors.txt @@ -0,0 +1,8 @@ +error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. +error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. + + +!!! error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. +!!! error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. +==== tests/cases/conformance/moduleResolution/index.ts (0 errors) ==== + \ No newline at end of file diff --git a/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts b/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts new file mode 100644 index 0000000000000..db00495c4ed8d --- /dev/null +++ b/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts @@ -0,0 +1,7 @@ +// @moduleResolution: classic, node, node16, nodenext, hybrid +// @resolvePackageJsonImports: true +// @resolvePackageJsonExports: true +// @noTypesAndSymbols: true +// @noEmit: true + +// @Filename: index.ts \ No newline at end of file From f6fa5f33ad78e1105af595f73faa9563f38695fc Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 28 Nov 2022 12:57:03 -0800 Subject: [PATCH 15/23] Fix test and prevent CJS require from resolving --- src/compiler/binder.ts | 3 ++ src/compiler/checker.ts | 5 +-- src/compiler/program.ts | 7 ++-- .../hybridSyntaxRestrictions.errors.txt | 23 ++++++++----- .../reference/hybridSyntaxRestrictions.js | 16 ++++++++-- .../hybridSyntaxRestrictions.symbols | 26 +++++++++++---- .../reference/hybridSyntaxRestrictions.types | 32 +++++++++++++++---- .../hybrid/hybridSyntaxRestrictions.ts | 8 +++-- 8 files changed, 88 insertions(+), 32 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 64fbdbce0e572..222eaff741dbd 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -82,6 +82,7 @@ import { getContainingClass, getEffectiveContainerForJSDocTemplateTag, getElementOrPropertyAccessName, + getEmitModuleResolutionKind, getEmitScriptTarget, getEnclosingBlockScopeContainer, getErrorSpanForNode, @@ -227,6 +228,7 @@ import { ModifierFlags, ModuleBlock, ModuleDeclaration, + ModuleResolutionKind, Mutable, NamespaceExportDeclaration, Node, @@ -3583,6 +3585,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void { if (!isBindingPattern(node.name)) { const possibleVariableDecl = node.kind === SyntaxKind.VariableDeclaration ? node : node.parent.parent; if (isInJSFile(node) && + getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Hybrid && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & ModifierFlags.Export) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 46db8246f0f13..1b0e1fa1b4753 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4505,6 +4505,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if ( namespace.valueDeclaration && isInJSFile(namespace.valueDeclaration) && + getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Hybrid && isVariableDeclaration(namespace.valueDeclaration) && namespace.valueDeclaration.initializer && isCommonJsRequire(namespace.valueDeclaration.initializer) @@ -33373,7 +33374,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } // In JavaScript files, calls to any identifier 'require' are treated as external module imports - if (isInJSFile(node) && isCommonJsRequire(node)) { + if (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Hybrid && isCommonJsRequire(node)) { return resolveExternalModuleTypeByLiteral(node.arguments![0] as StringLiteral); } @@ -44099,7 +44100,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === SyntaxKind.ImportDeclaration || node.parent.kind === SyntaxKind.ExportDeclaration) && (node.parent as ImportDeclaration).moduleSpecifier === node) || - ((isInJSFile(node) && isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || isImportCall(node.parent)) || + ((isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Hybrid && isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || isImportCall(node.parent)) || (isLiteralTypeNode(node.parent) && isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent) ) { return resolveExternalModuleName(node, node as LiteralExpression, ignoreErrors); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 974525793519c..749e35451a532 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -3065,7 +3065,10 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg for (const node of file.statements) { collectModuleReferences(node, /*inAmbientModule*/ false); } - if ((file.flags & NodeFlags.PossiblyContainsDynamicImport) || isJavaScriptFile) { + + // `require` has no special meaning in `--moduleResolution hybrid` + const shouldProcessRequires = isJavaScriptFile && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Hybrid; + if ((file.flags & NodeFlags.PossiblyContainsDynamicImport) || shouldProcessRequires) { collectDynamicImportOrRequireCalls(file); } @@ -3127,7 +3130,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg const r = /import|require/g; while (r.exec(file.text) !== null) { // eslint-disable-line no-null/no-null const node = getNodeAtPosition(file, r.lastIndex); - if (isJavaScriptFile && isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true)) { + if (shouldProcessRequires && isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true)) { setParentRecursive(node, /*incremental*/ false); // we need parent data on imports before the program is fully bound, so we ensure it's set here imports = append(imports, node.arguments[0]); } diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.errors.txt b/tests/baselines/reference/hybridSyntaxRestrictions.errors.txt index 0a3970e0fc647..e058049f3cd67 100644 --- a/tests/baselines/reference/hybridSyntaxRestrictions.errors.txt +++ b/tests/baselines/reference/hybridSyntaxRestrictions.errors.txt @@ -1,7 +1,21 @@ +error TS2468: Cannot find global value 'Promise'. /main.ts(2,1): error TS5099: Import assignment is not allowed when 'moduleResolution' is set to 'hybrid'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. /main.ts(3,1): error TS5100: Export assignment cannot be used when 'moduleResolution' is set to 'hybrid'. Consider using 'export default' or another module format instead. +/mainJs.js(2,1): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +!!! error TS2468: Cannot find global value 'Promise'. +==== /node_modules/@types/node/index.d.ts (0 errors) ==== + declare var require: (...args: any[]) => any; + +==== /mainJs.js (1 errors) ==== + import {} from "./a"; + import("./a"); + ~~~~~~~~~~~~~ +!!! error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + const _ = require("./a"); // No resolution + _.a; // any + ==== /main.ts (2 errors) ==== import {} from "./a"; import _ = require("./a"); // Error @@ -12,13 +26,6 @@ !!! error TS5100: Export assignment cannot be used when 'moduleResolution' is set to 'hybrid'. Consider using 'export default' or another module format instead. export {}; -==== /node_modules/@types/node/index.d.ts (0 errors) ==== - declare var require: (...args: any[]) => any; - ==== /a.ts (0 errors) ==== - export {}; - -==== /mainJs.js (0 errors) ==== - import {} from "./a"; - const _ = require("./a"); // No resolution + export const a = "a"; \ No newline at end of file diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.js b/tests/baselines/reference/hybridSyntaxRestrictions.js index 7776065ee35f2..95ac57e551973 100644 --- a/tests/baselines/reference/hybridSyntaxRestrictions.js +++ b/tests/baselines/reference/hybridSyntaxRestrictions.js @@ -3,12 +3,11 @@ //// [index.d.ts] declare var require: (...args: any[]) => any; -//// [a.ts] -export {}; - //// [mainJs.js] import {} from "./a"; +import("./a"); const _ = require("./a"); // No resolution +_.a; // any //// [main.ts] import {} from "./a"; @@ -16,10 +15,21 @@ import _ = require("./a"); // Error export = {}; // Error export {}; +//// [a.ts] +export const a = "a"; + //// [a.js] "use strict"; exports.__esModule = true; +exports.a = void 0; +exports.a = "a"; +//// [mainJs.js] +"use strict"; +exports.__esModule = true; +Promise.resolve().then(function () { return require("./a"); }); +var _ = require("./a"); // No resolution +_.a; // any //// [main.js] "use strict"; module.exports = {}; diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.symbols b/tests/baselines/reference/hybridSyntaxRestrictions.symbols index 5f06564f2a083..e48386d570bec 100644 --- a/tests/baselines/reference/hybridSyntaxRestrictions.symbols +++ b/tests/baselines/reference/hybridSyntaxRestrictions.symbols @@ -1,3 +1,20 @@ +=== /node_modules/@types/node/index.d.ts === +declare var require: (...args: any[]) => any; +>require : Symbol(require, Decl(index.d.ts, 0, 11)) +>args : Symbol(args, Decl(index.d.ts, 0, 22)) + +=== /mainJs.js === +import {} from "./a"; +import("./a"); +>"./a" : Symbol("/a", Decl(a.ts, 0, 0)) + +const _ = require("./a"); // No resolution +>_ : Symbol(_, Decl(mainJs.js, 2, 5)) +>require : Symbol(require, Decl(index.d.ts, 0, 11)) + +_.a; // any +>_ : Symbol(_, Decl(mainJs.js, 2, 5)) + === /main.ts === import {} from "./a"; import _ = require("./a"); // Error @@ -6,12 +23,7 @@ import _ = require("./a"); // Error export = {}; // Error export {}; -=== /node_modules/@types/node/index.d.ts === -declare var require: (...args: any[]) => any; ->require : Symbol(require, Decl(index.d.ts, 0, 11)) ->args : Symbol(args, Decl(index.d.ts, 0, 22)) - === /a.ts === - -export {}; +export const a = "a"; +>a : Symbol(a, Decl(a.ts, 0, 12)) diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.types b/tests/baselines/reference/hybridSyntaxRestrictions.types index 82fbd016666b3..ce832fdb57aa5 100644 --- a/tests/baselines/reference/hybridSyntaxRestrictions.types +++ b/tests/baselines/reference/hybridSyntaxRestrictions.types @@ -1,3 +1,25 @@ +=== /node_modules/@types/node/index.d.ts === +declare var require: (...args: any[]) => any; +>require : (...args: any[]) => any +>args : any[] + +=== /mainJs.js === +import {} from "./a"; +import("./a"); +>import("./a") : Promise +>"./a" : "./a" + +const _ = require("./a"); // No resolution +>_ : any +>require("./a") : any +>require : (...args: any[]) => any +>"./a" : "./a" + +_.a; // any +>_.a : any +>_ : any +>a : any + === /main.ts === import {} from "./a"; import _ = require("./a"); // Error @@ -8,12 +30,8 @@ export = {}; // Error export {}; -=== /node_modules/@types/node/index.d.ts === -declare var require: (...args: any[]) => any; ->require : (...args: any[]) => any ->args : any[] - === /a.ts === - -export {}; +export const a = "a"; +>a : "a" +>"a" : "a" diff --git a/tests/cases/conformance/moduleResolution/hybrid/hybridSyntaxRestrictions.ts b/tests/cases/conformance/moduleResolution/hybrid/hybridSyntaxRestrictions.ts index 123c0c6348402..b4b50b6b910f6 100644 --- a/tests/cases/conformance/moduleResolution/hybrid/hybridSyntaxRestrictions.ts +++ b/tests/cases/conformance/moduleResolution/hybrid/hybridSyntaxRestrictions.ts @@ -6,15 +6,17 @@ // @Filename: /node_modules/@types/node/index.d.ts declare var require: (...args: any[]) => any; -// @Filename: /a.ts -export {}; - // @Filename: /mainJs.js import {} from "./a"; +import("./a"); const _ = require("./a"); // No resolution +_.a; // any // @Filename: /main.ts import {} from "./a"; import _ = require("./a"); // Error export = {}; // Error export {}; + +// @Filename: /a.ts +export const a = "a"; From aeb23be7ccfc8edfa4d4e5283753b111c37da519 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 28 Nov 2022 13:03:32 -0800 Subject: [PATCH 16/23] Update unit test baselines --- ...ule-resolutions-from-non-modified-files.js | 40 +++++++++---------- ...ge-affects-a-single-module-of-a-package.js | 8 ++-- .../change-affects-imports.js | 2 +- .../change-affects-type-directives.js | 4 +- .../fetches-imports-after-npm-install.js | 2 +- .../missing-file-is-created.js | 4 +- .../missing-files-remain-missing.js | 4 +- .../module-kind-changes.js | 2 +- .../redirect-no-change.js | 16 ++++---- .../redirect-previous-duplicate-packages.js | 16 ++++---- .../redirect-target-changes.js | 16 ++++---- .../redirect-underlying-changes.js | 16 ++++---- ...rect-with-getSourceFileByPath-no-change.js | 16 ++++---- ...eFileByPath-previous-duplicate-packages.js | 16 ++++---- ...with-getSourceFileByPath-target-changes.js | 16 ++++---- ...-getSourceFileByPath-underlying-changes.js | 16 ++++---- .../resolution-cache-follows-imports.js | 6 +-- ...-an-ambient-external-module-declaration.js | 4 +- .../works-with-updated-SourceFiles.js | 4 +- 19 files changed, 104 insertions(+), 104 deletions(-) diff --git a/tests/baselines/reference/reuseProgramStructure/can-reuse-module-resolutions-from-non-modified-files.js b/tests/baselines/reference/reuseProgramStructure/can-reuse-module-resolutions-from-non-modified-files.js index c95483abd21a8..011755317b6e9 100644 --- a/tests/baselines/reference/reuseProgramStructure/can-reuse-module-resolutions-from-non-modified-files.js +++ b/tests/baselines/reference/reuseProgramStructure/can-reuse-module-resolutions-from-non-modified-files.js @@ -49,7 +49,7 @@ import { B } from './b1'; export let BB = B; declare module './b1' { interface B { y: string; } } resolvedModules: -./b1: {"resolvedFileName":"b1.ts","extension":".ts","isExternalLibraryImport":false} +./b1: {"resolvedFileName":"b1.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: typerefs1: {"primary":true,"resolvedFileName":"node_modules/@types/typerefs1/index.d.ts","isExternalLibraryImport":false} @@ -60,8 +60,8 @@ import { B } from './b2'; import { BB } from './f1'; (new BB).x; (new BB).y; resolvedModules: -./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false} -./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false} +./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} +./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: typerefs2: {"primary":true,"resolvedFileName":"node_modules/@types/typerefs2/index.d.ts","isExternalLibraryImport":false} @@ -147,7 +147,7 @@ import { B } from './b1'; export let BB = B; declare module './b1' { interface B { y: string; } } resolvedModules: -./b1: {"resolvedFileName":"b1.ts","extension":".ts","isExternalLibraryImport":false} +./b1: {"resolvedFileName":"b1.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: typerefs1: {"primary":true,"resolvedFileName":"node_modules/@types/typerefs1/index.d.ts","isExternalLibraryImport":false} @@ -158,8 +158,8 @@ import { B } from './b2'; import { BB } from './f1'; (new BB).x; (new BB).y; resolvedModules: -./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false} -./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false} +./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} +./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: typerefs2: {"primary":true,"resolvedFileName":"node_modules/@types/typerefs2/index.d.ts","isExternalLibraryImport":false} @@ -234,7 +234,7 @@ import { B } from './b1'; export let BB = B; declare module './b1' { interface B { y: string; } } resolvedModules: -./b1: {"resolvedFileName":"b1.ts","extension":".ts","isExternalLibraryImport":false} +./b1: {"resolvedFileName":"b1.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: f2.ts @@ -244,8 +244,8 @@ import { B } from './b2'; import { BB } from './f1'; (new BB).x; (new BB).y; resolvedModules: -./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false} -./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false} +./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} +./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: typerefs2: {"primary":true,"resolvedFileName":"node_modules/@types/typerefs2/index.d.ts","isExternalLibraryImport":false} @@ -315,7 +315,7 @@ import { B } from './b1'; export let BB = B; declare module './b1' { interface B { y: string; } } resolvedModules: -./b1: {"resolvedFileName":"b1.ts","extension":".ts","isExternalLibraryImport":false} +./b1: {"resolvedFileName":"b1.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: f2.ts @@ -325,8 +325,8 @@ import { B } from './b2'; import { BB } from './f1'; (new BB).x; (new BB).y; resolvedModules: -./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false} -./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false} +./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} +./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: typerefs2: {"primary":true,"resolvedFileName":"node_modules/@types/typerefs2/index.d.ts","isExternalLibraryImport":false} @@ -395,7 +395,7 @@ File: f1.ts import { B } from './b1'; declare module './b1' { interface B { y: string; } } resolvedModules: -./b1: {"resolvedFileName":"b1.ts","extension":".ts","isExternalLibraryImport":false} +./b1: {"resolvedFileName":"b1.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: f2.ts @@ -405,8 +405,8 @@ import { B } from './b2'; import { BB } from './f1'; (new BB).x; (new BB).y; resolvedModules: -./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false} -./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false} +./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} +./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: typerefs2: {"primary":true,"resolvedFileName":"node_modules/@types/typerefs2/index.d.ts","isExternalLibraryImport":false} @@ -473,7 +473,7 @@ File: f1.ts import { B } from './b1'; resolvedModules: -./b1: {"resolvedFileName":"b1.ts","extension":".ts","isExternalLibraryImport":false} +./b1: {"resolvedFileName":"b1.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: f2.ts @@ -483,8 +483,8 @@ import { B } from './b2'; import { BB } from './f1'; (new BB).x; (new BB).y; resolvedModules: -./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false} -./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false} +./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} +./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: typerefs2: {"primary":true,"resolvedFileName":"node_modules/@types/typerefs2/index.d.ts","isExternalLibraryImport":false} @@ -563,8 +563,8 @@ import { B } from './b2'; import { BB } from './f1'; (new BB).x; (new BB).y; resolvedModules: -./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false} -./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false} +./b2: {"resolvedFileName":"b2.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} +./f1: {"resolvedFileName":"f1.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: typerefs2: {"primary":true,"resolvedFileName":"node_modules/@types/typerefs2/index.d.ts","isExternalLibraryImport":false} diff --git a/tests/baselines/reference/reuseProgramStructure/change-affects-a-single-module-of-a-package.js b/tests/baselines/reference/reuseProgramStructure/change-affects-a-single-module-of-a-package.js index ecb55554d89ec..c0c2394346d11 100644 --- a/tests/baselines/reference/reuseProgramStructure/change-affects-a-single-module-of-a-package.js +++ b/tests/baselines/reference/reuseProgramStructure/change-affects-a-single-module-of-a-package.js @@ -11,7 +11,7 @@ File: /node_modules/b/index.d.ts export * from './internal'; resolvedModules: -./internal: {"resolvedFileName":"/node_modules/b/internal.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"b","subModuleName":"internal.d.ts","version":"1.2.3"}} +./internal: {"resolvedFileName":"/node_modules/b/internal.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"b","subModuleName":"internal.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -19,7 +19,7 @@ File: /a.ts import {b} from 'b' var a = b; resolvedModules: -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"b","subModuleName":"index.d.ts","version":"1.2.3"}} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"b","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined @@ -41,7 +41,7 @@ File: /node_modules/b/index.d.ts export * from './internal'; resolvedModules: -./internal: {"resolvedFileName":"/node_modules/b/internal.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"b","subModuleName":"internal.d.ts","version":"1.2.3"}} +./internal: {"resolvedFileName":"/node_modules/b/internal.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"b","subModuleName":"internal.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -49,7 +49,7 @@ File: /a.ts import {b} from 'b' var a = b; resolvedModules: -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"b","subModuleName":"index.d.ts","version":"1.2.3"}} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"b","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined diff --git a/tests/baselines/reference/reuseProgramStructure/change-affects-imports.js b/tests/baselines/reference/reuseProgramStructure/change-affects-imports.js index aba311c73193e..9889197003a90 100644 --- a/tests/baselines/reference/reuseProgramStructure/change-affects-imports.js +++ b/tests/baselines/reference/reuseProgramStructure/change-affects-imports.js @@ -34,7 +34,7 @@ File: c.ts import x from 'b' var z = 1; resolvedModules: -b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false} +b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: b.ts diff --git a/tests/baselines/reference/reuseProgramStructure/change-affects-type-directives.js b/tests/baselines/reference/reuseProgramStructure/change-affects-type-directives.js index 957a0402604ce..e1e02a76b843d 100644 --- a/tests/baselines/reference/reuseProgramStructure/change-affects-type-directives.js +++ b/tests/baselines/reference/reuseProgramStructure/change-affects-type-directives.js @@ -4,7 +4,7 @@ File: c.ts import x from 'b' var z = 1; resolvedModules: -b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false} +b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: b.ts @@ -36,7 +36,7 @@ File: c.ts import x from 'b' var z = 1; resolvedModules: -b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false} +b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: b.ts diff --git a/tests/baselines/reference/reuseProgramStructure/fetches-imports-after-npm-install.js b/tests/baselines/reference/reuseProgramStructure/fetches-imports-after-npm-install.js index 44ee08b080c8d..2f3079e4935cb 100644 --- a/tests/baselines/reference/reuseProgramStructure/fetches-imports-after-npm-install.js +++ b/tests/baselines/reference/reuseProgramStructure/fetches-imports-after-npm-install.js @@ -54,7 +54,7 @@ File: file1.ts import * as a from "a"; const myX: number = a.x; resolvedModules: -a: {"resolvedFileName":"node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: file2.ts diff --git a/tests/baselines/reference/reuseProgramStructure/missing-file-is-created.js b/tests/baselines/reference/reuseProgramStructure/missing-file-is-created.js index 9a80ac1e97245..2097558fb7a76 100644 --- a/tests/baselines/reference/reuseProgramStructure/missing-file-is-created.js +++ b/tests/baselines/reference/reuseProgramStructure/missing-file-is-created.js @@ -4,7 +4,7 @@ File: c.ts import x from 'b' var z = 1; resolvedModules: -b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false} +b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: b.ts @@ -40,7 +40,7 @@ File: c.ts import x from 'b' var z = 1; resolvedModules: -b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false} +b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: b.ts diff --git a/tests/baselines/reference/reuseProgramStructure/missing-files-remain-missing.js b/tests/baselines/reference/reuseProgramStructure/missing-files-remain-missing.js index 6218d9c271c29..76fb2a6068089 100644 --- a/tests/baselines/reference/reuseProgramStructure/missing-files-remain-missing.js +++ b/tests/baselines/reference/reuseProgramStructure/missing-files-remain-missing.js @@ -4,7 +4,7 @@ File: c.ts import x from 'b' var z = 1; resolvedModules: -b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false} +b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: b.ts @@ -40,7 +40,7 @@ File: c.ts import x from 'b' var z = 1; resolvedModules: -b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false} +b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: b.ts diff --git a/tests/baselines/reference/reuseProgramStructure/module-kind-changes.js b/tests/baselines/reference/reuseProgramStructure/module-kind-changes.js index a281816fc3046..a92dfe99966f0 100644 --- a/tests/baselines/reference/reuseProgramStructure/module-kind-changes.js +++ b/tests/baselines/reference/reuseProgramStructure/module-kind-changes.js @@ -40,7 +40,7 @@ File: c.ts import x from 'b' var z = 1; resolvedModules: -b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false} +b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: b.ts diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-no-change.js b/tests/baselines/reference/reuseProgramStructure/redirect-no-change.js index 51c155c3206b6..8a8faaea55cbb 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-no-change.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-no-change.js @@ -11,7 +11,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -26,7 +26,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -34,8 +34,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined @@ -57,7 +57,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -72,7 +72,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -80,8 +80,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; const x = 1; resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-previous-duplicate-packages.js b/tests/baselines/reference/reuseProgramStructure/redirect-previous-duplicate-packages.js index 2add0fb7bdc7a..a1d3a30d2dbb8 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-previous-duplicate-packages.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-previous-duplicate-packages.js @@ -11,7 +11,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -26,7 +26,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.4"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.4"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -34,8 +34,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined @@ -59,7 +59,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -74,7 +74,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -82,8 +82,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-target-changes.js b/tests/baselines/reference/reuseProgramStructure/redirect-target-changes.js index b5092c7bd3668..ba88adf1b9d73 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-target-changes.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-target-changes.js @@ -11,7 +11,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -26,7 +26,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -34,8 +34,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined @@ -57,7 +57,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -72,7 +72,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -80,8 +80,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-underlying-changes.js b/tests/baselines/reference/reuseProgramStructure/redirect-underlying-changes.js index 862191f70b6cf..31adae0658bca 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-underlying-changes.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-underlying-changes.js @@ -11,7 +11,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -26,7 +26,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -34,8 +34,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined @@ -57,7 +57,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -72,7 +72,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.4"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.4"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -80,8 +80,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-no-change.js b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-no-change.js index 51c155c3206b6..8a8faaea55cbb 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-no-change.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-no-change.js @@ -11,7 +11,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -26,7 +26,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -34,8 +34,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined @@ -57,7 +57,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -72,7 +72,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -80,8 +80,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; const x = 1; resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-previous-duplicate-packages.js b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-previous-duplicate-packages.js index 2add0fb7bdc7a..a1d3a30d2dbb8 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-previous-duplicate-packages.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-previous-duplicate-packages.js @@ -11,7 +11,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -26,7 +26,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.4"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.4"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -34,8 +34,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined @@ -59,7 +59,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -74,7 +74,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -82,8 +82,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-target-changes.js b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-target-changes.js index b5092c7bd3668..ba88adf1b9d73 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-target-changes.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-target-changes.js @@ -11,7 +11,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -26,7 +26,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -34,8 +34,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined @@ -57,7 +57,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -72,7 +72,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -80,8 +80,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-underlying-changes.js b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-underlying-changes.js index 862191f70b6cf..31adae0658bca 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-underlying-changes.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-underlying-changes.js @@ -11,7 +11,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -26,7 +26,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -34,8 +34,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined @@ -57,7 +57,7 @@ File: /node_modules/a/index.d.ts import X from "x"; export function a(x: X): void; resolvedModules: -x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"}} +x: {"resolvedFileName":"/node_modules/a/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.3"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /node_modules/b/node_modules/x/index.d.ts @@ -72,7 +72,7 @@ File: /node_modules/b/index.d.ts import X from "x"; export const b: X; resolvedModules: -x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.4"}} +x: {"resolvedFileName":"/node_modules/b/node_modules/x/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"packageId":{"name":"x","subModuleName":"index.d.ts","version":"1.2.4"},"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined File: /a.ts @@ -80,8 +80,8 @@ File: /a.ts import { a } from "a"; import { b } from "b"; a(b) resolvedModules: -a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} -b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true} +a: {"resolvedFileName":"/node_modules/a/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} +b: {"resolvedFileName":"/node_modules/b/index.d.ts","extension":".d.ts","isExternalLibraryImport":true,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined diff --git a/tests/baselines/reference/reuseProgramStructure/resolution-cache-follows-imports.js b/tests/baselines/reference/reuseProgramStructure/resolution-cache-follows-imports.js index 97252926f9a76..0222d6a4a125c 100644 --- a/tests/baselines/reference/reuseProgramStructure/resolution-cache-follows-imports.js +++ b/tests/baselines/reference/reuseProgramStructure/resolution-cache-follows-imports.js @@ -11,7 +11,7 @@ File: a.ts import {_} from 'b' var x = 1 resolvedModules: -b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false} +b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined @@ -34,7 +34,7 @@ File: a.ts import {_} from 'b' var x = 2 resolvedModules: -b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false} +b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined @@ -73,7 +73,7 @@ import x from 'b' var x = 2 resolvedModules: -b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false} +b: {"resolvedFileName":"b.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} c: undefined resolvedTypeReferenceDirectiveNames: undefined diff --git a/tests/baselines/reference/reuseProgramStructure/resolvedImports-after-re-using-an-ambient-external-module-declaration.js b/tests/baselines/reference/reuseProgramStructure/resolvedImports-after-re-using-an-ambient-external-module-declaration.js index 7c19c1adf675b..9188752a800fc 100644 --- a/tests/baselines/reference/reuseProgramStructure/resolvedImports-after-re-using-an-ambient-external-module-declaration.js +++ b/tests/baselines/reference/reuseProgramStructure/resolvedImports-after-re-using-an-ambient-external-module-declaration.js @@ -4,7 +4,7 @@ File: /a.ts import * as a from "a"; resolvedModules: -a: {"resolvedFileName":"/a.ts","extension":".ts","isExternalLibraryImport":false} +a: {"resolvedFileName":"/a.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined @@ -19,7 +19,7 @@ File: /a.ts import * as aa from "a"; resolvedModules: -a: {"resolvedFileName":"/a.ts","extension":".ts","isExternalLibraryImport":false} +a: {"resolvedFileName":"/a.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined diff --git a/tests/baselines/reference/reuseProgramStructure/works-with-updated-SourceFiles.js b/tests/baselines/reference/reuseProgramStructure/works-with-updated-SourceFiles.js index 266d6122b5389..2940ddfc64487 100644 --- a/tests/baselines/reference/reuseProgramStructure/works-with-updated-SourceFiles.js +++ b/tests/baselines/reference/reuseProgramStructure/works-with-updated-SourceFiles.js @@ -4,7 +4,7 @@ File: /a.ts import * as a from "a";a; resolvedModules: -a: {"resolvedFileName":"/a.ts","extension":".ts","isExternalLibraryImport":false} +a: {"resolvedFileName":"/a.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined @@ -20,7 +20,7 @@ File: /a.ts import * as a from "a";a; resolvedModules: -a: {"resolvedFileName":"/a.ts","extension":".ts","isExternalLibraryImport":false} +a: {"resolvedFileName":"/a.ts","extension":".ts","isExternalLibraryImport":false,"resolvedUsingTsExtension":false} resolvedTypeReferenceDirectiveNames: undefined From f9414aa23dcdc5672763e1a40ca09982822e2275 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 5 Dec 2022 11:25:15 -0800 Subject: [PATCH 17/23] Fix bad merge conflict resolution --- src/compiler/moduleNameResolver.ts | 2 - ...esolvepackagejsonexports=false).trace.json | 2 +- ...resolvepackagejsonexports=true).trace.json | 1 - ...sextensions=false,noemit=false).trace.json | 2 - ...tsextensions=false,noemit=true).trace.json | 2 - ...tsextensions=true,noemit=false).trace.json | 2 - ...gtsextensions=true,noemit=true).trace.json | 2 - .../reference/hybridNodeModules1.trace.json | 1 - ...seUrl-without-path-mappings-or-rootDirs.js | 36 ++++++---- .../classic-baseUrl-path-mappings.js | 12 ++-- .../moduleResolution/classic-baseUrl.js | 12 ++-- .../moduleResolution/classic-rootDirs.js | 9 ++- .../moduleResolution/nested-node-module.js | 6 +- .../node-baseUrl-path-mappings.js | 42 +++++++---- .../moduleResolution/node-baseUrl.js | 24 ++++--- .../moduleResolution/node-rootDirs.js | 18 +++-- .../non-relative-module-name-as-directory.js | 6 +- ...module-name-as-file-ts-files-not-loaded.js | 6 +- .../non-relative-module-name-as-file.js | 6 +- .../non-relative-preserveSymlinks.js | 6 +- ...ive-preserves-originalPath-on-cache-hit.js | 6 +- ...-relative-uses-originalPath-for-caching.js | 6 +- ...ive-module-name-as-directory-load-index.js | 6 +- ...-name-as-directory-with-invalid-typings.js | 30 +++++--- .../relative-module-name-as-directory.js | 24 ++++--- .../relative-module-name-as-file.js | 72 ++++++++++++------- ...utionWithExtensions_unexpected2.trace.json | 4 -- ...lutionWithSuffixes_one_jsModule.trace.json | 4 -- .../reference/packageJsonMain.trace.json | 4 -- ...en-package-json-with-type-module-exists.js | 16 ----- .../package-json-file-is-edited.js | 20 ------ 31 files changed, 219 insertions(+), 170 deletions(-) diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 500eddd9f773e..3381bd7e839e0 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1755,8 +1755,6 @@ function loadModuleFromFile(extensions: Extensions, candidate: string, onlyRecor return resolvedByAddingExtension; } } - - return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state); } function loadModuleFromFileNoImplicitExtensions(extensions: Extensions, candidate: string, onlyRecordFailures: boolean, state: ModuleResolutionState): PathAndExtension | undefined { diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).trace.json b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).trace.json index 922234fe125a0..49c7146ff7ee8 100644 --- a/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).trace.json +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).trace.json @@ -4,10 +4,10 @@ "File '/package.json' does not exist.", "Loading module 'lodash' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", "Found 'package.json' at '/node_modules/lodash/package.json'.", - "'package.json' does not have a 'typesVersions' field.", "File '/node_modules/lodash.ts' does not exist.", "File '/node_modules/lodash.tsx' does not exist.", "File '/node_modules/lodash.d.ts' does not exist.", + "'package.json' does not have a 'typesVersions' field.", "'package.json' does not have a 'typings' field.", "'package.json' does not have a 'types' field.", "'package.json' has 'main' field 'index.js' that references '/node_modules/lodash/index.js'.", diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).trace.json b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).trace.json index dd46403892a5a..8289b5cf1eab2 100644 --- a/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).trace.json +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).trace.json @@ -4,7 +4,6 @@ "File '/package.json' does not exist.", "Loading module 'lodash' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", "Found 'package.json' at '/node_modules/lodash/package.json'.", - "'package.json' does not have a 'typesVersions' field.", "Saw non-matching condition 'browser'.", "Matched 'exports' condition 'webpack'.", "Using 'exports' subpath '.' with target './webpack.js'.", diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json index c248542bacc88..2ebe4e7c42081 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json @@ -96,8 +96,6 @@ "File '/project/a.d.ts.d.ts' does not exist.", "File '/project/a.d.ts.js' does not exist.", "File '/project/a.d.ts.jsx' does not exist.", - "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", - "File '/project/a.d.ts' does not exist.", "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", "======== Module name './a.d.ts' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json index c248542bacc88..2ebe4e7c42081 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json @@ -96,8 +96,6 @@ "File '/project/a.d.ts.d.ts' does not exist.", "File '/project/a.d.ts.js' does not exist.", "File '/project/a.d.ts.jsx' does not exist.", - "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", - "File '/project/a.d.ts' does not exist.", "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", "======== Module name './a.d.ts' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json index c248542bacc88..2ebe4e7c42081 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json @@ -96,8 +96,6 @@ "File '/project/a.d.ts.d.ts' does not exist.", "File '/project/a.d.ts.js' does not exist.", "File '/project/a.d.ts.jsx' does not exist.", - "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", - "File '/project/a.d.ts' does not exist.", "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", "======== Module name './a.d.ts' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json index c248542bacc88..2ebe4e7c42081 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json @@ -96,8 +96,6 @@ "File '/project/a.d.ts.d.ts' does not exist.", "File '/project/a.d.ts.js' does not exist.", "File '/project/a.d.ts.jsx' does not exist.", - "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", - "File '/project/a.d.ts' does not exist.", "Directory '/project/a.d.ts' does not exist, skipping all lookups in it.", "======== Module name './a.d.ts' was not resolved. ========" ] \ No newline at end of file diff --git a/tests/baselines/reference/hybridNodeModules1.trace.json b/tests/baselines/reference/hybridNodeModules1.trace.json index 894b3616c2ee8..bcd13bb309acb 100644 --- a/tests/baselines/reference/hybridNodeModules1.trace.json +++ b/tests/baselines/reference/hybridNodeModules1.trace.json @@ -4,7 +4,6 @@ "File '/package.json' does not exist.", "Loading module 'dual' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", "Found 'package.json' at '/node_modules/dual/package.json'.", - "'package.json' does not have a 'typesVersions' field.", "Matched 'exports' condition 'import'.", "Using 'exports' subpath '.' with target './index.js'.", "File name '/node_modules/dual/index.js' has a '.js' extension - stripping it.", diff --git a/tests/baselines/reference/moduleResolution/baseUrl-without-path-mappings-or-rootDirs.js b/tests/baselines/reference/moduleResolution/baseUrl-without-path-mappings-or-rootDirs.js index 520a6a54583f9..14ef468557a78 100644 --- a/tests/baselines/reference/moduleResolution/baseUrl-without-path-mappings-or-rootDirs.js +++ b/tests/baselines/reference/moduleResolution/baseUrl-without-path-mappings-or-rootDirs.js @@ -12,7 +12,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder2/file2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -24,7 +25,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder2/file3.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -36,7 +38,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder1/file1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -48,7 +51,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder2/file2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -60,7 +64,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder2/file3.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -72,7 +77,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder1/file1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -93,7 +99,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder2/file2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -105,7 +112,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder2/file3.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -117,7 +125,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder1/file1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -129,7 +138,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder2/file2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -141,7 +151,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder2/file3.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -153,7 +164,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder1/file1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], diff --git a/tests/baselines/reference/moduleResolution/classic-baseUrl-path-mappings.js b/tests/baselines/reference/moduleResolution/classic-baseUrl-path-mappings.js index 67446c13fdfe3..0fe5e46fd6887 100644 --- a/tests/baselines/reference/moduleResolution/classic-baseUrl-path-mappings.js +++ b/tests/baselines/reference/moduleResolution/classic-baseUrl-path-mappings.js @@ -12,7 +12,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder1/file1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -24,7 +25,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/generated/folder1/file2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/folder1/file2.ts", @@ -40,7 +42,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/generated/folder1/file2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -52,7 +55,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/folder1/file3.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/folder1/file3.ts", diff --git a/tests/baselines/reference/moduleResolution/classic-baseUrl.js b/tests/baselines/reference/moduleResolution/classic-baseUrl.js index ac6b67c8bb104..7cfbf4d21c7ba 100644 --- a/tests/baselines/reference/moduleResolution/classic-baseUrl.js +++ b/tests/baselines/reference/moduleResolution/classic-baseUrl.js @@ -12,7 +12,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/x/m1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -24,7 +25,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/m2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/x/m2.ts", @@ -58,7 +60,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/x/m1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -70,7 +73,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/m2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/x/m2.ts", diff --git a/tests/baselines/reference/moduleResolution/classic-rootDirs.js b/tests/baselines/reference/moduleResolution/classic-rootDirs.js index 40cb12c8eab55..830d01b1d344c 100644 --- a/tests/baselines/reference/moduleResolution/classic-rootDirs.js +++ b/tests/baselines/reference/moduleResolution/classic-rootDirs.js @@ -15,7 +15,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/generated/folder1/file2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/folder1/file2.ts", @@ -31,7 +32,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder1/file1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/generated/folder1/file1.ts", @@ -47,7 +49,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/folder1/file1_1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/generated/folder2/folder1/file1_1.ts", diff --git a/tests/baselines/reference/moduleResolution/nested-node-module.js b/tests/baselines/reference/moduleResolution/nested-node-module.js index ba9c0a1480782..e1b43964b8003 100644 --- a/tests/baselines/reference/moduleResolution/nested-node-module.js +++ b/tests/baselines/reference/moduleResolution/nested-node-module.js @@ -12,7 +12,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/src/libs/guid/dist/guid.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/src/libs/guid.ts", @@ -39,7 +40,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/src/libs/guid/dist/guid.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/src/libs/guid.ts", diff --git a/tests/baselines/reference/moduleResolution/node-baseUrl-path-mappings.js b/tests/baselines/reference/moduleResolution/node-baseUrl-path-mappings.js index d28fcbea219c2..c433eeddbcc24 100644 --- a/tests/baselines/reference/moduleResolution/node-baseUrl-path-mappings.js +++ b/tests/baselines/reference/moduleResolution/node-baseUrl-path-mappings.js @@ -24,7 +24,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder1/file1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -36,7 +37,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/generated/folder1/file2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/folder1/file2.ts", @@ -56,7 +58,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/generated/folder1/file2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -68,7 +71,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/generated/folder2/file3/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/folder2/file3.ts", @@ -94,7 +98,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/generated/folder2/file4/dist/types.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/folder2/file4.ts", @@ -119,7 +124,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/someanotherfolder/file5/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/someanotherfolder/file5.ts", @@ -138,7 +144,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/node_modules/file6.ts", "extension": ".ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/file6.ts", @@ -197,7 +204,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder1/file1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -209,7 +217,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/generated/folder1/file2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/folder1/file2.ts", @@ -229,7 +238,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/generated/folder1/file2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -241,7 +251,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/generated/folder2/file3/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/folder2/file3.ts", @@ -267,7 +278,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/generated/folder2/file4/dist/types.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/folder2/file4.ts", @@ -292,7 +304,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/someanotherfolder/file5/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/someanotherfolder/file5.ts", @@ -311,7 +324,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/node_modules/file6.ts", "extension": ".ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/file6.ts", diff --git a/tests/baselines/reference/moduleResolution/node-baseUrl.js b/tests/baselines/reference/moduleResolution/node-baseUrl.js index 9b786b1bb6e91..f560859620abf 100644 --- a/tests/baselines/reference/moduleResolution/node-baseUrl.js +++ b/tests/baselines/reference/moduleResolution/node-baseUrl.js @@ -21,7 +21,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/m1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -33,7 +34,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/m2/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/m2.ts", @@ -52,7 +54,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/m3/dist/typings.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/m3.ts", @@ -70,7 +73,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/node_modules/m4.ts", "extension": ".ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/m4.ts", @@ -129,7 +133,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/m1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -141,7 +146,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/m2/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/m2.ts", @@ -160,7 +166,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/m3/dist/typings.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/m3.ts", @@ -178,7 +185,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/node_modules/m4.ts", "extension": ".ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/m4.ts", diff --git a/tests/baselines/reference/moduleResolution/node-rootDirs.js b/tests/baselines/reference/moduleResolution/node-rootDirs.js index 49fd78c947f3b..94aefdea91f5a 100644 --- a/tests/baselines/reference/moduleResolution/node-rootDirs.js +++ b/tests/baselines/reference/moduleResolution/node-rootDirs.js @@ -15,7 +15,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/generated/folder1/file2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/folder1/file2.ts", @@ -35,7 +36,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder1/file1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/generated/folder1/file1.ts", @@ -55,7 +57,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder1/file1_1/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/generated/folder1/file1_1.ts", @@ -93,7 +96,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/generated/folder1/file2.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/folder1/file2.ts", @@ -113,7 +117,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder1/file1.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/generated/folder1/file1.ts", @@ -133,7 +138,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/root/folder1/file1_1/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/root/generated/folder1/file1_1.ts", diff --git a/tests/baselines/reference/moduleResolution/non-relative-module-name-as-directory.js b/tests/baselines/reference/moduleResolution/non-relative-module-name-as-directory.js index 8ca68184a2e98..44223b1d0149b 100644 --- a/tests/baselines/reference/moduleResolution/non-relative-module-name-as-directory.js +++ b/tests/baselines/reference/moduleResolution/non-relative-module-name-as-directory.js @@ -9,7 +9,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/a/node_modules/foo/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/node_modules/b/c/node_modules/d/node_modules/foo/package.json", @@ -64,7 +65,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/a/node_modules/foo/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/node_modules/b/c/node_modules/d/node_modules/foo/package.json", diff --git a/tests/baselines/reference/moduleResolution/non-relative-module-name-as-file-ts-files-not-loaded.js b/tests/baselines/reference/moduleResolution/non-relative-module-name-as-file-ts-files-not-loaded.js index da517407b2b34..5b0027cc014ef 100644 --- a/tests/baselines/reference/moduleResolution/non-relative-module-name-as-file-ts-files-not-loaded.js +++ b/tests/baselines/reference/moduleResolution/non-relative-module-name-as-file-ts-files-not-loaded.js @@ -9,7 +9,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/a/b/node_modules/foo.ts", "extension": ".ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/b/c/d/node_modules/foo/package.json", @@ -49,7 +50,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/a/b/node_modules/foo.ts", "extension": ".ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/b/c/d/node_modules/foo/package.json", diff --git a/tests/baselines/reference/moduleResolution/non-relative-module-name-as-file.js b/tests/baselines/reference/moduleResolution/non-relative-module-name-as-file.js index 25338e92e477a..3d87342150dfd 100644 --- a/tests/baselines/reference/moduleResolution/non-relative-module-name-as-file.js +++ b/tests/baselines/reference/moduleResolution/non-relative-module-name-as-file.js @@ -9,7 +9,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/a/b/node_modules/foo.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/b/c/d/node_modules/foo/package.json", @@ -51,7 +52,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/a/b/node_modules/foo.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/b/c/d/node_modules/foo/package.json", diff --git a/tests/baselines/reference/moduleResolution/non-relative-preserveSymlinks.js b/tests/baselines/reference/moduleResolution/non-relative-preserveSymlinks.js index ef68b82c1edb7..1076d7b29b92e 100644 --- a/tests/baselines/reference/moduleResolution/non-relative-preserveSymlinks.js +++ b/tests/baselines/reference/moduleResolution/non-relative-preserveSymlinks.js @@ -12,7 +12,8 @@ Resolution:: { "resolvedFileName": "/linked/index.d.ts", "originalPath": "/app/node_modules/linked/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/app/node_modules/linked.ts", @@ -41,7 +42,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/app/node_modules/linked/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/app/node_modules/linked.ts", diff --git a/tests/baselines/reference/moduleResolution/non-relative-preserves-originalPath-on-cache-hit.js b/tests/baselines/reference/moduleResolution/non-relative-preserves-originalPath-on-cache-hit.js index 6c209264fec47..022b020197157 100644 --- a/tests/baselines/reference/moduleResolution/non-relative-preserves-originalPath-on-cache-hit.js +++ b/tests/baselines/reference/moduleResolution/non-relative-preserves-originalPath-on-cache-hit.js @@ -12,7 +12,8 @@ Resolution:: { "resolvedFileName": "/linked/index.d.ts", "originalPath": "/app/node_modules/linked/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/app/src/node_modules/linked/package.json", @@ -44,7 +45,8 @@ Resolution:: { "resolvedFileName": "/linked/index.d.ts", "originalPath": "/app/node_modules/linked/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/app/src/node_modules/linked/package.json", diff --git a/tests/baselines/reference/moduleResolution/non-relative-uses-originalPath-for-caching.js b/tests/baselines/reference/moduleResolution/non-relative-uses-originalPath-for-caching.js index 905354c32cd1a..0a4603155c860 100644 --- a/tests/baselines/reference/moduleResolution/non-relative-uses-originalPath-for-caching.js +++ b/tests/baselines/reference/moduleResolution/non-relative-uses-originalPath-for-caching.js @@ -12,7 +12,8 @@ Resolution:: { "resolvedFileName": "/modules/a.ts", "originalPath": "/sub/node_modules/a/index.ts", "extension": ".ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/sub/dir/node_modules/a/package.json", @@ -42,7 +43,8 @@ Resolution:: { "resolvedFileName": "/modules/a.ts", "originalPath": "/sub/node_modules/a/index.ts", "extension": ".ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/sub/dir/node_modules/a/package.json", diff --git a/tests/baselines/reference/moduleResolution/relative-module-name-as-directory-load-index.js b/tests/baselines/reference/moduleResolution/relative-module-name-as-directory-load-index.js index 441de892edc81..f856d9262444d 100644 --- a/tests/baselines/reference/moduleResolution/relative-module-name-as-directory-load-index.js +++ b/tests/baselines/reference/moduleResolution/relative-module-name-as-directory-load-index.js @@ -12,7 +12,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/a/b/foo/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/b/foo.ts", @@ -48,7 +49,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/a/b/foo/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/b/foo.ts", diff --git a/tests/baselines/reference/moduleResolution/relative-module-name-as-directory-with-invalid-typings.js b/tests/baselines/reference/moduleResolution/relative-module-name-as-directory-with-invalid-typings.js index 1313664721b83..b9dc765e8f64a 100644 --- a/tests/baselines/reference/moduleResolution/relative-module-name-as-directory-with-invalid-typings.js +++ b/tests/baselines/reference/moduleResolution/relative-module-name-as-directory-with-invalid-typings.js @@ -15,7 +15,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/node_modules/b/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/node_modules/b/package.json", @@ -57,7 +58,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/node_modules/b/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/node_modules/b/package.json", @@ -99,7 +101,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/node_modules/b/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/node_modules/b/package.json", @@ -141,7 +144,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/node_modules/b/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/node_modules/b/package.json", @@ -183,7 +187,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/node_modules/b/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/node_modules/b/package.json", @@ -225,7 +230,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/node_modules/b/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/node_modules/b/package.json", @@ -267,7 +273,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/node_modules/b/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/node_modules/b/package.json", @@ -309,7 +316,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/node_modules/b/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/node_modules/b/package.json", @@ -351,7 +359,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/node_modules/b/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/node_modules/b/package.json", @@ -393,7 +402,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/node_modules/b/index.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": true + "isExternalLibraryImport": true, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/node_modules/b/package.json", diff --git a/tests/baselines/reference/moduleResolution/relative-module-name-as-directory.js b/tests/baselines/reference/moduleResolution/relative-module-name-as-directory.js index 2c8937052e702..ae6aa592c9de0 100644 --- a/tests/baselines/reference/moduleResolution/relative-module-name-as-directory.js +++ b/tests/baselines/reference/moduleResolution/relative-module-name-as-directory.js @@ -12,7 +12,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/a/b/c/bar/c/d/e.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/b/c/bar.ts", @@ -39,7 +40,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/a/b/c/bar/c/d/e.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/b/c/bar.ts", @@ -66,7 +68,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/a/bar/e.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/bar.ts", @@ -93,7 +96,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/a/bar/e.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/a/bar.ts", @@ -120,7 +124,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/bar/e.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/bar.ts", @@ -147,7 +152,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/bar/e.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/bar.ts", @@ -174,7 +180,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "c:/bar/e.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "c:/bar.ts", @@ -201,7 +208,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "c:/bar/e.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "c:/bar.ts", diff --git a/tests/baselines/reference/moduleResolution/relative-module-name-as-file.js b/tests/baselines/reference/moduleResolution/relative-module-name-as-file.js index f39c056c2b07a..529c3b057f304 100644 --- a/tests/baselines/reference/moduleResolution/relative-module-name-as-file.js +++ b/tests/baselines/reference/moduleResolution/relative-module-name-as-file.js @@ -10,7 +10,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo/bar/foo.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -28,7 +29,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo/bar/foo.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -46,7 +48,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo/bar/foo.tsx", "extension": ".tsx", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/foo/bar/foo.ts" @@ -66,7 +69,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo/bar/foo.tsx", "extension": ".tsx", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/foo/bar/foo.ts" @@ -86,7 +90,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo/bar/foo.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/foo/bar/foo.ts", @@ -107,7 +112,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo/bar/foo.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/foo/bar/foo.ts", @@ -130,7 +136,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo/foo.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -148,7 +155,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo/foo.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -166,7 +174,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo/foo.tsx", "extension": ".tsx", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/foo/foo.ts" @@ -186,7 +195,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo/foo.tsx", "extension": ".tsx", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/foo/foo.ts" @@ -206,7 +216,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo/foo.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/foo/foo.ts", @@ -227,7 +238,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo/foo.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/foo/foo.ts", @@ -250,7 +262,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -268,7 +281,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -286,7 +300,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo.tsx", "extension": ".tsx", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/foo.ts" @@ -306,7 +321,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo.tsx", "extension": ".tsx", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/foo.ts" @@ -326,7 +342,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/foo.ts", @@ -347,7 +364,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "/foo.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "/foo.ts", @@ -370,7 +388,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "c:/foo.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -388,7 +407,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "c:/foo.ts", "extension": ".ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [], "affectingLocations": [], @@ -406,7 +426,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "c:/foo.tsx", "extension": ".tsx", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "c:/foo.ts" @@ -426,7 +447,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "c:/foo.tsx", "extension": ".tsx", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "c:/foo.ts" @@ -446,7 +468,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "c:/foo.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "c:/foo.ts", @@ -467,7 +490,8 @@ Resolution:: { "resolvedModule": { "resolvedFileName": "c:/foo.d.ts", "extension": ".d.ts", - "isExternalLibraryImport": false + "isExternalLibraryImport": false, + "resolvedUsingTsExtension": false }, "failedLookupLocations": [ "c:/foo.ts", diff --git a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json index cc002fa3d6f25..a2521c7f7395f 100644 --- a/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json +++ b/tests/baselines/reference/moduleResolutionWithExtensions_unexpected2.trace.json @@ -19,10 +19,6 @@ "File '/node_modules/foo/foo.js.ts' does not exist.", "File '/node_modules/foo/foo.js.tsx' does not exist.", "File '/node_modules/foo/foo.js.d.ts' does not exist.", - "File name '/node_modules/foo/foo.js' has a '.js' extension - stripping it.", - "File '/node_modules/foo/foo.ts' does not exist.", - "File '/node_modules/foo/foo.tsx' does not exist.", - "File '/node_modules/foo/foo.d.ts' does not exist.", "Directory '/node_modules/foo/foo.js' does not exist, skipping all lookups in it.", "File '/node_modules/foo/index.ts' does not exist.", "File '/node_modules/foo/index.tsx' does not exist.", diff --git a/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsModule.trace.json b/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsModule.trace.json index a63b584c81558..f1472c7f4c459 100644 --- a/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsModule.trace.json +++ b/tests/baselines/reference/moduleResolutionWithSuffixes_one_jsModule.trace.json @@ -9,10 +9,6 @@ "File '/foo.js.ios.ts' does not exist.", "File '/foo.js.ios.tsx' does not exist.", "File '/foo.js.ios.d.ts' does not exist.", - "File name '/foo.js' has a '.js' extension - stripping it.", - "File '/foo.ios.ts' does not exist.", - "File '/foo.ios.tsx' does not exist.", - "File '/foo.ios.d.ts' does not exist.", "Directory '/foo.js' does not exist, skipping all lookups in it.", "Loading module as file / folder, candidate module location '/foo.js', target file types: JavaScript.", "File name '/foo.js' has a '.js' extension - stripping it.", diff --git a/tests/baselines/reference/packageJsonMain.trace.json b/tests/baselines/reference/packageJsonMain.trace.json index ad862538465f5..0b4ae83be9631 100644 --- a/tests/baselines/reference/packageJsonMain.trace.json +++ b/tests/baselines/reference/packageJsonMain.trace.json @@ -51,10 +51,6 @@ "File '/node_modules/bar/rab.js.ts' does not exist.", "File '/node_modules/bar/rab.js.tsx' does not exist.", "File '/node_modules/bar/rab.js.d.ts' does not exist.", - "File name '/node_modules/bar/rab.js' has a '.js' extension - stripping it.", - "File '/node_modules/bar/rab.ts' does not exist.", - "File '/node_modules/bar/rab.tsx' does not exist.", - "File '/node_modules/bar/rab.d.ts' does not exist.", "Directory '/node_modules/bar/rab.js' does not exist, skipping all lookups in it.", "File '/node_modules/bar/index.ts' does not exist.", "File '/node_modules/bar/index.tsx' does not exist.", diff --git a/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js b/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js index af4b7b9ece81c..3d8b1ff5b569d 100644 --- a/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js +++ b/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited-when-package-json-with-type-module-exists.js @@ -50,10 +50,6 @@ File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extensi File '/user/username/projects/myproject/src/fileB.mts' does not exist. File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src 0 undefined Failed Lookup Locations @@ -169,10 +165,6 @@ File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations @@ -276,10 +268,6 @@ File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extensi File '/user/username/projects/myproject/src/fileB.mts' does not exist. File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== File '/a/lib/package.json' does not exist according to earlier cached lookups. @@ -390,10 +378,6 @@ File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations diff --git a/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited.js b/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited.js index 1e5a35c06ecfc..688ac828dc9f7 100644 --- a/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited.js +++ b/tests/baselines/reference/tscWatch/moduleResolution/package-json-file-is-edited.js @@ -55,10 +55,6 @@ File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations @@ -175,10 +171,6 @@ File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extensi File '/user/username/projects/myproject/src/fileB.mts' does not exist. File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== File '/a/lib/package.json' does not exist according to earlier cached lookups. @@ -283,10 +275,6 @@ File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations @@ -482,10 +470,6 @@ File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extensi File '/user/username/projects/myproject/src/fileB.mts' does not exist. File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== File '/a/lib/package.json' does not exist according to earlier cached lookups. @@ -597,10 +581,6 @@ File '/user/username/projects/myproject/src/fileB.mjs.tsx' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.d.ts' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.js' does not exist. File '/user/username/projects/myproject/src/fileB.mjs.jsx' does not exist. -File name '/user/username/projects/myproject/src/fileB.mjs' has a '.mjs' extension - stripping it. -File '/user/username/projects/myproject/src/fileB.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.d.mts' does not exist. -File '/user/username/projects/myproject/src/fileB.mjs' does not exist. Directory '/user/username/projects/myproject/src/fileB.mjs' does not exist, skipping all lookups in it. ======== Module name './fileB.mjs' was not resolved. ======== DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/src/fileB.mjs 1 undefined Failed Lookup Locations From dadc1a85722d89e35a94bc6e9e12099ecf858b6f Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 5 Dec 2022 15:49:38 -0800 Subject: [PATCH 18/23] Make resolvedUsingTsExtension optional --- src/compiler/types.ts | 2 +- src/testRunner/unittests/moduleResolution.ts | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 9663407956ac2..8cc9aaec0f2db 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -7224,7 +7224,7 @@ export interface ResolvedModule { * True if the original module reference used a .ts extension to refer directly to a .ts file, * which should produce an error during checking if emit is enabled. */ - resolvedUsingTsExtension: boolean; + resolvedUsingTsExtension?: boolean; } /** diff --git a/src/testRunner/unittests/moduleResolution.ts b/src/testRunner/unittests/moduleResolution.ts index 8b9326b0a3ed7..5ae7ebee71e56 100644 --- a/src/testRunner/unittests/moduleResolution.ts +++ b/src/testRunner/unittests/moduleResolution.ts @@ -169,7 +169,6 @@ describe("unittests:: moduleResolution:: Node module resolution - non-relative p resolvedFileName: "/sub/node_modules/a/index.ts", isExternalLibraryImport: true, extension: ts.Extension.Ts, - resolvedUsingTsExtension: false, }, failedLookupLocations: [], affectingLocations: [], @@ -185,7 +184,6 @@ describe("unittests:: moduleResolution:: Node module resolution - non-relative p resolvedFileName: "/sub/directory/node_modules/b/index.ts", isExternalLibraryImport: true, extension: ts.Extension.Ts, - resolvedUsingTsExtension: false, }, failedLookupLocations: [], affectingLocations: [], @@ -203,7 +201,6 @@ describe("unittests:: moduleResolution:: Node module resolution - non-relative p resolvedFileName: "/bar/node_modules/c/index.ts", isExternalLibraryImport: true, extension: ts.Extension.Ts, - resolvedUsingTsExtension: false, }, failedLookupLocations: [], affectingLocations: [], @@ -220,7 +217,6 @@ describe("unittests:: moduleResolution:: Node module resolution - non-relative p resolvedFileName: "/foo/index.ts", isExternalLibraryImport: true, extension: ts.Extension.Ts, - resolvedUsingTsExtension: false, }, failedLookupLocations: [], affectingLocations: [], @@ -236,7 +232,6 @@ describe("unittests:: moduleResolution:: Node module resolution - non-relative p resolvedFileName: "d:/bar/node_modules/e/index.ts", isExternalLibraryImport: true, extension: ts.Extension.Ts, - resolvedUsingTsExtension: false, }, failedLookupLocations: [], affectingLocations: [], From a88b8ad2d2232d6fa9a472e2ed8d69e96b383a9b Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 5 Dec 2022 16:14:49 -0800 Subject: [PATCH 19/23] Update missed baselines --- tests/baselines/reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- ...gBasedModuleResolution_withExtensionInName.trace.json | 4 ---- ...esolution_withExtension_MapedToNodeModules.trace.json | 9 --------- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 3531ac353759f..1b487d09bab4b 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -7264,7 +7264,7 @@ declare namespace ts { * True if the original module reference used a .ts extension to refer directly to a .ts file, * which should produce an error during checking if emit is enabled. */ - resolvedUsingTsExtension: boolean; + resolvedUsingTsExtension?: boolean; } /** * ResolvedModule with an explicitly provided `extension` property. diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 1ba7f1d31489b..30d6d7d1017d2 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3331,7 +3331,7 @@ declare namespace ts { * True if the original module reference used a .ts extension to refer directly to a .ts file, * which should produce an error during checking if emit is enabled. */ - resolvedUsingTsExtension: boolean; + resolvedUsingTsExtension?: boolean; } /** * ResolvedModule with an explicitly provided `extension` property. diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtensionInName.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtensionInName.trace.json index 16777d9bc8128..771d7c8ccf8ae 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtensionInName.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtensionInName.trace.json @@ -13,10 +13,6 @@ "File '/foo/zone.js.ts' does not exist.", "File '/foo/zone.js.tsx' does not exist.", "File '/foo/zone.js.d.ts' does not exist.", - "File name '/foo/zone.js' has a '.js' extension - stripping it.", - "File '/foo/zone.ts' does not exist.", - "File '/foo/zone.tsx' does not exist.", - "File '/foo/zone.d.ts' does not exist.", "File '/foo/zone.js/package.json' does not exist.", "File '/foo/zone.js/index.ts' does not exist.", "File '/foo/zone.js/index.tsx' does not exist.", diff --git a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.trace.json b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.trace.json index 043f67b4aa2ec..ef53886c656c8 100644 --- a/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.trace.json +++ b/tests/baselines/reference/pathMappingBasedModuleResolution_withExtension_MapedToNodeModules.trace.json @@ -13,10 +13,6 @@ "File '/node_modules/foo/bar/foobar.js.ts' does not exist.", "File '/node_modules/foo/bar/foobar.js.tsx' does not exist.", "File '/node_modules/foo/bar/foobar.js.d.ts' does not exist.", - "File name '/node_modules/foo/bar/foobar.js' has a '.js' extension - stripping it.", - "File '/node_modules/foo/bar/foobar.ts' does not exist.", - "File '/node_modules/foo/bar/foobar.tsx' does not exist.", - "File '/node_modules/foo/bar/foobar.d.ts' does not exist.", "Directory '/node_modules/foo/bar/foobar.js' does not exist, skipping all lookups in it.", "Trying substitution 'src/types', candidate module location: 'src/types'.", "Loading module as file / folder, candidate module location '/src/types', target file types: TypeScript, Declaration.", @@ -29,13 +25,8 @@ "File '/node_modules/foo/bar/foobar.js.ts' does not exist.", "File '/node_modules/foo/bar/foobar.js.tsx' does not exist.", "File '/node_modules/foo/bar/foobar.js.d.ts' does not exist.", - "File name '/node_modules/foo/bar/foobar.js' has a '.js' extension - stripping it.", - "File '/node_modules/foo/bar/foobar.ts' does not exist.", - "File '/node_modules/foo/bar/foobar.tsx' does not exist.", - "File '/node_modules/foo/bar/foobar.d.ts' does not exist.", "Directory '/node_modules/@types' does not exist, skipping all lookups in it.", "File name '/node_modules/@types/foo/bar/foobar.js' has a '.js' extension - stripping it.", - "File name '/node_modules/@types/foo/bar/foobar.js' has a '.js' extension - stripping it.", "'baseUrl' option is set to '/', using this value to resolve non-relative module name 'foo/bar/foobar.js'.", "'paths' option is specified, looking for a pattern to match module name 'foo/bar/foobar.js'.", "Module name 'foo/bar/foobar.js', matched pattern '*'.", From b2e283ca818d9c9a500bb00e62e5fed3d9e5d75f Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 6 Dec 2022 10:02:21 -0800 Subject: [PATCH 20/23] Revert now-unnecessary API implementation changes --- src/services/shims.ts | 2 +- src/testRunner/unittests/tscWatch/watchApi.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/services/shims.ts b/src/services/shims.ts index 4339931349053..6f36697703396 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -449,7 +449,7 @@ export class LanguageServiceShimHostAdapter implements LanguageServiceHost { const resolutionsInFile = JSON.parse(this.shimHost.getModuleResolutionsForFile!(containingFile)) as MapLike; // TODO: GH#18217 return map(moduleNames, name => { const result = getProperty(resolutionsInFile, name); - return result ? { resolvedFileName: result, extension: extensionFromPath(result), isExternalLibraryImport: false, resolvedUsingTsExtension: false } : undefined; + return result ? { resolvedFileName: result, extension: extensionFromPath(result), isExternalLibraryImport: false } : undefined; }); }; } diff --git a/src/testRunner/unittests/tscWatch/watchApi.ts b/src/testRunner/unittests/tscWatch/watchApi.ts index 6fc862f2c8eec..102bbd7746bfe 100644 --- a/src/testRunner/unittests/tscWatch/watchApi.ts +++ b/src/testRunner/unittests/tscWatch/watchApi.ts @@ -50,7 +50,6 @@ describe("unittests:: tsc-watch:: watchAPI:: tsc-watch with custom module resolu resolvedFileName: resolvedModule.resolvedFileName, isExternalLibraryImport: resolvedModule.isExternalLibraryImport, originalFileName: resolvedModule.originalPath, - resolvedUsingTsExtension: false, }; }); const watch = ts.createWatchProgram(host); From 30afa864244c141673eaa98bffcebf8a202643b1 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 9 Dec 2022 11:03:00 -0800 Subject: [PATCH 21/23] Clean up --- src/compiler/moduleNameResolver.ts | 4 +++- src/compiler/moduleSpecifiers.ts | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index c76ea56eb126e..048ef814ed7ec 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1768,7 +1768,9 @@ function loadModuleFromFileNoImplicitExtensions(extensions: Extensions, candidat // e.g. "./foo.js" can be matched by "./foo.ts" or "./foo.d.ts" if (hasJSFileExtension(candidate) || extensions & Extensions.Json && fileExtensionIs(candidate, Extension.Json) || - extensions & (Extensions.TypeScript | Extensions.Declaration) && moduleResolutionSupportsResolvingTsExtensions(state.compilerOptions) && fileExtensionIsOneOf(candidate, supportedTSExtensionsFlat) + extensions & (Extensions.TypeScript | Extensions.Declaration) + && moduleResolutionSupportsResolvingTsExtensions(state.compilerOptions) + && fileExtensionIsOneOf(candidate, supportedTSExtensionsFlat) ) { const extensionless = removeFileExtension(candidate); const extension = candidate.substring(extensionless.length); diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index db509d2c74ce3..351d98a24bd19 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -116,7 +116,7 @@ interface Preferences { /** * @param syntaxImpliedNodeFormat Used when the import syntax implies ESM or CJS irrespective of the mode of the file. */ - getAllowedEndingsInPrefererredOrder(syntaxImpliedNodeFormat?: SourceFile["impliedNodeFormat"]): ModuleSpecifierEnding[]; + getAllowedEndingsInPreferredOrder(syntaxImpliedNodeFormat?: SourceFile["impliedNodeFormat"]): ModuleSpecifierEnding[]; } function getPreferences( @@ -135,8 +135,8 @@ function getPreferences( importModuleSpecifierPreference === "non-relative" ? RelativePreference.NonRelative : importModuleSpecifierPreference === "project-relative" ? RelativePreference.ExternalNonRelative : RelativePreference.Shortest, - getAllowedEndingsInPrefererredOrder: syntaxImpliedNodeFormat => { - if (syntaxImpliedNodeFormat === ModuleKind.ESNext || (syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === ModuleKind.ESNext) { + getAllowedEndingsInPreferredOrder: syntaxImpliedNodeFormat => { + if ((syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === ModuleKind.ESNext) { if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) { return [ModuleSpecifierEnding.TsExtension, ModuleSpecifierEnding.JsExtension]; } @@ -429,7 +429,7 @@ function getInfo(importingSourceFileName: Path, host: ModuleSpecifierResolutionH function getLocalModuleSpecifier(moduleFileName: string, info: Info, compilerOptions: CompilerOptions, host: ModuleSpecifierResolutionHost, importMode: ResolutionMode, preferences: Preferences): string; function getLocalModuleSpecifier(moduleFileName: string, info: Info, compilerOptions: CompilerOptions, host: ModuleSpecifierResolutionHost, importMode: ResolutionMode, preferences: Preferences, pathsOnly?: boolean): string | undefined; -function getLocalModuleSpecifier(moduleFileName: string, info: Info, compilerOptions: CompilerOptions, host: ModuleSpecifierResolutionHost, importMode: ResolutionMode, { getAllowedEndingsInPrefererredOrder, relativePreference }: Preferences, pathsOnly?: boolean): string | undefined { +function getLocalModuleSpecifier(moduleFileName: string, info: Info, compilerOptions: CompilerOptions, host: ModuleSpecifierResolutionHost, importMode: ResolutionMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference }: Preferences, pathsOnly?: boolean): string | undefined { const { baseUrl, paths, rootDirs } = compilerOptions; if (pathsOnly && !paths) { return undefined; @@ -883,7 +883,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }: ModulePath, { getCan // Simplify the full file path to something that can be resolved by Node. const preferences = getPreferences(userPreferences, options, importingSourceFile); - const allowedEndings = preferences.getAllowedEndingsInPrefererredOrder(); + const allowedEndings = preferences.getAllowedEndingsInPreferredOrder(); let moduleSpecifier = path; let isPackageRootPath = false; if (!packageNameOnly) { From 6e763d969eeeb332bb9104e5232b9ede41ba48cb Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 9 Dec 2022 12:10:37 -0800 Subject: [PATCH 22/23] Update baselines to es5 emit --- ...ditions(resolvepackagejsonexports=false).js | 2 +- ...nditions(resolvepackagejsonexports=true).js | 2 +- tests/baselines/reference/hybridImportESM.js | 6 +++--- ...mportingtsextensions=false,noemit=false).js | 10 +++++----- ...importingtsextensions=true,noemit=false).js | 10 +++++----- .../baselines/reference/hybridNodeModules1.js | 6 +++--- tests/baselines/reference/hybridRelative1.js | 6 +++--- .../reference/hybridSyntaxRestrictions.js | 4 ++-- .../getSupportedCodeFixes-can-be-proxied.js | 18 ++++++++++++++++++ 9 files changed, 41 insertions(+), 23 deletions(-) diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).js b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).js index 8f831b27639a6..1ac29a4a032d3 100644 --- a/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).js +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).js @@ -30,4 +30,4 @@ import _ from "lodash"; //// [index.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).js b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).js index 8f831b27639a6..1ac29a4a032d3 100644 --- a/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).js +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).js @@ -30,4 +30,4 @@ import _ from "lodash"; //// [index.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/hybridImportESM.js b/tests/baselines/reference/hybridImportESM.js index 266e72301eaa5..9104892650c5a 100644 --- a/tests/baselines/reference/hybridImportESM.js +++ b/tests/baselines/reference/hybridImportESM.js @@ -15,12 +15,12 @@ import { esm } from "./esm.mjs"; //// [esm.mjs] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); exports.esm = void 0; exports.esm = 0; //// [not-actually-cjs.cjs] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); //// [still-not-cjs.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js index 82f75ee374412..bb552961f4adc 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js @@ -67,16 +67,16 @@ import type {} from "./a.d.ts"; //// [a.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); //// [index.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); //// [e.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); //// [e.txt.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); //// [main.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js index 82f75ee374412..bb552961f4adc 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js +++ b/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js @@ -67,16 +67,16 @@ import type {} from "./a.d.ts"; //// [a.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); //// [index.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); //// [e.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); //// [e.txt.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); //// [main.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/hybridNodeModules1.js b/tests/baselines/reference/hybridNodeModules1.js index 03ed212a2f875..97b4ba34ff3d9 100644 --- a/tests/baselines/reference/hybridNodeModules1.js +++ b/tests/baselines/reference/hybridNodeModules1.js @@ -39,10 +39,10 @@ import { esm, cjs } from "dual"; //// [main.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); //// [main.mjs] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); //// [main.cjs] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/hybridRelative1.js b/tests/baselines/reference/hybridRelative1.js index 3c009b0588bcd..1eab035117f24 100644 --- a/tests/baselines/reference/hybridRelative1.js +++ b/tests/baselines/reference/hybridRelative1.js @@ -34,14 +34,14 @@ import * as cjs from "./types/cjs"; //// [index.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; exports.x = 0; //// [index.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); exports.y = void 0; exports.y = 0; //// [main.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.js b/tests/baselines/reference/hybridSyntaxRestrictions.js index 95ac57e551973..7b066f1ff6dcf 100644 --- a/tests/baselines/reference/hybridSyntaxRestrictions.js +++ b/tests/baselines/reference/hybridSyntaxRestrictions.js @@ -21,12 +21,12 @@ export const a = "a"; //// [a.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); exports.a = void 0; exports.a = "a"; //// [mainJs.js] "use strict"; -exports.__esModule = true; +Object.defineProperty(exports, "__esModule", { value: true }); Promise.resolve().then(function () { return require("./a"); }); var _ = require("./a"); // No resolution _.a; // any diff --git a/tests/baselines/reference/tsserver/plugins/getSupportedCodeFixes-can-be-proxied.js b/tests/baselines/reference/tsserver/plugins/getSupportedCodeFixes-can-be-proxied.js index 12b3d134c26e8..cb8ce333a59cd 100644 --- a/tests/baselines/reference/tsserver/plugins/getSupportedCodeFixes-can-be-proxied.js +++ b/tests/baselines/reference/tsserver/plugins/getSupportedCodeFixes-can-be-proxied.js @@ -1143,6 +1143,7 @@ Info 32 [00:01:13.000] response: "2842", "2843", "2844", + "2846", "4000", "4002", "4004", @@ -1293,6 +1294,11 @@ Info 32 [00:01:13.000] response: "5093", "5094", "5095", + "5096", + "5097", + "5098", + "5099", + "5100", "6044", "6045", "6046", @@ -2463,6 +2469,7 @@ Info 38 [00:01:19.000] response: "2842", "2843", "2844", + "2846", "4000", "4002", "4004", @@ -2613,6 +2620,11 @@ Info 38 [00:01:19.000] response: "5093", "5094", "5095", + "5096", + "5097", + "5098", + "5099", + "5100", "6044", "6045", "6046", @@ -3695,6 +3707,7 @@ Info 40 [00:01:21.000] response: "2842", "2843", "2844", + "2846", "4000", "4002", "4004", @@ -3845,6 +3858,11 @@ Info 40 [00:01:21.000] response: "5093", "5094", "5095", + "5096", + "5097", + "5098", + "5099", + "5100", "6044", "6045", "6046", From d4a3b3c248e947211fe004023ccc4362ee4d02cc Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 13 Dec 2022 13:06:37 -0800 Subject: [PATCH 23/23] Rename to `bundler` --- src/compiler/binder.ts | 2 +- src/compiler/checker.ts | 16 +++++----- src/compiler/commandLineParser.ts | 8 ++--- src/compiler/diagnosticMessages.json | 12 ++++---- src/compiler/moduleNameResolver.ts | 18 +++++------ src/compiler/program.ts | 14 ++++----- src/compiler/types.ts | 2 +- src/compiler/utilities.ts | 10 +++---- .../reference/api/tsserverlibrary.d.ts | 4 +-- tests/baselines/reference/api/typescript.d.ts | 4 +-- ...hybridImportESM.js => bundlerImportESM.js} | 2 +- ...rtESM.symbols => bundlerImportESM.symbols} | 0 ...ImportESM.types => bundlerImportESM.types} | 0 ...extensions=false,noemit=false).errors.txt} | 0 ...ortingtsextensions=false,noemit=false).js} | 2 +- ...gtsextensions=false,noemit=false).symbols} | 0 ...extensions=false,noemit=false).trace.json} | 30 +++++++++---------- ...ingtsextensions=false,noemit=false).types} | 0 ...sextensions=false,noemit=true).errors.txt} | 0 ...ngtsextensions=false,noemit=true).symbols} | 0 ...sextensions=false,noemit=true).trace.json} | 30 +++++++++---------- ...tingtsextensions=false,noemit=true).types} | 0 ...sextensions=true,noemit=false).errors.txt} | 4 +-- ...portingtsextensions=true,noemit=false).js} | 2 +- ...ngtsextensions=true,noemit=false).symbols} | 0 ...sextensions=true,noemit=false).trace.json} | 30 +++++++++---------- ...tingtsextensions=true,noemit=false).types} | 0 ...tsextensions=true,noemit=true).errors.txt} | 0 ...ingtsextensions=true,noemit=true).symbols} | 0 ...tsextensions=true,noemit=true).trace.json} | 30 +++++++++---------- ...rtingtsextensions=true,noemit=true).types} | 0 ...ors.txt => bundlerNodeModules1.errors.txt} | 0 ...NodeModules1.js => bundlerNodeModules1.js} | 2 +- ...s1.symbols => bundlerNodeModules1.symbols} | 0 ...ce.json => bundlerNodeModules1.trace.json} | 2 +- ...dules1.types => bundlerNodeModules1.types} | 0 ...errors.txt => bundlerRelative1.errors.txt} | 0 ...hybridRelative1.js => bundlerRelative1.js} | 2 +- ...tive1.symbols => bundlerRelative1.symbols} | 0 ...trace.json => bundlerRelative1.trace.json} | 16 +++++----- ...Relative1.types => bundlerRelative1.types} | 0 ...t => bundlerSyntaxRestrictions.errors.txt} | 8 ++--- ...ctions.js => bundlerSyntaxRestrictions.js} | 2 +- ...bols => bundlerSyntaxRestrictions.symbols} | 0 ....types => bundlerSyntaxRestrictions.types} | 0 ...rse empty options of --moduleResolution.js | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- .../tsconfig.json | 2 +- ...esolvepackagejsonexports=false).trace.json | 2 +- ...resolvepackagejsonexports=true).trace.json | 2 +- ...riority(moduleresolution=bundler).symbols} | 0 ...gPriority(moduleresolution=bundler).types} | 0 ...ompat(moduleresolution=classic).errors.txt | 8 ++--- ...onCompat(moduleresolution=node).errors.txt | 8 ++--- .../bundlerImportESM.ts} | 2 +- .../bundlerImportTsExtensions.ts} | 2 +- .../bundlerNodeModules1.ts} | 2 +- .../bundlerRelative1.ts} | 2 +- .../bundlerSyntaxRestrictions.ts} | 2 +- .../moduleResolution/customConditions.ts | 2 +- .../extensionLoadingPriority.ts | 2 +- .../packageJsonImportsExportsOptionCompat.ts | 2 +- .../fourslash/autoImportAllowTsExtensions1.ts | 2 +- .../fourslash/autoImportAllowTsExtensions2.ts | 2 +- .../fourslash/autoImportAllowTsExtensions3.ts | 2 +- .../fourslash/autoImportAllowTsExtensions4.ts | 2 +- .../pathCompletionsAllowTsExtensions.ts | 2 +- 76 files changed, 161 insertions(+), 161 deletions(-) rename tests/baselines/reference/{hybridImportESM.js => bundlerImportESM.js} (84%) rename tests/baselines/reference/{hybridImportESM.symbols => bundlerImportESM.symbols} (100%) rename tests/baselines/reference/{hybridImportESM.types => bundlerImportESM.types} (100%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt => bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt} (100%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js => bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).js} (91%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols => bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols} (100%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json => bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json} (88%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).types => bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).types} (100%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt => bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt} (100%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols => bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols} (100%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json => bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json} (88%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).types => bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=true).types} (100%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt => bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt} (92%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js => bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).js} (91%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols => bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols} (100%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json => bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json} (88%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).types => bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).types} (100%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt => bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt} (100%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols => bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols} (100%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json => bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json} (88%) rename tests/baselines/reference/{hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).types => bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=true).types} (100%) rename tests/baselines/reference/{hybridNodeModules1.errors.txt => bundlerNodeModules1.errors.txt} (100%) rename tests/baselines/reference/{hybridNodeModules1.js => bundlerNodeModules1.js} (88%) rename tests/baselines/reference/{hybridNodeModules1.symbols => bundlerNodeModules1.symbols} (100%) rename tests/baselines/reference/{hybridNodeModules1.trace.json => bundlerNodeModules1.trace.json} (96%) rename tests/baselines/reference/{hybridNodeModules1.types => bundlerNodeModules1.types} (100%) rename tests/baselines/reference/{hybridRelative1.errors.txt => bundlerRelative1.errors.txt} (100%) rename tests/baselines/reference/{hybridRelative1.js => bundlerRelative1.js} (89%) rename tests/baselines/reference/{hybridRelative1.symbols => bundlerRelative1.symbols} (100%) rename tests/baselines/reference/{hybridRelative1.trace.json => bundlerRelative1.trace.json} (90%) rename tests/baselines/reference/{hybridRelative1.types => bundlerRelative1.types} (100%) rename tests/baselines/reference/{hybridSyntaxRestrictions.errors.txt => bundlerSyntaxRestrictions.errors.txt} (69%) rename tests/baselines/reference/{hybridSyntaxRestrictions.js => bundlerSyntaxRestrictions.js} (85%) rename tests/baselines/reference/{hybridSyntaxRestrictions.symbols => bundlerSyntaxRestrictions.symbols} (100%) rename tests/baselines/reference/{hybridSyntaxRestrictions.types => bundlerSyntaxRestrictions.types} (100%) rename tests/baselines/reference/{extensionLoadingPriority(moduleresolution=hybrid).symbols => extensionLoadingPriority(moduleresolution=bundler).symbols} (100%) rename tests/baselines/reference/{extensionLoadingPriority(moduleresolution=hybrid).types => extensionLoadingPriority(moduleresolution=bundler).types} (100%) rename tests/cases/conformance/moduleResolution/{hybrid/hybridImportESM.ts => bundler/bundlerImportESM.ts} (88%) rename tests/cases/conformance/moduleResolution/{hybrid/hybridImportTsExtensions.ts => bundler/bundlerImportTsExtensions.ts} (97%) rename tests/cases/conformance/moduleResolution/{hybrid/hybridNodeModules1.ts => bundler/bundlerNodeModules1.ts} (96%) rename tests/cases/conformance/moduleResolution/{hybrid/hybridRelative1.ts => bundler/bundlerRelative1.ts} (95%) rename tests/cases/conformance/moduleResolution/{hybrid/hybridSyntaxRestrictions.ts => bundler/bundlerSyntaxRestrictions.ts} (93%) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 1f9f269723444..d6bc1769ea5f3 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -3522,7 +3522,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void { if (!isBindingPattern(node.name)) { const possibleVariableDecl = node.kind === SyntaxKind.VariableDeclaration ? node : node.parent.parent; if (isInJSFile(node) && - getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Hybrid && + getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Bundler && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & ModifierFlags.Export) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 16cbde17b8195..3d9d48b1bb893 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4547,7 +4547,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { if ( namespace.valueDeclaration && isInJSFile(namespace.valueDeclaration) && - getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Hybrid && + getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Bundler && isVariableDeclaration(namespace.valueDeclaration) && namespace.valueDeclaration.initializer && isCommonJsRequire(namespace.valueDeclaration.initializer) @@ -33326,7 +33326,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } // In JavaScript files, calls to any identifier 'require' are treated as external module imports - if (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Hybrid && isCommonJsRequire(node)) { + if (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Bundler && isCommonJsRequire(node)) { return resolveExternalModuleTypeByLiteral(node.arguments![0] as StringLiteral); } @@ -42728,8 +42728,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Import equals declaration is deprecated in es6 or above grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } - else if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Hybrid) { - grammarErrorOnNode(node, Diagnostics.Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_hybrid_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); + else if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Bundler) { + grammarErrorOnNode(node, Diagnostics.Import_assignment_is_not_allowed_when_moduleResolution_is_set_to_bundler_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } } } @@ -42953,8 +42953,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // system modules does not support export assignment grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); } - else if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Hybrid) { - grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_hybrid_Consider_using_export_default_or_another_module_format_instead); + else if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Bundler) { + grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_moduleResolution_is_set_to_bundler_Consider_using_export_default_or_another_module_format_instead); } } } @@ -44050,7 +44050,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || ((node.parent.kind === SyntaxKind.ImportDeclaration || node.parent.kind === SyntaxKind.ExportDeclaration) && (node.parent as ImportDeclaration).moduleSpecifier === node) || - ((isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Hybrid && isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || isImportCall(node.parent)) || + ((isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Bundler && isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || isImportCall(node.parent)) || (isLiteralTypeNode(node.parent) && isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent) ) { return resolveExternalModuleName(node, node as LiteralExpression, ignoreErrors); @@ -47356,4 +47356,4 @@ class SymbolTrackerImpl implements SymbolTracker { private onDiagnosticReported() { this.context.reportedDiagnostic = true; } -} \ No newline at end of file +} diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 60ed28d965141..e8f5452edfcba 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -965,7 +965,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ classic: ModuleResolutionKind.Classic, node16: ModuleResolutionKind.Node16, nodenext: ModuleResolutionKind.NodeNext, - hybrid: ModuleResolutionKind.Hybrid, + bundler: ModuleResolutionKind.Bundler, })), affectsModuleResolution: true, paramType: Diagnostics.STRATEGY, @@ -1087,7 +1087,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ type: "boolean", affectsModuleResolution: true, category: Diagnostics.Modules, - description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_hybrid_and_either_noEmit_or_emitDeclarationOnly_to_be_set, + description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set, defaultValueDescription: false, }, { @@ -1096,7 +1096,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ affectsModuleResolution: true, category: Diagnostics.Modules, description: Diagnostics.Use_the_package_json_exports_field_when_resolving_package_imports, - defaultValueDescription: Diagnostics.true_when_moduleResolution_is_node16_nodenext_or_hybrid_otherwise_false, + defaultValueDescription: Diagnostics.true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false, }, { name: "resolvePackageJsonImports", @@ -1104,7 +1104,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [ affectsModuleResolution: true, category: Diagnostics.Modules, description: Diagnostics.Use_the_package_json_imports_field_when_resolving_imports, - defaultValueDescription: Diagnostics.true_when_moduleResolution_is_node16_nodenext_or_hybrid_otherwise_false, + defaultValueDescription: Diagnostics.true_when_moduleResolution_is_node16_nodenext_or_bundler_otherwise_false, }, { name: "customConditions", diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index bee4bc522c85f..ad3d9ec3e3eba 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4225,7 +4225,7 @@ "category": "Error", "code": 5095 }, - "Option 'allowImportingTsExtensions' can only be used when 'moduleResolution' is set to 'hybrid' and either 'noEmit' or 'emitDeclarationOnly' is set.": { + "Option 'allowImportingTsExtensions' can only be used when 'moduleResolution' is set to 'bundler' and either 'noEmit' or 'emitDeclarationOnly' is set.": { "category": "Error", "code": 5096 }, @@ -4233,15 +4233,15 @@ "category": "Error", "code": 5097 }, - "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'.": { + "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'.": { "category": "Error", "code": 5098 }, - "Import assignment is not allowed when 'moduleResolution' is set to 'hybrid'. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead.": { + "Import assignment is not allowed when 'moduleResolution' is set to 'bundler'. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead.": { "category": "Error", "code": 5099 }, - "Export assignment cannot be used when 'moduleResolution' is set to 'hybrid'. Consider using 'export default' or another module format instead.": { + "Export assignment cannot be used when 'moduleResolution' is set to 'bundler'. Consider using 'export default' or another module format instead.": { "category": "Error", "code": 5100 }, @@ -5450,7 +5450,7 @@ "category": "Message", "code": 6406 }, - "Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set.": { + "Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.": { "category": "Message", "code": 6407 }, @@ -5466,7 +5466,7 @@ "category": "Message", "code": 6410 }, - "`true` when 'moduleResolution' is 'node16', 'nodenext', or 'hybrid'; otherwise `false`.": { + "`true` when 'moduleResolution' is 'node16', 'nodenext', or 'bundler'; otherwise `false`.": { "category": "Message", "code": 6411 }, diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 585231137ff6a..5a1c504bc2515 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -638,8 +638,8 @@ function getNodeResolutionFeatures(options: CompilerOptions) { case ModuleResolutionKind.NodeNext: features = NodeResolutionFeatures.NodeNextDefault; break; - case ModuleResolutionKind.Hybrid: - features = NodeResolutionFeatures.HybridDefault; + case ModuleResolutionKind.Bundler: + features = NodeResolutionFeatures.BundlerDefault; break; } if (options.resolvePackageJsonExports) { @@ -658,9 +658,9 @@ function getNodeResolutionFeatures(options: CompilerOptions) { } function getConditions(options: CompilerOptions, esmMode?: boolean) { - // conditions are only used by the node16/nodenext/hybrid resolvers - there's no priority order in the list, + // conditions are only used by the node16/nodenext/bundler resolvers - there's no priority order in the list, // it's essentially a set (priority is determined by object insertion order in the object we look at). - const conditions = esmMode || getEmitModuleResolutionKind(options) === ModuleResolutionKind.Hybrid + const conditions = esmMode || getEmitModuleResolutionKind(options) === ModuleResolutionKind.Bundler ? ["node", "import"] : ["node", "require"]; if (!options.noDtsResolution) { @@ -1284,8 +1284,8 @@ export function resolveModuleName(moduleName: string, containingFile: string, co case ModuleResolutionKind.Classic: result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference); break; - case ModuleResolutionKind.Hybrid: - result = hybridModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference); + case ModuleResolutionKind.Bundler: + result = bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference); break; default: return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`); @@ -1541,7 +1541,7 @@ export enum NodeResolutionFeatures { NodeNextDefault = AllFeatures, - HybridDefault = Imports | SelfName | Exports | ExportsPatternTrailers, + BundlerDefault = Imports | SelfName | Exports | ExportsPatternTrailers, EsmMode = 1 << 5, } @@ -1601,7 +1601,7 @@ function tryResolveJSModuleWorker(moduleName: string, initialDir: string, host: /*redirectedReferences*/ undefined); } -export function hybridModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations { +export function bundlerModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations { const containingDirectory = getDirectoryPath(containingFile); let extensions = compilerOptions.noDtsResolution ? Extensions.ImplementationFiles : Extensions.TypeScript | Extensions.JavaScript | Extensions.Declaration; if (getResolveJsonModule(compilerOptions)) { @@ -2969,7 +2969,7 @@ export function classicNameResolver(moduleName: string, containingFile: string, } export function moduleResolutionSupportsResolvingTsExtensions(compilerOptions: CompilerOptions) { - return getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Hybrid; + return getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Bundler; } // Program errors validate that `noEmit` or `emitDeclarationOnly` is also set, diff --git a/src/compiler/program.ts b/src/compiler/program.ts index c8e9a5fea3358..ee27160a182e9 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -3162,8 +3162,8 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg collectModuleReferences(node, /*inAmbientModule*/ false); } - // `require` has no special meaning in `--moduleResolution hybrid` - const shouldProcessRequires = isJavaScriptFile && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Hybrid; + // `require` has no special meaning in `--moduleResolution bundler` + const shouldProcessRequires = isJavaScriptFile && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Bundler; if ((file.flags & NodeFlags.PossiblyContainsDynamicImport) || shouldProcessRequires) { collectDynamicImportOrRequireCalls(file); } @@ -4121,7 +4121,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg if (getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeJs && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Node16 && getEmitModuleResolutionKind(options) !== ModuleResolutionKind.NodeNext && - getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Hybrid) { + getEmitModuleResolutionKind(options) !== ModuleResolutionKind.Bundler) { createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule"); } // Any emit other than common js, amd, es2015 or esnext is error @@ -4213,18 +4213,18 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg } if (options.allowImportingTsExtensions && !(moduleResolutionSupportsResolvingTsExtensions(options) && (options.noEmit || options.emitDeclarationOnly))) { - createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_moduleResolution_is_set_to_hybrid_and_either_noEmit_or_emitDeclarationOnly_is_set); + createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_moduleResolution_is_set_to_bundler_and_either_noEmit_or_emitDeclarationOnly_is_set); } const moduleResolution = getEmitModuleResolutionKind(options); if (options.resolvePackageJsonExports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { - createOptionValueDiagnostic("resolvePackageJsonExports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_hybrid, "resolvePackageJsonExports"); + createOptionValueDiagnostic("resolvePackageJsonExports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonExports"); } if (options.resolvePackageJsonImports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { - createOptionValueDiagnostic("resolvePackageJsonImports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_hybrid, "resolvePackageJsonImports"); + createOptionValueDiagnostic("resolvePackageJsonImports", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "resolvePackageJsonImports"); } if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { - createOptionValueDiagnostic("customConditions", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_hybrid, "customConditions"); + createOptionValueDiagnostic("customConditions", Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions"); } // If the emit is enabled make sure that every output file is unique and not overwriting any of the input files diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0dad4de51a17a..52cd88091726b 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6886,7 +6886,7 @@ export enum ModuleResolutionKind { // In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target Node16 = 3, NodeNext = 99, // Not simply `Node16` so that compiled code linked against TS can use the `Next` value reliably (same as with `ModuleKind`) - Hybrid = 100, + Bundler = 100, } export enum ModuleDetectionKind { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 73ac5a2e36278..4f69ae16f98a5 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -7780,13 +7780,13 @@ export function getAllowSyntheticDefaultImports(compilerOptions: CompilerOptions } return getESModuleInterop(compilerOptions) || getEmitModuleKind(compilerOptions) === ModuleKind.System - || getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Hybrid; + || getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Bundler; } /** @internal */ export function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution: ModuleResolutionKind): boolean { return moduleResolution >= ModuleResolutionKind.Node16 && moduleResolution <= ModuleResolutionKind.NodeNext - || moduleResolution === ModuleResolutionKind.Hybrid; + || moduleResolution === ModuleResolutionKind.Bundler; } /** @internal */ @@ -7801,7 +7801,7 @@ export function getResolvePackageJsonExports(compilerOptions: CompilerOptions) { switch (moduleResolution) { case ModuleResolutionKind.Node16: case ModuleResolutionKind.NodeNext: - case ModuleResolutionKind.Hybrid: + case ModuleResolutionKind.Bundler: return true; } return false; @@ -7819,7 +7819,7 @@ export function getResolvePackageJsonImports(compilerOptions: CompilerOptions) { switch (moduleResolution) { case ModuleResolutionKind.Node16: case ModuleResolutionKind.NodeNext: - case ModuleResolutionKind.Hybrid: + case ModuleResolutionKind.Bundler: return true; } return false; @@ -7830,7 +7830,7 @@ export function getResolveJsonModule(compilerOptions: CompilerOptions) { if (compilerOptions.resolveJsonModule !== undefined) { return compilerOptions.resolveJsonModule; } - return getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Hybrid; + return getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Bundler; } /** @internal */ diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 3615aabce2ab3..cad75d3083540 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -6972,7 +6972,7 @@ declare namespace ts { NodeJs = 2, Node16 = 3, NodeNext = 99, - Hybrid = 100 + Bundler = 100 } enum ModuleDetectionKind { /** @@ -9213,7 +9213,7 @@ declare namespace ts { function createTypeReferenceDirectiveResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache): TypeReferenceDirectiveResolutionCache; function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache, mode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations | undefined; function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations; - function hybridModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; + function bundlerModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; function moduleResolutionSupportsResolvingTsExtensions(compilerOptions: CompilerOptions): boolean; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 3bb8af561e2e4..c6bb421d196b8 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3038,7 +3038,7 @@ declare namespace ts { NodeJs = 2, Node16 = 3, NodeNext = 99, - Hybrid = 100 + Bundler = 100 } enum ModuleDetectionKind { /** @@ -5279,7 +5279,7 @@ declare namespace ts { function createTypeReferenceDirectiveResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache): TypeReferenceDirectiveResolutionCache; function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache, mode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations | undefined; function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations; - function hybridModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; + function bundlerModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations; function moduleResolutionSupportsResolvingTsExtensions(compilerOptions: CompilerOptions): boolean; diff --git a/tests/baselines/reference/hybridImportESM.js b/tests/baselines/reference/bundlerImportESM.js similarity index 84% rename from tests/baselines/reference/hybridImportESM.js rename to tests/baselines/reference/bundlerImportESM.js index 9104892650c5a..efe3cbd491689 100644 --- a/tests/baselines/reference/hybridImportESM.js +++ b/tests/baselines/reference/bundlerImportESM.js @@ -1,4 +1,4 @@ -//// [tests/cases/conformance/moduleResolution/hybrid/hybridImportESM.ts] //// +//// [tests/cases/conformance/moduleResolution/bundler/bundlerImportESM.ts] //// //// [esm.mts] export const esm = 0; diff --git a/tests/baselines/reference/hybridImportESM.symbols b/tests/baselines/reference/bundlerImportESM.symbols similarity index 100% rename from tests/baselines/reference/hybridImportESM.symbols rename to tests/baselines/reference/bundlerImportESM.symbols diff --git a/tests/baselines/reference/hybridImportESM.types b/tests/baselines/reference/bundlerImportESM.types similarity index 100% rename from tests/baselines/reference/hybridImportESM.types rename to tests/baselines/reference/bundlerImportESM.types diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt similarity index 100% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).errors.txt diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).js similarity index 91% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).js index bb552961f4adc..e6f603d88dc3b 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).js +++ b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).js @@ -1,4 +1,4 @@ -//// [tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts] //// +//// [tests/cases/conformance/moduleResolution/bundler/bundlerImportTsExtensions.ts] //// //// [a.ts] export {}; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols similarity index 100% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).symbols diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json similarity index 88% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json index 2ebe4e7c42081..16bd4a9de2e58 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json +++ b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json @@ -1,58 +1,58 @@ [ "======== Resolving module './a' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/a.ts' exist - use it as a name resolution result.", "======== Module name './a' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './a.js' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a.js', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/a.js' has a '.js' extension - stripping it.", "File '/project/a.ts' exist - use it as a name resolution result.", "======== Module name './a.js' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './a.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/a.ts' has a '.ts' extension - stripping it.", "File '/project/a.ts' exist - use it as a name resolution result.", "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './b' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/b.ts' exist - use it as a name resolution result.", "======== Module name './b' was successfully resolved to '/project/b.ts'. ========", "======== Resolving module './b.js' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b.js', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/b.js' has a '.js' extension - stripping it.", "File '/project/b.ts' exist - use it as a name resolution result.", "======== Module name './b.js' was successfully resolved to '/project/b.ts'. ========", "======== Resolving module './b.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/b.ts' has a '.ts' extension - stripping it.", "File '/project/b.ts' exist - use it as a name resolution result.", "======== Module name './b.ts' was successfully resolved to '/project/b.ts'. ========", "======== Resolving module './b.d.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b.d.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/b.d.ts' has a '.d.ts' extension - stripping it.", "File '/project/b.d.ts' exist - use it as a name resolution result.", "======== Module name './b.d.ts' was successfully resolved to '/project/b.d.ts'. ========", "======== Resolving module './c.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/c.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/c.ts' has a '.ts' extension - stripping it.", "File '/project/c.ts' exist - use it as a name resolution result.", "======== Module name './c.ts' was successfully resolved to '/project/c.ts'. ========", "======== Resolving module './c.tsx' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/c.tsx', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/c.tsx' has a '.tsx' extension - stripping it.", "File '/project/c.tsx' exist - use it as a name resolution result.", "======== Module name './c.tsx' was successfully resolved to '/project/c.tsx'. ========", "======== Resolving module './d' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/d', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/d.ts' does not exist.", "File '/project/d.tsx' does not exist.", @@ -63,23 +63,23 @@ "File '/project/d/index.ts' exist - use it as a name resolution result.", "======== Module name './d' was successfully resolved to '/project/d/index.ts'. ========", "======== Resolving module './d/index' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/d/index', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/d/index.ts' exist - use it as a name resolution result.", "======== Module name './d/index' was successfully resolved to '/project/d/index.ts'. ========", "======== Resolving module './d/index.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/d/index.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/d/index.ts' has a '.ts' extension - stripping it.", "File '/project/d/index.ts' exist - use it as a name resolution result.", "======== Module name './d/index.ts' was successfully resolved to '/project/d/index.ts'. ========", "======== Resolving module './e' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/e', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/e.ts' exist - use it as a name resolution result.", "======== Module name './e' was successfully resolved to '/project/e.ts'. ========", "======== Resolving module './e.txt' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/e.txt', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/e.txt.ts' exist - use it as a name resolution result.", "======== Module name './e.txt' was successfully resolved to '/project/e.txt.ts'. ========", @@ -87,7 +87,7 @@ "Resolution for module './a.ts' was found in cache from location '/project'.", "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './a.d.ts' from '/project/types.d.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a.d.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", "File '/project/a.d.ts' does not exist.", diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).types b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).types similarity index 100% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).types rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=false).types diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt similarity index 100% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=true).errors.txt diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols similarity index 100% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=true).symbols diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json similarity index 88% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json index 2ebe4e7c42081..16bd4a9de2e58 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json +++ b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json @@ -1,58 +1,58 @@ [ "======== Resolving module './a' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/a.ts' exist - use it as a name resolution result.", "======== Module name './a' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './a.js' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a.js', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/a.js' has a '.js' extension - stripping it.", "File '/project/a.ts' exist - use it as a name resolution result.", "======== Module name './a.js' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './a.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/a.ts' has a '.ts' extension - stripping it.", "File '/project/a.ts' exist - use it as a name resolution result.", "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './b' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/b.ts' exist - use it as a name resolution result.", "======== Module name './b' was successfully resolved to '/project/b.ts'. ========", "======== Resolving module './b.js' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b.js', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/b.js' has a '.js' extension - stripping it.", "File '/project/b.ts' exist - use it as a name resolution result.", "======== Module name './b.js' was successfully resolved to '/project/b.ts'. ========", "======== Resolving module './b.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/b.ts' has a '.ts' extension - stripping it.", "File '/project/b.ts' exist - use it as a name resolution result.", "======== Module name './b.ts' was successfully resolved to '/project/b.ts'. ========", "======== Resolving module './b.d.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b.d.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/b.d.ts' has a '.d.ts' extension - stripping it.", "File '/project/b.d.ts' exist - use it as a name resolution result.", "======== Module name './b.d.ts' was successfully resolved to '/project/b.d.ts'. ========", "======== Resolving module './c.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/c.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/c.ts' has a '.ts' extension - stripping it.", "File '/project/c.ts' exist - use it as a name resolution result.", "======== Module name './c.ts' was successfully resolved to '/project/c.ts'. ========", "======== Resolving module './c.tsx' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/c.tsx', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/c.tsx' has a '.tsx' extension - stripping it.", "File '/project/c.tsx' exist - use it as a name resolution result.", "======== Module name './c.tsx' was successfully resolved to '/project/c.tsx'. ========", "======== Resolving module './d' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/d', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/d.ts' does not exist.", "File '/project/d.tsx' does not exist.", @@ -63,23 +63,23 @@ "File '/project/d/index.ts' exist - use it as a name resolution result.", "======== Module name './d' was successfully resolved to '/project/d/index.ts'. ========", "======== Resolving module './d/index' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/d/index', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/d/index.ts' exist - use it as a name resolution result.", "======== Module name './d/index' was successfully resolved to '/project/d/index.ts'. ========", "======== Resolving module './d/index.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/d/index.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/d/index.ts' has a '.ts' extension - stripping it.", "File '/project/d/index.ts' exist - use it as a name resolution result.", "======== Module name './d/index.ts' was successfully resolved to '/project/d/index.ts'. ========", "======== Resolving module './e' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/e', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/e.ts' exist - use it as a name resolution result.", "======== Module name './e' was successfully resolved to '/project/e.ts'. ========", "======== Resolving module './e.txt' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/e.txt', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/e.txt.ts' exist - use it as a name resolution result.", "======== Module name './e.txt' was successfully resolved to '/project/e.txt.ts'. ========", @@ -87,7 +87,7 @@ "Resolution for module './a.ts' was found in cache from location '/project'.", "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './a.d.ts' from '/project/types.d.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a.d.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", "File '/project/a.d.ts' does not exist.", diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).types b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=true).types similarity index 100% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).types rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=false,noemit=true).types diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt similarity index 92% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt index d8c5a67083615..683dac372525f 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt +++ b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt @@ -1,6 +1,6 @@ error TS5056: Cannot write file 'out/b.js' because it would be overwritten by multiple input files. error TS5056: Cannot write file 'out/c.js' because it would be overwritten by multiple input files. -error TS5096: Option 'allowImportingTsExtensions' can only be used when 'moduleResolution' is set to 'hybrid' and either 'noEmit' or 'emitDeclarationOnly' is set. +error TS5096: Option 'allowImportingTsExtensions' can only be used when 'moduleResolution' is set to 'bundler' and either 'noEmit' or 'emitDeclarationOnly' is set. error TS6054: File '/project/e.txt' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'. The file is in the program because: Root file specified for compilation @@ -12,7 +12,7 @@ error TS6054: File '/project/e.txt' has an unsupported extension. The only suppo !!! error TS5056: Cannot write file 'out/b.js' because it would be overwritten by multiple input files. !!! error TS5056: Cannot write file 'out/c.js' because it would be overwritten by multiple input files. -!!! error TS5096: Option 'allowImportingTsExtensions' can only be used when 'moduleResolution' is set to 'hybrid' and either 'noEmit' or 'emitDeclarationOnly' is set. +!!! error TS5096: Option 'allowImportingTsExtensions' can only be used when 'moduleResolution' is set to 'bundler' and either 'noEmit' or 'emitDeclarationOnly' is set. !!! error TS6054: File '/project/e.txt' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'. !!! error TS6054: The file is in the program because: !!! error TS6054: Root file specified for compilation diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).js similarity index 91% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).js index bb552961f4adc..e6f603d88dc3b 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).js +++ b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).js @@ -1,4 +1,4 @@ -//// [tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts] //// +//// [tests/cases/conformance/moduleResolution/bundler/bundlerImportTsExtensions.ts] //// //// [a.ts] export {}; diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols similarity index 100% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).symbols diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json similarity index 88% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json index 2ebe4e7c42081..16bd4a9de2e58 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=false).trace.json +++ b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).trace.json @@ -1,58 +1,58 @@ [ "======== Resolving module './a' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/a.ts' exist - use it as a name resolution result.", "======== Module name './a' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './a.js' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a.js', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/a.js' has a '.js' extension - stripping it.", "File '/project/a.ts' exist - use it as a name resolution result.", "======== Module name './a.js' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './a.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/a.ts' has a '.ts' extension - stripping it.", "File '/project/a.ts' exist - use it as a name resolution result.", "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './b' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/b.ts' exist - use it as a name resolution result.", "======== Module name './b' was successfully resolved to '/project/b.ts'. ========", "======== Resolving module './b.js' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b.js', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/b.js' has a '.js' extension - stripping it.", "File '/project/b.ts' exist - use it as a name resolution result.", "======== Module name './b.js' was successfully resolved to '/project/b.ts'. ========", "======== Resolving module './b.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/b.ts' has a '.ts' extension - stripping it.", "File '/project/b.ts' exist - use it as a name resolution result.", "======== Module name './b.ts' was successfully resolved to '/project/b.ts'. ========", "======== Resolving module './b.d.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b.d.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/b.d.ts' has a '.d.ts' extension - stripping it.", "File '/project/b.d.ts' exist - use it as a name resolution result.", "======== Module name './b.d.ts' was successfully resolved to '/project/b.d.ts'. ========", "======== Resolving module './c.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/c.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/c.ts' has a '.ts' extension - stripping it.", "File '/project/c.ts' exist - use it as a name resolution result.", "======== Module name './c.ts' was successfully resolved to '/project/c.ts'. ========", "======== Resolving module './c.tsx' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/c.tsx', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/c.tsx' has a '.tsx' extension - stripping it.", "File '/project/c.tsx' exist - use it as a name resolution result.", "======== Module name './c.tsx' was successfully resolved to '/project/c.tsx'. ========", "======== Resolving module './d' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/d', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/d.ts' does not exist.", "File '/project/d.tsx' does not exist.", @@ -63,23 +63,23 @@ "File '/project/d/index.ts' exist - use it as a name resolution result.", "======== Module name './d' was successfully resolved to '/project/d/index.ts'. ========", "======== Resolving module './d/index' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/d/index', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/d/index.ts' exist - use it as a name resolution result.", "======== Module name './d/index' was successfully resolved to '/project/d/index.ts'. ========", "======== Resolving module './d/index.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/d/index.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/d/index.ts' has a '.ts' extension - stripping it.", "File '/project/d/index.ts' exist - use it as a name resolution result.", "======== Module name './d/index.ts' was successfully resolved to '/project/d/index.ts'. ========", "======== Resolving module './e' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/e', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/e.ts' exist - use it as a name resolution result.", "======== Module name './e' was successfully resolved to '/project/e.ts'. ========", "======== Resolving module './e.txt' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/e.txt', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/e.txt.ts' exist - use it as a name resolution result.", "======== Module name './e.txt' was successfully resolved to '/project/e.txt.ts'. ========", @@ -87,7 +87,7 @@ "Resolution for module './a.ts' was found in cache from location '/project'.", "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './a.d.ts' from '/project/types.d.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a.d.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", "File '/project/a.d.ts' does not exist.", diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).types b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).types similarity index 100% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=false).types rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).types diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt similarity index 100% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=true).errors.txt diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols similarity index 100% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=true).symbols diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json similarity index 88% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json index 2ebe4e7c42081..16bd4a9de2e58 100644 --- a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=false,noemit=true).trace.json +++ b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=true).trace.json @@ -1,58 +1,58 @@ [ "======== Resolving module './a' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/a.ts' exist - use it as a name resolution result.", "======== Module name './a' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './a.js' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a.js', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/a.js' has a '.js' extension - stripping it.", "File '/project/a.ts' exist - use it as a name resolution result.", "======== Module name './a.js' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './a.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/a.ts' has a '.ts' extension - stripping it.", "File '/project/a.ts' exist - use it as a name resolution result.", "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './b' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/b.ts' exist - use it as a name resolution result.", "======== Module name './b' was successfully resolved to '/project/b.ts'. ========", "======== Resolving module './b.js' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b.js', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/b.js' has a '.js' extension - stripping it.", "File '/project/b.ts' exist - use it as a name resolution result.", "======== Module name './b.js' was successfully resolved to '/project/b.ts'. ========", "======== Resolving module './b.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/b.ts' has a '.ts' extension - stripping it.", "File '/project/b.ts' exist - use it as a name resolution result.", "======== Module name './b.ts' was successfully resolved to '/project/b.ts'. ========", "======== Resolving module './b.d.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/b.d.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/b.d.ts' has a '.d.ts' extension - stripping it.", "File '/project/b.d.ts' exist - use it as a name resolution result.", "======== Module name './b.d.ts' was successfully resolved to '/project/b.d.ts'. ========", "======== Resolving module './c.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/c.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/c.ts' has a '.ts' extension - stripping it.", "File '/project/c.ts' exist - use it as a name resolution result.", "======== Module name './c.ts' was successfully resolved to '/project/c.ts'. ========", "======== Resolving module './c.tsx' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/c.tsx', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/c.tsx' has a '.tsx' extension - stripping it.", "File '/project/c.tsx' exist - use it as a name resolution result.", "======== Module name './c.tsx' was successfully resolved to '/project/c.tsx'. ========", "======== Resolving module './d' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/d', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/d.ts' does not exist.", "File '/project/d.tsx' does not exist.", @@ -63,23 +63,23 @@ "File '/project/d/index.ts' exist - use it as a name resolution result.", "======== Module name './d' was successfully resolved to '/project/d/index.ts'. ========", "======== Resolving module './d/index' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/d/index', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/d/index.ts' exist - use it as a name resolution result.", "======== Module name './d/index' was successfully resolved to '/project/d/index.ts'. ========", "======== Resolving module './d/index.ts' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/d/index.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/d/index.ts' has a '.ts' extension - stripping it.", "File '/project/d/index.ts' exist - use it as a name resolution result.", "======== Module name './d/index.ts' was successfully resolved to '/project/d/index.ts'. ========", "======== Resolving module './e' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/e', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/e.ts' exist - use it as a name resolution result.", "======== Module name './e' was successfully resolved to '/project/e.ts'. ========", "======== Resolving module './e.txt' from '/project/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/e.txt', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/project/e.txt.ts' exist - use it as a name resolution result.", "======== Module name './e.txt' was successfully resolved to '/project/e.txt.ts'. ========", @@ -87,7 +87,7 @@ "Resolution for module './a.ts' was found in cache from location '/project'.", "======== Module name './a.ts' was successfully resolved to '/project/a.ts'. ========", "======== Resolving module './a.d.ts' from '/project/types.d.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/project/a.d.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/project/a.d.ts' has a '.d.ts' extension - stripping it.", "File '/project/a.d.ts' does not exist.", diff --git a/tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).types b/tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=true).types similarity index 100% rename from tests/baselines/reference/hybridImportTsExtensions(allowimportingtsextensions=true,noemit=true).types rename to tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=true).types diff --git a/tests/baselines/reference/hybridNodeModules1.errors.txt b/tests/baselines/reference/bundlerNodeModules1.errors.txt similarity index 100% rename from tests/baselines/reference/hybridNodeModules1.errors.txt rename to tests/baselines/reference/bundlerNodeModules1.errors.txt diff --git a/tests/baselines/reference/hybridNodeModules1.js b/tests/baselines/reference/bundlerNodeModules1.js similarity index 88% rename from tests/baselines/reference/hybridNodeModules1.js rename to tests/baselines/reference/bundlerNodeModules1.js index 97b4ba34ff3d9..8567c3f9b4561 100644 --- a/tests/baselines/reference/hybridNodeModules1.js +++ b/tests/baselines/reference/bundlerNodeModules1.js @@ -1,4 +1,4 @@ -//// [tests/cases/conformance/moduleResolution/hybrid/hybridNodeModules1.ts] //// +//// [tests/cases/conformance/moduleResolution/bundler/bundlerNodeModules1.ts] //// //// [package.json] { diff --git a/tests/baselines/reference/hybridNodeModules1.symbols b/tests/baselines/reference/bundlerNodeModules1.symbols similarity index 100% rename from tests/baselines/reference/hybridNodeModules1.symbols rename to tests/baselines/reference/bundlerNodeModules1.symbols diff --git a/tests/baselines/reference/hybridNodeModules1.trace.json b/tests/baselines/reference/bundlerNodeModules1.trace.json similarity index 96% rename from tests/baselines/reference/hybridNodeModules1.trace.json rename to tests/baselines/reference/bundlerNodeModules1.trace.json index bcd13bb309acb..d1f74dccd4b1a 100644 --- a/tests/baselines/reference/hybridNodeModules1.trace.json +++ b/tests/baselines/reference/bundlerNodeModules1.trace.json @@ -1,6 +1,6 @@ [ "======== Resolving module 'dual' from '/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "File '/package.json' does not exist.", "Loading module 'dual' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", "Found 'package.json' at '/node_modules/dual/package.json'.", diff --git a/tests/baselines/reference/hybridNodeModules1.types b/tests/baselines/reference/bundlerNodeModules1.types similarity index 100% rename from tests/baselines/reference/hybridNodeModules1.types rename to tests/baselines/reference/bundlerNodeModules1.types diff --git a/tests/baselines/reference/hybridRelative1.errors.txt b/tests/baselines/reference/bundlerRelative1.errors.txt similarity index 100% rename from tests/baselines/reference/hybridRelative1.errors.txt rename to tests/baselines/reference/bundlerRelative1.errors.txt diff --git a/tests/baselines/reference/hybridRelative1.js b/tests/baselines/reference/bundlerRelative1.js similarity index 89% rename from tests/baselines/reference/hybridRelative1.js rename to tests/baselines/reference/bundlerRelative1.js index 1eab035117f24..9238cc0f8ef3b 100644 --- a/tests/baselines/reference/hybridRelative1.js +++ b/tests/baselines/reference/bundlerRelative1.js @@ -1,4 +1,4 @@ -//// [tests/cases/conformance/moduleResolution/hybrid/hybridRelative1.ts] //// +//// [tests/cases/conformance/moduleResolution/bundler/bundlerRelative1.ts] //// //// [index.ts] export const x = 0; diff --git a/tests/baselines/reference/hybridRelative1.symbols b/tests/baselines/reference/bundlerRelative1.symbols similarity index 100% rename from tests/baselines/reference/hybridRelative1.symbols rename to tests/baselines/reference/bundlerRelative1.symbols diff --git a/tests/baselines/reference/hybridRelative1.trace.json b/tests/baselines/reference/bundlerRelative1.trace.json similarity index 90% rename from tests/baselines/reference/hybridRelative1.trace.json rename to tests/baselines/reference/bundlerRelative1.trace.json index 1c13c05219f26..19e7e28acd7ea 100644 --- a/tests/baselines/reference/hybridRelative1.trace.json +++ b/tests/baselines/reference/bundlerRelative1.trace.json @@ -1,6 +1,6 @@ [ "======== Resolving module './dir' from '/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/dir', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/dir.ts' does not exist.", "File '/dir.tsx' does not exist.", @@ -11,24 +11,24 @@ "File '/dir/index.ts' exist - use it as a name resolution result.", "======== Module name './dir' was successfully resolved to '/dir/index.ts'. ========", "======== Resolving module './dir/index' from '/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/dir/index', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/dir/index.ts' exist - use it as a name resolution result.", "======== Module name './dir/index' was successfully resolved to '/dir/index.ts'. ========", "======== Resolving module './dir/index.js' from '/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/dir/index.js', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/dir/index.js' has a '.js' extension - stripping it.", "File '/dir/index.ts' exist - use it as a name resolution result.", "======== Module name './dir/index.js' was successfully resolved to '/dir/index.ts'. ========", "======== Resolving module './dir/index.ts' from '/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/dir/index.ts', target file types: TypeScript, JavaScript, Declaration, JSON.", "File name '/dir/index.ts' has a '.ts' extension - stripping it.", "File '/dir/index.ts' exist - use it as a name resolution result.", "======== Module name './dir/index.ts' was successfully resolved to '/dir/index.ts'. ========", "======== Resolving module './redirect' from '/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/redirect', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/redirect.ts' does not exist.", "File '/redirect.tsx' does not exist.", @@ -50,7 +50,7 @@ "File '/foo/index.ts' exist - use it as a name resolution result.", "======== Module name './redirect' was successfully resolved to '/foo/index.ts'. ========", "======== Resolving module './redirect/index' from '/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/redirect/index', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/redirect/index.ts' does not exist.", "File '/redirect/index.tsx' does not exist.", @@ -60,14 +60,14 @@ "Directory '/redirect/index' does not exist, skipping all lookups in it.", "======== Module name './redirect/index' was not resolved. ========", "======== Resolving module './types/esm' from '/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/types/esm', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/types/esm.ts' does not exist.", "File '/types/esm.tsx' does not exist.", "File '/types/esm.d.ts' exist - use it as a name resolution result.", "======== Module name './types/esm' was successfully resolved to '/types/esm.d.ts'. ========", "======== Resolving module './types/cjs' from '/main.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "Loading module as file / folder, candidate module location '/types/cjs', target file types: TypeScript, JavaScript, Declaration, JSON.", "File '/types/cjs.ts' does not exist.", "File '/types/cjs.tsx' does not exist.", diff --git a/tests/baselines/reference/hybridRelative1.types b/tests/baselines/reference/bundlerRelative1.types similarity index 100% rename from tests/baselines/reference/hybridRelative1.types rename to tests/baselines/reference/bundlerRelative1.types diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.errors.txt b/tests/baselines/reference/bundlerSyntaxRestrictions.errors.txt similarity index 69% rename from tests/baselines/reference/hybridSyntaxRestrictions.errors.txt rename to tests/baselines/reference/bundlerSyntaxRestrictions.errors.txt index e058049f3cd67..bae60c5cc726a 100644 --- a/tests/baselines/reference/hybridSyntaxRestrictions.errors.txt +++ b/tests/baselines/reference/bundlerSyntaxRestrictions.errors.txt @@ -1,6 +1,6 @@ error TS2468: Cannot find global value 'Promise'. -/main.ts(2,1): error TS5099: Import assignment is not allowed when 'moduleResolution' is set to 'hybrid'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. -/main.ts(3,1): error TS5100: Export assignment cannot be used when 'moduleResolution' is set to 'hybrid'. Consider using 'export default' or another module format instead. +/main.ts(2,1): error TS5099: Import assignment is not allowed when 'moduleResolution' is set to 'bundler'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. +/main.ts(3,1): error TS5100: Export assignment cannot be used when 'moduleResolution' is set to 'bundler'. Consider using 'export default' or another module format instead. /mainJs.js(2,1): error TS2712: A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. @@ -20,10 +20,10 @@ error TS2468: Cannot find global value 'Promise'. import {} from "./a"; import _ = require("./a"); // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS5099: Import assignment is not allowed when 'moduleResolution' is set to 'hybrid'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. +!!! error TS5099: Import assignment is not allowed when 'moduleResolution' is set to 'bundler'. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead. export = {}; // Error ~~~~~~~~~~~~ -!!! error TS5100: Export assignment cannot be used when 'moduleResolution' is set to 'hybrid'. Consider using 'export default' or another module format instead. +!!! error TS5100: Export assignment cannot be used when 'moduleResolution' is set to 'bundler'. Consider using 'export default' or another module format instead. export {}; ==== /a.ts (0 errors) ==== diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.js b/tests/baselines/reference/bundlerSyntaxRestrictions.js similarity index 85% rename from tests/baselines/reference/hybridSyntaxRestrictions.js rename to tests/baselines/reference/bundlerSyntaxRestrictions.js index 7b066f1ff6dcf..cd49b3c2efd7d 100644 --- a/tests/baselines/reference/hybridSyntaxRestrictions.js +++ b/tests/baselines/reference/bundlerSyntaxRestrictions.js @@ -1,4 +1,4 @@ -//// [tests/cases/conformance/moduleResolution/hybrid/hybridSyntaxRestrictions.ts] //// +//// [tests/cases/conformance/moduleResolution/bundler/bundlerSyntaxRestrictions.ts] //// //// [index.d.ts] declare var require: (...args: any[]) => any; diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.symbols b/tests/baselines/reference/bundlerSyntaxRestrictions.symbols similarity index 100% rename from tests/baselines/reference/hybridSyntaxRestrictions.symbols rename to tests/baselines/reference/bundlerSyntaxRestrictions.symbols diff --git a/tests/baselines/reference/hybridSyntaxRestrictions.types b/tests/baselines/reference/bundlerSyntaxRestrictions.types similarity index 100% rename from tests/baselines/reference/hybridSyntaxRestrictions.types rename to tests/baselines/reference/bundlerSyntaxRestrictions.types diff --git a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --moduleResolution.js b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --moduleResolution.js index 2bcff8882d32d..562f23f1a7748 100644 --- a/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --moduleResolution.js +++ b/tests/baselines/reference/config/commandLineParsing/parseCommandLine/Parse empty options of --moduleResolution.js @@ -7,4 +7,4 @@ FileNames:: 0.ts Errors:: error TS6044: Compiler option 'moduleResolution' expects an argument. -error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext', 'hybrid'. +error TS6046: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node16', 'nodenext', 'bundler'. diff --git a/tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json index 6c441a8d09dc3..5eaa44daaec1e 100644 --- a/tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Default initialized TSConfig/tsconfig.json @@ -35,7 +35,7 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --help/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --help/tsconfig.json index 6c441a8d09dc3..5eaa44daaec1e 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --help/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --help/tsconfig.json @@ -35,7 +35,7 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --watch/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --watch/tsconfig.json index 6c441a8d09dc3..5eaa44daaec1e 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --watch/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with --watch/tsconfig.json @@ -35,7 +35,7 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with advanced options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with advanced options/tsconfig.json index 51189f709b334..00903ad0c38a1 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with advanced options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with advanced options/tsconfig.json @@ -35,7 +35,7 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json index 73cfaeb1e2781..07e8da2a6e437 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json @@ -35,7 +35,7 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with enum value compiler options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with enum value compiler options/tsconfig.json index 0ea88943dc980..ff2c5a0a7e672 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with enum value compiler options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with enum value compiler options/tsconfig.json @@ -35,7 +35,7 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with files options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with files options/tsconfig.json index 9977c19ffc059..3955bbd422ede 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with files options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with files options/tsconfig.json @@ -35,7 +35,7 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json index 8564d1f1c2aa8..f635f645ea08b 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option value/tsconfig.json @@ -35,7 +35,7 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json index 6c441a8d09dc3..5eaa44daaec1e 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with incorrect compiler option/tsconfig.json @@ -35,7 +35,7 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json index 2b4eafb70befb..ed7f34f5e6557 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options with enum value/tsconfig.json @@ -35,7 +35,7 @@ // "types": [], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ diff --git a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options/tsconfig.json b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options/tsconfig.json index 4a2a162913e21..cc9d87c258ddb 100644 --- a/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options/tsconfig.json +++ b/tests/baselines/reference/config/initTSConfig/Initialized TSConfig with list compiler options/tsconfig.json @@ -35,7 +35,7 @@ "types": ["jquery","mocha"], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution hybrid' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).trace.json b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).trace.json index 49c7146ff7ee8..1b85a4d6fcaf1 100644 --- a/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).trace.json +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=false).trace.json @@ -1,6 +1,6 @@ [ "======== Resolving module 'lodash' from '/index.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "File '/package.json' does not exist.", "Loading module 'lodash' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", "Found 'package.json' at '/node_modules/lodash/package.json'.", diff --git a/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).trace.json b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).trace.json index 8289b5cf1eab2..2019c28fc9f0d 100644 --- a/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).trace.json +++ b/tests/baselines/reference/customConditions(resolvepackagejsonexports=true).trace.json @@ -1,6 +1,6 @@ [ "======== Resolving module 'lodash' from '/index.ts'. ========", - "Explicitly specified module resolution kind: 'Hybrid'.", + "Explicitly specified module resolution kind: 'Bundler'.", "File '/package.json' does not exist.", "Loading module 'lodash' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.", "Found 'package.json' at '/node_modules/lodash/package.json'.", diff --git a/tests/baselines/reference/extensionLoadingPriority(moduleresolution=hybrid).symbols b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=bundler).symbols similarity index 100% rename from tests/baselines/reference/extensionLoadingPriority(moduleresolution=hybrid).symbols rename to tests/baselines/reference/extensionLoadingPriority(moduleresolution=bundler).symbols diff --git a/tests/baselines/reference/extensionLoadingPriority(moduleresolution=hybrid).types b/tests/baselines/reference/extensionLoadingPriority(moduleresolution=bundler).types similarity index 100% rename from tests/baselines/reference/extensionLoadingPriority(moduleresolution=hybrid).types rename to tests/baselines/reference/extensionLoadingPriority(moduleresolution=bundler).types diff --git a/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=classic).errors.txt b/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=classic).errors.txt index 023c4dc8610ad..93ffdb73d1766 100644 --- a/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=classic).errors.txt +++ b/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=classic).errors.txt @@ -1,8 +1,8 @@ -error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. -error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. +error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'. +error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'. -!!! error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. -!!! error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. +!!! error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'. +!!! error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'. ==== tests/cases/conformance/moduleResolution/index.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=node).errors.txt b/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=node).errors.txt index 023c4dc8610ad..93ffdb73d1766 100644 --- a/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=node).errors.txt +++ b/tests/baselines/reference/packageJsonImportsExportsOptionCompat(moduleresolution=node).errors.txt @@ -1,8 +1,8 @@ -error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. -error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. +error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'. +error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'. -!!! error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. -!!! error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'hybrid'. +!!! error TS5098: Option 'resolvePackageJsonExports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'. +!!! error TS5098: Option 'resolvePackageJsonImports' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'. ==== tests/cases/conformance/moduleResolution/index.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/cases/conformance/moduleResolution/hybrid/hybridImportESM.ts b/tests/cases/conformance/moduleResolution/bundler/bundlerImportESM.ts similarity index 88% rename from tests/cases/conformance/moduleResolution/hybrid/hybridImportESM.ts rename to tests/cases/conformance/moduleResolution/bundler/bundlerImportESM.ts index fcd14153c4c16..86107d98fbcab 100644 --- a/tests/cases/conformance/moduleResolution/hybrid/hybridImportESM.ts +++ b/tests/cases/conformance/moduleResolution/bundler/bundlerImportESM.ts @@ -1,4 +1,4 @@ -// @moduleResolution: hybrid +// @moduleResolution: bundler // @Filename: /esm.mts export const esm = 0; diff --git a/tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts b/tests/cases/conformance/moduleResolution/bundler/bundlerImportTsExtensions.ts similarity index 97% rename from tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts rename to tests/cases/conformance/moduleResolution/bundler/bundlerImportTsExtensions.ts index 8cb7141e5c409..8ba4b62b7116b 100644 --- a/tests/cases/conformance/moduleResolution/hybrid/hybridImportTsExtensions.ts +++ b/tests/cases/conformance/moduleResolution/bundler/bundlerImportTsExtensions.ts @@ -1,4 +1,4 @@ -// @moduleResolution: hybrid +// @moduleResolution: bundler // @outDir: dist // @allowJs: true // @checkJs: true diff --git a/tests/cases/conformance/moduleResolution/hybrid/hybridNodeModules1.ts b/tests/cases/conformance/moduleResolution/bundler/bundlerNodeModules1.ts similarity index 96% rename from tests/cases/conformance/moduleResolution/hybrid/hybridNodeModules1.ts rename to tests/cases/conformance/moduleResolution/bundler/bundlerNodeModules1.ts index c1f35a255db6c..ffa7242ff3c09 100644 --- a/tests/cases/conformance/moduleResolution/hybrid/hybridNodeModules1.ts +++ b/tests/cases/conformance/moduleResolution/bundler/bundlerNodeModules1.ts @@ -1,4 +1,4 @@ -// @moduleResolution: hybrid +// @moduleResolution: bundler // @traceResolution: true // @Filename: /node_modules/dual/package.json diff --git a/tests/cases/conformance/moduleResolution/hybrid/hybridRelative1.ts b/tests/cases/conformance/moduleResolution/bundler/bundlerRelative1.ts similarity index 95% rename from tests/cases/conformance/moduleResolution/hybrid/hybridRelative1.ts rename to tests/cases/conformance/moduleResolution/bundler/bundlerRelative1.ts index b560bf5462709..d23292176f8d4 100644 --- a/tests/cases/conformance/moduleResolution/hybrid/hybridRelative1.ts +++ b/tests/cases/conformance/moduleResolution/bundler/bundlerRelative1.ts @@ -1,4 +1,4 @@ -// @moduleResolution: hybrid +// @moduleResolution: bundler // @traceResolution: true // @Filename: /dir/index.ts diff --git a/tests/cases/conformance/moduleResolution/hybrid/hybridSyntaxRestrictions.ts b/tests/cases/conformance/moduleResolution/bundler/bundlerSyntaxRestrictions.ts similarity index 93% rename from tests/cases/conformance/moduleResolution/hybrid/hybridSyntaxRestrictions.ts rename to tests/cases/conformance/moduleResolution/bundler/bundlerSyntaxRestrictions.ts index b4b50b6b910f6..fdc7f7c77819d 100644 --- a/tests/cases/conformance/moduleResolution/hybrid/hybridSyntaxRestrictions.ts +++ b/tests/cases/conformance/moduleResolution/bundler/bundlerSyntaxRestrictions.ts @@ -1,4 +1,4 @@ -// @moduleResolution: hybrid +// @moduleResolution: bundler // @checkJs: true // @allowJs: true // @outDir: out diff --git a/tests/cases/conformance/moduleResolution/customConditions.ts b/tests/cases/conformance/moduleResolution/customConditions.ts index 1205a9860f07d..47fb048ac28bf 100644 --- a/tests/cases/conformance/moduleResolution/customConditions.ts +++ b/tests/cases/conformance/moduleResolution/customConditions.ts @@ -1,4 +1,4 @@ -// @moduleResolution: hybrid +// @moduleResolution: bundler // @customConditions: webpack, browser // @resolvePackageJsonExports: true, false // @traceResolution: true diff --git a/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts b/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts index 485d9f905d4cf..c3a06a36b52aa 100644 --- a/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts +++ b/tests/cases/conformance/moduleResolution/extensionLoadingPriority.ts @@ -1,4 +1,4 @@ -// @moduleResolution: classic,node,node16,nodenext,hybrid +// @moduleResolution: classic,node,node16,nodenext,bundler // @allowJs: true // @checkJs: true // @noEmit: true diff --git a/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts b/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts index db00495c4ed8d..b1bf3811d6e64 100644 --- a/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts +++ b/tests/cases/conformance/moduleResolution/packageJsonImportsExportsOptionCompat.ts @@ -1,4 +1,4 @@ -// @moduleResolution: classic, node, node16, nodenext, hybrid +// @moduleResolution: classic, node, node16, nodenext, bundler // @resolvePackageJsonImports: true // @resolvePackageJsonExports: true // @noTypesAndSymbols: true diff --git a/tests/cases/fourslash/autoImportAllowTsExtensions1.ts b/tests/cases/fourslash/autoImportAllowTsExtensions1.ts index 882ab404669b9..e71867ceb67d8 100644 --- a/tests/cases/fourslash/autoImportAllowTsExtensions1.ts +++ b/tests/cases/fourslash/autoImportAllowTsExtensions1.ts @@ -1,6 +1,6 @@ /// -// @moduleResolution: hybrid +// @moduleResolution: bundler // @allowImportingTsExtensions: true // @noEmit: true diff --git a/tests/cases/fourslash/autoImportAllowTsExtensions2.ts b/tests/cases/fourslash/autoImportAllowTsExtensions2.ts index 84eda57047a35..5fd8b0730bbf0 100644 --- a/tests/cases/fourslash/autoImportAllowTsExtensions2.ts +++ b/tests/cases/fourslash/autoImportAllowTsExtensions2.ts @@ -1,6 +1,6 @@ /// -// @moduleResolution: hybrid +// @moduleResolution: bundler // @allowImportingTsExtensions: true // @noEmit: true diff --git a/tests/cases/fourslash/autoImportAllowTsExtensions3.ts b/tests/cases/fourslash/autoImportAllowTsExtensions3.ts index f46128644c6bd..d6e38bf236e1d 100644 --- a/tests/cases/fourslash/autoImportAllowTsExtensions3.ts +++ b/tests/cases/fourslash/autoImportAllowTsExtensions3.ts @@ -1,6 +1,6 @@ /// -// @moduleResolution: hybrid +// @moduleResolution: bundler // @allowImportingTsExtensions: true // @noEmit: true diff --git a/tests/cases/fourslash/autoImportAllowTsExtensions4.ts b/tests/cases/fourslash/autoImportAllowTsExtensions4.ts index bc6235658c2bc..b4f479fef5bf9 100644 --- a/tests/cases/fourslash/autoImportAllowTsExtensions4.ts +++ b/tests/cases/fourslash/autoImportAllowTsExtensions4.ts @@ -1,6 +1,6 @@ /// -// @moduleResolution: hybrid +// @moduleResolution: bundler // @allowImportingTsExtensions: true // @noEmit: true diff --git a/tests/cases/fourslash/pathCompletionsAllowTsExtensions.ts b/tests/cases/fourslash/pathCompletionsAllowTsExtensions.ts index 32b566f0839e6..b871ce1f429e4 100644 --- a/tests/cases/fourslash/pathCompletionsAllowTsExtensions.ts +++ b/tests/cases/fourslash/pathCompletionsAllowTsExtensions.ts @@ -1,6 +1,6 @@ /// -// @moduleResolution: hybrid +// @moduleResolution: bundler // @allowImportingTsExtensions: true // @noEmit: true