@typescript-deploys/pr-build 5.3.0-pr-52972-6 → 5.3.0-pr-55820-7
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 +4 -0
- package/lib/lib.webworker.d.ts +2 -0
- package/lib/tsc.js +178 -166
- package/lib/tsserver.js +249 -230
- package/lib/typescript.js +249 -225
- package/lib/typingsInstaller.js +10 -6
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -994,8 +994,6 @@ __export(server_exports, {
|
|
|
994
994
|
getResolvePackageJsonExports: () => getResolvePackageJsonExports,
|
|
995
995
|
getResolvePackageJsonImports: () => getResolvePackageJsonImports,
|
|
996
996
|
getResolvedExternalModuleName: () => getResolvedExternalModuleName,
|
|
997
|
-
getResolvedModule: () => getResolvedModule,
|
|
998
|
-
getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
|
|
999
997
|
getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
|
|
1000
998
|
getRestParameterElementType: () => getRestParameterElementType,
|
|
1001
999
|
getRightMostAssignedExpression: () => getRightMostAssignedExpression,
|
|
@@ -2093,8 +2091,6 @@ __export(server_exports, {
|
|
|
2093
2091
|
setParent: () => setParent,
|
|
2094
2092
|
setParentRecursive: () => setParentRecursive,
|
|
2095
2093
|
setPrivateIdentifier: () => setPrivateIdentifier,
|
|
2096
|
-
setResolvedModule: () => setResolvedModule,
|
|
2097
|
-
setResolvedTypeReferenceDirective: () => setResolvedTypeReferenceDirective,
|
|
2098
2094
|
setSnippetElement: () => setSnippetElement,
|
|
2099
2095
|
setSourceMapRange: () => setSourceMapRange,
|
|
2100
2096
|
setStackTraceLimit: () => setStackTraceLimit,
|
|
@@ -2321,14 +2317,13 @@ __export(server_exports, {
|
|
|
2321
2317
|
writeCommentRange: () => writeCommentRange,
|
|
2322
2318
|
writeFile: () => writeFile,
|
|
2323
2319
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
2324
|
-
zipToModeAwareCache: () => zipToModeAwareCache,
|
|
2325
2320
|
zipWith: () => zipWith
|
|
2326
2321
|
});
|
|
2327
2322
|
module.exports = __toCommonJS(server_exports);
|
|
2328
2323
|
|
|
2329
2324
|
// src/compiler/corePublic.ts
|
|
2330
2325
|
var versionMajorMinor = "5.3";
|
|
2331
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2326
|
+
var version = `${versionMajorMinor}.0-insiders.20230921`;
|
|
2332
2327
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2333
2328
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2334
2329
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -11209,7 +11204,7 @@ var Diagnostics = {
|
|
|
11209
11204
|
Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
|
|
11210
11205
|
Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
|
|
11211
11206
|
Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
|
|
11212
|
-
|
|
11207
|
+
Can_only_convert_string_concatenations_and_string_literals: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenations_and_string_literals_95154", "Can only convert string concatenations and string literals"),
|
|
11213
11208
|
Selection_is_not_a_valid_statement_or_statements: diag(95155, 3 /* Message */, "Selection_is_not_a_valid_statement_or_statements_95155", "Selection is not a valid statement or statements"),
|
|
11214
11209
|
Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
|
|
11215
11210
|
Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
|
|
@@ -15143,26 +15138,6 @@ function usingSingleLineStringWriter(action) {
|
|
|
15143
15138
|
function getFullWidth(node) {
|
|
15144
15139
|
return node.end - node.pos;
|
|
15145
15140
|
}
|
|
15146
|
-
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
15147
|
-
var _a, _b;
|
|
15148
|
-
return (_b = (_a = sourceFile == null ? void 0 : sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleNameText, mode)) == null ? void 0 : _b.resolvedModule;
|
|
15149
|
-
}
|
|
15150
|
-
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
15151
|
-
if (!sourceFile.resolvedModules) {
|
|
15152
|
-
sourceFile.resolvedModules = createModeAwareCache();
|
|
15153
|
-
}
|
|
15154
|
-
sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
|
|
15155
|
-
}
|
|
15156
|
-
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective, mode) {
|
|
15157
|
-
if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
15158
|
-
sourceFile.resolvedTypeReferenceDirectiveNames = createModeAwareCache();
|
|
15159
|
-
}
|
|
15160
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
|
|
15161
|
-
}
|
|
15162
|
-
function getResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, mode) {
|
|
15163
|
-
var _a, _b;
|
|
15164
|
-
return (_b = (_a = sourceFile == null ? void 0 : sourceFile.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(typeReferenceDirectiveName, mode)) == null ? void 0 : _b.resolvedTypeReferenceDirective;
|
|
15165
|
-
}
|
|
15166
15141
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
15167
15142
|
return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
|
|
15168
15143
|
}
|
|
@@ -15170,8 +15145,8 @@ function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
|
15170
15145
|
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.node10Result === newResolution.node10Result;
|
|
15171
15146
|
}
|
|
15172
15147
|
function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
|
|
15173
|
-
var _a, _b;
|
|
15174
|
-
const node10Result = (_b = (_a =
|
|
15148
|
+
var _a, _b, _c;
|
|
15149
|
+
const node10Result = (_c = (_b = (_a = host.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(moduleReference, mode)) == null ? void 0 : _c.node10Result;
|
|
15175
15150
|
const result = node10Result ? chainDiagnosticMessages(
|
|
15176
15151
|
/*details*/
|
|
15177
15152
|
void 0,
|
|
@@ -20619,14 +20594,11 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
|
|
|
20619
20594
|
(symlinkedDirectories || (symlinkedDirectories = /* @__PURE__ */ new Map())).set(symlinkPath, real);
|
|
20620
20595
|
}
|
|
20621
20596
|
},
|
|
20622
|
-
setSymlinksFromResolutions(
|
|
20623
|
-
var _a, _b;
|
|
20597
|
+
setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, typeReferenceDirectives) {
|
|
20624
20598
|
Debug.assert(!hasProcessedResolutions);
|
|
20625
20599
|
hasProcessedResolutions = true;
|
|
20626
|
-
|
|
20627
|
-
|
|
20628
|
-
(_b = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _b.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
20629
|
-
}
|
|
20600
|
+
resolvedModules == null ? void 0 : resolvedModules.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedModule)));
|
|
20601
|
+
resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective)));
|
|
20630
20602
|
typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
20631
20603
|
},
|
|
20632
20604
|
hasProcessedResolutions: () => hasProcessedResolutions
|
|
@@ -25666,7 +25638,6 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
25666
25638
|
node.imports = void 0;
|
|
25667
25639
|
node.moduleAugmentations = void 0;
|
|
25668
25640
|
node.ambientModuleNames = void 0;
|
|
25669
|
-
node.resolvedModules = void 0;
|
|
25670
25641
|
node.classifiableNames = void 0;
|
|
25671
25642
|
node.impliedNodeFormat = void 0;
|
|
25672
25643
|
return node;
|
|
@@ -38485,6 +38456,7 @@ var moduleOptionDeclaration = {
|
|
|
38485
38456
|
node16: 100 /* Node16 */,
|
|
38486
38457
|
nodenext: 199 /* NodeNext */
|
|
38487
38458
|
})),
|
|
38459
|
+
affectsSourceFile: true,
|
|
38488
38460
|
affectsModuleResolution: true,
|
|
38489
38461
|
affectsEmit: true,
|
|
38490
38462
|
affectsBuildInfo: true,
|
|
@@ -38921,6 +38893,7 @@ var commandOptionsWithoutBuild = [
|
|
|
38921
38893
|
bundler: 100 /* Bundler */
|
|
38922
38894
|
})),
|
|
38923
38895
|
deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
|
|
38896
|
+
affectsSourceFile: true,
|
|
38924
38897
|
affectsModuleResolution: true,
|
|
38925
38898
|
paramType: Diagnostics.STRATEGY,
|
|
38926
38899
|
category: Diagnostics.Modules,
|
|
@@ -39463,6 +39436,7 @@ var commandOptionsWithoutBuild = [
|
|
|
39463
39436
|
legacy: 1 /* Legacy */,
|
|
39464
39437
|
force: 3 /* Force */
|
|
39465
39438
|
})),
|
|
39439
|
+
affectsSourceFile: true,
|
|
39466
39440
|
affectsModuleResolution: true,
|
|
39467
39441
|
description: Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
39468
39442
|
category: Diagnostics.Language_and_Environment,
|
|
@@ -39482,7 +39456,7 @@ var semanticDiagnosticsOptionDeclarations = optionDeclarations.filter((option) =
|
|
|
39482
39456
|
var affectsEmitOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsEmit);
|
|
39483
39457
|
var affectsDeclarationPathOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsDeclarationPath);
|
|
39484
39458
|
var moduleResolutionOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsModuleResolution);
|
|
39485
|
-
var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.
|
|
39459
|
+
var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsBindDiagnostics);
|
|
39486
39460
|
var optionsAffectingProgramStructure = optionDeclarations.filter((option) => !!option.affectsProgramStructure);
|
|
39487
39461
|
var transpileOptionValueCompilerOptions = optionDeclarations.filter((option) => hasProperty(option, "transpileOptionValue"));
|
|
39488
39462
|
var optionsForBuild = [
|
|
@@ -41957,15 +41931,6 @@ function createModeAwareCache() {
|
|
|
41957
41931
|
return result;
|
|
41958
41932
|
}
|
|
41959
41933
|
}
|
|
41960
|
-
function zipToModeAwareCache(file, keys, values, nameAndModeGetter) {
|
|
41961
|
-
Debug.assert(keys.length === values.length);
|
|
41962
|
-
const map2 = createModeAwareCache();
|
|
41963
|
-
for (let i = 0; i < keys.length; ++i) {
|
|
41964
|
-
const entry = keys[i];
|
|
41965
|
-
map2.set(nameAndModeGetter.getName(entry), nameAndModeGetter.getMode(entry, file), values[i]);
|
|
41966
|
-
}
|
|
41967
|
-
return map2;
|
|
41968
|
-
}
|
|
41969
41934
|
function getOriginalOrResolvedModuleFileName(result) {
|
|
41970
41935
|
return result.resolvedModule && (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
41971
41936
|
}
|
|
@@ -42806,7 +42771,9 @@ function loadEntrypointsFromExportMap(scope, exports, state, extensions) {
|
|
|
42806
42771
|
extensionsToExtensionsArray(extensions),
|
|
42807
42772
|
/*excludes*/
|
|
42808
42773
|
void 0,
|
|
42809
|
-
[
|
|
42774
|
+
[
|
|
42775
|
+
isDeclarationFileName(target) ? target.replace("*", "**/*") : changeAnyExtension(target.replace("*", "**/*"), getDeclarationEmitExtensionForPath(target))
|
|
42776
|
+
]
|
|
42810
42777
|
).forEach((entry) => {
|
|
42811
42778
|
entrypoints = appendIfUnique(entrypoints, {
|
|
42812
42779
|
path: entry,
|
|
@@ -51013,7 +50980,7 @@ function createTypeChecker(host) {
|
|
|
51013
50980
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
51014
50981
|
}
|
|
51015
50982
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
51016
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
50983
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
51017
50984
|
if (startsWith(moduleReference, "@types/")) {
|
|
51018
50985
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
51019
50986
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -51031,7 +50998,7 @@ function createTypeChecker(host) {
|
|
|
51031
50998
|
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
|
|
51032
50999
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
51033
51000
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
51034
|
-
const resolvedModule =
|
|
51001
|
+
const resolvedModule = (_i = (_h = (_g = host.resolvedModules) == null ? void 0 : _g.get(currentSourceFile.path)) == null ? void 0 : _h.get(moduleReference, mode)) == null ? void 0 : _i.resolvedModule;
|
|
51035
51002
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
51036
51003
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
51037
51004
|
if (sourceFile) {
|
|
@@ -51039,7 +51006,7 @@ function createTypeChecker(host) {
|
|
|
51039
51006
|
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
51040
51007
|
}
|
|
51041
51008
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
51042
|
-
const importOrExport = ((
|
|
51009
|
+
const importOrExport = ((_j = findAncestor(location, isImportDeclaration)) == null ? void 0 : _j.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
51043
51010
|
if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
51044
51011
|
error2(
|
|
51045
51012
|
errorNode,
|
|
@@ -51048,7 +51015,7 @@ function createTypeChecker(host) {
|
|
|
51048
51015
|
);
|
|
51049
51016
|
}
|
|
51050
51017
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
51051
|
-
const importOrExport = ((
|
|
51018
|
+
const importOrExport = ((_k = findAncestor(location, isImportDeclaration)) == null ? void 0 : _k.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
51052
51019
|
if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
51053
51020
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
51054
51021
|
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
@@ -51069,7 +51036,7 @@ function createTypeChecker(host) {
|
|
|
51069
51036
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
51070
51037
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
51071
51038
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
51072
|
-
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (
|
|
51039
|
+
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_l = overrideClauseHost.assertions) == null ? void 0 : _l.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
51073
51040
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
51074
51041
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
51075
51042
|
error2(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
|
|
@@ -51176,7 +51143,7 @@ function createTypeChecker(host) {
|
|
|
51176
51143
|
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
51177
51144
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
51178
51145
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
51179
|
-
const suggestedExt = (
|
|
51146
|
+
const suggestedExt = (_m = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _m[1];
|
|
51180
51147
|
if (suggestedExt) {
|
|
51181
51148
|
error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
51182
51149
|
} else {
|
|
@@ -52475,7 +52442,7 @@ function createTypeChecker(host) {
|
|
|
52475
52442
|
}
|
|
52476
52443
|
return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode));
|
|
52477
52444
|
}
|
|
52478
|
-
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */
|
|
52445
|
+
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */) {
|
|
52479
52446
|
const name2 = typeParameterToName(type, context);
|
|
52480
52447
|
context.approximateLength += idText(name2).length;
|
|
52481
52448
|
return factory.createTypeReferenceNode(
|
|
@@ -53241,36 +53208,65 @@ function createTypeChecker(host) {
|
|
|
53241
53208
|
true
|
|
53242
53209
|
)[0];
|
|
53243
53210
|
let cleanup;
|
|
53244
|
-
if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
|
|
53245
|
-
|
|
53246
|
-
|
|
53247
|
-
|
|
53248
|
-
|
|
53249
|
-
|
|
53250
|
-
if (
|
|
53251
|
-
|
|
53252
|
-
|
|
53253
|
-
|
|
53254
|
-
|
|
53255
|
-
|
|
53256
|
-
|
|
53211
|
+
if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && (some(expandedParams) || some(signature.typeParameters))) {
|
|
53212
|
+
let pushFakeScope2 = function(kind2, addAll) {
|
|
53213
|
+
Debug.assert(context.enclosingDeclaration);
|
|
53214
|
+
let existingFakeScope;
|
|
53215
|
+
if (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration === kind2) {
|
|
53216
|
+
existingFakeScope = context.enclosingDeclaration;
|
|
53217
|
+
} else if (context.enclosingDeclaration.parent && getNodeLinks(context.enclosingDeclaration.parent).fakeScopeForSignatureDeclaration === kind2) {
|
|
53218
|
+
existingFakeScope = context.enclosingDeclaration.parent;
|
|
53219
|
+
}
|
|
53220
|
+
Debug.assertOptionalNode(existingFakeScope, isBlock);
|
|
53221
|
+
const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
|
|
53222
|
+
let newLocals;
|
|
53223
|
+
addAll((name, symbol) => {
|
|
53224
|
+
if (!locals.has(name)) {
|
|
53225
|
+
newLocals = append(newLocals, name);
|
|
53226
|
+
locals.set(name, symbol);
|
|
53227
|
+
}
|
|
53228
|
+
});
|
|
53229
|
+
if (!newLocals)
|
|
53230
|
+
return;
|
|
53231
|
+
const oldCleanup = cleanup;
|
|
53232
|
+
function undo() {
|
|
53257
53233
|
forEach(newLocals, (s) => locals.delete(s));
|
|
53258
|
-
|
|
53259
|
-
|
|
53234
|
+
oldCleanup == null ? void 0 : oldCleanup();
|
|
53235
|
+
}
|
|
53260
53236
|
if (existingFakeScope) {
|
|
53261
|
-
cleanup =
|
|
53237
|
+
cleanup = undo;
|
|
53262
53238
|
} else {
|
|
53263
53239
|
const fakeScope = parseNodeFactory.createBlock(emptyArray);
|
|
53264
|
-
getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration =
|
|
53240
|
+
getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = kind2;
|
|
53265
53241
|
fakeScope.locals = locals;
|
|
53266
53242
|
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
53267
53243
|
setParent(fakeScope, saveEnclosingDeclaration);
|
|
53268
53244
|
context.enclosingDeclaration = fakeScope;
|
|
53269
53245
|
cleanup = () => {
|
|
53270
53246
|
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
53271
|
-
|
|
53247
|
+
undo();
|
|
53272
53248
|
};
|
|
53273
53249
|
}
|
|
53250
|
+
};
|
|
53251
|
+
var pushFakeScope = pushFakeScope2;
|
|
53252
|
+
pushFakeScope2(
|
|
53253
|
+
"params",
|
|
53254
|
+
(add) => {
|
|
53255
|
+
for (const param of expandedParams) {
|
|
53256
|
+
add(param.escapedName, param);
|
|
53257
|
+
}
|
|
53258
|
+
}
|
|
53259
|
+
);
|
|
53260
|
+
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
53261
|
+
pushFakeScope2(
|
|
53262
|
+
"typeParams",
|
|
53263
|
+
(add) => {
|
|
53264
|
+
for (const typeParam of signature.typeParameters ?? emptyArray) {
|
|
53265
|
+
const typeParamName = typeParameterToName(typeParam, context).escapedText;
|
|
53266
|
+
add(typeParamName, typeParam.symbol);
|
|
53267
|
+
}
|
|
53268
|
+
}
|
|
53269
|
+
);
|
|
53274
53270
|
}
|
|
53275
53271
|
}
|
|
53276
53272
|
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
|
|
@@ -53814,7 +53810,7 @@ function createTypeChecker(host) {
|
|
|
53814
53810
|
return identifier;
|
|
53815
53811
|
}
|
|
53816
53812
|
}
|
|
53817
|
-
function
|
|
53813
|
+
function typeParameterShadowsOtherTypeParameterInScope(escapedName, context, type) {
|
|
53818
53814
|
const result = resolveName(
|
|
53819
53815
|
context.enclosingDeclaration,
|
|
53820
53816
|
escapedName,
|
|
@@ -53825,11 +53821,8 @@ function createTypeChecker(host) {
|
|
|
53825
53821
|
/*isUse*/
|
|
53826
53822
|
false
|
|
53827
53823
|
);
|
|
53828
|
-
if (result) {
|
|
53829
|
-
|
|
53830
|
-
return false;
|
|
53831
|
-
}
|
|
53832
|
-
return true;
|
|
53824
|
+
if (result && result.flags & 262144 /* TypeParameter */) {
|
|
53825
|
+
return result !== type.symbol;
|
|
53833
53826
|
}
|
|
53834
53827
|
return false;
|
|
53835
53828
|
}
|
|
@@ -53855,7 +53848,7 @@ function createTypeChecker(host) {
|
|
|
53855
53848
|
const rawtext = result.escapedText;
|
|
53856
53849
|
let i = ((_a = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _a.get(rawtext)) || 0;
|
|
53857
53850
|
let text = rawtext;
|
|
53858
|
-
while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) ||
|
|
53851
|
+
while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
|
|
53859
53852
|
i++;
|
|
53860
53853
|
text = `${rawtext}_${i}`;
|
|
53861
53854
|
}
|
|
@@ -53866,7 +53859,7 @@ function createTypeChecker(host) {
|
|
|
53866
53859
|
}
|
|
53867
53860
|
(context.typeParameterNamesByTextNextNameCount || (context.typeParameterNamesByTextNextNameCount = /* @__PURE__ */ new Map())).set(rawtext, i);
|
|
53868
53861
|
(context.typeParameterNames || (context.typeParameterNames = /* @__PURE__ */ new Map())).set(getTypeId(type), result);
|
|
53869
|
-
(context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(
|
|
53862
|
+
(context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(text);
|
|
53870
53863
|
}
|
|
53871
53864
|
return result;
|
|
53872
53865
|
}
|
|
@@ -54011,7 +54004,10 @@ function createTypeChecker(host) {
|
|
|
54011
54004
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
54012
54005
|
}
|
|
54013
54006
|
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
54014
|
-
|
|
54007
|
+
while (getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration) {
|
|
54008
|
+
enclosingDeclaration = enclosingDeclaration.parent;
|
|
54009
|
+
}
|
|
54010
|
+
return enclosingDeclaration;
|
|
54015
54011
|
}
|
|
54016
54012
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
54017
54013
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
@@ -54091,7 +54087,7 @@ function createTypeChecker(host) {
|
|
|
54091
54087
|
}
|
|
54092
54088
|
if (isIdentifier(node)) {
|
|
54093
54089
|
const type = getDeclaredTypeOfSymbol(sym);
|
|
54094
|
-
const name = sym.flags & 262144 /* TypeParameter */
|
|
54090
|
+
const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node);
|
|
54095
54091
|
name.symbol = sym;
|
|
54096
54092
|
return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
|
|
54097
54093
|
}
|
|
@@ -57934,7 +57930,28 @@ function createTypeChecker(host) {
|
|
|
57934
57930
|
}
|
|
57935
57931
|
}
|
|
57936
57932
|
}
|
|
57937
|
-
|
|
57933
|
+
let resolved = combineSymbolTables(earlySymbols, lateSymbols);
|
|
57934
|
+
if (symbol.flags & 33554432 /* Transient */ && links.cjsExportMerged && symbol.declarations) {
|
|
57935
|
+
for (const decl of symbol.declarations) {
|
|
57936
|
+
const original = getSymbolLinks(decl.symbol)[resolutionKind];
|
|
57937
|
+
if (!resolved) {
|
|
57938
|
+
resolved = original;
|
|
57939
|
+
continue;
|
|
57940
|
+
}
|
|
57941
|
+
if (!original)
|
|
57942
|
+
continue;
|
|
57943
|
+
original.forEach((s, name) => {
|
|
57944
|
+
const existing = resolved.get(name);
|
|
57945
|
+
if (!existing)
|
|
57946
|
+
resolved.set(name, s);
|
|
57947
|
+
else if (existing === s)
|
|
57948
|
+
return;
|
|
57949
|
+
else
|
|
57950
|
+
resolved.set(name, mergeSymbol(existing, s));
|
|
57951
|
+
});
|
|
57952
|
+
}
|
|
57953
|
+
}
|
|
57954
|
+
links[resolutionKind] = resolved || emptySymbols;
|
|
57938
57955
|
}
|
|
57939
57956
|
return links[resolutionKind];
|
|
57940
57957
|
}
|
|
@@ -68760,13 +68777,10 @@ function createTypeChecker(host) {
|
|
|
68760
68777
|
if (sourceNameType && targetNameType)
|
|
68761
68778
|
inferFromTypes(sourceNameType, targetNameType);
|
|
68762
68779
|
}
|
|
68763
|
-
if (getObjectFlags(target) & 32 /* Mapped */) {
|
|
68764
|
-
const
|
|
68765
|
-
if (
|
|
68766
|
-
|
|
68767
|
-
if (inferToMappedType(source, mappedType, constraintType)) {
|
|
68768
|
-
return;
|
|
68769
|
-
}
|
|
68780
|
+
if (getObjectFlags(target) & 32 /* Mapped */ && !target.declaration.nameType) {
|
|
68781
|
+
const constraintType = getConstraintTypeFromMappedType(target);
|
|
68782
|
+
if (inferToMappedType(source, target, constraintType)) {
|
|
68783
|
+
return;
|
|
68770
68784
|
}
|
|
68771
68785
|
}
|
|
68772
68786
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
@@ -120330,15 +120344,15 @@ function isReferencedFile(reason) {
|
|
|
120330
120344
|
function isReferenceFileLocation(location) {
|
|
120331
120345
|
return location.pos !== void 0;
|
|
120332
120346
|
}
|
|
120333
|
-
function getReferencedFileLocation(
|
|
120334
|
-
var _a, _b, _c, _d, _e, _f;
|
|
120335
|
-
const file = Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
120347
|
+
function getReferencedFileLocation(program, ref) {
|
|
120348
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
120349
|
+
const file = Debug.checkDefined(program.getSourceFileByPath(ref.file));
|
|
120336
120350
|
const { kind, index } = ref;
|
|
120337
120351
|
let pos, end, packageId, resolutionMode;
|
|
120338
120352
|
switch (kind) {
|
|
120339
120353
|
case 3 /* Import */:
|
|
120340
120354
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
120341
|
-
packageId = (_c = (_b = (_a =
|
|
120355
|
+
packageId = (_d = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(file.path)) == null ? void 0 : _b.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.packageId;
|
|
120342
120356
|
if (importLiteral.pos === -1)
|
|
120343
120357
|
return { file, packageId, text: importLiteral.text };
|
|
120344
120358
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -120349,7 +120363,7 @@ function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
|
120349
120363
|
break;
|
|
120350
120364
|
case 5 /* TypeReferenceDirective */:
|
|
120351
120365
|
({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
|
|
120352
|
-
packageId = (
|
|
120366
|
+
packageId = (_h = (_g = (_f = (_e = program.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _e.get(file.path)) == null ? void 0 : _f.get(toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) == null ? void 0 : _g.resolvedTypeReferenceDirective) == null ? void 0 : _h.packageId;
|
|
120353
120367
|
break;
|
|
120354
120368
|
case 7 /* LibReferenceDirective */:
|
|
120355
120369
|
({ pos, end } = file.libReferenceDirectives[index]);
|
|
@@ -120567,6 +120581,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120567
120581
|
let automaticTypeDirectiveResolutions;
|
|
120568
120582
|
let resolvedLibReferences;
|
|
120569
120583
|
let resolvedLibProcessing;
|
|
120584
|
+
let resolvedModules;
|
|
120585
|
+
let resolvedModulesProcessing;
|
|
120586
|
+
let resolvedTypeReferenceDirectiveNames;
|
|
120587
|
+
let resolvedTypeReferenceDirectiveNamesProcessing;
|
|
120570
120588
|
let packageMap;
|
|
120571
120589
|
const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
120572
120590
|
let currentNodeModulesDepth = 0;
|
|
@@ -120831,6 +120849,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120831
120849
|
}
|
|
120832
120850
|
oldProgram = void 0;
|
|
120833
120851
|
resolvedLibProcessing = void 0;
|
|
120852
|
+
resolvedModulesProcessing = void 0;
|
|
120853
|
+
resolvedTypeReferenceDirectiveNamesProcessing = void 0;
|
|
120834
120854
|
const program = {
|
|
120835
120855
|
getRootFileNames: () => rootNames,
|
|
120836
120856
|
getSourceFile,
|
|
@@ -120872,6 +120892,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120872
120892
|
sourceFileToPackageName,
|
|
120873
120893
|
redirectTargetsMap,
|
|
120874
120894
|
usesUriStyleNodeCoreModules,
|
|
120895
|
+
resolvedModules,
|
|
120896
|
+
resolvedTypeReferenceDirectiveNames,
|
|
120875
120897
|
resolvedLibReferences,
|
|
120876
120898
|
getCurrentPackagesMap: () => packageMap,
|
|
120877
120899
|
typesPackageExists,
|
|
@@ -120903,7 +120925,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120903
120925
|
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
|
120904
120926
|
return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray));
|
|
120905
120927
|
case 0 /* FilePreprocessingReferencedDiagnostic */:
|
|
120906
|
-
const { file, pos, end } = getReferencedFileLocation(
|
|
120928
|
+
const { file, pos, end } = getReferencedFileLocation(program, diagnostic.reason);
|
|
120907
120929
|
return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
|
|
120908
120930
|
case 2 /* ResolutionDiagnostics */:
|
|
120909
120931
|
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
|
@@ -120920,14 +120942,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120920
120942
|
if (packageMap)
|
|
120921
120943
|
return packageMap;
|
|
120922
120944
|
packageMap = /* @__PURE__ */ new Map();
|
|
120923
|
-
files.forEach(
|
|
120924
|
-
|
|
120925
|
-
|
|
120926
|
-
|
|
120927
|
-
|
|
120928
|
-
|
|
120929
|
-
|
|
120930
|
-
|
|
120945
|
+
files.forEach(
|
|
120946
|
+
(sf) => {
|
|
120947
|
+
var _a2;
|
|
120948
|
+
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(sf.path)) == null ? void 0 : _a2.forEach(({ resolvedModule }) => {
|
|
120949
|
+
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
120950
|
+
packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
|
|
120951
|
+
});
|
|
120952
|
+
}
|
|
120953
|
+
);
|
|
120931
120954
|
return packageMap;
|
|
120932
120955
|
}
|
|
120933
120956
|
function typesPackageExists(packageName) {
|
|
@@ -121059,7 +121082,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121059
121082
|
return classifiableNames;
|
|
121060
121083
|
}
|
|
121061
121084
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
121062
|
-
var _a2;
|
|
121085
|
+
var _a2, _b2;
|
|
121063
121086
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
121064
121087
|
return resolveModuleNamesWorker(
|
|
121065
121088
|
moduleNames,
|
|
@@ -121068,24 +121091,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121068
121091
|
void 0
|
|
121069
121092
|
);
|
|
121070
121093
|
}
|
|
121071
|
-
const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
121072
|
-
if (oldSourceFile !== file && file.resolvedModules) {
|
|
121073
|
-
const result2 = [];
|
|
121074
|
-
for (const moduleName of moduleNames) {
|
|
121075
|
-
const resolvedModule = file.resolvedModules.get(moduleName.text, getModeForUsageLocation(file, moduleName));
|
|
121076
|
-
result2.push(resolvedModule);
|
|
121077
|
-
}
|
|
121078
|
-
return result2;
|
|
121079
|
-
}
|
|
121080
121094
|
let unknownModuleNames;
|
|
121081
121095
|
let result;
|
|
121082
121096
|
let reusedNames;
|
|
121083
121097
|
const predictedToResolveToAmbientModuleMarker = emptyResolution;
|
|
121098
|
+
const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
121084
121099
|
for (let i = 0; i < moduleNames.length; i++) {
|
|
121085
121100
|
const moduleName = moduleNames[i];
|
|
121086
|
-
if (file === oldSourceFile && !hasInvalidatedResolutions(
|
|
121101
|
+
if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
|
|
121087
121102
|
const mode = getModeForUsageLocation(file, moduleName);
|
|
121088
|
-
const oldResolution = (_a2 =
|
|
121103
|
+
const oldResolution = (_b2 = (_a2 = oldProgram == null ? void 0 : oldProgram.resolvedModules) == null ? void 0 : _a2.get(file.path)) == null ? void 0 : _b2.get(moduleName.text, mode);
|
|
121089
121104
|
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
121090
121105
|
if (isTraceEnabled(options, host)) {
|
|
121091
121106
|
trace(
|
|
@@ -121132,7 +121147,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121132
121147
|
Debug.assert(j === resolutions.length);
|
|
121133
121148
|
return result;
|
|
121134
121149
|
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
121135
|
-
|
|
121150
|
+
var _a3, _b3, _c2;
|
|
121151
|
+
const resolutionToFile = (_c2 = (_b3 = (_a3 = oldProgram == null ? void 0 : oldProgram.resolvedModules) == null ? void 0 : _a3.get(file.path)) == null ? void 0 : _b3.get(moduleName.text, getModeForUsageLocation(file, moduleName))) == null ? void 0 : _c2.resolvedModule;
|
|
121136
121152
|
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
121137
121153
|
if (resolutionToFile && resolvedFile) {
|
|
121138
121154
|
return false;
|
|
@@ -121148,7 +121164,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121148
121164
|
}
|
|
121149
121165
|
}
|
|
121150
121166
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
121151
|
-
var _a2;
|
|
121167
|
+
var _a2, _b2;
|
|
121152
121168
|
if (structureIsReused === 0 /* Not */) {
|
|
121153
121169
|
return resolveTypeReferenceDirectiveNamesWorker(
|
|
121154
121170
|
typeDirectiveNames,
|
|
@@ -121157,28 +121173,18 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121157
121173
|
void 0
|
|
121158
121174
|
);
|
|
121159
121175
|
}
|
|
121160
|
-
const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
|
|
121161
|
-
if (!isString(containingFile)) {
|
|
121162
|
-
if (oldSourceFile !== containingFile && containingFile.resolvedTypeReferenceDirectiveNames) {
|
|
121163
|
-
const result2 = [];
|
|
121164
|
-
for (const typeDirectiveName of typeDirectiveNames) {
|
|
121165
|
-
const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getTypeReferenceResolutionName(typeDirectiveName), getModeForFileReference(typeDirectiveName, containingFile.impliedNodeFormat));
|
|
121166
|
-
result2.push(resolvedTypeReferenceDirective);
|
|
121167
|
-
}
|
|
121168
|
-
return result2;
|
|
121169
|
-
}
|
|
121170
|
-
}
|
|
121171
121176
|
let unknownTypeReferenceDirectiveNames;
|
|
121172
121177
|
let result;
|
|
121173
121178
|
let reusedNames;
|
|
121174
121179
|
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
121175
|
-
const
|
|
121180
|
+
const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
|
|
121181
|
+
const canReuseResolutions = !isString(containingFile) ? containingFile === oldSourceFile && !hasInvalidatedResolutions(containingFile.path) : !hasInvalidatedResolutions(toPath3(containingFile));
|
|
121176
121182
|
for (let i = 0; i < typeDirectiveNames.length; i++) {
|
|
121177
121183
|
const entry = typeDirectiveNames[i];
|
|
121178
121184
|
if (canReuseResolutions) {
|
|
121179
121185
|
const typeDirectiveName = getTypeReferenceResolutionName(entry);
|
|
121180
121186
|
const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
121181
|
-
const oldResolution = (
|
|
121187
|
+
const oldResolution = (_b2 = !isString(containingFile) ? (_a2 = oldProgram == null ? void 0 : oldProgram.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a2.get(containingFile.path) : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _b2.get(typeDirectiveName, mode);
|
|
121182
121188
|
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
121183
121189
|
if (isTraceEnabled(options, host)) {
|
|
121184
121190
|
trace(
|
|
@@ -121238,7 +121244,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121238
121244
|
);
|
|
121239
121245
|
}
|
|
121240
121246
|
function tryReuseStructureFromOldProgram() {
|
|
121241
|
-
var _a2;
|
|
121247
|
+
var _a2, _b2, _c2;
|
|
121242
121248
|
if (!oldProgram) {
|
|
121243
121249
|
return 0 /* Not */;
|
|
121244
121250
|
}
|
|
@@ -121340,42 +121346,37 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121340
121346
|
structureIsReused = 1 /* SafeModules */;
|
|
121341
121347
|
}
|
|
121342
121348
|
}
|
|
121343
|
-
modifiedSourceFiles.push(
|
|
121349
|
+
modifiedSourceFiles.push(newSourceFile);
|
|
121344
121350
|
} else if (hasInvalidatedResolutions(oldSourceFile.path)) {
|
|
121345
121351
|
structureIsReused = 1 /* SafeModules */;
|
|
121346
|
-
modifiedSourceFiles.push(
|
|
121352
|
+
modifiedSourceFiles.push(newSourceFile);
|
|
121353
|
+
} else {
|
|
121354
|
+
for (const moduleName of oldSourceFile.ambientModuleNames) {
|
|
121355
|
+
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldSourceFile.fileName);
|
|
121356
|
+
}
|
|
121347
121357
|
}
|
|
121348
121358
|
newSourceFiles.push(newSourceFile);
|
|
121349
121359
|
}
|
|
121350
121360
|
if (structureIsReused !== 2 /* Completely */) {
|
|
121351
121361
|
return structureIsReused;
|
|
121352
121362
|
}
|
|
121353
|
-
const
|
|
121354
|
-
for (const oldFile of oldSourceFiles) {
|
|
121355
|
-
if (!contains(modifiedFiles, oldFile)) {
|
|
121356
|
-
for (const moduleName of oldFile.ambientModuleNames) {
|
|
121357
|
-
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
121358
|
-
}
|
|
121359
|
-
}
|
|
121360
|
-
}
|
|
121361
|
-
for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
|
|
121363
|
+
for (const newSourceFile of modifiedSourceFiles) {
|
|
121362
121364
|
const moduleNames = getModuleNames(newSourceFile);
|
|
121363
121365
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
121364
|
-
|
|
121365
|
-
|
|
121366
|
+
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
121367
|
+
const oldResolutions = (_b2 = oldProgram.resolvedModules) == null ? void 0 : _b2.get(newSourceFile.path);
|
|
121368
|
+
const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldResolutions, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
|
|
121369
|
+
if (resolutionsChanged)
|
|
121366
121370
|
structureIsReused = 1 /* SafeModules */;
|
|
121367
|
-
newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions, moduleResolutionNameAndModeGetter);
|
|
121368
|
-
} else {
|
|
121369
|
-
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
121370
|
-
}
|
|
121371
121371
|
const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
121372
121372
|
const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
121373
|
-
|
|
121373
|
+
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
|
|
121374
|
+
const oldTypeResolutions = (_c2 = oldProgram.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _c2.get(newSourceFile.path);
|
|
121375
|
+
const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldTypeResolutions, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
|
|
121374
121376
|
if (typeReferenceResolutionsChanged) {
|
|
121375
121377
|
structureIsReused = 1 /* SafeModules */;
|
|
121376
|
-
|
|
121377
|
-
|
|
121378
|
-
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
121378
|
+
} else if (oldTypeResolutions) {
|
|
121379
|
+
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, oldTypeResolutions);
|
|
121379
121380
|
}
|
|
121380
121381
|
}
|
|
121381
121382
|
if (structureIsReused !== 2 /* Completely */) {
|
|
@@ -121423,6 +121424,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121423
121424
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
121424
121425
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
121425
121426
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
121427
|
+
resolvedModules = oldProgram.resolvedModules;
|
|
121428
|
+
resolvedTypeReferenceDirectiveNames = oldProgram.resolvedTypeReferenceDirectiveNames;
|
|
121426
121429
|
resolvedLibReferences = oldProgram.resolvedLibReferences;
|
|
121427
121430
|
packageMap = oldProgram.getCurrentPackagesMap();
|
|
121428
121431
|
return 2 /* Completely */;
|
|
@@ -122468,16 +122471,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122468
122471
|
}
|
|
122469
122472
|
function processTypeReferenceDirectives(file) {
|
|
122470
122473
|
const typeDirectives = file.typeReferenceDirectives;
|
|
122471
|
-
if (!typeDirectives.length)
|
|
122472
|
-
file.resolvedTypeReferenceDirectiveNames = void 0;
|
|
122474
|
+
if (!typeDirectives.length)
|
|
122473
122475
|
return;
|
|
122474
|
-
|
|
122475
|
-
const
|
|
122476
|
+
const resolutions = (resolvedTypeReferenceDirectiveNamesProcessing == null ? void 0 : resolvedTypeReferenceDirectiveNamesProcessing.get(file.path)) || resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
|
|
122477
|
+
const resolutionsInFile = createModeAwareCache();
|
|
122478
|
+
(resolvedTypeReferenceDirectiveNames ?? (resolvedTypeReferenceDirectiveNames = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
122476
122479
|
for (let index = 0; index < typeDirectives.length; index++) {
|
|
122477
122480
|
const ref = file.typeReferenceDirectives[index];
|
|
122478
122481
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
122479
122482
|
const fileName = toFileNameLowerCase(ref.fileName);
|
|
122480
|
-
|
|
122483
|
+
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
122481
122484
|
const mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
122482
122485
|
if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
|
|
122483
122486
|
(fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({
|
|
@@ -122641,14 +122644,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122641
122644
|
collectExternalModuleReferences(file);
|
|
122642
122645
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
122643
122646
|
const moduleNames = getModuleNames(file);
|
|
122644
|
-
const resolutions = resolveModuleNamesReusingOldState(moduleNames, file);
|
|
122647
|
+
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
122645
122648
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
122646
122649
|
const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options : void 0) || options;
|
|
122650
|
+
const resolutionsInFile = createModeAwareCache();
|
|
122651
|
+
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
122647
122652
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
122648
122653
|
const resolution = resolutions[index].resolvedModule;
|
|
122649
122654
|
const moduleName = moduleNames[index].text;
|
|
122650
122655
|
const mode = getModeForUsageLocation(file, moduleNames[index]);
|
|
122651
|
-
|
|
122656
|
+
resolutionsInFile.set(moduleName, mode, resolutions[index]);
|
|
122652
122657
|
addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
|
|
122653
122658
|
if (!resolution) {
|
|
122654
122659
|
continue;
|
|
@@ -122679,8 +122684,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122679
122684
|
currentNodeModulesDepth--;
|
|
122680
122685
|
}
|
|
122681
122686
|
}
|
|
122682
|
-
} else {
|
|
122683
|
-
file.resolvedModules = void 0;
|
|
122684
122687
|
}
|
|
122685
122688
|
}
|
|
122686
122689
|
function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {
|
|
@@ -123195,7 +123198,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123195
123198
|
processReason(fileProcessingReason);
|
|
123196
123199
|
if (locationReason && (fileIncludeReasons == null ? void 0 : fileIncludeReasons.length) === 1)
|
|
123197
123200
|
fileIncludeReasons = void 0;
|
|
123198
|
-
const location = locationReason && getReferencedFileLocation(
|
|
123201
|
+
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
|
123199
123202
|
const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
123200
123203
|
const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
|
|
123201
123204
|
const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
|
|
@@ -123231,7 +123234,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123231
123234
|
}
|
|
123232
123235
|
function fileIncludeReasonToRelatedInformation(reason) {
|
|
123233
123236
|
if (isReferencedFile(reason)) {
|
|
123234
|
-
const referenceLocation = getReferencedFileLocation(
|
|
123237
|
+
const referenceLocation = getReferencedFileLocation(program, reason);
|
|
123235
123238
|
let message2;
|
|
123236
123239
|
switch (reason.kind) {
|
|
123237
123240
|
case 3 /* Import */:
|
|
@@ -123520,8 +123523,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123520
123523
|
if (!symlinks) {
|
|
123521
123524
|
symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
123522
123525
|
}
|
|
123523
|
-
if (files &&
|
|
123524
|
-
symlinks.setSymlinksFromResolutions(
|
|
123526
|
+
if (files && !symlinks.hasProcessedResolutions()) {
|
|
123527
|
+
symlinks.setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, automaticTypeDirectiveResolutions);
|
|
123525
123528
|
}
|
|
123526
123529
|
return symlinks;
|
|
123527
123530
|
}
|
|
@@ -123883,6 +123886,7 @@ var BuilderState;
|
|
|
123883
123886
|
return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
|
|
123884
123887
|
}
|
|
123885
123888
|
function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
|
|
123889
|
+
var _a;
|
|
123886
123890
|
let referencedFiles;
|
|
123887
123891
|
if (sourceFile.imports && sourceFile.imports.length > 0) {
|
|
123888
123892
|
const checker = program.getTypeChecker();
|
|
@@ -123898,8 +123902,9 @@ var BuilderState;
|
|
|
123898
123902
|
addReferencedFile(referencedPath);
|
|
123899
123903
|
}
|
|
123900
123904
|
}
|
|
123901
|
-
|
|
123902
|
-
|
|
123905
|
+
const resolvedTypeReferenceDirectiveNames = (_a = program.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(sourceFile.path);
|
|
123906
|
+
if (resolvedTypeReferenceDirectiveNames) {
|
|
123907
|
+
resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
|
|
123903
123908
|
if (!resolvedTypeReferenceDirective) {
|
|
123904
123909
|
return;
|
|
123905
123910
|
}
|
|
@@ -125722,10 +125727,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125722
125727
|
clear: clear2,
|
|
125723
125728
|
onChangesAffectModuleResolution
|
|
125724
125729
|
};
|
|
125725
|
-
function
|
|
125730
|
+
function getResolvedModule(resolution) {
|
|
125726
125731
|
return resolution.resolvedModule;
|
|
125727
125732
|
}
|
|
125728
|
-
function
|
|
125733
|
+
function getResolvedTypeReferenceDirective(resolution) {
|
|
125729
125734
|
return resolution.resolvedTypeReferenceDirective;
|
|
125730
125735
|
}
|
|
125731
125736
|
function clear2() {
|
|
@@ -125801,7 +125806,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125801
125806
|
stopWatchFailedLookupLocationOfResolution(
|
|
125802
125807
|
resolution,
|
|
125803
125808
|
resolutionHost.toPath(getInferredLibraryNameResolveFrom(newProgram.getCompilerOptions(), getCurrentDirectory(), libFileName)),
|
|
125804
|
-
|
|
125809
|
+
getResolvedModule
|
|
125805
125810
|
);
|
|
125806
125811
|
resolvedLibraries.delete(libFileName);
|
|
125807
125812
|
}
|
|
@@ -126007,7 +126012,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126007
126012
|
((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost,
|
|
126008
126013
|
typeReferenceDirectiveResolutionCache
|
|
126009
126014
|
),
|
|
126010
|
-
getResolutionWithResolvedFileName:
|
|
126015
|
+
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
126011
126016
|
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
126012
126017
|
deferWatchingNonRelativeResolution: false
|
|
126013
126018
|
});
|
|
@@ -126026,7 +126031,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126026
126031
|
redirectedReference,
|
|
126027
126032
|
options
|
|
126028
126033
|
),
|
|
126029
|
-
getResolutionWithResolvedFileName:
|
|
126034
|
+
getResolutionWithResolvedFileName: getResolvedModule,
|
|
126030
126035
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
126031
126036
|
logChanges: logChangesWhenResolvingModule,
|
|
126032
126037
|
deferWatchingNonRelativeResolution: true
|
|
@@ -126045,17 +126050,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126045
126050
|
libraryName,
|
|
126046
126051
|
resolution,
|
|
126047
126052
|
path,
|
|
126048
|
-
|
|
126053
|
+
getResolvedModule,
|
|
126049
126054
|
/*deferWatchingNonRelativeResolution*/
|
|
126050
126055
|
false
|
|
126051
126056
|
);
|
|
126052
126057
|
resolvedLibraries.set(libFileName, resolution);
|
|
126053
126058
|
if (existingResolution) {
|
|
126054
|
-
stopWatchFailedLookupLocationOfResolution(existingResolution, path,
|
|
126059
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule);
|
|
126055
126060
|
}
|
|
126056
126061
|
} else {
|
|
126057
126062
|
if (isTraceEnabled(options, host)) {
|
|
126058
|
-
const resolved =
|
|
126063
|
+
const resolved = getResolvedModule(resolution);
|
|
126059
126064
|
trace(
|
|
126060
126065
|
host,
|
|
126061
126066
|
(resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved,
|
|
@@ -126332,8 +126337,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126332
126337
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
126333
126338
|
}
|
|
126334
126339
|
function removeResolutionsOfFile(filePath) {
|
|
126335
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath,
|
|
126336
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath,
|
|
126340
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
|
|
126341
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
126337
126342
|
}
|
|
126338
126343
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
126339
126344
|
if (!resolutions)
|
|
@@ -126759,7 +126764,7 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
|
126759
126764
|
var _a, _b;
|
|
126760
126765
|
const options = program.getCompilerOptions();
|
|
126761
126766
|
if (isReferencedFile(reason)) {
|
|
126762
|
-
const referenceLocation = getReferencedFileLocation(
|
|
126767
|
+
const referenceLocation = getReferencedFileLocation(program, reason);
|
|
126763
126768
|
const referenceText = isReferenceFileLocation(referenceLocation) ? referenceLocation.file.text.substring(referenceLocation.pos, referenceLocation.end) : `"${referenceLocation.text}"`;
|
|
126764
126769
|
let message;
|
|
126765
126770
|
Debug.assert(isReferenceFileLocation(referenceLocation) || reason.kind === 3 /* Import */, "Only synthetic references are imports");
|
|
@@ -135444,14 +135449,14 @@ function combinePathsSafe(pathA, pathB) {
|
|
|
135444
135449
|
return ensurePathIsNonModuleName(combineNormal(pathA, pathB));
|
|
135445
135450
|
}
|
|
135446
135451
|
function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) {
|
|
135447
|
-
var _a;
|
|
135452
|
+
var _a, _b;
|
|
135448
135453
|
if (importedModuleSymbol) {
|
|
135449
135454
|
const oldFileName = find(importedModuleSymbol.declarations, isSourceFile).fileName;
|
|
135450
135455
|
const newFileName = oldToNew(oldFileName);
|
|
135451
135456
|
return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true };
|
|
135452
135457
|
} else {
|
|
135453
135458
|
const mode = getModeForUsageLocation(importingSourceFile, importLiteral);
|
|
135454
|
-
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? (_a =
|
|
135459
|
+
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(importingSourceFile.path)) == null ? void 0 : _b.get(importLiteral.text, mode) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
|
|
135455
135460
|
return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
|
|
135456
135461
|
}
|
|
135457
135462
|
}
|
|
@@ -136346,6 +136351,7 @@ function createSourceFileLike(text, lineMap) {
|
|
|
136346
136351
|
// src/services/suggestionDiagnostics.ts
|
|
136347
136352
|
var visitedNestedConvertibleFunctions = /* @__PURE__ */ new Map();
|
|
136348
136353
|
function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
136354
|
+
var _a, _b, _c;
|
|
136349
136355
|
program.getSemanticDiagnostics(sourceFile, cancellationToken);
|
|
136350
136356
|
const diags = [];
|
|
136351
136357
|
const checker = program.getTypeChecker();
|
|
@@ -136362,7 +136368,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
|
136362
136368
|
const name = importNameForConvertToDefaultImport(importNode);
|
|
136363
136369
|
if (!name)
|
|
136364
136370
|
continue;
|
|
136365
|
-
const module2 =
|
|
136371
|
+
const module2 = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))) == null ? void 0 : _c.resolvedModule;
|
|
136366
136372
|
const resolvedFile = module2 && program.getSourceFile(module2.resolvedFileName);
|
|
136367
136373
|
if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
|
|
136368
136374
|
diags.push(createDiagnosticForNode(name, Diagnostics.Import_may_be_converted_to_a_default_import));
|
|
@@ -138765,10 +138771,10 @@ function getTargetFileImportsAndAddExportInOldFile(oldFile, targetFile, importsT
|
|
|
138765
138771
|
const targetSourceFile = program.getSourceFile(targetFile);
|
|
138766
138772
|
for (const oldStatement of oldFile.statements) {
|
|
138767
138773
|
forEachImportInStatement(oldStatement, (i) => {
|
|
138768
|
-
var _a, _b;
|
|
138774
|
+
var _a, _b, _c;
|
|
138769
138775
|
const moduleSpecifier = moduleSpecifierFromImport(i);
|
|
138770
|
-
const resolved = (_a =
|
|
138771
|
-
const fileName = (
|
|
138776
|
+
const resolved = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(oldFile.path)) == null ? void 0 : _b.get(moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
|
|
138777
|
+
const fileName = (_c = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _c.resolvedFileName;
|
|
138772
138778
|
if (fileName && targetSourceFile) {
|
|
138773
138779
|
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.path, fileName, createModuleSpecifierResolutionHost(program, host));
|
|
138774
138780
|
append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
@@ -140693,12 +140699,16 @@ function getRefactorActionsToConvertToTemplateString(context) {
|
|
|
140693
140699
|
const { file, startPosition } = context;
|
|
140694
140700
|
const node = getNodeOrParentOfParentheses(file, startPosition);
|
|
140695
140701
|
const maybeBinary = getParentBinaryExpression(node);
|
|
140702
|
+
const nodeIsStringLiteral = isStringLiteral(maybeBinary);
|
|
140696
140703
|
const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
|
|
140697
|
-
if (
|
|
140704
|
+
if (nodeIsStringLiteral && context.triggerReason !== "invoked") {
|
|
140705
|
+
return emptyArray;
|
|
140706
|
+
}
|
|
140707
|
+
if (isExpressionNode(maybeBinary) && (nodeIsStringLiteral || isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation)) {
|
|
140698
140708
|
refactorInfo.actions.push(convertStringAction);
|
|
140699
140709
|
return [refactorInfo];
|
|
140700
140710
|
} else if (context.preferences.provideRefactorNotApplicableReason) {
|
|
140701
|
-
refactorInfo.actions.push({ ...convertStringAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.
|
|
140711
|
+
refactorInfo.actions.push({ ...convertStringAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenations_and_string_literals) });
|
|
140702
140712
|
return [refactorInfo];
|
|
140703
140713
|
}
|
|
140704
140714
|
return emptyArray;
|
|
@@ -149042,16 +149052,17 @@ registerCodeFix({
|
|
|
149042
149052
|
const moduleExportsChangedToDefault = convertFileToEsModule(sourceFile, program.getTypeChecker(), changes2, getEmitScriptTarget(program.getCompilerOptions()), getQuotePreference(sourceFile, preferences));
|
|
149043
149053
|
if (moduleExportsChangedToDefault) {
|
|
149044
149054
|
for (const importingFile of program.getSourceFiles()) {
|
|
149045
|
-
fixImportOfModuleExports(importingFile, sourceFile, changes2, getQuotePreference(importingFile, preferences));
|
|
149055
|
+
fixImportOfModuleExports(importingFile, sourceFile, program, changes2, getQuotePreference(importingFile, preferences));
|
|
149046
149056
|
}
|
|
149047
149057
|
}
|
|
149048
149058
|
});
|
|
149049
149059
|
return [createCodeFixActionWithoutFixAll("convertToEsModule", changes, Diagnostics.Convert_to_ES_module)];
|
|
149050
149060
|
}
|
|
149051
149061
|
});
|
|
149052
|
-
function fixImportOfModuleExports(importingFile, exportingFile, changes, quotePreference) {
|
|
149062
|
+
function fixImportOfModuleExports(importingFile, exportingFile, program, changes, quotePreference) {
|
|
149063
|
+
var _a, _b, _c;
|
|
149053
149064
|
for (const moduleSpecifier of importingFile.imports) {
|
|
149054
|
-
const imported =
|
|
149065
|
+
const imported = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(importingFile.path)) == null ? void 0 : _b.get(moduleSpecifier.text, getModeForUsageLocation(importingFile, moduleSpecifier))) == null ? void 0 : _c.resolvedModule;
|
|
149055
149066
|
if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
|
|
149056
149067
|
continue;
|
|
149057
149068
|
}
|
|
@@ -150204,7 +150215,7 @@ registerCodeFix({
|
|
|
150204
150215
|
fix,
|
|
150205
150216
|
/*includeSymbolNameInDescription*/
|
|
150206
150217
|
symbolName2 !== errorIdentifierText,
|
|
150207
|
-
program
|
|
150218
|
+
program,
|
|
150208
150219
|
preferences
|
|
150209
150220
|
)
|
|
150210
150221
|
);
|
|
@@ -150453,7 +150464,6 @@ function createImportSpecifierResolver(importingFile, program, host, preferences
|
|
|
150453
150464
|
}
|
|
150454
150465
|
}
|
|
150455
150466
|
function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
|
|
150456
|
-
const compilerOptions = program.getCompilerOptions();
|
|
150457
150467
|
let exportInfos;
|
|
150458
150468
|
if (exportMapKey) {
|
|
150459
150469
|
exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
|
|
@@ -150474,7 +150484,7 @@ function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sou
|
|
|
150474
150484
|
fix,
|
|
150475
150485
|
/*includeSymbolNameInDescription*/
|
|
150476
150486
|
false,
|
|
150477
|
-
|
|
150487
|
+
program,
|
|
150478
150488
|
preferences
|
|
150479
150489
|
))
|
|
150480
150490
|
};
|
|
@@ -150484,7 +150494,15 @@ function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, ho
|
|
|
150484
150494
|
const symbolName2 = single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions));
|
|
150485
150495
|
const fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName2, program);
|
|
150486
150496
|
const includeSymbolNameInDescription = symbolName2 !== symbolToken.text;
|
|
150487
|
-
return fix && codeFixActionToCodeAction(codeActionForFix(
|
|
150497
|
+
return fix && codeFixActionToCodeAction(codeActionForFix(
|
|
150498
|
+
{ host, formatContext, preferences },
|
|
150499
|
+
sourceFile,
|
|
150500
|
+
symbolName2,
|
|
150501
|
+
fix,
|
|
150502
|
+
includeSymbolNameInDescription,
|
|
150503
|
+
program,
|
|
150504
|
+
preferences
|
|
150505
|
+
));
|
|
150488
150506
|
}
|
|
150489
150507
|
function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
150490
150508
|
const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
@@ -151054,14 +151072,14 @@ function getExportEqualsImportKind(importingFile, compilerOptions, forceImportKe
|
|
|
151054
151072
|
}
|
|
151055
151073
|
return allowSyntheticDefaults ? 1 /* Default */ : 3 /* CommonJS */;
|
|
151056
151074
|
}
|
|
151057
|
-
function codeActionForFix(context, sourceFile, symbolName2, fix, includeSymbolNameInDescription,
|
|
151075
|
+
function codeActionForFix(context, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences) {
|
|
151058
151076
|
let diag2;
|
|
151059
151077
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
|
|
151060
|
-
diag2 = codeActionForFixWorker(tracker, sourceFile, symbolName2, fix, includeSymbolNameInDescription,
|
|
151078
|
+
diag2 = codeActionForFixWorker(tracker, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences);
|
|
151061
151079
|
});
|
|
151062
151080
|
return createCodeFixAction(importFixName, changes, diag2, importFixId, Diagnostics.Add_all_missing_imports);
|
|
151063
151081
|
}
|
|
151064
|
-
function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSymbolNameInDescription,
|
|
151082
|
+
function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences) {
|
|
151065
151083
|
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
151066
151084
|
switch (fix.kind) {
|
|
151067
151085
|
case 0 /* UseNamespace */:
|
|
@@ -151098,7 +151116,7 @@ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSy
|
|
|
151098
151116
|
defaultImport,
|
|
151099
151117
|
namedImports,
|
|
151100
151118
|
namespaceLikeImport,
|
|
151101
|
-
|
|
151119
|
+
program.getCompilerOptions()
|
|
151102
151120
|
),
|
|
151103
151121
|
/*blankLineBetween*/
|
|
151104
151122
|
true,
|
|
@@ -151111,7 +151129,7 @@ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSy
|
|
|
151111
151129
|
}
|
|
151112
151130
|
case 4 /* PromoteTypeOnly */: {
|
|
151113
151131
|
const { typeOnlyAliasDeclaration } = fix;
|
|
151114
|
-
const promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration,
|
|
151132
|
+
const promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, program, sourceFile, preferences);
|
|
151115
151133
|
return promotedDeclaration.kind === 276 /* ImportSpecifier */ ? [Diagnostics.Remove_type_from_import_of_0_from_1, symbolName2, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)];
|
|
151116
151134
|
}
|
|
151117
151135
|
default:
|
|
@@ -151122,7 +151140,8 @@ function getModuleSpecifierText(promotedDeclaration) {
|
|
|
151122
151140
|
var _a, _b;
|
|
151123
151141
|
return promotedDeclaration.kind === 271 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text;
|
|
151124
151142
|
}
|
|
151125
|
-
function promoteFromTypeOnly(changes, aliasDeclaration,
|
|
151143
|
+
function promoteFromTypeOnly(changes, aliasDeclaration, program, sourceFile, preferences) {
|
|
151144
|
+
const compilerOptions = program.getCompilerOptions();
|
|
151126
151145
|
const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions);
|
|
151127
151146
|
switch (aliasDeclaration.kind) {
|
|
151128
151147
|
case 276 /* ImportSpecifier */:
|
|
@@ -151164,10 +151183,11 @@ function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceF
|
|
|
151164
151183
|
Debug.failBadSyntaxKind(aliasDeclaration);
|
|
151165
151184
|
}
|
|
151166
151185
|
function promoteImportClause(importClause) {
|
|
151186
|
+
var _a, _b, _c;
|
|
151167
151187
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
|
|
151168
151188
|
if (!compilerOptions.allowImportingTsExtensions) {
|
|
151169
151189
|
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
|
|
151170
|
-
const resolvedModule = moduleSpecifier &&
|
|
151190
|
+
const resolvedModule = moduleSpecifier && ((_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))) == null ? void 0 : _c.resolvedModule);
|
|
151171
151191
|
if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
|
|
151172
151192
|
const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
|
|
151173
151193
|
changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
|
|
@@ -151835,7 +151855,7 @@ registerCodeFix({
|
|
|
151835
151855
|
}
|
|
151836
151856
|
});
|
|
151837
151857
|
function getInfo7(sourceFile, pos, program) {
|
|
151838
|
-
var _a;
|
|
151858
|
+
var _a, _b, _c, _d;
|
|
151839
151859
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
151840
151860
|
if (isIdentifier(token)) {
|
|
151841
151861
|
const importDeclaration = findAncestor(token, isImportDeclaration);
|
|
@@ -151844,19 +151864,18 @@ function getInfo7(sourceFile, pos, program) {
|
|
|
151844
151864
|
const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : void 0;
|
|
151845
151865
|
if (moduleSpecifier === void 0)
|
|
151846
151866
|
return void 0;
|
|
151847
|
-
const resolvedModule =
|
|
151848
|
-
sourceFile,
|
|
151867
|
+
const resolvedModule = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(
|
|
151849
151868
|
moduleSpecifier,
|
|
151850
151869
|
/*mode*/
|
|
151851
151870
|
void 0
|
|
151852
|
-
);
|
|
151871
|
+
)) == null ? void 0 : _c.resolvedModule;
|
|
151853
151872
|
if (resolvedModule === void 0)
|
|
151854
151873
|
return void 0;
|
|
151855
151874
|
const moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
|
|
151856
151875
|
if (moduleSourceFile === void 0 || isSourceFileFromLibrary(program, moduleSourceFile))
|
|
151857
151876
|
return void 0;
|
|
151858
151877
|
const moduleSymbol = moduleSourceFile.symbol;
|
|
151859
|
-
const locals = (
|
|
151878
|
+
const locals = (_d = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _d.locals;
|
|
151860
151879
|
if (locals === void 0)
|
|
151861
151880
|
return void 0;
|
|
151862
151881
|
const localSymbol = locals.get(token.escapedText);
|
|
@@ -152111,9 +152130,10 @@ function convertSemanticMeaningToSymbolFlags(meaning) {
|
|
|
152111
152130
|
return flags;
|
|
152112
152131
|
}
|
|
152113
152132
|
function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) {
|
|
152133
|
+
var _a, _b, _c;
|
|
152114
152134
|
if (!importDeclaration || !isStringLiteralLike(importDeclaration.moduleSpecifier))
|
|
152115
152135
|
return void 0;
|
|
152116
|
-
const resolvedModule =
|
|
152136
|
+
const resolvedModule = (_c = (_b = (_a = context.program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(importDeclaration.moduleSpecifier.text, getModeForUsageLocation(sourceFile, importDeclaration.moduleSpecifier))) == null ? void 0 : _c.resolvedModule;
|
|
152117
152137
|
if (!resolvedModule)
|
|
152118
152138
|
return void 0;
|
|
152119
152139
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -162916,7 +162936,7 @@ function declarationIsWriteAccess(decl) {
|
|
|
162916
162936
|
var Core;
|
|
162917
162937
|
((Core2) => {
|
|
162918
162938
|
function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options = {}, sourceFilesSet = new Set(sourceFiles.map((f) => f.fileName))) {
|
|
162919
|
-
var _a, _b, _c;
|
|
162939
|
+
var _a, _b, _c, _d;
|
|
162920
162940
|
node = getAdjustedNode2(node, options);
|
|
162921
162941
|
if (isSourceFile(node)) {
|
|
162922
162942
|
const resolvedRef = ts_GoToDefinition_exports.getReferenceAtPosition(node, position, program);
|
|
@@ -162955,7 +162975,7 @@ var Core;
|
|
|
162955
162975
|
if (!options.implementations && isStringLiteralLike(node)) {
|
|
162956
162976
|
if (isModuleSpecifierLike(node)) {
|
|
162957
162977
|
const fileIncludeReasons = program.getFileIncludeReasons();
|
|
162958
|
-
const referencedFileName = (_c = (_b = (_a = node.getSourceFile().
|
|
162978
|
+
const referencedFileName = (_d = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(node.getSourceFile().path)) == null ? void 0 : _b.get(node.text, getModeForUsageLocation(node.getSourceFile(), node))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.resolvedFileName;
|
|
162959
162979
|
const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0;
|
|
162960
162980
|
if (referencedFile) {
|
|
162961
162981
|
return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }];
|
|
@@ -163018,7 +163038,7 @@ var Core;
|
|
|
163018
163038
|
for (const ref of references) {
|
|
163019
163039
|
if (isReferencedFile(ref)) {
|
|
163020
163040
|
const referencingFile = program.getSourceFileByPath(ref.file);
|
|
163021
|
-
const location = getReferencedFileLocation(program
|
|
163041
|
+
const location = getReferencedFileLocation(program, ref);
|
|
163022
163042
|
if (isReferenceFileLocation(location)) {
|
|
163023
163043
|
entries = append(entries, {
|
|
163024
163044
|
kind: 0 /* Span */,
|
|
@@ -164358,7 +164378,7 @@ __export(ts_GoToDefinition_exports, {
|
|
|
164358
164378
|
|
|
164359
164379
|
// src/services/goToDefinition.ts
|
|
164360
164380
|
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
164361
|
-
var _a, _b;
|
|
164381
|
+
var _a, _b, _c;
|
|
164362
164382
|
const resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
164363
164383
|
const fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || emptyArray;
|
|
164364
164384
|
if (resolvedRef == null ? void 0 : resolvedRef.file) {
|
|
@@ -164431,7 +164451,7 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
|
164431
164451
|
}
|
|
164432
164452
|
}
|
|
164433
164453
|
if (!symbol && isModuleSpecifierLike(fallbackNode)) {
|
|
164434
|
-
const ref = (_b = (_a =
|
|
164454
|
+
const ref = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode))) == null ? void 0 : _c.resolvedModule;
|
|
164435
164455
|
if (ref) {
|
|
164436
164456
|
return [{
|
|
164437
164457
|
name: fallbackNode.text,
|
|
@@ -164543,10 +164563,11 @@ function getReferenceAtPosition(sourceFile, position, program) {
|
|
|
164543
164563
|
const file = program.getLibFileFromReference(libReferenceDirective);
|
|
164544
164564
|
return file && { reference: libReferenceDirective, fileName: file.fileName, file, unverified: false };
|
|
164545
164565
|
}
|
|
164546
|
-
|
|
164566
|
+
const resolvedModules = (_b = program.resolvedModules) == null ? void 0 : _b.get(sourceFile.path);
|
|
164567
|
+
if (resolvedModules == null ? void 0 : resolvedModules.size()) {
|
|
164547
164568
|
const node = getTouchingToken(sourceFile, position);
|
|
164548
|
-
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) &&
|
|
164549
|
-
const verifiedFileName = (_d = (_c =
|
|
164569
|
+
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && resolvedModules.has(node.text, getModeForUsageLocation(sourceFile, node))) {
|
|
164570
|
+
const verifiedFileName = (_d = (_c = resolvedModules.get(node.text, getModeForUsageLocation(sourceFile, node))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.resolvedFileName;
|
|
164550
164571
|
const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text);
|
|
164551
164572
|
return {
|
|
164552
164573
|
file: program.getSourceFile(fileName),
|
|
@@ -173484,8 +173505,6 @@ __export(ts_exports2, {
|
|
|
173484
173505
|
getResolvePackageJsonExports: () => getResolvePackageJsonExports,
|
|
173485
173506
|
getResolvePackageJsonImports: () => getResolvePackageJsonImports,
|
|
173486
173507
|
getResolvedExternalModuleName: () => getResolvedExternalModuleName,
|
|
173487
|
-
getResolvedModule: () => getResolvedModule,
|
|
173488
|
-
getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
|
|
173489
173508
|
getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
|
|
173490
173509
|
getRestParameterElementType: () => getRestParameterElementType,
|
|
173491
173510
|
getRightMostAssignedExpression: () => getRightMostAssignedExpression,
|
|
@@ -174583,8 +174602,6 @@ __export(ts_exports2, {
|
|
|
174583
174602
|
setParent: () => setParent,
|
|
174584
174603
|
setParentRecursive: () => setParentRecursive,
|
|
174585
174604
|
setPrivateIdentifier: () => setPrivateIdentifier,
|
|
174586
|
-
setResolvedModule: () => setResolvedModule,
|
|
174587
|
-
setResolvedTypeReferenceDirective: () => setResolvedTypeReferenceDirective,
|
|
174588
174605
|
setSnippetElement: () => setSnippetElement,
|
|
174589
174606
|
setSourceMapRange: () => setSourceMapRange,
|
|
174590
174607
|
setStackTraceLimit: () => setStackTraceLimit,
|
|
@@ -174811,7 +174828,6 @@ __export(ts_exports2, {
|
|
|
174811
174828
|
writeCommentRange: () => writeCommentRange,
|
|
174812
174829
|
writeFile: () => writeFile,
|
|
174813
174830
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
174814
|
-
zipToModeAwareCache: () => zipToModeAwareCache,
|
|
174815
174831
|
zipWith: () => zipWith
|
|
174816
174832
|
});
|
|
174817
174833
|
|
|
@@ -176685,7 +176701,8 @@ var Project3 = class _Project {
|
|
|
176685
176701
|
}
|
|
176686
176702
|
if (this.program && !this.symlinks.hasProcessedResolutions()) {
|
|
176687
176703
|
this.symlinks.setSymlinksFromResolutions(
|
|
176688
|
-
this.program.
|
|
176704
|
+
this.program.resolvedModules,
|
|
176705
|
+
this.program.resolvedTypeReferenceDirectiveNames,
|
|
176689
176706
|
this.program.getAutomaticTypeDirectiveResolutions()
|
|
176690
176707
|
);
|
|
176691
176708
|
}
|
|
@@ -178090,16 +178107,23 @@ function getUnresolvedImports(program, cachedUnresolvedImportsPerFile) {
|
|
|
178090
178107
|
const sourceFiles = program.getSourceFiles();
|
|
178091
178108
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "getUnresolvedImports", { count: sourceFiles.length });
|
|
178092
178109
|
const ambientModules = program.getTypeChecker().getAmbientModules().map((mod) => stripQuotes(mod.getName()));
|
|
178093
|
-
const result = sortAndDeduplicate(flatMap(sourceFiles, (sourceFile) => extractUnresolvedImportsFromSourceFile(
|
|
178110
|
+
const result = sortAndDeduplicate(flatMap(sourceFiles, (sourceFile) => extractUnresolvedImportsFromSourceFile(
|
|
178111
|
+
program,
|
|
178112
|
+
sourceFile,
|
|
178113
|
+
ambientModules,
|
|
178114
|
+
cachedUnresolvedImportsPerFile
|
|
178115
|
+
)));
|
|
178094
178116
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
178095
178117
|
return result;
|
|
178096
178118
|
}
|
|
178097
|
-
function extractUnresolvedImportsFromSourceFile(file, ambientModules, cachedUnresolvedImportsPerFile) {
|
|
178119
|
+
function extractUnresolvedImportsFromSourceFile(program, file, ambientModules, cachedUnresolvedImportsPerFile) {
|
|
178098
178120
|
return getOrUpdate(cachedUnresolvedImportsPerFile, file.path, () => {
|
|
178099
|
-
|
|
178121
|
+
var _a;
|
|
178122
|
+
const resolvedModules = (_a = program.resolvedModules) == null ? void 0 : _a.get(file.path);
|
|
178123
|
+
if (!resolvedModules)
|
|
178100
178124
|
return emptyArray2;
|
|
178101
178125
|
let unresolvedImports;
|
|
178102
|
-
|
|
178126
|
+
resolvedModules.forEach(({ resolvedModule }, name) => {
|
|
178103
178127
|
if ((!resolvedModule || !resolutionExtensionIsTSOrJson(resolvedModule.extension)) && !isExternalModuleNameRelative(name) && !ambientModules.some((m) => m === name)) {
|
|
178104
178128
|
unresolvedImports = append(unresolvedImports, parsePackageName(name).packageName);
|
|
178105
178129
|
}
|
|
@@ -188046,8 +188070,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
188046
188070
|
getResolvePackageJsonExports,
|
|
188047
188071
|
getResolvePackageJsonImports,
|
|
188048
188072
|
getResolvedExternalModuleName,
|
|
188049
|
-
getResolvedModule,
|
|
188050
|
-
getResolvedTypeReferenceDirective,
|
|
188051
188073
|
getRestIndicatorOfBindingOrAssignmentElement,
|
|
188052
188074
|
getRestParameterElementType,
|
|
188053
188075
|
getRightMostAssignedExpression,
|
|
@@ -189145,8 +189167,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189145
189167
|
setParent,
|
|
189146
189168
|
setParentRecursive,
|
|
189147
189169
|
setPrivateIdentifier,
|
|
189148
|
-
setResolvedModule,
|
|
189149
|
-
setResolvedTypeReferenceDirective,
|
|
189150
189170
|
setSnippetElement,
|
|
189151
189171
|
setSourceMapRange,
|
|
189152
189172
|
setStackTraceLimit,
|
|
@@ -189373,7 +189393,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189373
189393
|
writeCommentRange,
|
|
189374
189394
|
writeFile,
|
|
189375
189395
|
writeFileEnsuringDirectories,
|
|
189376
|
-
zipToModeAwareCache,
|
|
189377
189396
|
zipWith
|
|
189378
189397
|
});
|
|
189379
189398
|
//# sourceMappingURL=tsserver.js.map
|