typescript 5.0.0-dev.20221205 → 5.0.0-dev.20221206
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/tsc.js +421 -299
- package/lib/tsserver.js +468 -322
- package/lib/tsserverlibrary.d.ts +27 -18
- package/lib/tsserverlibrary.js +469 -323
- package/lib/typescript.d.ts +27 -15
- package/lib/typescript.js +448 -306
- package/lib/typingsInstaller.js +20 -8
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -42,7 +42,7 @@ var ts = (() => {
|
|
|
42
42
|
"src/compiler/corePublic.ts"() {
|
|
43
43
|
"use strict";
|
|
44
44
|
versionMajorMinor = "5.0";
|
|
45
|
-
version = `${versionMajorMinor}.0-dev.
|
|
45
|
+
version = `${versionMajorMinor}.0-dev.20221206`;
|
|
46
46
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
47
47
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
48
48
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4097,6 +4097,7 @@ ${lanes.join("\n")}
|
|
|
4097
4097
|
FilePreprocessingDiagnosticsKind = /* @__PURE__ */ ((FilePreprocessingDiagnosticsKind2) => {
|
|
4098
4098
|
FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["FilePreprocessingReferencedDiagnostic"] = 0] = "FilePreprocessingReferencedDiagnostic";
|
|
4099
4099
|
FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["FilePreprocessingFileExplainingDiagnostic"] = 1] = "FilePreprocessingFileExplainingDiagnostic";
|
|
4100
|
+
FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["ResolutionDiagnostics"] = 2] = "ResolutionDiagnostics";
|
|
4100
4101
|
return FilePreprocessingDiagnosticsKind2;
|
|
4101
4102
|
})(FilePreprocessingDiagnosticsKind || {});
|
|
4102
4103
|
EmitOnly = /* @__PURE__ */ ((EmitOnly4) => {
|
|
@@ -12244,7 +12245,8 @@ ${lanes.join("\n")}
|
|
|
12244
12245
|
return node.end - node.pos;
|
|
12245
12246
|
}
|
|
12246
12247
|
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
12247
|
-
|
|
12248
|
+
var _a2, _b;
|
|
12249
|
+
return (_b = (_a2 = sourceFile == null ? void 0 : sourceFile.resolvedModules) == null ? void 0 : _a2.get(moduleNameText, mode)) == null ? void 0 : _b.resolvedModule;
|
|
12248
12250
|
}
|
|
12249
12251
|
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
12250
12252
|
if (!sourceFile.resolvedModules) {
|
|
@@ -12259,14 +12261,14 @@ ${lanes.join("\n")}
|
|
|
12259
12261
|
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
|
|
12260
12262
|
}
|
|
12261
12263
|
function getResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, mode) {
|
|
12262
|
-
var _a2;
|
|
12263
|
-
return (_a2 = sourceFile == null ? void 0 : sourceFile.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a2.get(typeReferenceDirectiveName, mode);
|
|
12264
|
+
var _a2, _b;
|
|
12265
|
+
return (_b = (_a2 = sourceFile == null ? void 0 : sourceFile.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a2.get(typeReferenceDirectiveName, mode)) == null ? void 0 : _b.resolvedTypeReferenceDirective;
|
|
12264
12266
|
}
|
|
12265
12267
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
12266
12268
|
return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
|
|
12267
12269
|
}
|
|
12268
12270
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
12269
|
-
return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport && oldResolution.extension === newResolution.extension && oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.originalPath === newResolution.originalPath && packageIdIsEqual(oldResolution.packageId, newResolution.packageId);
|
|
12271
|
+
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);
|
|
12270
12272
|
}
|
|
12271
12273
|
function packageIdIsEqual(a, b) {
|
|
12272
12274
|
return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
|
|
@@ -12278,15 +12280,15 @@ ${lanes.join("\n")}
|
|
|
12278
12280
|
return `${packageIdToPackageName(packageId)}@${packageId.version}`;
|
|
12279
12281
|
}
|
|
12280
12282
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
12281
|
-
return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary && oldResolution.originalPath === newResolution.originalPath;
|
|
12283
|
+
return oldResolution === newResolution || oldResolution.resolvedTypeReferenceDirective === newResolution.resolvedTypeReferenceDirective || !!oldResolution.resolvedTypeReferenceDirective && !!newResolution.resolvedTypeReferenceDirective && oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName && !!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary && oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
|
|
12282
12284
|
}
|
|
12283
|
-
function hasChangesInResolutions(names, newSourceFile, newResolutions, oldResolutions, comparer) {
|
|
12285
|
+
function hasChangesInResolutions(names, newSourceFile, newResolutions, oldResolutions, comparer, nameAndModeGetter) {
|
|
12284
12286
|
Debug.assert(names.length === newResolutions.length);
|
|
12285
12287
|
for (let i = 0; i < names.length; i++) {
|
|
12286
12288
|
const newResolution = newResolutions[i];
|
|
12287
12289
|
const entry = names[i];
|
|
12288
|
-
const name =
|
|
12289
|
-
const mode =
|
|
12290
|
+
const name = nameAndModeGetter.getName(entry);
|
|
12291
|
+
const mode = nameAndModeGetter.getMode(entry, newSourceFile);
|
|
12290
12292
|
const oldResolution = oldResolutions && oldResolutions.get(name, mode);
|
|
12291
12293
|
const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
|
|
12292
12294
|
if (changed) {
|
|
@@ -16635,13 +16637,14 @@ ${lanes.join("\n")}
|
|
|
16635
16637
|
}
|
|
16636
16638
|
},
|
|
16637
16639
|
setSymlinksFromResolutions(files, typeReferenceDirectives) {
|
|
16638
|
-
var _a2;
|
|
16640
|
+
var _a2, _b;
|
|
16639
16641
|
Debug.assert(!hasProcessedResolutions);
|
|
16640
16642
|
hasProcessedResolutions = true;
|
|
16641
16643
|
for (const file of files) {
|
|
16642
|
-
(_a2 = file.resolvedModules) == null ? void 0 : _a2.forEach((resolution) => processResolution(this, resolution));
|
|
16644
|
+
(_a2 = file.resolvedModules) == null ? void 0 : _a2.forEach((resolution) => processResolution(this, resolution.resolvedModule));
|
|
16645
|
+
(_b = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _b.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
16643
16646
|
}
|
|
16644
|
-
typeReferenceDirectives
|
|
16647
|
+
typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
16645
16648
|
},
|
|
16646
16649
|
hasProcessedResolutions: () => hasProcessedResolutions
|
|
16647
16650
|
};
|
|
@@ -34981,17 +34984,29 @@ ${lanes.join("\n")}
|
|
|
34981
34984
|
}
|
|
34982
34985
|
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
34983
34986
|
if (resultFromCache) {
|
|
34984
|
-
resultFromCache.failedLookupLocations.
|
|
34985
|
-
resultFromCache.affectingLocations.
|
|
34987
|
+
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
34988
|
+
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
34989
|
+
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
34986
34990
|
return resultFromCache;
|
|
34987
34991
|
}
|
|
34988
34992
|
return {
|
|
34989
34993
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? void 0 : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport, packageId: resolved.packageId },
|
|
34990
|
-
failedLookupLocations,
|
|
34991
|
-
affectingLocations,
|
|
34992
|
-
resolutionDiagnostics: diagnostics
|
|
34994
|
+
failedLookupLocations: initializeResolutionField(failedLookupLocations),
|
|
34995
|
+
affectingLocations: initializeResolutionField(affectingLocations),
|
|
34996
|
+
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
34993
34997
|
};
|
|
34994
34998
|
}
|
|
34999
|
+
function initializeResolutionField(value) {
|
|
35000
|
+
return value.length ? value : void 0;
|
|
35001
|
+
}
|
|
35002
|
+
function updateResolutionField(to, value) {
|
|
35003
|
+
if (!(value == null ? void 0 : value.length))
|
|
35004
|
+
return to;
|
|
35005
|
+
if (!(to == null ? void 0 : to.length))
|
|
35006
|
+
return value;
|
|
35007
|
+
to.push(...value);
|
|
35008
|
+
return to;
|
|
35009
|
+
}
|
|
34995
35010
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
34996
35011
|
if (!hasProperty(jsonContent, fieldName)) {
|
|
34997
35012
|
if (state.traceEnabled) {
|
|
@@ -35195,7 +35210,12 @@ ${lanes.join("\n")}
|
|
|
35195
35210
|
isExternalLibraryImport: pathContainsNodeModules(fileName)
|
|
35196
35211
|
};
|
|
35197
35212
|
}
|
|
35198
|
-
result = {
|
|
35213
|
+
result = {
|
|
35214
|
+
resolvedTypeReferenceDirective,
|
|
35215
|
+
failedLookupLocations: initializeResolutionField(failedLookupLocations),
|
|
35216
|
+
affectingLocations: initializeResolutionField(affectingLocations),
|
|
35217
|
+
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
35218
|
+
};
|
|
35199
35219
|
perFolderCache == null ? void 0 : perFolderCache.set(typeReferenceDirectiveName, resolutionMode, result);
|
|
35200
35220
|
if (traceEnabled)
|
|
35201
35221
|
traceResult(result);
|
|
@@ -35465,18 +35485,12 @@ ${lanes.join("\n")}
|
|
|
35465
35485
|
return result;
|
|
35466
35486
|
}
|
|
35467
35487
|
}
|
|
35468
|
-
function
|
|
35469
|
-
return !isString(entry) ? isStringLiteralLike(entry) ? entry.text : toFileNameLowerCase(entry.fileName) : entry;
|
|
35470
|
-
}
|
|
35471
|
-
function getResolutionMode(entry, file) {
|
|
35472
|
-
return isStringLiteralLike(entry) ? getModeForUsageLocation(file, entry) : entry.resolutionMode || file.impliedNodeFormat;
|
|
35473
|
-
}
|
|
35474
|
-
function zipToModeAwareCache(file, keys, values) {
|
|
35488
|
+
function zipToModeAwareCache(file, keys, values, nameAndModeGetter) {
|
|
35475
35489
|
Debug.assert(keys.length === values.length);
|
|
35476
35490
|
const map2 = createModeAwareCache();
|
|
35477
35491
|
for (let i = 0; i < keys.length; ++i) {
|
|
35478
35492
|
const entry = keys[i];
|
|
35479
|
-
map2.set(
|
|
35493
|
+
map2.set(nameAndModeGetter.getName(entry), nameAndModeGetter.getMode(entry, file), values[i]);
|
|
35480
35494
|
}
|
|
35481
35495
|
return map2;
|
|
35482
35496
|
}
|
|
@@ -35765,7 +35779,7 @@ ${lanes.join("\n")}
|
|
|
35765
35779
|
function resolveJSModule(moduleName, initialDir, host) {
|
|
35766
35780
|
const { resolvedModule, failedLookupLocations } = tryResolveJSModuleWorker(moduleName, initialDir, host);
|
|
35767
35781
|
if (!resolvedModule) {
|
|
35768
|
-
throw new Error(`Could not resolve JS module '${moduleName}' starting at '${initialDir}'. Looked in: ${failedLookupLocations.join(", ")}`);
|
|
35782
|
+
throw new Error(`Could not resolve JS module '${moduleName}' starting at '${initialDir}'. Looked in: ${failedLookupLocations == null ? void 0 : failedLookupLocations.join(", ")}`);
|
|
35769
35783
|
}
|
|
35770
35784
|
return resolvedModule.resolvedFileName;
|
|
35771
35785
|
}
|
|
@@ -40480,9 +40494,9 @@ ${lanes.join("\n")}
|
|
|
40480
40494
|
host.getSourceFiles().forEach((sf) => {
|
|
40481
40495
|
if (!sf.resolvedModules)
|
|
40482
40496
|
return;
|
|
40483
|
-
sf.resolvedModules.forEach((
|
|
40484
|
-
if (
|
|
40485
|
-
map2.set(
|
|
40497
|
+
sf.resolvedModules.forEach(({ resolvedModule }) => {
|
|
40498
|
+
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
40499
|
+
map2.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!map2.get(resolvedModule.packageId.name));
|
|
40486
40500
|
});
|
|
40487
40501
|
});
|
|
40488
40502
|
return map2;
|
|
@@ -41286,6 +41300,12 @@ ${lanes.join("\n")}
|
|
|
41286
41300
|
return diagnostic;
|
|
41287
41301
|
}
|
|
41288
41302
|
function isDeprecatedSymbol(symbol) {
|
|
41303
|
+
if (length(symbol.declarations) > 1) {
|
|
41304
|
+
const parentSymbol = getParentOfSymbol(symbol);
|
|
41305
|
+
if (parentSymbol && parentSymbol.flags & 64 /* Interface */) {
|
|
41306
|
+
return some(symbol.declarations, (d) => !!(getCombinedNodeFlags(d) & 268435456 /* Deprecated */));
|
|
41307
|
+
}
|
|
41308
|
+
}
|
|
41289
41309
|
return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 268435456 /* Deprecated */);
|
|
41290
41310
|
}
|
|
41291
41311
|
function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
|
|
@@ -50979,7 +50999,7 @@ ${lanes.join("\n")}
|
|
|
50979
50999
|
const resolved = resolveAlias(aliasSymbol2);
|
|
50980
51000
|
if (resolved && resolved.flags & 524288 /* TypeAlias */) {
|
|
50981
51001
|
newAliasSymbol = resolved;
|
|
50982
|
-
aliasTypeArguments = typeArgumentsFromTypeReferenceNode(node);
|
|
51002
|
+
aliasTypeArguments = typeArgumentsFromTypeReferenceNode(node) || (typeParameters ? [] : void 0);
|
|
50983
51003
|
}
|
|
50984
51004
|
}
|
|
50985
51005
|
}
|
|
@@ -59795,13 +59815,13 @@ ${lanes.join("\n")}
|
|
|
59795
59815
|
}
|
|
59796
59816
|
const target = getReferenceCandidate(typeOfExpr.expression);
|
|
59797
59817
|
if (!isMatchingReference(reference, target)) {
|
|
59798
|
-
|
|
59818
|
+
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
59819
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
59820
|
+
}
|
|
59821
|
+
const propertyAccess = getDiscriminantPropertyAccess(target, type);
|
|
59799
59822
|
if (propertyAccess) {
|
|
59800
59823
|
return narrowTypeByDiscriminant(type, propertyAccess, (t) => narrowTypeByLiteralExpression(t, literal, assumeTrue));
|
|
59801
59824
|
}
|
|
59802
|
-
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
59803
|
-
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
59804
|
-
}
|
|
59805
59825
|
return type;
|
|
59806
59826
|
}
|
|
59807
59827
|
return narrowTypeByLiteralExpression(type, literal, assumeTrue);
|
|
@@ -73412,11 +73432,11 @@ ${lanes.join("\n")}
|
|
|
73412
73432
|
let fileToDirective;
|
|
73413
73433
|
if (resolvedTypeReferenceDirectives) {
|
|
73414
73434
|
fileToDirective = /* @__PURE__ */ new Map();
|
|
73415
|
-
resolvedTypeReferenceDirectives.forEach((
|
|
73416
|
-
if (!
|
|
73435
|
+
resolvedTypeReferenceDirectives.forEach(({ resolvedTypeReferenceDirective }, key, mode) => {
|
|
73436
|
+
if (!(resolvedTypeReferenceDirective == null ? void 0 : resolvedTypeReferenceDirective.resolvedFileName)) {
|
|
73417
73437
|
return;
|
|
73418
73438
|
}
|
|
73419
|
-
const file = host.getSourceFile(
|
|
73439
|
+
const file = host.getSourceFile(resolvedTypeReferenceDirective.resolvedFileName);
|
|
73420
73440
|
if (file) {
|
|
73421
73441
|
addReferencedFilesToTypeDirective(file, key, mode);
|
|
73422
73442
|
}
|
|
@@ -100199,25 +100219,6 @@ ${lanes.join("\n")}
|
|
|
100199
100219
|
}
|
|
100200
100220
|
return result;
|
|
100201
100221
|
}
|
|
100202
|
-
function loadWithTypeDirectiveCache(names, containingFile, redirectedReference, containingFileMode, loader) {
|
|
100203
|
-
if (names.length === 0) {
|
|
100204
|
-
return [];
|
|
100205
|
-
}
|
|
100206
|
-
const resolutions = [];
|
|
100207
|
-
const cache = createModeAwareCache();
|
|
100208
|
-
for (const name of names) {
|
|
100209
|
-
let result;
|
|
100210
|
-
const mode = getModeForFileReference(name, containingFileMode);
|
|
100211
|
-
const strName = getResolutionName(name);
|
|
100212
|
-
if (cache.has(strName, mode)) {
|
|
100213
|
-
result = cache.get(strName, mode);
|
|
100214
|
-
} else {
|
|
100215
|
-
cache.set(strName, mode, result = loader(strName, containingFile, redirectedReference, mode));
|
|
100216
|
-
}
|
|
100217
|
-
resolutions.push(result);
|
|
100218
|
-
}
|
|
100219
|
-
return resolutions;
|
|
100220
|
-
}
|
|
100221
100222
|
function getModeForFileReference(ref, containingFileMode) {
|
|
100222
100223
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
100223
100224
|
}
|
|
@@ -100283,22 +100284,53 @@ ${lanes.join("\n")}
|
|
|
100283
100284
|
}
|
|
100284
100285
|
return elem.value.text === "import" ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
100285
100286
|
}
|
|
100286
|
-
function
|
|
100287
|
-
|
|
100288
|
-
|
|
100289
|
-
|
|
100287
|
+
function getModuleResolutionName(literal) {
|
|
100288
|
+
return literal.text;
|
|
100289
|
+
}
|
|
100290
|
+
function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
100291
|
+
return {
|
|
100292
|
+
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
100293
|
+
resolve: (moduleName, resoluionMode) => resolveModuleName(
|
|
100294
|
+
moduleName,
|
|
100295
|
+
containingFile,
|
|
100296
|
+
options,
|
|
100297
|
+
host,
|
|
100298
|
+
cache,
|
|
100299
|
+
redirectedReference,
|
|
100300
|
+
resoluionMode
|
|
100301
|
+
)
|
|
100302
|
+
};
|
|
100303
|
+
}
|
|
100304
|
+
function getTypeReferenceResolutionName(entry) {
|
|
100305
|
+
return !isString(entry) ? toFileNameLowerCase(entry.fileName) : entry;
|
|
100306
|
+
}
|
|
100307
|
+
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
100308
|
+
return {
|
|
100309
|
+
nameAndMode: typeReferenceResolutionNameAndModeGetter,
|
|
100310
|
+
resolve: (typeRef, resoluionMode) => resolveTypeReferenceDirective(
|
|
100311
|
+
typeRef,
|
|
100312
|
+
containingFile,
|
|
100313
|
+
options,
|
|
100314
|
+
host,
|
|
100315
|
+
redirectedReference,
|
|
100316
|
+
cache,
|
|
100317
|
+
resoluionMode
|
|
100318
|
+
)
|
|
100319
|
+
};
|
|
100320
|
+
}
|
|
100321
|
+
function loadWithModeAwareCache(entries, containingFile, redirectedReference, options, containingSourceFile, host, resolutionCache, createLoader) {
|
|
100322
|
+
if (entries.length === 0)
|
|
100323
|
+
return emptyArray;
|
|
100290
100324
|
const resolutions = [];
|
|
100291
|
-
const cache =
|
|
100292
|
-
|
|
100293
|
-
for (const entry of
|
|
100294
|
-
|
|
100295
|
-
const mode =
|
|
100296
|
-
|
|
100297
|
-
|
|
100298
|
-
if (
|
|
100299
|
-
result =
|
|
100300
|
-
} else {
|
|
100301
|
-
cache.set(name, mode, result = loader(name, mode, containingFileName, redirectedReference));
|
|
100325
|
+
const cache = /* @__PURE__ */ new Map();
|
|
100326
|
+
const loader = createLoader(containingFile, redirectedReference, options, host, resolutionCache);
|
|
100327
|
+
for (const entry of entries) {
|
|
100328
|
+
const name = loader.nameAndMode.getName(entry);
|
|
100329
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
100330
|
+
const key = createModeAwareCacheKey(name, mode);
|
|
100331
|
+
let result = cache.get(key);
|
|
100332
|
+
if (!result) {
|
|
100333
|
+
cache.set(key, result = loader.resolve(name, mode));
|
|
100302
100334
|
}
|
|
100303
100335
|
resolutions.push(result);
|
|
100304
100336
|
}
|
|
@@ -100343,14 +100375,14 @@ ${lanes.join("\n")}
|
|
|
100343
100375
|
return location.pos !== void 0;
|
|
100344
100376
|
}
|
|
100345
100377
|
function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
100346
|
-
var _a2, _b, _c, _d;
|
|
100378
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
100347
100379
|
const file = Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
100348
100380
|
const { kind, index } = ref;
|
|
100349
100381
|
let pos, end, packageId, resolutionMode;
|
|
100350
100382
|
switch (kind) {
|
|
100351
100383
|
case 3 /* Import */:
|
|
100352
100384
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
100353
|
-
packageId = (_b = (_a2 = file.resolvedModules) == null ? void 0 : _a2.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _b.packageId;
|
|
100385
|
+
packageId = (_c = (_b = (_a2 = file.resolvedModules) == null ? void 0 : _a2.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _b.resolvedModule) == null ? void 0 : _c.packageId;
|
|
100354
100386
|
if (importLiteral.pos === -1)
|
|
100355
100387
|
return { file, packageId, text: importLiteral.text };
|
|
100356
100388
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -100361,7 +100393,7 @@ ${lanes.join("\n")}
|
|
|
100361
100393
|
break;
|
|
100362
100394
|
case 5 /* TypeReferenceDirective */:
|
|
100363
100395
|
({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
|
|
100364
|
-
packageId = (
|
|
100396
|
+
packageId = (_f = (_e = (_d = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _d.get(toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) == null ? void 0 : _e.resolvedTypeReferenceDirective) == null ? void 0 : _f.packageId;
|
|
100365
100397
|
break;
|
|
100366
100398
|
case 7 /* LibReferenceDirective */:
|
|
100367
100399
|
({ pos, end } = file.libReferenceDirectives[index]);
|
|
@@ -100457,7 +100489,7 @@ ${lanes.join("\n")}
|
|
|
100457
100489
|
};
|
|
100458
100490
|
}
|
|
100459
100491
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
100460
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
100492
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
100461
100493
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
100462
100494
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences } = createProgramOptions;
|
|
100463
100495
|
let { oldProgram } = createProgramOptions;
|
|
@@ -100474,6 +100506,8 @@ ${lanes.join("\n")}
|
|
|
100474
100506
|
const cachedDeclarationDiagnosticsForFile = {};
|
|
100475
100507
|
let resolvedTypeReferenceDirectives = createModeAwareCache();
|
|
100476
100508
|
let fileProcessingDiagnostics;
|
|
100509
|
+
let automaticTypeDirectiveNames;
|
|
100510
|
+
let automaticTypeDirectiveResolutions;
|
|
100477
100511
|
const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
100478
100512
|
let currentNodeModulesDepth = 0;
|
|
100479
100513
|
const modulesWithElidedImports = /* @__PURE__ */ new Map();
|
|
@@ -100492,50 +100526,59 @@ ${lanes.join("\n")}
|
|
|
100492
100526
|
const hasEmitBlockingDiagnostics = /* @__PURE__ */ new Map();
|
|
100493
100527
|
let _compilerOptionsObjectLiteralSyntax;
|
|
100494
100528
|
let moduleResolutionCache;
|
|
100495
|
-
let typeReferenceDirectiveResolutionCache;
|
|
100496
100529
|
let actualResolveModuleNamesWorker;
|
|
100497
100530
|
const hasInvalidatedResolutions = host.hasInvalidatedResolutions || returnFalse;
|
|
100498
|
-
if (host.
|
|
100499
|
-
actualResolveModuleNamesWorker = (
|
|
100500
|
-
var _a3;
|
|
100501
|
-
return host.resolveModuleNames(
|
|
100502
|
-
moduleNames.map((literal) => literal.text),
|
|
100503
|
-
containingFileName,
|
|
100504
|
-
(_a3 = resolutionInfo == null ? void 0 : resolutionInfo.reusedNames) == null ? void 0 : _a3.map((literal) => literal.text),
|
|
100505
|
-
redirectedReference,
|
|
100506
|
-
options,
|
|
100507
|
-
containingFile,
|
|
100508
|
-
resolutionInfo
|
|
100509
|
-
).map((resolved) => {
|
|
100510
|
-
if (!resolved || resolved.extension !== void 0) {
|
|
100511
|
-
return resolved;
|
|
100512
|
-
}
|
|
100513
|
-
const withExtension = clone(resolved);
|
|
100514
|
-
withExtension.extension = extensionFromPath(resolved.resolvedFileName);
|
|
100515
|
-
return withExtension;
|
|
100516
|
-
});
|
|
100517
|
-
};
|
|
100531
|
+
if (host.resolveModuleNameLiterals) {
|
|
100532
|
+
actualResolveModuleNamesWorker = host.resolveModuleNameLiterals.bind(host);
|
|
100518
100533
|
moduleResolutionCache = (_b = host.getModuleResolutionCache) == null ? void 0 : _b.call(host);
|
|
100534
|
+
} else if (host.resolveModuleNames) {
|
|
100535
|
+
actualResolveModuleNamesWorker = (moduleNames, containingFile, redirectedReference, options2, containingSourceFile, reusedNames) => host.resolveModuleNames(
|
|
100536
|
+
moduleNames.map(getModuleResolutionName),
|
|
100537
|
+
containingFile,
|
|
100538
|
+
reusedNames == null ? void 0 : reusedNames.map(getModuleResolutionName),
|
|
100539
|
+
redirectedReference,
|
|
100540
|
+
options2,
|
|
100541
|
+
containingSourceFile
|
|
100542
|
+
).map(
|
|
100543
|
+
(resolved) => resolved ? resolved.extension !== void 0 ? { resolvedModule: resolved } : { resolvedModule: { ...resolved, extension: extensionFromPath(resolved.resolvedFileName) } } : emptyResolution
|
|
100544
|
+
);
|
|
100545
|
+
moduleResolutionCache = (_c = host.getModuleResolutionCache) == null ? void 0 : _c.call(host);
|
|
100519
100546
|
} else {
|
|
100520
100547
|
moduleResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
100521
|
-
|
|
100522
|
-
|
|
100548
|
+
actualResolveModuleNamesWorker = (moduleNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
100549
|
+
moduleNames,
|
|
100550
|
+
containingFile,
|
|
100551
|
+
redirectedReference,
|
|
100552
|
+
options2,
|
|
100553
|
+
containingSourceFile,
|
|
100554
|
+
host,
|
|
100555
|
+
moduleResolutionCache,
|
|
100556
|
+
createModuleResolutionLoader
|
|
100557
|
+
);
|
|
100523
100558
|
}
|
|
100524
100559
|
let actualResolveTypeReferenceDirectiveNamesWorker;
|
|
100525
|
-
if (host.
|
|
100526
|
-
actualResolveTypeReferenceDirectiveNamesWorker =
|
|
100560
|
+
if (host.resolveTypeReferenceDirectiveReferences) {
|
|
100561
|
+
actualResolveTypeReferenceDirectiveNamesWorker = host.resolveTypeReferenceDirectiveReferences.bind(host);
|
|
100562
|
+
} else if (host.resolveTypeReferenceDirectives) {
|
|
100563
|
+
actualResolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => host.resolveTypeReferenceDirectives(
|
|
100564
|
+
typeDirectiveNames.map(getTypeReferenceResolutionName),
|
|
100565
|
+
containingFile,
|
|
100566
|
+
redirectedReference,
|
|
100567
|
+
options2,
|
|
100568
|
+
containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat
|
|
100569
|
+
).map((resolvedTypeReferenceDirective) => ({ resolvedTypeReferenceDirective }));
|
|
100527
100570
|
} else {
|
|
100528
|
-
typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
100529
|
-
|
|
100530
|
-
|
|
100571
|
+
const typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
100572
|
+
actualResolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
100573
|
+
typeDirectiveNames,
|
|
100531
100574
|
containingFile,
|
|
100532
|
-
options,
|
|
100533
|
-
host,
|
|
100534
100575
|
redirectedReference,
|
|
100576
|
+
options2,
|
|
100577
|
+
containingSourceFile,
|
|
100578
|
+
host,
|
|
100535
100579
|
typeReferenceDirectiveResolutionCache,
|
|
100536
|
-
|
|
100537
|
-
)
|
|
100538
|
-
actualResolveTypeReferenceDirectiveNamesWorker = (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) => loadWithTypeDirectiveCache(Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader);
|
|
100580
|
+
createTypeReferenceResolutionLoader
|
|
100581
|
+
);
|
|
100539
100582
|
}
|
|
100540
100583
|
const packageIdToSourceFile = /* @__PURE__ */ new Map();
|
|
100541
100584
|
let sourceFileToPackageName = /* @__PURE__ */ new Map();
|
|
@@ -100548,7 +100591,7 @@ ${lanes.join("\n")}
|
|
|
100548
100591
|
let projectReferenceRedirects;
|
|
100549
100592
|
let mapFromFileToProjectReferenceRedirects;
|
|
100550
100593
|
let mapFromToProjectReferenceRedirectSource;
|
|
100551
|
-
const useSourceOfProjectReferenceRedirect = !!((
|
|
100594
|
+
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
|
|
100552
100595
|
const { onProgramCreateComplete, fileExists, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
100553
100596
|
compilerHost: host,
|
|
100554
100597
|
getSymlinkCache,
|
|
@@ -100559,13 +100602,13 @@ ${lanes.join("\n")}
|
|
|
100559
100602
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
100560
100603
|
});
|
|
100561
100604
|
const readFile = host.readFile.bind(host);
|
|
100562
|
-
(
|
|
100605
|
+
(_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
100563
100606
|
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
100564
|
-
(
|
|
100607
|
+
(_f = tracing) == null ? void 0 : _f.pop();
|
|
100565
100608
|
let structureIsReused;
|
|
100566
|
-
(
|
|
100609
|
+
(_g = tracing) == null ? void 0 : _g.push(tracing.Phase.Program, "tryReuseStructureFromOldProgram", {});
|
|
100567
100610
|
structureIsReused = tryReuseStructureFromOldProgram();
|
|
100568
|
-
(
|
|
100611
|
+
(_h = tracing) == null ? void 0 : _h.pop();
|
|
100569
100612
|
if (structureIsReused !== 2 /* Completely */) {
|
|
100570
100613
|
processingDefaultLibFiles = [];
|
|
100571
100614
|
processingOtherFiles = [];
|
|
@@ -100599,19 +100642,30 @@ ${lanes.join("\n")}
|
|
|
100599
100642
|
});
|
|
100600
100643
|
}
|
|
100601
100644
|
}
|
|
100602
|
-
(
|
|
100645
|
+
(_i = tracing) == null ? void 0 : _i.push(tracing.Phase.Program, "processRootFiles", { count: rootNames.length });
|
|
100603
100646
|
forEach(rootNames, (name, index) => processRootFile(name, false, false, { kind: 0 /* RootFile */, index }));
|
|
100604
|
-
(
|
|
100605
|
-
|
|
100606
|
-
|
|
100607
|
-
|
|
100647
|
+
(_j = tracing) == null ? void 0 : _j.pop();
|
|
100648
|
+
automaticTypeDirectiveNames != null ? automaticTypeDirectiveNames : automaticTypeDirectiveNames = rootNames.length ? getAutomaticTypeDirectiveNames(options, host) : emptyArray;
|
|
100649
|
+
automaticTypeDirectiveResolutions = createModeAwareCache();
|
|
100650
|
+
if (automaticTypeDirectiveNames.length) {
|
|
100651
|
+
(_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
100608
100652
|
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
|
|
100609
100653
|
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
100610
|
-
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(
|
|
100611
|
-
for (let i = 0; i <
|
|
100612
|
-
|
|
100654
|
+
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
|
|
100655
|
+
for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
100656
|
+
automaticTypeDirectiveResolutions.set(automaticTypeDirectiveNames[i], void 0, resolutions[i]);
|
|
100657
|
+
processTypeReferenceDirective(
|
|
100658
|
+
automaticTypeDirectiveNames[i],
|
|
100659
|
+
void 0,
|
|
100660
|
+
resolutions[i],
|
|
100661
|
+
{
|
|
100662
|
+
kind: 8 /* AutomaticTypeDirectiveFile */,
|
|
100663
|
+
typeReference: automaticTypeDirectiveNames[i],
|
|
100664
|
+
packageId: (_m = (_l = resolutions[i]) == null ? void 0 : _l.resolvedTypeReferenceDirective) == null ? void 0 : _m.packageId
|
|
100665
|
+
}
|
|
100666
|
+
);
|
|
100613
100667
|
}
|
|
100614
|
-
(
|
|
100668
|
+
(_n = tracing) == null ? void 0 : _n.pop();
|
|
100615
100669
|
}
|
|
100616
100670
|
if (rootNames.length && !skipDefaultLib) {
|
|
100617
100671
|
const defaultLibraryFileName = getDefaultLibraryFileName();
|
|
@@ -100658,7 +100712,6 @@ ${lanes.join("\n")}
|
|
|
100658
100712
|
}
|
|
100659
100713
|
);
|
|
100660
100714
|
}
|
|
100661
|
-
typeReferenceDirectiveResolutionCache = void 0;
|
|
100662
100715
|
oldProgram = void 0;
|
|
100663
100716
|
const program = {
|
|
100664
100717
|
getRootFileNames: () => rootNames,
|
|
@@ -100691,6 +100744,8 @@ ${lanes.join("\n")}
|
|
|
100691
100744
|
getRelationCacheSizes: () => getTypeChecker().getRelationCacheSizes(),
|
|
100692
100745
|
getFileProcessingDiagnostics: () => fileProcessingDiagnostics,
|
|
100693
100746
|
getResolvedTypeReferenceDirectives: () => resolvedTypeReferenceDirectives,
|
|
100747
|
+
getAutomaticTypeDirectiveNames: () => automaticTypeDirectiveNames,
|
|
100748
|
+
getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
|
|
100694
100749
|
isSourceFileFromExternalLibrary,
|
|
100695
100750
|
isSourceFileDefaultLibrary,
|
|
100696
100751
|
getSourceFileFromReference,
|
|
@@ -100700,7 +100755,6 @@ ${lanes.join("\n")}
|
|
|
100700
100755
|
usesUriStyleNodeCoreModules,
|
|
100701
100756
|
isEmittedFile,
|
|
100702
100757
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
|
|
100703
|
-
getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
100704
100758
|
getProjectReferences,
|
|
100705
100759
|
getResolvedProjectReferences,
|
|
100706
100760
|
getProjectReferenceRedirect,
|
|
@@ -100713,7 +100767,7 @@ ${lanes.join("\n")}
|
|
|
100713
100767
|
readFile,
|
|
100714
100768
|
directoryExists,
|
|
100715
100769
|
getSymlinkCache,
|
|
100716
|
-
realpath: (
|
|
100770
|
+
realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
|
|
100717
100771
|
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
|
100718
100772
|
getFileIncludeReasons: () => fileReasons,
|
|
100719
100773
|
structureIsReused,
|
|
@@ -100727,6 +100781,8 @@ ${lanes.join("\n")}
|
|
|
100727
100781
|
case 0 /* FilePreprocessingReferencedDiagnostic */:
|
|
100728
100782
|
const { file, pos, end } = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason);
|
|
100729
100783
|
return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
|
|
100784
|
+
case 2 /* ResolutionDiagnostics */:
|
|
100785
|
+
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
|
100730
100786
|
default:
|
|
100731
100787
|
Debug.assertNever(diagnostic);
|
|
100732
100788
|
}
|
|
@@ -100734,32 +100790,30 @@ ${lanes.join("\n")}
|
|
|
100734
100790
|
verifyCompilerOptions();
|
|
100735
100791
|
mark("afterProgram");
|
|
100736
100792
|
measure("Program", "beforeProgram", "afterProgram");
|
|
100737
|
-
(
|
|
100793
|
+
(_p = tracing) == null ? void 0 : _p.pop();
|
|
100738
100794
|
return program;
|
|
100739
|
-
function addResolutionDiagnostics(
|
|
100740
|
-
|
|
100795
|
+
function addResolutionDiagnostics(resolution) {
|
|
100796
|
+
var _a3;
|
|
100797
|
+
if (!((_a3 = resolution.resolutionDiagnostics) == null ? void 0 : _a3.length))
|
|
100741
100798
|
return;
|
|
100742
|
-
|
|
100743
|
-
|
|
100744
|
-
|
|
100799
|
+
(fileProcessingDiagnostics != null ? fileProcessingDiagnostics : fileProcessingDiagnostics = []).push({
|
|
100800
|
+
kind: 2 /* ResolutionDiagnostics */,
|
|
100801
|
+
diagnostics: resolution.resolutionDiagnostics
|
|
100802
|
+
});
|
|
100745
100803
|
}
|
|
100746
|
-
function
|
|
100747
|
-
|
|
100748
|
-
|
|
100804
|
+
function addResolutionDiagnosticsFromResolutionOrCache(containingFile, name, resolution, mode) {
|
|
100805
|
+
if (host.resolveModuleNameLiterals || !host.resolveModuleNames)
|
|
100806
|
+
return addResolutionDiagnostics(resolution);
|
|
100807
|
+
if (!moduleResolutionCache || isExternalModuleNameRelative(name))
|
|
100749
100808
|
return;
|
|
100750
100809
|
const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
100751
100810
|
const containingDir = getDirectoryPath(containingFileName);
|
|
100752
100811
|
const redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
100753
|
-
|
|
100754
|
-
|
|
100755
|
-
|
|
100756
|
-
if (isExternalModuleNameRelative(name))
|
|
100757
|
-
continue;
|
|
100758
|
-
const diags = (_a3 = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) == null ? void 0 : _a3.resolutionDiagnostics;
|
|
100759
|
-
addResolutionDiagnostics(diags);
|
|
100760
|
-
}
|
|
100812
|
+
const fromCache = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir);
|
|
100813
|
+
if (fromCache)
|
|
100814
|
+
addResolutionDiagnostics(fromCache);
|
|
100761
100815
|
}
|
|
100762
|
-
function resolveModuleNamesWorker(moduleNames, containingFile,
|
|
100816
|
+
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
100763
100817
|
var _a3, _b2;
|
|
100764
100818
|
if (!moduleNames.length)
|
|
100765
100819
|
return emptyArray;
|
|
@@ -100767,23 +100821,22 @@ ${lanes.join("\n")}
|
|
|
100767
100821
|
const redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
100768
100822
|
(_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName });
|
|
100769
100823
|
mark("beforeResolveModule");
|
|
100770
|
-
const result = actualResolveModuleNamesWorker(moduleNames,
|
|
100824
|
+
const result = actualResolveModuleNamesWorker(moduleNames, containingFileName, redirectedReference, options, containingFile, reusedNames);
|
|
100771
100825
|
mark("afterResolveModule");
|
|
100772
100826
|
measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
100773
100827
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
100774
|
-
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
100775
100828
|
return result;
|
|
100776
100829
|
}
|
|
100777
|
-
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile,
|
|
100830
|
+
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, reusedNames) {
|
|
100778
100831
|
var _a3, _b2;
|
|
100779
100832
|
if (!typeDirectiveNames.length)
|
|
100780
100833
|
return [];
|
|
100834
|
+
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
100781
100835
|
const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
100782
|
-
const redirectedReference =
|
|
100783
|
-
const containingFileMode = !isString(containingFile) ? containingFile.impliedNodeFormat : void 0;
|
|
100836
|
+
const redirectedReference = containingSourceFile && getRedirectReferenceForResolution(containingSourceFile);
|
|
100784
100837
|
(_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName });
|
|
100785
100838
|
mark("beforeResolveTypeReference");
|
|
100786
|
-
const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference,
|
|
100839
|
+
const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, options, containingSourceFile, reusedNames);
|
|
100787
100840
|
mark("afterResolveTypeReference");
|
|
100788
100841
|
measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
100789
100842
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
@@ -100829,9 +100882,6 @@ ${lanes.join("\n")}
|
|
|
100829
100882
|
}
|
|
100830
100883
|
return libs.length + 2;
|
|
100831
100884
|
}
|
|
100832
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
|
|
100833
|
-
return moduleResolutionCache && resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
|
|
100834
|
-
}
|
|
100835
100885
|
function toPath3(fileName) {
|
|
100836
100886
|
return toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
100837
100887
|
}
|
|
@@ -100860,6 +100910,7 @@ ${lanes.join("\n")}
|
|
|
100860
100910
|
return classifiableNames;
|
|
100861
100911
|
}
|
|
100862
100912
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
100913
|
+
var _a3;
|
|
100863
100914
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
100864
100915
|
return resolveModuleNamesWorker(moduleNames, file, void 0);
|
|
100865
100916
|
}
|
|
@@ -100875,24 +100926,24 @@ ${lanes.join("\n")}
|
|
|
100875
100926
|
let unknownModuleNames;
|
|
100876
100927
|
let result;
|
|
100877
100928
|
let reusedNames;
|
|
100878
|
-
const predictedToResolveToAmbientModuleMarker =
|
|
100929
|
+
const predictedToResolveToAmbientModuleMarker = emptyResolution;
|
|
100879
100930
|
for (let i = 0; i < moduleNames.length; i++) {
|
|
100880
100931
|
const moduleName = moduleNames[i];
|
|
100881
100932
|
if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) {
|
|
100882
100933
|
const mode = getModeForUsageLocation(file, moduleName);
|
|
100883
|
-
const
|
|
100884
|
-
if (
|
|
100934
|
+
const oldResolution = (_a3 = oldSourceFile.resolvedModules) == null ? void 0 : _a3.get(moduleName.text, mode);
|
|
100935
|
+
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
100885
100936
|
if (isTraceEnabled(options, host)) {
|
|
100886
100937
|
trace(
|
|
100887
100938
|
host,
|
|
100888
|
-
|
|
100939
|
+
oldResolution.resolvedModule.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,
|
|
100889
100940
|
moduleName.text,
|
|
100890
100941
|
getNormalizedAbsolutePath(file.originalFileName, currentDirectory),
|
|
100891
|
-
|
|
100892
|
-
|
|
100942
|
+
oldResolution.resolvedModule.resolvedFileName,
|
|
100943
|
+
oldResolution.resolvedModule.packageId && packageIdToString(oldResolution.resolvedModule.packageId)
|
|
100893
100944
|
);
|
|
100894
100945
|
}
|
|
100895
|
-
(result != null ? result : result = new Array(moduleNames.length))[i] =
|
|
100946
|
+
(result != null ? result : result = new Array(moduleNames.length))[i] = oldResolution;
|
|
100896
100947
|
(reusedNames != null ? reusedNames : reusedNames = []).push(moduleName);
|
|
100897
100948
|
continue;
|
|
100898
100949
|
}
|
|
@@ -100912,18 +100963,14 @@ ${lanes.join("\n")}
|
|
|
100912
100963
|
(unknownModuleNames != null ? unknownModuleNames : unknownModuleNames = []).push(moduleName);
|
|
100913
100964
|
}
|
|
100914
100965
|
}
|
|
100915
|
-
const resolutions = unknownModuleNames && unknownModuleNames.length ? resolveModuleNamesWorker(unknownModuleNames, file,
|
|
100966
|
+
const resolutions = unknownModuleNames && unknownModuleNames.length ? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames) : emptyArray;
|
|
100916
100967
|
if (!result) {
|
|
100917
100968
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
100918
100969
|
return resolutions;
|
|
100919
100970
|
}
|
|
100920
100971
|
let j = 0;
|
|
100921
100972
|
for (let i = 0; i < result.length; i++) {
|
|
100922
|
-
if (result[i]) {
|
|
100923
|
-
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
100924
|
-
result[i] = void 0;
|
|
100925
|
-
}
|
|
100926
|
-
} else {
|
|
100973
|
+
if (!result[i]) {
|
|
100927
100974
|
result[i] = resolutions[j];
|
|
100928
100975
|
j++;
|
|
100929
100976
|
}
|
|
@@ -100947,6 +100994,7 @@ ${lanes.join("\n")}
|
|
|
100947
100994
|
}
|
|
100948
100995
|
}
|
|
100949
100996
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
100997
|
+
var _a3;
|
|
100950
100998
|
if (structureIsReused === 0 /* Not */) {
|
|
100951
100999
|
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, void 0);
|
|
100952
101000
|
}
|
|
@@ -100955,7 +101003,7 @@ ${lanes.join("\n")}
|
|
|
100955
101003
|
if (oldSourceFile !== containingFile && containingFile.resolvedTypeReferenceDirectiveNames) {
|
|
100956
101004
|
const result2 = [];
|
|
100957
101005
|
for (const typeDirectiveName of typeDirectiveNames) {
|
|
100958
|
-
const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(
|
|
101006
|
+
const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getTypeReferenceResolutionName(typeDirectiveName), getModeForFileReference(typeDirectiveName, containingFile.impliedNodeFormat));
|
|
100959
101007
|
result2.push(resolvedTypeReferenceDirective);
|
|
100960
101008
|
}
|
|
100961
101009
|
return result2;
|
|
@@ -100969,21 +101017,21 @@ ${lanes.join("\n")}
|
|
|
100969
101017
|
for (let i = 0; i < typeDirectiveNames.length; i++) {
|
|
100970
101018
|
const entry = typeDirectiveNames[i];
|
|
100971
101019
|
if (canReuseResolutions) {
|
|
100972
|
-
const typeDirectiveName =
|
|
101020
|
+
const typeDirectiveName = getTypeReferenceResolutionName(entry);
|
|
100973
101021
|
const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
100974
|
-
const
|
|
100975
|
-
if (
|
|
101022
|
+
const oldResolution = (_a3 = !isString(containingFile) ? oldSourceFile == null ? void 0 : oldSourceFile.resolvedTypeReferenceDirectiveNames : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a3.get(typeDirectiveName, mode);
|
|
101023
|
+
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
100976
101024
|
if (isTraceEnabled(options, host)) {
|
|
100977
101025
|
trace(
|
|
100978
101026
|
host,
|
|
100979
|
-
|
|
101027
|
+
oldResolution.resolvedTypeReferenceDirective.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2,
|
|
100980
101028
|
typeDirectiveName,
|
|
100981
101029
|
!isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile,
|
|
100982
|
-
|
|
100983
|
-
|
|
101030
|
+
oldResolution.resolvedTypeReferenceDirective.resolvedFileName,
|
|
101031
|
+
oldResolution.resolvedTypeReferenceDirective.packageId && packageIdToString(oldResolution.resolvedTypeReferenceDirective.packageId)
|
|
100984
101032
|
);
|
|
100985
101033
|
}
|
|
100986
|
-
(result != null ? result : result = new Array(typeDirectiveNames.length))[i] =
|
|
101034
|
+
(result != null ? result : result = new Array(typeDirectiveNames.length))[i] = oldResolution;
|
|
100987
101035
|
(reusedNames != null ? reusedNames : reusedNames = []).push(entry);
|
|
100988
101036
|
continue;
|
|
100989
101037
|
}
|
|
@@ -100995,7 +101043,7 @@ ${lanes.join("\n")}
|
|
|
100995
101043
|
const resolutions = resolveTypeReferenceDirectiveNamesWorker(
|
|
100996
101044
|
unknownTypeReferenceDirectiveNames,
|
|
100997
101045
|
containingFile,
|
|
100998
|
-
|
|
101046
|
+
reusedNames
|
|
100999
101047
|
);
|
|
101000
101048
|
if (!result) {
|
|
101001
101049
|
Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
@@ -101031,7 +101079,7 @@ ${lanes.join("\n")}
|
|
|
101031
101079
|
);
|
|
101032
101080
|
}
|
|
101033
101081
|
function tryReuseStructureFromOldProgram() {
|
|
101034
|
-
var _a3
|
|
101082
|
+
var _a3;
|
|
101035
101083
|
if (!oldProgram) {
|
|
101036
101084
|
return 0 /* Not */;
|
|
101037
101085
|
}
|
|
@@ -101141,19 +101189,19 @@ ${lanes.join("\n")}
|
|
|
101141
101189
|
for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
|
|
101142
101190
|
const moduleNames = getModuleNames(newSourceFile);
|
|
101143
101191
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
101144
|
-
const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo);
|
|
101192
|
+
const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
|
|
101145
101193
|
if (resolutionsChanged) {
|
|
101146
101194
|
structureIsReused = 1 /* SafeModules */;
|
|
101147
|
-
newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
|
|
101195
|
+
newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions, moduleResolutionNameAndModeGetter);
|
|
101148
101196
|
} else {
|
|
101149
101197
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
101150
101198
|
}
|
|
101151
101199
|
const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
101152
101200
|
const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
101153
|
-
const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo);
|
|
101201
|
+
const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
|
|
101154
101202
|
if (typeReferenceResolutionsChanged) {
|
|
101155
101203
|
structureIsReused = 1 /* SafeModules */;
|
|
101156
|
-
newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
101204
|
+
newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions, typeReferenceResolutionNameAndModeGetter);
|
|
101157
101205
|
} else {
|
|
101158
101206
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
101159
101207
|
}
|
|
@@ -101161,9 +101209,17 @@ ${lanes.join("\n")}
|
|
|
101161
101209
|
if (structureIsReused !== 2 /* Completely */) {
|
|
101162
101210
|
return structureIsReused;
|
|
101163
101211
|
}
|
|
101164
|
-
if (changesAffectingProgramStructure(oldOptions, options)
|
|
101212
|
+
if (changesAffectingProgramStructure(oldOptions, options)) {
|
|
101165
101213
|
return 1 /* SafeModules */;
|
|
101166
101214
|
}
|
|
101215
|
+
if (host.hasChangedAutomaticTypeDirectiveNames) {
|
|
101216
|
+
if (host.hasChangedAutomaticTypeDirectiveNames())
|
|
101217
|
+
return 1 /* SafeModules */;
|
|
101218
|
+
} else {
|
|
101219
|
+
automaticTypeDirectiveNames = getAutomaticTypeDirectiveNames(options, host);
|
|
101220
|
+
if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
101221
|
+
return 1 /* SafeModules */;
|
|
101222
|
+
}
|
|
101167
101223
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
101168
101224
|
Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
101169
101225
|
for (const newSourceFile of newSourceFiles) {
|
|
@@ -101187,6 +101243,8 @@ ${lanes.join("\n")}
|
|
|
101187
101243
|
fileReasons = oldProgram.getFileIncludeReasons();
|
|
101188
101244
|
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
|
101189
101245
|
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
|
|
101246
|
+
automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
|
|
101247
|
+
automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
|
|
101190
101248
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
101191
101249
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
101192
101250
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
@@ -102130,7 +102188,8 @@ ${lanes.join("\n")}
|
|
|
102130
102188
|
}
|
|
102131
102189
|
function processTypeReferenceDirectives(file) {
|
|
102132
102190
|
const typeDirectives = file.typeReferenceDirectives;
|
|
102133
|
-
if (!typeDirectives) {
|
|
102191
|
+
if (!typeDirectives.length) {
|
|
102192
|
+
file.resolvedTypeReferenceDirectiveNames = void 0;
|
|
102134
102193
|
return;
|
|
102135
102194
|
}
|
|
102136
102195
|
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
|
|
@@ -102141,23 +102200,31 @@ ${lanes.join("\n")}
|
|
|
102141
102200
|
setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective, getModeForFileReference(ref, file.impliedNodeFormat));
|
|
102142
102201
|
const mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
102143
102202
|
if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
|
|
102144
|
-
|
|
102203
|
+
(fileProcessingDiagnostics != null ? fileProcessingDiagnostics : fileProcessingDiagnostics = []).push({
|
|
102204
|
+
kind: 2 /* ResolutionDiagnostics */,
|
|
102205
|
+
diagnostics: [
|
|
102206
|
+
createDiagnosticForRange(file, ref, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)
|
|
102207
|
+
]
|
|
102208
|
+
});
|
|
102145
102209
|
}
|
|
102146
102210
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
102147
102211
|
}
|
|
102148
102212
|
}
|
|
102149
|
-
function processTypeReferenceDirective(typeReferenceDirective, mode,
|
|
102213
|
+
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
102150
102214
|
var _a3, _b2;
|
|
102151
|
-
(_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 });
|
|
102152
|
-
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
102215
|
+
(_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 });
|
|
102216
|
+
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason);
|
|
102153
102217
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
102154
102218
|
}
|
|
102155
|
-
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
102156
|
-
|
|
102219
|
+
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason) {
|
|
102220
|
+
var _a3;
|
|
102221
|
+
addResolutionDiagnostics(resolution);
|
|
102222
|
+
const previousResolution = (_a3 = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode)) == null ? void 0 : _a3.resolvedTypeReferenceDirective;
|
|
102157
102223
|
if (previousResolution && previousResolution.primary) {
|
|
102158
102224
|
return;
|
|
102159
102225
|
}
|
|
102160
102226
|
let saveResolution = true;
|
|
102227
|
+
const { resolvedTypeReferenceDirective } = resolution;
|
|
102161
102228
|
if (resolvedTypeReferenceDirective) {
|
|
102162
102229
|
if (resolvedTypeReferenceDirective.isExternalLibraryImport)
|
|
102163
102230
|
currentNodeModulesDepth++;
|
|
@@ -102188,7 +102255,7 @@ ${lanes.join("\n")}
|
|
|
102188
102255
|
addFilePreprocessingFileExplainingDiagnostic(void 0, reason, Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
|
|
102189
102256
|
}
|
|
102190
102257
|
if (saveResolution) {
|
|
102191
|
-
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode,
|
|
102258
|
+
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolution);
|
|
102192
102259
|
}
|
|
102193
102260
|
}
|
|
102194
102261
|
function pathForLibFile(libFileName) {
|
|
@@ -102237,8 +102304,11 @@ ${lanes.join("\n")}
|
|
|
102237
102304
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
102238
102305
|
const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a3 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a3.commandLine.options : void 0) || options;
|
|
102239
102306
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
102240
|
-
const resolution = resolutions[index];
|
|
102241
|
-
|
|
102307
|
+
const resolution = resolutions[index].resolvedModule;
|
|
102308
|
+
const moduleName = moduleNames[index].text;
|
|
102309
|
+
const mode = getModeForUsageLocation(file, moduleNames[index]);
|
|
102310
|
+
setResolvedModule(file, moduleName, resolutions[index], mode);
|
|
102311
|
+
addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
|
|
102242
102312
|
if (!resolution) {
|
|
102243
102313
|
continue;
|
|
102244
102314
|
}
|
|
@@ -102879,8 +102949,8 @@ ${lanes.join("\n")}
|
|
|
102879
102949
|
if (!symlinks) {
|
|
102880
102950
|
symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
102881
102951
|
}
|
|
102882
|
-
if (files &&
|
|
102883
|
-
symlinks.setSymlinksFromResolutions(files,
|
|
102952
|
+
if (files && automaticTypeDirectiveResolutions && !symlinks.hasProcessedResolutions()) {
|
|
102953
|
+
symlinks.setSymlinksFromResolutions(files, automaticTypeDirectiveResolutions);
|
|
102884
102954
|
}
|
|
102885
102955
|
return symlinks;
|
|
102886
102956
|
}
|
|
@@ -103123,7 +103193,7 @@ ${lanes.join("\n")}
|
|
|
103123
103193
|
}
|
|
103124
103194
|
Debug.fail("should never ask for module name at index higher than possible module name");
|
|
103125
103195
|
}
|
|
103126
|
-
var ForegroundColorEscapeSequences, gutterStyleSequence, gutterSeparator, resetEscapeSequence, ellipsis, halfIndent, indent, inferredTypesContainingFile, plainJSErrors, emitSkippedWithNoDiagnostics;
|
|
103196
|
+
var ForegroundColorEscapeSequences, gutterStyleSequence, gutterSeparator, resetEscapeSequence, ellipsis, halfIndent, indent, emptyResolution, moduleResolutionNameAndModeGetter, typeReferenceResolutionNameAndModeGetter, inferredTypesContainingFile, plainJSErrors, emitSkippedWithNoDiagnostics;
|
|
103127
103197
|
var init_program = __esm({
|
|
103128
103198
|
"src/compiler/program.ts"() {
|
|
103129
103199
|
"use strict";
|
|
@@ -103144,6 +103214,18 @@ ${lanes.join("\n")}
|
|
|
103144
103214
|
ellipsis = "...";
|
|
103145
103215
|
halfIndent = " ";
|
|
103146
103216
|
indent = " ";
|
|
103217
|
+
emptyResolution = {
|
|
103218
|
+
resolvedModule: void 0,
|
|
103219
|
+
resolvedTypeReferenceDirective: void 0
|
|
103220
|
+
};
|
|
103221
|
+
moduleResolutionNameAndModeGetter = {
|
|
103222
|
+
getName: getModuleResolutionName,
|
|
103223
|
+
getMode: (entry, file) => getModeForUsageLocation(file, entry)
|
|
103224
|
+
};
|
|
103225
|
+
typeReferenceResolutionNameAndModeGetter = {
|
|
103226
|
+
getName: getTypeReferenceResolutionName,
|
|
103227
|
+
getMode: (entry, file) => getModeForFileReference(entry, file == null ? void 0 : file.impliedNodeFormat)
|
|
103228
|
+
};
|
|
103147
103229
|
inferredTypesContainingFile = "__inferred type names__.ts";
|
|
103148
103230
|
plainJSErrors = /* @__PURE__ */ new Set([
|
|
103149
103231
|
Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
|
|
@@ -103350,7 +103432,7 @@ ${lanes.join("\n")}
|
|
|
103350
103432
|
}
|
|
103351
103433
|
}
|
|
103352
103434
|
if (sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
103353
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.forEach((resolvedTypeReferenceDirective) => {
|
|
103435
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
|
|
103354
103436
|
if (!resolvedTypeReferenceDirective) {
|
|
103355
103437
|
return;
|
|
103356
103438
|
}
|
|
@@ -104900,9 +104982,9 @@ ${lanes.join("\n")}
|
|
|
104900
104982
|
finishRecordingFilesWithChangedResolutions,
|
|
104901
104983
|
startCachingPerDirectoryResolution,
|
|
104902
104984
|
finishCachingPerDirectoryResolution,
|
|
104903
|
-
|
|
104904
|
-
|
|
104905
|
-
|
|
104985
|
+
resolveModuleNameLiterals,
|
|
104986
|
+
resolveTypeReferenceDirectiveReferences,
|
|
104987
|
+
resolveSingleModuleNameWithoutWatching,
|
|
104906
104988
|
removeResolutionsFromProjectReferenceRedirects,
|
|
104907
104989
|
removeResolutionsOfFile,
|
|
104908
104990
|
hasChangedAutomaticTypeDirectiveNames: () => hasChangedAutomaticTypeDirectiveNames,
|
|
@@ -105020,14 +105102,16 @@ ${lanes.join("\n")}
|
|
|
105020
105102
|
});
|
|
105021
105103
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
105022
105104
|
}
|
|
105023
|
-
function resolveModuleName2(moduleName, containingFile, compilerOptions,
|
|
105105
|
+
function resolveModuleName2(moduleName, containingFile, compilerOptions, redirectedReference, mode) {
|
|
105106
|
+
var _a2;
|
|
105107
|
+
const host = ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost;
|
|
105024
105108
|
const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
105025
105109
|
if (!resolutionHost.getGlobalCache) {
|
|
105026
105110
|
return primaryResult;
|
|
105027
105111
|
}
|
|
105028
105112
|
const globalCache = resolutionHost.getGlobalCache();
|
|
105029
105113
|
if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
105030
|
-
const { resolvedModule, failedLookupLocations, affectingLocations } = loadModuleFromGlobalCache(
|
|
105114
|
+
const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
|
|
105031
105115
|
Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
|
|
105032
105116
|
resolutionHost.projectName,
|
|
105033
105117
|
compilerOptions,
|
|
@@ -105037,49 +105121,55 @@ ${lanes.join("\n")}
|
|
|
105037
105121
|
);
|
|
105038
105122
|
if (resolvedModule) {
|
|
105039
105123
|
primaryResult.resolvedModule = resolvedModule;
|
|
105040
|
-
primaryResult.failedLookupLocations.
|
|
105041
|
-
primaryResult.affectingLocations.
|
|
105124
|
+
primaryResult.failedLookupLocations = updateResolutionField(primaryResult.failedLookupLocations, failedLookupLocations);
|
|
105125
|
+
primaryResult.affectingLocations = updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
105126
|
+
primaryResult.resolutionDiagnostics = updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
105042
105127
|
return primaryResult;
|
|
105043
105128
|
}
|
|
105044
105129
|
}
|
|
105045
105130
|
return primaryResult;
|
|
105046
105131
|
}
|
|
105047
|
-
function
|
|
105048
|
-
return
|
|
105132
|
+
function createModuleResolutionLoader2(containingFile, redirectedReference, options) {
|
|
105133
|
+
return {
|
|
105134
|
+
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
105135
|
+
resolve: (moduleName, resoluionMode) => resolveModuleName2(
|
|
105136
|
+
moduleName,
|
|
105137
|
+
containingFile,
|
|
105138
|
+
options,
|
|
105139
|
+
redirectedReference,
|
|
105140
|
+
resoluionMode
|
|
105141
|
+
)
|
|
105142
|
+
};
|
|
105049
105143
|
}
|
|
105050
105144
|
function resolveNamesWithLocalCache({
|
|
105051
|
-
|
|
105145
|
+
entries,
|
|
105052
105146
|
containingFile,
|
|
105147
|
+
containingSourceFile,
|
|
105053
105148
|
redirectedReference,
|
|
105149
|
+
options,
|
|
105054
105150
|
perFileCache,
|
|
105151
|
+
reusedNames,
|
|
105055
105152
|
loader,
|
|
105056
105153
|
getResolutionWithResolvedFileName,
|
|
105057
105154
|
shouldRetryResolution,
|
|
105058
|
-
|
|
105059
|
-
resolutionInfo,
|
|
105060
|
-
logChanges,
|
|
105061
|
-
containingSourceFile,
|
|
105062
|
-
containingSourceFileMode
|
|
105155
|
+
logChanges
|
|
105063
105156
|
}) {
|
|
105064
|
-
var _a2
|
|
105157
|
+
var _a2;
|
|
105065
105158
|
const path = resolutionHost.toPath(containingFile);
|
|
105066
105159
|
const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
|
|
105067
105160
|
const resolvedModules = [];
|
|
105068
|
-
const compilerOptions = resolutionHost.getCompilationSettings();
|
|
105069
105161
|
const hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
105070
105162
|
const program = resolutionHost.getCurrentProgram();
|
|
105071
105163
|
const oldRedirect = program && program.getResolvedProjectReferenceToRedirect(containingFile);
|
|
105072
105164
|
const unmatchedRedirects = oldRedirect ? !redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path : !!redirectedReference;
|
|
105073
105165
|
const seenNamesInFile = createModeAwareCache();
|
|
105074
|
-
|
|
105075
|
-
|
|
105076
|
-
const
|
|
105077
|
-
const mode = !isString(entry) ? isStringLiteralLike(entry) ? getModeForUsageLocation(containingSourceFile, entry) : getModeForFileReference(entry, containingSourceFileMode) : containingSourceFile ? getModeForResolutionAtIndex(containingSourceFile, i) : void 0;
|
|
105078
|
-
i++;
|
|
105166
|
+
for (const entry of entries) {
|
|
105167
|
+
const name = loader.nameAndMode.getName(entry);
|
|
105168
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
105079
105169
|
let resolution = resolutionsInFile.get(name, mode);
|
|
105080
105170
|
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
105081
105171
|
const existingResolution = resolution;
|
|
105082
|
-
resolution = loader(name,
|
|
105172
|
+
resolution = loader.resolve(name, mode);
|
|
105083
105173
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
105084
105174
|
resolutionHost.onDiscoveredSymlink();
|
|
105085
105175
|
}
|
|
@@ -105093,12 +105183,12 @@ ${lanes.join("\n")}
|
|
|
105093
105183
|
logChanges = false;
|
|
105094
105184
|
}
|
|
105095
105185
|
} else {
|
|
105096
|
-
const host = ((
|
|
105097
|
-
if (isTraceEnabled(
|
|
105186
|
+
const host = ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost;
|
|
105187
|
+
if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) {
|
|
105098
105188
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
105099
105189
|
trace(
|
|
105100
105190
|
host,
|
|
105101
|
-
|
|
105191
|
+
perFileCache === resolvedModuleNames ? (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 : (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved,
|
|
105102
105192
|
name,
|
|
105103
105193
|
containingFile,
|
|
105104
105194
|
resolved == null ? void 0 : resolved.resolvedFileName,
|
|
@@ -105108,19 +105198,16 @@ ${lanes.join("\n")}
|
|
|
105108
105198
|
}
|
|
105109
105199
|
Debug.assert(resolution !== void 0 && !resolution.isInvalidated);
|
|
105110
105200
|
seenNamesInFile.set(name, mode, true);
|
|
105111
|
-
resolvedModules.push(
|
|
105112
|
-
}
|
|
105113
|
-
if (resolutionInfo && (loader === resolveTypeReferenceDirective2 || containingSourceFile)) {
|
|
105114
|
-
(_c = resolutionInfo.reusedNames) == null ? void 0 : _c.forEach((entry) => seenNamesInFile.set(
|
|
105115
|
-
getResolutionName(entry),
|
|
105116
|
-
!isString(entry) && isStringLiteralLike(entry) ? getModeForUsageLocation(containingSourceFile, entry) : getModeForFileReference(entry, containingSourceFileMode),
|
|
105117
|
-
true
|
|
105118
|
-
));
|
|
105119
|
-
reusedNames = void 0;
|
|
105201
|
+
resolvedModules.push(resolution);
|
|
105120
105202
|
}
|
|
105203
|
+
reusedNames == null ? void 0 : reusedNames.forEach((entry) => seenNamesInFile.set(
|
|
105204
|
+
loader.nameAndMode.getName(entry),
|
|
105205
|
+
loader.nameAndMode.getMode(entry, containingSourceFile),
|
|
105206
|
+
true
|
|
105207
|
+
));
|
|
105121
105208
|
if (resolutionsInFile.size() !== seenNamesInFile.size()) {
|
|
105122
105209
|
resolutionsInFile.forEach((resolution, name, mode) => {
|
|
105123
|
-
if (!seenNamesInFile.has(name, mode)
|
|
105210
|
+
if (!seenNamesInFile.has(name, mode)) {
|
|
105124
105211
|
stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
105125
105212
|
resolutionsInFile.delete(name, mode);
|
|
105126
105213
|
}
|
|
@@ -105145,39 +105232,53 @@ ${lanes.join("\n")}
|
|
|
105145
105232
|
return oldResult.resolvedFileName === newResult.resolvedFileName;
|
|
105146
105233
|
}
|
|
105147
105234
|
}
|
|
105148
|
-
function
|
|
105235
|
+
function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
105236
|
+
var _a2;
|
|
105149
105237
|
return resolveNamesWithLocalCache({
|
|
105150
|
-
|
|
105238
|
+
entries: typeDirectiveReferences,
|
|
105151
105239
|
containingFile,
|
|
105240
|
+
containingSourceFile,
|
|
105152
105241
|
redirectedReference,
|
|
105242
|
+
options,
|
|
105243
|
+
reusedNames,
|
|
105153
105244
|
perFileCache: resolvedTypeReferenceDirectives,
|
|
105154
|
-
loader:
|
|
105245
|
+
loader: createTypeReferenceResolutionLoader(
|
|
105246
|
+
containingFile,
|
|
105247
|
+
redirectedReference,
|
|
105248
|
+
options,
|
|
105249
|
+
((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost,
|
|
105250
|
+
typeReferenceDirectiveResolutionCache
|
|
105251
|
+
),
|
|
105155
105252
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective2,
|
|
105156
|
-
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0
|
|
105157
|
-
containingSourceFileMode: containingFileMode,
|
|
105158
|
-
resolutionInfo
|
|
105253
|
+
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0
|
|
105159
105254
|
});
|
|
105160
105255
|
}
|
|
105161
|
-
function
|
|
105256
|
+
function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
105162
105257
|
return resolveNamesWithLocalCache({
|
|
105163
|
-
|
|
105258
|
+
entries: moduleLiterals,
|
|
105164
105259
|
containingFile,
|
|
105260
|
+
containingSourceFile,
|
|
105165
105261
|
redirectedReference,
|
|
105262
|
+
options,
|
|
105263
|
+
reusedNames,
|
|
105166
105264
|
perFileCache: resolvedModuleNames,
|
|
105167
|
-
loader:
|
|
105265
|
+
loader: createModuleResolutionLoader2(
|
|
105266
|
+
containingFile,
|
|
105267
|
+
redirectedReference,
|
|
105268
|
+
options
|
|
105269
|
+
),
|
|
105168
105270
|
getResolutionWithResolvedFileName: getResolvedModule2,
|
|
105169
105271
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
105170
|
-
|
|
105171
|
-
resolutionInfo,
|
|
105172
|
-
logChanges: logChangesWhenResolvingModule,
|
|
105173
|
-
containingSourceFile
|
|
105272
|
+
logChanges: logChangesWhenResolvingModule
|
|
105174
105273
|
});
|
|
105175
105274
|
}
|
|
105176
|
-
function
|
|
105177
|
-
const
|
|
105178
|
-
|
|
105179
|
-
|
|
105180
|
-
|
|
105275
|
+
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
105276
|
+
const path = resolutionHost.toPath(containingFile);
|
|
105277
|
+
const resolutionsInFile = resolvedModuleNames.get(path);
|
|
105278
|
+
const resolution = resolutionsInFile == null ? void 0 : resolutionsInFile.get(moduleName, void 0);
|
|
105279
|
+
if (resolution && !resolution.isInvalidated)
|
|
105280
|
+
return resolution;
|
|
105281
|
+
return resolveModuleName2(moduleName, containingFile, resolutionHost.getCompilationSettings());
|
|
105181
105282
|
}
|
|
105182
105283
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
105183
105284
|
return endsWith(dirPath, "/node_modules/@types");
|
|
@@ -105256,37 +105357,39 @@ ${lanes.join("\n")}
|
|
|
105256
105357
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
105257
105358
|
Debug.assert(!!resolution.refCount);
|
|
105258
105359
|
const { failedLookupLocations, affectingLocations } = resolution;
|
|
105259
|
-
if (!failedLookupLocations.length && !affectingLocations.length)
|
|
105360
|
+
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length))
|
|
105260
105361
|
return;
|
|
105261
|
-
if (failedLookupLocations.length)
|
|
105362
|
+
if (failedLookupLocations == null ? void 0 : failedLookupLocations.length)
|
|
105262
105363
|
resolutionsWithFailedLookups.push(resolution);
|
|
105263
105364
|
let setAtRoot = false;
|
|
105264
|
-
|
|
105265
|
-
const
|
|
105266
|
-
|
|
105267
|
-
|
|
105268
|
-
|
|
105269
|
-
|
|
105270
|
-
|
|
105271
|
-
|
|
105272
|
-
|
|
105273
|
-
|
|
105274
|
-
|
|
105275
|
-
|
|
105276
|
-
|
|
105277
|
-
|
|
105365
|
+
if (failedLookupLocations) {
|
|
105366
|
+
for (const failedLookupLocation of failedLookupLocations) {
|
|
105367
|
+
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
105368
|
+
const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
105369
|
+
if (toWatch) {
|
|
105370
|
+
const { dir, dirPath, nonRecursive } = toWatch;
|
|
105371
|
+
if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
|
|
105372
|
+
const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
|
|
105373
|
+
customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
|
|
105374
|
+
}
|
|
105375
|
+
if (dirPath === rootPath) {
|
|
105376
|
+
Debug.assert(!nonRecursive);
|
|
105377
|
+
setAtRoot = true;
|
|
105378
|
+
} else {
|
|
105379
|
+
setDirectoryWatcher(dir, dirPath, nonRecursive);
|
|
105380
|
+
}
|
|
105278
105381
|
}
|
|
105279
105382
|
}
|
|
105383
|
+
if (setAtRoot) {
|
|
105384
|
+
setDirectoryWatcher(rootDir, rootPath, true);
|
|
105385
|
+
}
|
|
105280
105386
|
}
|
|
105281
|
-
|
|
105282
|
-
setDirectoryWatcher(rootDir, rootPath, true);
|
|
105283
|
-
}
|
|
105284
|
-
watchAffectingLocationsOfResolution(resolution, !failedLookupLocations.length);
|
|
105387
|
+
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length));
|
|
105285
105388
|
}
|
|
105286
105389
|
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
105287
105390
|
Debug.assert(!!resolution.refCount);
|
|
105288
105391
|
const { affectingLocations } = resolution;
|
|
105289
|
-
if (!affectingLocations.length)
|
|
105392
|
+
if (!(affectingLocations == null ? void 0 : affectingLocations.length))
|
|
105290
105393
|
return;
|
|
105291
105394
|
if (addToResolutionsWithOnlyAffectingLocations)
|
|
105292
105395
|
resolutionsWithOnlyAffectingLocations.push(resolution);
|
|
@@ -105404,12 +105507,14 @@ ${lanes.join("\n")}
|
|
|
105404
105507
|
if (removeAtRoot) {
|
|
105405
105508
|
removeDirectoryWatcher(rootPath);
|
|
105406
105509
|
}
|
|
105407
|
-
} else if (affectingLocations.length) {
|
|
105510
|
+
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
105408
105511
|
unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
|
|
105409
105512
|
}
|
|
105410
|
-
|
|
105411
|
-
const
|
|
105412
|
-
|
|
105513
|
+
if (affectingLocations) {
|
|
105514
|
+
for (const affectingLocation of affectingLocations) {
|
|
105515
|
+
const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
105516
|
+
watcher.resolutions--;
|
|
105517
|
+
}
|
|
105413
105518
|
}
|
|
105414
105519
|
}
|
|
105415
105520
|
function removeDirectoryWatcher(dirPath) {
|
|
@@ -105531,17 +105636,19 @@ ${lanes.join("\n")}
|
|
|
105531
105636
|
return invalidated;
|
|
105532
105637
|
}
|
|
105533
105638
|
function canInvalidateFailedLookupResolution(resolution) {
|
|
105639
|
+
var _a2;
|
|
105534
105640
|
if (canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution))
|
|
105535
105641
|
return true;
|
|
105536
105642
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
|
|
105537
105643
|
return false;
|
|
105538
|
-
return resolution.failedLookupLocations.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
|
|
105644
|
+
return (_a2 = resolution.failedLookupLocations) == null ? void 0 : _a2.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
|
|
105539
105645
|
}
|
|
105540
105646
|
function isInvalidatedFailedLookup(locationPath) {
|
|
105541
105647
|
return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || emptyIterator, (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || emptyIterator, (fileOrDirectoryPath) => isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : void 0);
|
|
105542
105648
|
}
|
|
105543
105649
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
105544
|
-
|
|
105650
|
+
var _a2;
|
|
105651
|
+
return !!affectingPathChecks && ((_a2 = resolution.affectingLocations) == null ? void 0 : _a2.some((location) => affectingPathChecks.has(location)));
|
|
105545
105652
|
}
|
|
105546
105653
|
function closeTypeRootsWatch() {
|
|
105547
105654
|
clearMap(typeRootsWatches, closeFileWatcher);
|
|
@@ -106346,10 +106453,18 @@ ${lanes.join("\n")}
|
|
|
106346
106453
|
configFileName ? getDirectoryPath(getNormalizedAbsolutePath(configFileName, currentDirectory)) : currentDirectory,
|
|
106347
106454
|
false
|
|
106348
106455
|
);
|
|
106349
|
-
compilerHost.
|
|
106350
|
-
compilerHost.
|
|
106351
|
-
compilerHost.
|
|
106352
|
-
|
|
106456
|
+
compilerHost.resolveModuleNameLiterals = maybeBind(host, host.resolveModuleNameLiterals);
|
|
106457
|
+
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
106458
|
+
if (!compilerHost.resolveModuleNameLiterals && !compilerHost.resolveModuleNames) {
|
|
106459
|
+
compilerHost.resolveModuleNameLiterals = resolutionCache.resolveModuleNameLiterals.bind(resolutionCache);
|
|
106460
|
+
}
|
|
106461
|
+
compilerHost.resolveTypeReferenceDirectiveReferences = maybeBind(host, host.resolveTypeReferenceDirectiveReferences);
|
|
106462
|
+
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
106463
|
+
if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) {
|
|
106464
|
+
compilerHost.resolveTypeReferenceDirectiveReferences = resolutionCache.resolveTypeReferenceDirectiveReferences.bind(resolutionCache);
|
|
106465
|
+
}
|
|
106466
|
+
compilerHost.getModuleResolutionCache = host.resolveModuleNameLiterals || host.resolveModuleNames ? maybeBind(host, host.getModuleResolutionCache) : () => resolutionCache.getModuleResolutionCache();
|
|
106467
|
+
const userProvidedResolution = !!host.resolveModuleNameLiterals || !!host.resolveTypeReferenceDirectiveReferences || !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
106353
106468
|
const customHasInvalidatedResolutions = userProvidedResolution ? maybeBind(host, host.hasInvalidatedResolutions) || returnTrue : returnFalse;
|
|
106354
106469
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
106355
106470
|
synchronizeProgram();
|
|
@@ -107020,19 +107135,38 @@ ${lanes.join("\n")}
|
|
|
107020
107135
|
const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions);
|
|
107021
107136
|
setGetSourceFileAsHashVersioned(compilerHost);
|
|
107022
107137
|
compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
|
|
107138
|
+
compilerHost.resolveModuleNameLiterals = maybeBind(host, host.resolveModuleNameLiterals);
|
|
107139
|
+
compilerHost.resolveTypeReferenceDirectiveReferences = maybeBind(host, host.resolveTypeReferenceDirectiveReferences);
|
|
107023
107140
|
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
107024
107141
|
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
107025
107142
|
compilerHost.getModuleResolutionCache = maybeBind(host, host.getModuleResolutionCache);
|
|
107026
|
-
|
|
107027
|
-
|
|
107028
|
-
|
|
107029
|
-
|
|
107030
|
-
|
|
107143
|
+
let moduleResolutionCache, typeReferenceDirectiveResolutionCache;
|
|
107144
|
+
if (!compilerHost.resolveModuleNameLiterals && !compilerHost.resolveModuleNames) {
|
|
107145
|
+
moduleResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName);
|
|
107146
|
+
compilerHost.resolveModuleNameLiterals = (moduleNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
107147
|
+
moduleNames,
|
|
107148
|
+
containingFile,
|
|
107149
|
+
redirectedReference,
|
|
107150
|
+
options2,
|
|
107151
|
+
containingSourceFile,
|
|
107152
|
+
host,
|
|
107153
|
+
moduleResolutionCache,
|
|
107154
|
+
createModuleResolutionLoader
|
|
107155
|
+
);
|
|
107031
107156
|
compilerHost.getModuleResolutionCache = () => moduleResolutionCache;
|
|
107032
107157
|
}
|
|
107033
|
-
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
107034
|
-
|
|
107035
|
-
compilerHost.
|
|
107158
|
+
if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) {
|
|
107159
|
+
typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
107160
|
+
compilerHost.resolveTypeReferenceDirectiveReferences = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
107161
|
+
typeDirectiveNames,
|
|
107162
|
+
containingFile,
|
|
107163
|
+
redirectedReference,
|
|
107164
|
+
options2,
|
|
107165
|
+
containingSourceFile,
|
|
107166
|
+
host,
|
|
107167
|
+
typeReferenceDirectiveResolutionCache,
|
|
107168
|
+
createTypeReferenceResolutionLoader
|
|
107169
|
+
);
|
|
107036
107170
|
}
|
|
107037
107171
|
compilerHost.getBuildInfo = (fileName, configFilePath) => getBuildInfo3(state, fileName, toResolvedConfigFilePath(state, configFilePath), void 0);
|
|
107038
107172
|
const { watchFile: watchFile2, watchDirectory, writeLog } = createWatchFactory(hostWithWatch, options);
|
|
@@ -114067,13 +114201,14 @@ ${lanes.join("\n")}
|
|
|
114067
114201
|
return ensurePathIsNonModuleName(combineNormal(pathA, pathB));
|
|
114068
114202
|
}
|
|
114069
114203
|
function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) {
|
|
114204
|
+
var _a2;
|
|
114070
114205
|
if (importedModuleSymbol) {
|
|
114071
114206
|
const oldFileName = find(importedModuleSymbol.declarations, isSourceFile).fileName;
|
|
114072
114207
|
const newFileName = oldToNew(oldFileName);
|
|
114073
114208
|
return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true };
|
|
114074
114209
|
} else {
|
|
114075
114210
|
const mode = getModeForUsageLocation(importingSourceFile, importLiteral);
|
|
114076
|
-
const resolved = host.resolveModuleNames ?
|
|
114211
|
+
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? (_a2 = importingSourceFile.resolvedModules) == null ? void 0 : _a2.get(importLiteral.text, mode) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
|
|
114077
114212
|
return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
|
|
114078
114213
|
}
|
|
114079
114214
|
}
|
|
@@ -116394,6 +116529,8 @@ ${lanes.join("\n")}
|
|
|
116394
116529
|
getModuleResolutionCache: maybeBind(host, host.getModuleResolutionCache),
|
|
116395
116530
|
createHash: maybeBind(host, host.createHash),
|
|
116396
116531
|
resolveTypeReferenceDirectives: maybeBind(host, host.resolveTypeReferenceDirectives),
|
|
116532
|
+
resolveModuleNameLiterals: maybeBind(host, host.resolveModuleNameLiterals),
|
|
116533
|
+
resolveTypeReferenceDirectiveReferences: maybeBind(host, host.resolveTypeReferenceDirectiveReferences),
|
|
116397
116534
|
useSourceOfProjectReferenceRedirect: maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
116398
116535
|
getParsedCommandLine
|
|
116399
116536
|
};
|
|
@@ -124590,6 +124727,7 @@ ${lanes.join("\n")}
|
|
|
124590
124727
|
|
|
124591
124728
|
// src/services/codefixes/fixAddMissingMember.ts
|
|
124592
124729
|
function getInfo7(sourceFile, tokenPos, errorCode, checker, program) {
|
|
124730
|
+
var _a2;
|
|
124593
124731
|
const token = getTokenAtPosition(sourceFile, tokenPos);
|
|
124594
124732
|
const parent2 = token.parent;
|
|
124595
124733
|
if (errorCode === Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code) {
|
|
@@ -124625,7 +124763,7 @@ ${lanes.join("\n")}
|
|
|
124625
124763
|
return { kind: 4 /* JsxAttributes */, token, attributes, parentDeclaration: token.parent };
|
|
124626
124764
|
}
|
|
124627
124765
|
if (isIdentifier(token)) {
|
|
124628
|
-
const type = checker.getContextualType(token);
|
|
124766
|
+
const type = (_a2 = checker.getContextualType(token)) == null ? void 0 : _a2.getNonNullableType();
|
|
124629
124767
|
if (type && getObjectFlags(type) & 16 /* Anonymous */) {
|
|
124630
124768
|
const signature = firstOrUndefined(checker.getSignaturesOfType(type, 0 /* Call */));
|
|
124631
124769
|
if (signature === void 0)
|
|
@@ -133495,6 +133633,7 @@ ${lanes.join("\n")}
|
|
|
133495
133633
|
});
|
|
133496
133634
|
}
|
|
133497
133635
|
function findModuleReferences(program, sourceFiles, searchModuleSymbol) {
|
|
133636
|
+
var _a2;
|
|
133498
133637
|
const refs = [];
|
|
133499
133638
|
const checker = program.getTypeChecker();
|
|
133500
133639
|
for (const referencingFile of sourceFiles) {
|
|
@@ -133506,7 +133645,7 @@ ${lanes.join("\n")}
|
|
|
133506
133645
|
}
|
|
133507
133646
|
}
|
|
133508
133647
|
for (const ref of referencingFile.typeReferenceDirectives) {
|
|
133509
|
-
const referenced = program.getResolvedTypeReferenceDirectives().get(ref.fileName, ref.resolutionMode || referencingFile.impliedNodeFormat);
|
|
133648
|
+
const referenced = (_a2 = program.getResolvedTypeReferenceDirectives().get(ref.fileName, ref.resolutionMode || referencingFile.impliedNodeFormat)) == null ? void 0 : _a2.resolvedTypeReferenceDirective;
|
|
133510
133649
|
if (referenced !== void 0 && referenced.resolvedFileName === searchSourceFile.fileName) {
|
|
133511
133650
|
refs.push({ kind: "reference", referencingFile, ref });
|
|
133512
133651
|
}
|
|
@@ -134217,7 +134356,7 @@ ${lanes.join("\n")}
|
|
|
134217
134356
|
})(FindReferencesUse || {});
|
|
134218
134357
|
((Core2) => {
|
|
134219
134358
|
function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options = {}, sourceFilesSet = new Set(sourceFiles.map((f) => f.fileName))) {
|
|
134220
|
-
var _a2, _b;
|
|
134359
|
+
var _a2, _b, _c;
|
|
134221
134360
|
node = getAdjustedNode(node, options);
|
|
134222
134361
|
if (isSourceFile(node)) {
|
|
134223
134362
|
const resolvedRef = ts_GoToDefinition_exports.getReferenceAtPosition(node, position, program);
|
|
@@ -134249,7 +134388,7 @@ ${lanes.join("\n")}
|
|
|
134249
134388
|
if (!options.implementations && isStringLiteralLike(node)) {
|
|
134250
134389
|
if (isModuleSpecifierLike(node)) {
|
|
134251
134390
|
const fileIncludeReasons = program.getFileIncludeReasons();
|
|
134252
|
-
const referencedFileName = (_b = (_a2 = node.getSourceFile().resolvedModules) == null ? void 0 : _a2.get(node.text, getModeForUsageLocation(node.getSourceFile(), node))) == null ? void 0 : _b.resolvedFileName;
|
|
134391
|
+
const referencedFileName = (_c = (_b = (_a2 = node.getSourceFile().resolvedModules) == null ? void 0 : _a2.get(node.text, getModeForUsageLocation(node.getSourceFile(), node))) == null ? void 0 : _b.resolvedModule) == null ? void 0 : _c.resolvedFileName;
|
|
134253
134392
|
const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0;
|
|
134254
134393
|
if (referencedFile) {
|
|
134255
134394
|
return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }];
|
|
@@ -135494,7 +135633,7 @@ ${lanes.join("\n")}
|
|
|
135494
135633
|
|
|
135495
135634
|
// src/services/goToDefinition.ts
|
|
135496
135635
|
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
135497
|
-
var _a2;
|
|
135636
|
+
var _a2, _b;
|
|
135498
135637
|
const resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
135499
135638
|
const fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || emptyArray;
|
|
135500
135639
|
if (resolvedRef == null ? void 0 : resolvedRef.file) {
|
|
@@ -135540,7 +135679,7 @@ ${lanes.join("\n")}
|
|
|
135540
135679
|
}
|
|
135541
135680
|
}
|
|
135542
135681
|
if (!symbol && isModuleSpecifierLike(fallbackNode)) {
|
|
135543
|
-
const ref = (_a2 = sourceFile.resolvedModules) == null ? void 0 : _a2.get(fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode));
|
|
135682
|
+
const ref = (_b = (_a2 = sourceFile.resolvedModules) == null ? void 0 : _a2.get(fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode))) == null ? void 0 : _b.resolvedModule;
|
|
135544
135683
|
if (ref) {
|
|
135545
135684
|
return [{
|
|
135546
135685
|
name: fallbackNode.text,
|
|
@@ -135618,7 +135757,7 @@ ${lanes.join("\n")}
|
|
|
135618
135757
|
return getDefinitionFromSymbol(typeChecker, symbol, node);
|
|
135619
135758
|
}
|
|
135620
135759
|
function getReferenceAtPosition(sourceFile, position, program) {
|
|
135621
|
-
var _a2, _b;
|
|
135760
|
+
var _a2, _b, _c, _d;
|
|
135622
135761
|
const referencePath = findReferenceInPosition(sourceFile.referencedFiles, position);
|
|
135623
135762
|
if (referencePath) {
|
|
135624
135763
|
const file = program.getSourceFileFromReference(sourceFile, referencePath);
|
|
@@ -135626,7 +135765,7 @@ ${lanes.join("\n")}
|
|
|
135626
135765
|
}
|
|
135627
135766
|
const typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position);
|
|
135628
135767
|
if (typeReferenceDirective) {
|
|
135629
|
-
const reference = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName, typeReferenceDirective.resolutionMode || sourceFile.impliedNodeFormat);
|
|
135768
|
+
const reference = (_a2 = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName, typeReferenceDirective.resolutionMode || sourceFile.impliedNodeFormat)) == null ? void 0 : _a2.resolvedTypeReferenceDirective;
|
|
135630
135769
|
const file = reference && program.getSourceFile(reference.resolvedFileName);
|
|
135631
135770
|
return file && { reference: typeReferenceDirective, fileName: file.fileName, file, unverified: false };
|
|
135632
135771
|
}
|
|
@@ -135635,10 +135774,10 @@ ${lanes.join("\n")}
|
|
|
135635
135774
|
const file = program.getLibFileFromReference(libReferenceDirective);
|
|
135636
135775
|
return file && { reference: libReferenceDirective, fileName: file.fileName, file, unverified: false };
|
|
135637
135776
|
}
|
|
135638
|
-
if ((
|
|
135777
|
+
if ((_b = sourceFile.resolvedModules) == null ? void 0 : _b.size()) {
|
|
135639
135778
|
const node = getTouchingToken(sourceFile, position);
|
|
135640
135779
|
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, getModeForUsageLocation(sourceFile, node))) {
|
|
135641
|
-
const verifiedFileName = (
|
|
135780
|
+
const verifiedFileName = (_d = (_c = sourceFile.resolvedModules.get(node.text, getModeForUsageLocation(sourceFile, node))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.resolvedFileName;
|
|
135642
135781
|
const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text);
|
|
135643
135782
|
return {
|
|
135644
135783
|
file: program.getSourceFile(fileName),
|
|
@@ -137868,7 +138007,8 @@ ${lanes.join("\n")}
|
|
|
137868
138007
|
changes.insertNodeBefore(file, enclosingNode, ignoreSourceNewlines(newTypeNode), true);
|
|
137869
138008
|
changes.replaceNode(file, selection, factory.createTypeReferenceNode(name, typeParameters.map((id) => factory.createTypeReferenceNode(id.name, void 0))), { leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.Exclude, trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.ExcludeWhitespace });
|
|
137870
138009
|
}
|
|
137871
|
-
function doTypedefChange(changes,
|
|
138010
|
+
function doTypedefChange(changes, context, file, name, info) {
|
|
138011
|
+
var _a2;
|
|
137872
138012
|
const { enclosingNode, selection, typeParameters } = info;
|
|
137873
138013
|
setEmitFlags(selection, 3072 /* NoComments */ | 4096 /* NoNestedComments */);
|
|
137874
138014
|
const node = factory.createJSDocTypedefTag(
|
|
@@ -137890,7 +138030,7 @@ ${lanes.join("\n")}
|
|
|
137890
138030
|
const jsDoc = factory.createJSDocComment(void 0, factory.createNodeArray(concatenate(templates, [node])));
|
|
137891
138031
|
if (isJSDoc(enclosingNode)) {
|
|
137892
138032
|
const pos = enclosingNode.getStart(file);
|
|
137893
|
-
const newLineCharacter =
|
|
138033
|
+
const newLineCharacter = getNewLineOrDefaultFromHost(context.host, (_a2 = context.formatContext) == null ? void 0 : _a2.options);
|
|
137894
138034
|
changes.insertNodeAt(file, enclosingNode.getStart(file), jsDoc, {
|
|
137895
138035
|
suffix: newLineCharacter + newLineCharacter + file.text.slice(getPrecedingNonSpaceCharacterPosition(file.text, pos - 1), pos)
|
|
137896
138036
|
});
|
|
@@ -137955,7 +138095,7 @@ ${lanes.join("\n")}
|
|
|
137955
138095
|
return emptyArray;
|
|
137956
138096
|
},
|
|
137957
138097
|
getEditsForAction: function getRefactorEditsToExtractType(context, actionName2) {
|
|
137958
|
-
const { file
|
|
138098
|
+
const { file } = context;
|
|
137959
138099
|
const info = getRangeToExtract(context);
|
|
137960
138100
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected to find a range to extract");
|
|
137961
138101
|
const name = getUniqueName("NewType", file);
|
|
@@ -137966,7 +138106,7 @@ ${lanes.join("\n")}
|
|
|
137966
138106
|
return doTypeAliasChange(changes, file, name, info);
|
|
137967
138107
|
case extractToTypeDefAction.name:
|
|
137968
138108
|
Debug.assert(info.isJS, "Invalid actionName/JS combo");
|
|
137969
|
-
return doTypedefChange(changes,
|
|
138109
|
+
return doTypedefChange(changes, context, file, name, info);
|
|
137970
138110
|
case extractToInterfaceAction.name:
|
|
137971
138111
|
Debug.assert(!info.isJS && !!info.typeElements, "Invalid actionName/JS combo");
|
|
137972
138112
|
return doInterfaceChange(changes, file, name, info);
|
|
@@ -149604,7 +149744,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
149604
149744
|
if (!file.resolvedModules)
|
|
149605
149745
|
return emptyArray2;
|
|
149606
149746
|
let unresolvedImports;
|
|
149607
|
-
file.resolvedModules.forEach((resolvedModule, name) => {
|
|
149747
|
+
file.resolvedModules.forEach(({ resolvedModule }, name) => {
|
|
149608
149748
|
if ((!resolvedModule || !resolutionExtensionIsTSOrJson(resolvedModule.extension)) && !isExternalModuleNameRelative(name) && !ambientModules.some((m) => m === name)) {
|
|
149609
149749
|
unresolvedImports = append(unresolvedImports, parsePackageName(name).packageName);
|
|
149610
149750
|
}
|
|
@@ -149768,7 +149908,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
149768
149908
|
if (this.program && !this.symlinks.hasProcessedResolutions()) {
|
|
149769
149909
|
this.symlinks.setSymlinksFromResolutions(
|
|
149770
149910
|
this.program.getSourceFiles(),
|
|
149771
|
-
this.program.
|
|
149911
|
+
this.program.getAutomaticTypeDirectiveResolutions()
|
|
149772
149912
|
);
|
|
149773
149913
|
}
|
|
149774
149914
|
return this.symlinks;
|
|
@@ -149852,17 +149992,21 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
149852
149992
|
const path = this.toPath(file);
|
|
149853
149993
|
return !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file);
|
|
149854
149994
|
}
|
|
149855
|
-
|
|
149856
|
-
return this.resolutionCache.
|
|
149995
|
+
resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
149996
|
+
return this.resolutionCache.resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames);
|
|
149857
149997
|
}
|
|
149858
149998
|
getModuleResolutionCache() {
|
|
149859
149999
|
return this.resolutionCache.getModuleResolutionCache();
|
|
149860
150000
|
}
|
|
149861
|
-
|
|
149862
|
-
return this.resolutionCache.
|
|
149863
|
-
|
|
149864
|
-
|
|
149865
|
-
|
|
150001
|
+
resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
150002
|
+
return this.resolutionCache.resolveTypeReferenceDirectiveReferences(
|
|
150003
|
+
typeDirectiveReferences,
|
|
150004
|
+
containingFile,
|
|
150005
|
+
redirectedReference,
|
|
150006
|
+
options,
|
|
150007
|
+
containingSourceFile,
|
|
150008
|
+
reusedNames
|
|
150009
|
+
);
|
|
149866
150010
|
}
|
|
149867
150011
|
directoryExists(path) {
|
|
149868
150012
|
return this.directoryStructureHost.directoryExists(path);
|
|
@@ -155967,7 +156111,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
155967
156111
|
definitions = definitions.filter((d) => !d.isAmbient && !d.failedAliasResolution);
|
|
155968
156112
|
return this.mapDefinitionInfo(definitions, project);
|
|
155969
156113
|
function findImplementationFileFromDtsFileName(fileName, resolveFromFile, auxiliaryProject) {
|
|
155970
|
-
var _a3;
|
|
156114
|
+
var _a3, _b, _c;
|
|
155971
156115
|
const nodeModulesPathParts = getNodeModulePathParts(fileName);
|
|
155972
156116
|
if (nodeModulesPathParts && fileName.lastIndexOf(nodeModulesPathPart) === nodeModulesPathParts.topLevelNodeModulesIndex) {
|
|
155973
156117
|
const packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
|
|
@@ -155989,13 +156133,11 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
155989
156133
|
const packageName = getPackageNameFromTypesPackageName(unmangleScopedPackageName(packageNamePathPart));
|
|
155990
156134
|
const path = project.toPath(fileName);
|
|
155991
156135
|
if (entrypoints && some(entrypoints, (e) => project.toPath(e) === path)) {
|
|
155992
|
-
|
|
155993
|
-
return implementationResolution == null ? void 0 : implementationResolution.resolvedFileName;
|
|
156136
|
+
return (_b = auxiliaryProject.resolutionCache.resolveSingleModuleNameWithoutWatching(packageName, resolveFromFile).resolvedModule) == null ? void 0 : _b.resolvedFileName;
|
|
155994
156137
|
} else {
|
|
155995
156138
|
const pathToFileInPackage = fileName.substring(nodeModulesPathParts.packageRootIndex + 1);
|
|
155996
156139
|
const specifier = `${packageName}/${removeFileExtension(pathToFileInPackage)}`;
|
|
155997
|
-
|
|
155998
|
-
return implementationResolution == null ? void 0 : implementationResolution.resolvedFileName;
|
|
156140
|
+
return (_c = auxiliaryProject.resolutionCache.resolveSingleModuleNameWithoutWatching(specifier, resolveFromFile).resolvedModule) == null ? void 0 : _c.resolvedFileName;
|
|
155999
156141
|
}
|
|
156000
156142
|
}
|
|
156001
156143
|
return void 0;
|
|
@@ -158645,6 +158787,7 @@ ${e.message}`;
|
|
|
158645
158787
|
createModuleBlock: () => createModuleBlock,
|
|
158646
158788
|
createModuleDeclaration: () => createModuleDeclaration,
|
|
158647
158789
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
158790
|
+
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
158648
158791
|
createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
|
|
158649
158792
|
createMultiMap: () => createMultiMap,
|
|
158650
158793
|
createNamedExports: () => createNamedExports,
|
|
@@ -158767,6 +158910,7 @@ ${e.message}`;
|
|
|
158767
158910
|
createTypeQueryNode: () => createTypeQueryNode,
|
|
158768
158911
|
createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache,
|
|
158769
158912
|
createTypeReferenceNode: () => createTypeReferenceNode,
|
|
158913
|
+
createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader,
|
|
158770
158914
|
createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap,
|
|
158771
158915
|
createUnionTypeNode: () => createUnionTypeNode,
|
|
158772
158916
|
createUniqueName: () => createUniqueName,
|
|
@@ -159256,9 +159400,7 @@ ${e.message}`;
|
|
|
159256
159400
|
getRenameLocation: () => getRenameLocation,
|
|
159257
159401
|
getReplacementSpanForContextToken: () => getReplacementSpanForContextToken,
|
|
159258
159402
|
getResolutionDiagnostic: () => getResolutionDiagnostic,
|
|
159259
|
-
getResolutionMode: () => getResolutionMode,
|
|
159260
159403
|
getResolutionModeOverrideForClause: () => getResolutionModeOverrideForClause,
|
|
159261
|
-
getResolutionName: () => getResolutionName,
|
|
159262
159404
|
getResolvedExternalModuleName: () => getResolvedExternalModuleName,
|
|
159263
159405
|
getResolvedModule: () => getResolvedModule,
|
|
159264
159406
|
getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
|
|
@@ -160077,7 +160219,6 @@ ${e.message}`;
|
|
|
160077
160219
|
listFiles: () => listFiles,
|
|
160078
160220
|
loadModuleFromGlobalCache: () => loadModuleFromGlobalCache,
|
|
160079
160221
|
loadWithModeAwareCache: () => loadWithModeAwareCache,
|
|
160080
|
-
loadWithTypeDirectiveCache: () => loadWithTypeDirectiveCache,
|
|
160081
160222
|
makeIdentifierFromModuleName: () => makeIdentifierFromModuleName,
|
|
160082
160223
|
makeImport: () => makeImport,
|
|
160083
160224
|
makeImportIfNecessary: () => makeImportIfNecessary,
|
|
@@ -160109,6 +160250,7 @@ ${e.message}`;
|
|
|
160109
160250
|
modifiersToFlags: () => modifiersToFlags,
|
|
160110
160251
|
moduleOptionDeclaration: () => moduleOptionDeclaration,
|
|
160111
160252
|
moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
|
|
160253
|
+
moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
|
|
160112
160254
|
moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
|
|
160113
160255
|
moduleResolutionRespectsExports: () => moduleResolutionRespectsExports,
|
|
160114
160256
|
moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
|
|
@@ -160485,6 +160627,7 @@ ${e.message}`;
|
|
|
160485
160627
|
typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
|
|
160486
160628
|
typeKeywords: () => typeKeywords,
|
|
160487
160629
|
typeParameterNamePart: () => typeParameterNamePart,
|
|
160630
|
+
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
|
|
160488
160631
|
typeToDisplayParts: () => typeToDisplayParts,
|
|
160489
160632
|
unchangedPollThresholds: () => unchangedPollThresholds,
|
|
160490
160633
|
unchangedTextChangeRange: () => unchangedTextChangeRange,
|
|
@@ -160600,6 +160743,7 @@ ${e.message}`;
|
|
|
160600
160743
|
updatePropertyAssignment: () => updatePropertyAssignment,
|
|
160601
160744
|
updatePropertySignature: () => updatePropertySignature,
|
|
160602
160745
|
updateQualifiedName: () => updateQualifiedName,
|
|
160746
|
+
updateResolutionField: () => updateResolutionField,
|
|
160603
160747
|
updateRestTypeNode: () => updateRestTypeNode,
|
|
160604
160748
|
updateReturn: () => updateReturn,
|
|
160605
160749
|
updateSetAccessor: () => updateSetAccessor,
|
|
@@ -161267,6 +161411,7 @@ ${e.message}`;
|
|
|
161267
161411
|
createModuleBlock: () => createModuleBlock,
|
|
161268
161412
|
createModuleDeclaration: () => createModuleDeclaration,
|
|
161269
161413
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
161414
|
+
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
161270
161415
|
createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
|
|
161271
161416
|
createMultiMap: () => createMultiMap,
|
|
161272
161417
|
createNamedExports: () => createNamedExports,
|
|
@@ -161389,6 +161534,7 @@ ${e.message}`;
|
|
|
161389
161534
|
createTypeQueryNode: () => createTypeQueryNode,
|
|
161390
161535
|
createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache,
|
|
161391
161536
|
createTypeReferenceNode: () => createTypeReferenceNode,
|
|
161537
|
+
createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader,
|
|
161392
161538
|
createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap,
|
|
161393
161539
|
createUnionTypeNode: () => createUnionTypeNode,
|
|
161394
161540
|
createUniqueName: () => createUniqueName,
|
|
@@ -161878,9 +162024,7 @@ ${e.message}`;
|
|
|
161878
162024
|
getRenameLocation: () => getRenameLocation,
|
|
161879
162025
|
getReplacementSpanForContextToken: () => getReplacementSpanForContextToken,
|
|
161880
162026
|
getResolutionDiagnostic: () => getResolutionDiagnostic,
|
|
161881
|
-
getResolutionMode: () => getResolutionMode,
|
|
161882
162027
|
getResolutionModeOverrideForClause: () => getResolutionModeOverrideForClause,
|
|
161883
|
-
getResolutionName: () => getResolutionName,
|
|
161884
162028
|
getResolvedExternalModuleName: () => getResolvedExternalModuleName,
|
|
161885
162029
|
getResolvedModule: () => getResolvedModule,
|
|
161886
162030
|
getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
|
|
@@ -162699,7 +162843,6 @@ ${e.message}`;
|
|
|
162699
162843
|
listFiles: () => listFiles,
|
|
162700
162844
|
loadModuleFromGlobalCache: () => loadModuleFromGlobalCache,
|
|
162701
162845
|
loadWithModeAwareCache: () => loadWithModeAwareCache,
|
|
162702
|
-
loadWithTypeDirectiveCache: () => loadWithTypeDirectiveCache,
|
|
162703
162846
|
makeIdentifierFromModuleName: () => makeIdentifierFromModuleName,
|
|
162704
162847
|
makeImport: () => makeImport,
|
|
162705
162848
|
makeImportIfNecessary: () => makeImportIfNecessary,
|
|
@@ -162731,6 +162874,7 @@ ${e.message}`;
|
|
|
162731
162874
|
modifiersToFlags: () => modifiersToFlags,
|
|
162732
162875
|
moduleOptionDeclaration: () => moduleOptionDeclaration,
|
|
162733
162876
|
moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
|
|
162877
|
+
moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
|
|
162734
162878
|
moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
|
|
162735
162879
|
moduleResolutionRespectsExports: () => moduleResolutionRespectsExports,
|
|
162736
162880
|
moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
|
|
@@ -163107,6 +163251,7 @@ ${e.message}`;
|
|
|
163107
163251
|
typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
|
|
163108
163252
|
typeKeywords: () => typeKeywords,
|
|
163109
163253
|
typeParameterNamePart: () => typeParameterNamePart,
|
|
163254
|
+
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
|
|
163110
163255
|
typeToDisplayParts: () => typeToDisplayParts,
|
|
163111
163256
|
unchangedPollThresholds: () => unchangedPollThresholds,
|
|
163112
163257
|
unchangedTextChangeRange: () => unchangedTextChangeRange,
|
|
@@ -163222,6 +163367,7 @@ ${e.message}`;
|
|
|
163222
163367
|
updatePropertyAssignment: () => updatePropertyAssignment,
|
|
163223
163368
|
updatePropertySignature: () => updatePropertySignature,
|
|
163224
163369
|
updateQualifiedName: () => updateQualifiedName,
|
|
163370
|
+
updateResolutionField: () => updateResolutionField,
|
|
163225
163371
|
updateRestTypeNode: () => updateRestTypeNode,
|
|
163226
163372
|
updateReturn: () => updateReturn,
|
|
163227
163373
|
updateSetAccessor: () => updateSetAccessor,
|