typescript 5.4.0-dev.20240115 → 5.4.0-dev.20240117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.dom.d.ts +363 -153
- package/lib/lib.dom.iterable.d.ts +35 -28
- package/lib/lib.webworker.d.ts +202 -111
- package/lib/lib.webworker.iterable.d.ts +29 -28
- package/lib/tsc.js +84 -44
- package/lib/tsserver.js +106 -52
- package/lib/typescript.js +106 -52
- package/lib/typingsInstaller.js +47 -23
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -2341,7 +2341,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2341
2341
|
|
|
2342
2342
|
// src/compiler/corePublic.ts
|
|
2343
2343
|
var versionMajorMinor = "5.4";
|
|
2344
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2344
|
+
var version = `${versionMajorMinor}.0-dev.20240117`;
|
|
2345
2345
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2346
2346
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2347
2347
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7021,7 +7021,6 @@ var CharacterCodes = /* @__PURE__ */ ((CharacterCodes2) => {
|
|
|
7021
7021
|
CharacterCodes2[CharacterCodes2["ideographicSpace"] = 12288] = "ideographicSpace";
|
|
7022
7022
|
CharacterCodes2[CharacterCodes2["mathematicalSpace"] = 8287] = "mathematicalSpace";
|
|
7023
7023
|
CharacterCodes2[CharacterCodes2["ogham"] = 5760] = "ogham";
|
|
7024
|
-
CharacterCodes2[CharacterCodes2["replacementCharacter"] = 65533] = "replacementCharacter";
|
|
7025
7024
|
CharacterCodes2[CharacterCodes2["_"] = 95] = "_";
|
|
7026
7025
|
CharacterCodes2[CharacterCodes2["$"] = 36] = "$";
|
|
7027
7026
|
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
|
|
@@ -10711,6 +10710,8 @@ var Diagnostics = {
|
|
|
10711
10710
|
Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6276, 3 /* Message */, "Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6276", "Export specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
10712
10711
|
Resolution_of_non_relative_name_failed_trying_with_modern_Node_resolution_features_disabled_to_see_if_npm_library_needs_configuration_update: diag(6277, 3 /* Message */, "Resolution_of_non_relative_name_failed_trying_with_modern_Node_resolution_features_disabled_to_see_i_6277", "Resolution of non-relative name failed; trying with modern Node resolution features disabled to see if npm library needs configuration update."),
|
|
10713
10712
|
There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings: diag(6278, 3 /* Message */, "There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The__6278", `There are types at '{0}', but this result could not be resolved when respecting package.json "exports". The '{1}' library may need to update its package.json or typings.`),
|
|
10713
|
+
Resolution_of_non_relative_name_failed_trying_with_moduleResolution_bundler_to_see_if_project_may_need_configuration_update: diag(6279, 3 /* Message */, "Resolution_of_non_relative_name_failed_trying_with_moduleResolution_bundler_to_see_if_project_may_ne_6279", "Resolution of non-relative name failed; trying with '--moduleResolution bundler' to see if project may need configuration update."),
|
|
10714
|
+
There_are_types_at_0_but_this_result_could_not_be_resolved_under_your_current_moduleResolution_setting_Consider_updating_to_node16_nodenext_or_bundler: diag(6280, 3 /* Message */, "There_are_types_at_0_but_this_result_could_not_be_resolved_under_your_current_moduleResolution_setti_6280", "There are types at '{0}', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'."),
|
|
10714
10715
|
Enable_project_compilation: diag(6302, 3 /* Message */, "Enable_project_compilation_6302", "Enable project compilation"),
|
|
10715
10716
|
Composite_projects_may_not_disable_declaration_emit: diag(6304, 1 /* Error */, "Composite_projects_may_not_disable_declaration_emit_6304", "Composite projects may not disable declaration emit."),
|
|
10716
10717
|
Output_file_0_has_not_been_built_from_source_file_1: diag(6305, 1 /* Error */, "Output_file_0_has_not_been_built_from_source_file_1_6305", "Output file '{0}' has not been built from source file '{1}'."),
|
|
@@ -12698,7 +12699,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12698
12699
|
}
|
|
12699
12700
|
const ch = codePointAt(text, pos);
|
|
12700
12701
|
if (pos === 0) {
|
|
12701
|
-
if (
|
|
12702
|
+
if (text.slice(0, 256).includes("\uFFFD")) {
|
|
12702
12703
|
error2(Diagnostics.File_appears_to_be_binary);
|
|
12703
12704
|
pos = end;
|
|
12704
12705
|
return token = 8 /* NonTextFileMarkerTrivia */;
|
|
@@ -15304,17 +15305,20 @@ function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
|
15304
15305
|
return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
|
|
15305
15306
|
}
|
|
15306
15307
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
15307
|
-
return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId) && oldResolution.
|
|
15308
|
+
return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId) && oldResolution.alternateResult === newResolution.alternateResult;
|
|
15308
15309
|
}
|
|
15309
15310
|
function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
|
|
15310
15311
|
var _a;
|
|
15311
|
-
const
|
|
15312
|
-
const
|
|
15312
|
+
const alternateResult = (_a = host.getResolvedModule(sourceFile, moduleReference, mode)) == null ? void 0 : _a.alternateResult;
|
|
15313
|
+
const alternateResultMessage = alternateResult && (getEmitModuleResolutionKind(host.getCompilerOptions()) === 2 /* Node10 */ ? [Diagnostics.There_are_types_at_0_but_this_result_could_not_be_resolved_under_your_current_moduleResolution_setting_Consider_updating_to_node16_nodenext_or_bundler, [alternateResult]] : [
|
|
15314
|
+
Diagnostics.There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings,
|
|
15315
|
+
[alternateResult, alternateResult.includes(nodeModulesPathPart + "@types/") ? `@types/${mangleScopedPackageName(packageName)}` : packageName]
|
|
15316
|
+
]);
|
|
15317
|
+
const result = alternateResultMessage ? chainDiagnosticMessages(
|
|
15313
15318
|
/*details*/
|
|
15314
15319
|
void 0,
|
|
15315
|
-
|
|
15316
|
-
|
|
15317
|
-
node10Result.includes(nodeModulesPathPart + "@types/") ? `@types/${mangleScopedPackageName(packageName)}` : packageName
|
|
15320
|
+
alternateResultMessage[0],
|
|
15321
|
+
...alternateResultMessage[1]
|
|
15318
15322
|
) : host.typesPackageExists(packageName) ? chainDiagnosticMessages(
|
|
15319
15323
|
/*details*/
|
|
15320
15324
|
void 0,
|
|
@@ -41724,7 +41728,7 @@ function resolvedTypeScriptOnly(resolved) {
|
|
|
41724
41728
|
Debug.assert(extensionIsTS(resolved.extension));
|
|
41725
41729
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
41726
41730
|
}
|
|
41727
|
-
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, cache,
|
|
41731
|
+
function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, cache, alternateResult) {
|
|
41728
41732
|
if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
|
|
41729
41733
|
const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
|
|
41730
41734
|
if (originalPath)
|
|
@@ -41738,10 +41742,10 @@ function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName
|
|
|
41738
41742
|
diagnostics,
|
|
41739
41743
|
state.resultFromCache,
|
|
41740
41744
|
cache,
|
|
41741
|
-
|
|
41745
|
+
alternateResult
|
|
41742
41746
|
);
|
|
41743
41747
|
}
|
|
41744
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, cache,
|
|
41748
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, cache, alternateResult) {
|
|
41745
41749
|
if (resultFromCache) {
|
|
41746
41750
|
if (!(cache == null ? void 0 : cache.isReadonly)) {
|
|
41747
41751
|
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
@@ -41769,7 +41773,7 @@ function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibra
|
|
|
41769
41773
|
failedLookupLocations: initializeResolutionField(failedLookupLocations),
|
|
41770
41774
|
affectingLocations: initializeResolutionField(affectingLocations),
|
|
41771
41775
|
resolutionDiagnostics: initializeResolutionField(diagnostics),
|
|
41772
|
-
|
|
41776
|
+
alternateResult
|
|
41773
41777
|
};
|
|
41774
41778
|
}
|
|
41775
41779
|
function initializeResolutionField(value) {
|
|
@@ -41988,7 +41992,8 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
41988
41992
|
requestContainingDirectory: containingDirectory,
|
|
41989
41993
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
41990
41994
|
isConfigLookup: false,
|
|
41991
|
-
candidateIsFromPackageJsonField: false
|
|
41995
|
+
candidateIsFromPackageJsonField: false,
|
|
41996
|
+
resolvedPackageDirectory: false
|
|
41992
41997
|
};
|
|
41993
41998
|
let resolved = primaryLookup();
|
|
41994
41999
|
let primary = true;
|
|
@@ -42879,7 +42884,7 @@ function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
|
42879
42884
|
);
|
|
42880
42885
|
}
|
|
42881
42886
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference, conditions) {
|
|
42882
|
-
var _a, _b, _c, _d;
|
|
42887
|
+
var _a, _b, _c, _d, _e;
|
|
42883
42888
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
42884
42889
|
const failedLookupLocations = [];
|
|
42885
42890
|
const affectingLocations = [];
|
|
@@ -42901,7 +42906,8 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
42901
42906
|
requestContainingDirectory: containingDirectory,
|
|
42902
42907
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
42903
42908
|
isConfigLookup,
|
|
42904
|
-
candidateIsFromPackageJsonField: false
|
|
42909
|
+
candidateIsFromPackageJsonField: false,
|
|
42910
|
+
resolvedPackageDirectory: false
|
|
42905
42911
|
};
|
|
42906
42912
|
if (traceEnabled && moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
42907
42913
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", state.conditions.map((c) => `'${c}'`).join(", "));
|
|
@@ -42914,29 +42920,46 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
42914
42920
|
} else {
|
|
42915
42921
|
result = tryResolve(extensions, state);
|
|
42916
42922
|
}
|
|
42917
|
-
let
|
|
42918
|
-
if (
|
|
42919
|
-
|
|
42920
|
-
|
|
42921
|
-
|
|
42922
|
-
|
|
42923
|
-
|
|
42924
|
-
|
|
42925
|
-
|
|
42926
|
-
|
|
42927
|
-
|
|
42923
|
+
let alternateResult;
|
|
42924
|
+
if (state.resolvedPackageDirectory && !isConfigLookup && !isExternalModuleNameRelative(moduleName)) {
|
|
42925
|
+
const wantedTypesButGotJs = (result == null ? void 0 : result.value) && extensions & (1 /* TypeScript */ | 4 /* Declaration */) && !extensionIsOk(1 /* TypeScript */ | 4 /* Declaration */, result.value.resolved.extension);
|
|
42926
|
+
if (((_a = result == null ? void 0 : result.value) == null ? void 0 : _a.isExternalLibraryImport) && wantedTypesButGotJs && features & 8 /* Exports */ && (conditions == null ? void 0 : conditions.includes("import"))) {
|
|
42927
|
+
traceIfEnabled(state, Diagnostics.Resolution_of_non_relative_name_failed_trying_with_modern_Node_resolution_features_disabled_to_see_if_npm_library_needs_configuration_update);
|
|
42928
|
+
const diagnosticState = {
|
|
42929
|
+
...state,
|
|
42930
|
+
features: state.features & ~8 /* Exports */,
|
|
42931
|
+
reportDiagnostic: noop
|
|
42932
|
+
};
|
|
42933
|
+
const diagnosticResult = tryResolve(extensions & (1 /* TypeScript */ | 4 /* Declaration */), diagnosticState);
|
|
42934
|
+
if ((_b = diagnosticResult == null ? void 0 : diagnosticResult.value) == null ? void 0 : _b.isExternalLibraryImport) {
|
|
42935
|
+
alternateResult = diagnosticResult.value.resolved.path;
|
|
42936
|
+
}
|
|
42937
|
+
} else if ((!(result == null ? void 0 : result.value) || wantedTypesButGotJs) && moduleResolution === 2 /* Node10 */) {
|
|
42938
|
+
traceIfEnabled(state, Diagnostics.Resolution_of_non_relative_name_failed_trying_with_moduleResolution_bundler_to_see_if_project_may_need_configuration_update);
|
|
42939
|
+
const diagnosticsCompilerOptions = { ...state.compilerOptions, moduleResolution: 100 /* Bundler */ };
|
|
42940
|
+
const diagnosticState = {
|
|
42941
|
+
...state,
|
|
42942
|
+
compilerOptions: diagnosticsCompilerOptions,
|
|
42943
|
+
features: 30 /* BundlerDefault */,
|
|
42944
|
+
conditions: getConditions(diagnosticsCompilerOptions),
|
|
42945
|
+
reportDiagnostic: noop
|
|
42946
|
+
};
|
|
42947
|
+
const diagnosticResult = tryResolve(extensions & (1 /* TypeScript */ | 4 /* Declaration */), diagnosticState);
|
|
42948
|
+
if ((_c = diagnosticResult == null ? void 0 : diagnosticResult.value) == null ? void 0 : _c.isExternalLibraryImport) {
|
|
42949
|
+
alternateResult = diagnosticResult.value.resolved.path;
|
|
42950
|
+
}
|
|
42928
42951
|
}
|
|
42929
42952
|
}
|
|
42930
42953
|
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
42931
42954
|
moduleName,
|
|
42932
|
-
(
|
|
42933
|
-
(
|
|
42955
|
+
(_d = result == null ? void 0 : result.value) == null ? void 0 : _d.resolved,
|
|
42956
|
+
(_e = result == null ? void 0 : result.value) == null ? void 0 : _e.isExternalLibraryImport,
|
|
42934
42957
|
failedLookupLocations,
|
|
42935
42958
|
affectingLocations,
|
|
42936
42959
|
diagnostics,
|
|
42937
42960
|
state,
|
|
42938
42961
|
cache,
|
|
42939
|
-
|
|
42962
|
+
alternateResult
|
|
42940
42963
|
);
|
|
42941
42964
|
function tryResolve(extensions2, state2) {
|
|
42942
42965
|
const loader = (extensions3, candidate, onlyRecordFailures, state3) => nodeLoadModuleByRelativeName(
|
|
@@ -43302,7 +43325,8 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
|
|
|
43302
43325
|
requestContainingDirectory: void 0,
|
|
43303
43326
|
reportDiagnostic: noop,
|
|
43304
43327
|
isConfigLookup: false,
|
|
43305
|
-
candidateIsFromPackageJsonField: false
|
|
43328
|
+
candidateIsFromPackageJsonField: false,
|
|
43329
|
+
resolvedPackageDirectory: false
|
|
43306
43330
|
};
|
|
43307
43331
|
}
|
|
43308
43332
|
function getPackageScopeForPath(fileName, state) {
|
|
@@ -44028,6 +44052,9 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
44028
44052
|
if (rest !== "") {
|
|
44029
44053
|
packageInfo = rootPackageInfo ?? getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
44030
44054
|
}
|
|
44055
|
+
if (packageInfo) {
|
|
44056
|
+
state.resolvedPackageDirectory = true;
|
|
44057
|
+
}
|
|
44031
44058
|
if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) {
|
|
44032
44059
|
return (_b = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _b.value;
|
|
44033
44060
|
}
|
|
@@ -44147,7 +44174,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
44147
44174
|
requestContainingDirectory: containingDirectory,
|
|
44148
44175
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
44149
44176
|
isConfigLookup: false,
|
|
44150
|
-
candidateIsFromPackageJsonField: false
|
|
44177
|
+
candidateIsFromPackageJsonField: false,
|
|
44178
|
+
resolvedPackageDirectory: false
|
|
44151
44179
|
};
|
|
44152
44180
|
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
44153
44181
|
return createResolvedModuleWithFailedLookupLocationsHandlingSymlink(
|
|
@@ -44256,7 +44284,8 @@ function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, hos
|
|
|
44256
44284
|
requestContainingDirectory: void 0,
|
|
44257
44285
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
44258
44286
|
isConfigLookup: false,
|
|
44259
|
-
candidateIsFromPackageJsonField: false
|
|
44287
|
+
candidateIsFromPackageJsonField: false,
|
|
44288
|
+
resolvedPackageDirectory: false
|
|
44260
44289
|
};
|
|
44261
44290
|
const resolved = loadModuleFromImmediateNodeModulesDirectory(
|
|
44262
44291
|
4 /* Declaration */,
|
|
@@ -51622,7 +51651,7 @@ function createTypeChecker(host) {
|
|
|
51622
51651
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
51623
51652
|
}
|
|
51624
51653
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
51625
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
51654
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
51626
51655
|
if (startsWith(moduleReference, "@types/")) {
|
|
51627
51656
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
51628
51657
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -51791,7 +51820,17 @@ function createTypeChecker(host) {
|
|
|
51791
51820
|
error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
51792
51821
|
}
|
|
51793
51822
|
} else {
|
|
51794
|
-
|
|
51823
|
+
if ((_k = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _k.alternateResult) {
|
|
51824
|
+
const errorInfo = createModuleNotFoundChain(currentSourceFile, host, moduleReference, mode, moduleReference);
|
|
51825
|
+
errorOrSuggestion(
|
|
51826
|
+
/*isError*/
|
|
51827
|
+
true,
|
|
51828
|
+
errorNode,
|
|
51829
|
+
chainDiagnosticMessages(errorInfo, moduleNotFoundError, moduleReference)
|
|
51830
|
+
);
|
|
51831
|
+
} else {
|
|
51832
|
+
error2(errorNode, moduleNotFoundError, moduleReference);
|
|
51833
|
+
}
|
|
51795
51834
|
}
|
|
51796
51835
|
}
|
|
51797
51836
|
}
|
|
@@ -128051,10 +128090,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
128051
128090
|
}
|
|
128052
128091
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
128053
128092
|
Debug.assert(!!resolution.refCount);
|
|
128054
|
-
const { failedLookupLocations, affectingLocations,
|
|
128055
|
-
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !
|
|
128093
|
+
const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
|
|
128094
|
+
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !alternateResult)
|
|
128056
128095
|
return;
|
|
128057
|
-
if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) ||
|
|
128096
|
+
if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || alternateResult)
|
|
128058
128097
|
resolutionsWithFailedLookups.add(resolution);
|
|
128059
128098
|
let setAtRoot = false;
|
|
128060
128099
|
if (failedLookupLocations) {
|
|
@@ -128062,8 +128101,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
128062
128101
|
setAtRoot = watchFailedLookupLocation(failedLookupLocation, setAtRoot);
|
|
128063
128102
|
}
|
|
128064
128103
|
}
|
|
128065
|
-
if (
|
|
128066
|
-
setAtRoot = watchFailedLookupLocation(
|
|
128104
|
+
if (alternateResult)
|
|
128105
|
+
setAtRoot = watchFailedLookupLocation(alternateResult, setAtRoot);
|
|
128067
128106
|
if (setAtRoot) {
|
|
128068
128107
|
setDirectoryWatcher(
|
|
128069
128108
|
rootDir,
|
|
@@ -128072,7 +128111,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
128072
128111
|
true
|
|
128073
128112
|
);
|
|
128074
128113
|
}
|
|
128075
|
-
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !
|
|
128114
|
+
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !alternateResult);
|
|
128076
128115
|
}
|
|
128077
128116
|
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
128078
128117
|
Debug.assert(!!resolution.refCount);
|
|
@@ -128210,7 +128249,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
128210
128249
|
if ((resolutions == null ? void 0 : resolutions.delete(resolution)) && !resolutions.size)
|
|
128211
128250
|
resolvedFileToResolution.delete(key);
|
|
128212
128251
|
}
|
|
128213
|
-
const { failedLookupLocations, affectingLocations,
|
|
128252
|
+
const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
|
|
128214
128253
|
if (resolutionsWithFailedLookups.delete(resolution)) {
|
|
128215
128254
|
let removeAtRoot = false;
|
|
128216
128255
|
if (failedLookupLocations) {
|
|
@@ -128218,8 +128257,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
128218
128257
|
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove);
|
|
128219
128258
|
}
|
|
128220
128259
|
}
|
|
128221
|
-
if (
|
|
128222
|
-
removeAtRoot = stopWatchFailedLookupLocation(
|
|
128260
|
+
if (alternateResult)
|
|
128261
|
+
removeAtRoot = stopWatchFailedLookupLocation(alternateResult, removeAtRoot, syncDirWatcherRemove);
|
|
128223
128262
|
if (removeAtRoot)
|
|
128224
128263
|
removeDirectoryWatcher(rootPath, syncDirWatcherRemove);
|
|
128225
128264
|
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
@@ -128386,7 +128425,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
128386
128425
|
return true;
|
|
128387
128426
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
|
|
128388
128427
|
return false;
|
|
128389
|
-
return ((_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)))) || !!resolution.
|
|
128428
|
+
return ((_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)))) || !!resolution.alternateResult && isInvalidatedFailedLookup(resolutionHost.toPath(resolution.alternateResult));
|
|
128390
128429
|
}
|
|
128391
128430
|
function isInvalidatedFailedLookup(locationPath) {
|
|
128392
128431
|
return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (dirPath) => locationPath.length > dirPath.length && startsWith(locationPath, dirPath) && (isDiskPathRoot(dirPath) || locationPath[dirPath.length] === directorySeparator) ? true : void 0);
|
|
@@ -135602,7 +135641,7 @@ function forEachExternalModuleToImportFrom(program, host, preferences, useAutoIm
|
|
|
135602
135641
|
const pattern = getPatternFromSpec(spec, "", "exclude");
|
|
135603
135642
|
return pattern ? getRegexFromPattern(pattern, useCaseSensitiveFileNames2) : void 0;
|
|
135604
135643
|
});
|
|
135605
|
-
forEachExternalModule(program.getTypeChecker(), program.getSourceFiles(), excludePatterns, (module2, file) => cb(
|
|
135644
|
+
forEachExternalModule(program.getTypeChecker(), program.getSourceFiles(), excludePatterns, host, (module2, file) => cb(
|
|
135606
135645
|
module2,
|
|
135607
135646
|
file,
|
|
135608
135647
|
program,
|
|
@@ -135613,7 +135652,7 @@ function forEachExternalModuleToImportFrom(program, host, preferences, useAutoIm
|
|
|
135613
135652
|
if (autoImportProvider) {
|
|
135614
135653
|
const start2 = timestamp();
|
|
135615
135654
|
const checker = program.getTypeChecker();
|
|
135616
|
-
forEachExternalModule(autoImportProvider.getTypeChecker(), autoImportProvider.getSourceFiles(), excludePatterns, (module2, file) => {
|
|
135655
|
+
forEachExternalModule(autoImportProvider.getTypeChecker(), autoImportProvider.getSourceFiles(), excludePatterns, host, (module2, file) => {
|
|
135617
135656
|
if (file && !program.getSourceFile(file.fileName) || !file && !checker.resolveName(
|
|
135618
135657
|
module2.name,
|
|
135619
135658
|
/*location*/
|
|
@@ -135634,11 +135673,26 @@ function forEachExternalModuleToImportFrom(program, host, preferences, useAutoIm
|
|
|
135634
135673
|
(_b = host.log) == null ? void 0 : _b.call(host, `forEachExternalModuleToImportFrom autoImportProvider: ${timestamp() - start2}`);
|
|
135635
135674
|
}
|
|
135636
135675
|
}
|
|
135637
|
-
function forEachExternalModule(checker, allSourceFiles, excludePatterns, cb) {
|
|
135638
|
-
var _a;
|
|
135639
|
-
const
|
|
135676
|
+
function forEachExternalModule(checker, allSourceFiles, excludePatterns, host, cb) {
|
|
135677
|
+
var _a, _b;
|
|
135678
|
+
const realpathsWithSymlinks = (_a = host.getSymlinkCache) == null ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
135679
|
+
const isExcluded = excludePatterns && (({ fileName, path }) => {
|
|
135680
|
+
if (excludePatterns.some((p) => p.test(fileName)))
|
|
135681
|
+
return true;
|
|
135682
|
+
if ((realpathsWithSymlinks == null ? void 0 : realpathsWithSymlinks.size) && pathContainsNodeModules(fileName)) {
|
|
135683
|
+
let dir = getDirectoryPath(fileName);
|
|
135684
|
+
return forEachAncestorDirectory(getDirectoryPath(path), (dirPath) => {
|
|
135685
|
+
const symlinks = realpathsWithSymlinks.get(ensureTrailingDirectorySeparator(dirPath));
|
|
135686
|
+
if (symlinks) {
|
|
135687
|
+
return symlinks.some((s) => excludePatterns.some((p) => p.test(fileName.replace(dir, s))));
|
|
135688
|
+
}
|
|
135689
|
+
dir = getDirectoryPath(dir);
|
|
135690
|
+
}) ?? false;
|
|
135691
|
+
}
|
|
135692
|
+
return false;
|
|
135693
|
+
});
|
|
135640
135694
|
for (const ambient of checker.getAmbientModules()) {
|
|
135641
|
-
if (!ambient.name.includes("*") && !(excludePatterns && ((
|
|
135695
|
+
if (!ambient.name.includes("*") && !(excludePatterns && ((_b = ambient.declarations) == null ? void 0 : _b.every((d) => isExcluded(d.getSourceFile()))))) {
|
|
135642
135696
|
cb(
|
|
135643
135697
|
ambient,
|
|
135644
135698
|
/*sourceFile*/
|
|
@@ -135647,7 +135701,7 @@ function forEachExternalModule(checker, allSourceFiles, excludePatterns, cb) {
|
|
|
135647
135701
|
}
|
|
135648
135702
|
}
|
|
135649
135703
|
for (const sourceFile of allSourceFiles) {
|
|
135650
|
-
if (isExternalOrCommonJsModule(sourceFile) && !(isExcluded == null ? void 0 : isExcluded(sourceFile
|
|
135704
|
+
if (isExternalOrCommonJsModule(sourceFile) && !(isExcluded == null ? void 0 : isExcluded(sourceFile))) {
|
|
135651
135705
|
cb(checker.getMergedSymbol(sourceFile.symbol), sourceFile);
|
|
135652
135706
|
}
|
|
135653
135707
|
}
|