@typescript-deploys/pr-build 5.0.0-pr-51725-7 → 5.0.0-pr-51771-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +427 -301
- package/lib/tsserver.js +474 -324
- package/lib/tsserverlibrary.d.ts +27 -18
- package/lib/tsserverlibrary.js +475 -325
- package/lib/typescript.d.ts +27 -15
- package/lib/typescript.js +454 -308
- package/lib/typingsInstaller.js +20 -8
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
26
|
+
var version = `${versionMajorMinor}.0-insiders.20221205`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -10702,7 +10702,8 @@ function getFullWidth(node) {
|
|
|
10702
10702
|
return node.end - node.pos;
|
|
10703
10703
|
}
|
|
10704
10704
|
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
10705
|
-
|
|
10705
|
+
var _a2, _b;
|
|
10706
|
+
return (_b = (_a2 = sourceFile == null ? void 0 : sourceFile.resolvedModules) == null ? void 0 : _a2.get(moduleNameText, mode)) == null ? void 0 : _b.resolvedModule;
|
|
10706
10707
|
}
|
|
10707
10708
|
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
10708
10709
|
if (!sourceFile.resolvedModules) {
|
|
@@ -10716,15 +10717,11 @@ function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveNam
|
|
|
10716
10717
|
}
|
|
10717
10718
|
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
|
|
10718
10719
|
}
|
|
10719
|
-
function getResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, mode) {
|
|
10720
|
-
var _a2;
|
|
10721
|
-
return (_a2 = sourceFile == null ? void 0 : sourceFile.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a2.get(typeReferenceDirectiveName, mode);
|
|
10722
|
-
}
|
|
10723
10720
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
10724
10721
|
return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
|
|
10725
10722
|
}
|
|
10726
10723
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
10727
|
-
return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport && oldResolution.extension === newResolution.extension && oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.originalPath === newResolution.originalPath && packageIdIsEqual(oldResolution.packageId, newResolution.packageId);
|
|
10724
|
+
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);
|
|
10728
10725
|
}
|
|
10729
10726
|
function packageIdIsEqual(a, b) {
|
|
10730
10727
|
return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
|
|
@@ -10736,15 +10733,15 @@ function packageIdToString(packageId) {
|
|
|
10736
10733
|
return `${packageIdToPackageName(packageId)}@${packageId.version}`;
|
|
10737
10734
|
}
|
|
10738
10735
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
10739
|
-
return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary && oldResolution.originalPath === newResolution.originalPath;
|
|
10736
|
+
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;
|
|
10740
10737
|
}
|
|
10741
|
-
function hasChangesInResolutions(names, newSourceFile, newResolutions, oldResolutions, comparer) {
|
|
10738
|
+
function hasChangesInResolutions(names, newSourceFile, newResolutions, oldResolutions, comparer, nameAndModeGetter) {
|
|
10742
10739
|
Debug.assert(names.length === newResolutions.length);
|
|
10743
10740
|
for (let i = 0; i < names.length; i++) {
|
|
10744
10741
|
const newResolution = newResolutions[i];
|
|
10745
10742
|
const entry = names[i];
|
|
10746
|
-
const name =
|
|
10747
|
-
const mode =
|
|
10743
|
+
const name = nameAndModeGetter.getName(entry);
|
|
10744
|
+
const mode = nameAndModeGetter.getMode(entry, newSourceFile);
|
|
10748
10745
|
const oldResolution = oldResolutions && oldResolutions.get(name, mode);
|
|
10749
10746
|
const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
|
|
10750
10747
|
if (changed) {
|
|
@@ -14824,13 +14821,14 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
|
|
|
14824
14821
|
}
|
|
14825
14822
|
},
|
|
14826
14823
|
setSymlinksFromResolutions(files, typeReferenceDirectives) {
|
|
14827
|
-
var _a2;
|
|
14824
|
+
var _a2, _b;
|
|
14828
14825
|
Debug.assert(!hasProcessedResolutions);
|
|
14829
14826
|
hasProcessedResolutions = true;
|
|
14830
14827
|
for (const file of files) {
|
|
14831
|
-
(_a2 = file.resolvedModules) == null ? void 0 : _a2.forEach((resolution) => processResolution(this, resolution));
|
|
14828
|
+
(_a2 = file.resolvedModules) == null ? void 0 : _a2.forEach((resolution) => processResolution(this, resolution.resolvedModule));
|
|
14829
|
+
(_b = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _b.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
14832
14830
|
}
|
|
14833
|
-
typeReferenceDirectives
|
|
14831
|
+
typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
14834
14832
|
},
|
|
14835
14833
|
hasProcessedResolutions: () => hasProcessedResolutions
|
|
14836
14834
|
};
|
|
@@ -32721,17 +32719,29 @@ function resolvedTypeScriptOnly(resolved) {
|
|
|
32721
32719
|
}
|
|
32722
32720
|
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
32723
32721
|
if (resultFromCache) {
|
|
32724
|
-
resultFromCache.failedLookupLocations.
|
|
32725
|
-
resultFromCache.affectingLocations.
|
|
32722
|
+
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
32723
|
+
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
32724
|
+
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
32726
32725
|
return resultFromCache;
|
|
32727
32726
|
}
|
|
32728
32727
|
return {
|
|
32729
32728
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? void 0 : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport, packageId: resolved.packageId },
|
|
32730
|
-
failedLookupLocations,
|
|
32731
|
-
affectingLocations,
|
|
32732
|
-
resolutionDiagnostics: diagnostics
|
|
32729
|
+
failedLookupLocations: initializeResolutionField(failedLookupLocations),
|
|
32730
|
+
affectingLocations: initializeResolutionField(affectingLocations),
|
|
32731
|
+
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
32733
32732
|
};
|
|
32734
32733
|
}
|
|
32734
|
+
function initializeResolutionField(value) {
|
|
32735
|
+
return value.length ? value : void 0;
|
|
32736
|
+
}
|
|
32737
|
+
function updateResolutionField(to, value) {
|
|
32738
|
+
if (!(value == null ? void 0 : value.length))
|
|
32739
|
+
return to;
|
|
32740
|
+
if (!(to == null ? void 0 : to.length))
|
|
32741
|
+
return value;
|
|
32742
|
+
to.push(...value);
|
|
32743
|
+
return to;
|
|
32744
|
+
}
|
|
32735
32745
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
32736
32746
|
if (!hasProperty(jsonContent, fieldName)) {
|
|
32737
32747
|
if (state.traceEnabled) {
|
|
@@ -32937,7 +32947,12 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
32937
32947
|
isExternalLibraryImport: pathContainsNodeModules(fileName)
|
|
32938
32948
|
};
|
|
32939
32949
|
}
|
|
32940
|
-
result = {
|
|
32950
|
+
result = {
|
|
32951
|
+
resolvedTypeReferenceDirective,
|
|
32952
|
+
failedLookupLocations: initializeResolutionField(failedLookupLocations),
|
|
32953
|
+
affectingLocations: initializeResolutionField(affectingLocations),
|
|
32954
|
+
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
32955
|
+
};
|
|
32941
32956
|
perFolderCache == null ? void 0 : perFolderCache.set(typeReferenceDirectiveName, resolutionMode, result);
|
|
32942
32957
|
if (traceEnabled)
|
|
32943
32958
|
traceResult(result);
|
|
@@ -33197,18 +33212,12 @@ function createModeAwareCache() {
|
|
|
33197
33212
|
return result;
|
|
33198
33213
|
}
|
|
33199
33214
|
}
|
|
33200
|
-
function
|
|
33201
|
-
return !isString(entry) ? isStringLiteralLike(entry) ? entry.text : toFileNameLowerCase(entry.fileName) : entry;
|
|
33202
|
-
}
|
|
33203
|
-
function getResolutionMode(entry, file) {
|
|
33204
|
-
return isStringLiteralLike(entry) ? getModeForUsageLocation(file, entry) : entry.resolutionMode || file.impliedNodeFormat;
|
|
33205
|
-
}
|
|
33206
|
-
function zipToModeAwareCache(file, keys, values) {
|
|
33215
|
+
function zipToModeAwareCache(file, keys, values, nameAndModeGetter) {
|
|
33207
33216
|
Debug.assert(keys.length === values.length);
|
|
33208
33217
|
const map2 = createModeAwareCache();
|
|
33209
33218
|
for (let i = 0; i < keys.length; ++i) {
|
|
33210
33219
|
const entry = keys[i];
|
|
33211
|
-
map2.set(
|
|
33220
|
+
map2.set(nameAndModeGetter.getName(entry), nameAndModeGetter.getMode(entry, file), values[i]);
|
|
33212
33221
|
}
|
|
33213
33222
|
return map2;
|
|
33214
33223
|
}
|
|
@@ -33306,13 +33315,6 @@ function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanoni
|
|
|
33306
33315
|
perDirectoryResolutionCache.clear();
|
|
33307
33316
|
}
|
|
33308
33317
|
}
|
|
33309
|
-
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
33310
|
-
const containingDirectory = getDirectoryPath(containingFile);
|
|
33311
|
-
const perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory);
|
|
33312
|
-
if (!perFolderCache)
|
|
33313
|
-
return void 0;
|
|
33314
|
-
return perFolderCache.get(moduleName, mode);
|
|
33315
|
-
}
|
|
33316
33318
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
33317
33319
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
33318
33320
|
if (redirectedReference) {
|
|
@@ -33497,7 +33499,7 @@ function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, state) {
|
|
|
33497
33499
|
function resolveJSModule(moduleName, initialDir, host) {
|
|
33498
33500
|
const { resolvedModule, failedLookupLocations } = tryResolveJSModuleWorker(moduleName, initialDir, host);
|
|
33499
33501
|
if (!resolvedModule) {
|
|
33500
|
-
throw new Error(`Could not resolve JS module '${moduleName}' starting at '${initialDir}'. Looked in: ${failedLookupLocations.join(", ")}`);
|
|
33502
|
+
throw new Error(`Could not resolve JS module '${moduleName}' starting at '${initialDir}'. Looked in: ${failedLookupLocations == null ? void 0 : failedLookupLocations.join(", ")}`);
|
|
33501
33503
|
}
|
|
33502
33504
|
return resolvedModule.resolvedFileName;
|
|
33503
33505
|
}
|
|
@@ -38169,9 +38171,9 @@ function createTypeChecker(host) {
|
|
|
38169
38171
|
host.getSourceFiles().forEach((sf) => {
|
|
38170
38172
|
if (!sf.resolvedModules)
|
|
38171
38173
|
return;
|
|
38172
|
-
sf.resolvedModules.forEach((
|
|
38173
|
-
if (
|
|
38174
|
-
map2.set(
|
|
38174
|
+
sf.resolvedModules.forEach(({ resolvedModule }) => {
|
|
38175
|
+
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
38176
|
+
map2.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!map2.get(resolvedModule.packageId.name));
|
|
38175
38177
|
});
|
|
38176
38178
|
});
|
|
38177
38179
|
return map2;
|
|
@@ -38975,6 +38977,12 @@ function createTypeChecker(host) {
|
|
|
38975
38977
|
return diagnostic;
|
|
38976
38978
|
}
|
|
38977
38979
|
function isDeprecatedSymbol(symbol) {
|
|
38980
|
+
if (length(symbol.declarations) > 1) {
|
|
38981
|
+
const parentSymbol = getParentOfSymbol(symbol);
|
|
38982
|
+
if (parentSymbol && parentSymbol.flags & 64 /* Interface */) {
|
|
38983
|
+
return some(symbol.declarations, (d) => !!(getCombinedNodeFlags(d) & 268435456 /* Deprecated */));
|
|
38984
|
+
}
|
|
38985
|
+
}
|
|
38978
38986
|
return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 268435456 /* Deprecated */);
|
|
38979
38987
|
}
|
|
38980
38988
|
function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
|
|
@@ -48668,7 +48676,7 @@ function createTypeChecker(host) {
|
|
|
48668
48676
|
const resolved = resolveAlias(aliasSymbol2);
|
|
48669
48677
|
if (resolved && resolved.flags & 524288 /* TypeAlias */) {
|
|
48670
48678
|
newAliasSymbol = resolved;
|
|
48671
|
-
aliasTypeArguments = typeArgumentsFromTypeReferenceNode(node);
|
|
48679
|
+
aliasTypeArguments = typeArgumentsFromTypeReferenceNode(node) || (typeParameters ? [] : void 0);
|
|
48672
48680
|
}
|
|
48673
48681
|
}
|
|
48674
48682
|
}
|
|
@@ -48911,7 +48919,7 @@ function createTypeChecker(host) {
|
|
|
48911
48919
|
const links = getNodeLinks(node);
|
|
48912
48920
|
if (!links.resolvedType) {
|
|
48913
48921
|
const type = checkExpressionWithTypeArguments(node);
|
|
48914
|
-
links.resolvedType = getWidenedType(type);
|
|
48922
|
+
links.resolvedType = getRegularTypeOfLiteralType(getWidenedType(type));
|
|
48915
48923
|
}
|
|
48916
48924
|
return links.resolvedType;
|
|
48917
48925
|
}
|
|
@@ -55355,7 +55363,11 @@ function createTypeChecker(host) {
|
|
|
55355
55363
|
}
|
|
55356
55364
|
if (source.aliasSymbol && source.aliasSymbol === target.aliasSymbol) {
|
|
55357
55365
|
if (source.aliasTypeArguments) {
|
|
55358
|
-
|
|
55366
|
+
const params = getSymbolLinks(source.aliasSymbol).typeParameters;
|
|
55367
|
+
const minParams = getMinTypeArgumentCount(params);
|
|
55368
|
+
const sourceTypes = fillMissingTypeArguments(source.aliasTypeArguments, params, minParams, false);
|
|
55369
|
+
const targetTypes = fillMissingTypeArguments(target.aliasTypeArguments, params, minParams, false);
|
|
55370
|
+
inferFromTypeArguments(sourceTypes, targetTypes, getAliasVariances(source.aliasSymbol));
|
|
55359
55371
|
}
|
|
55360
55372
|
return;
|
|
55361
55373
|
}
|
|
@@ -57484,13 +57496,13 @@ function createTypeChecker(host) {
|
|
|
57484
57496
|
}
|
|
57485
57497
|
const target = getReferenceCandidate(typeOfExpr.expression);
|
|
57486
57498
|
if (!isMatchingReference(reference, target)) {
|
|
57487
|
-
|
|
57499
|
+
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
57500
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
57501
|
+
}
|
|
57502
|
+
const propertyAccess = getDiscriminantPropertyAccess(target, type);
|
|
57488
57503
|
if (propertyAccess) {
|
|
57489
57504
|
return narrowTypeByDiscriminant(type, propertyAccess, (t) => narrowTypeByLiteralExpression(t, literal, assumeTrue));
|
|
57490
57505
|
}
|
|
57491
|
-
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
57492
|
-
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
57493
|
-
}
|
|
57494
57506
|
return type;
|
|
57495
57507
|
}
|
|
57496
57508
|
return narrowTypeByLiteralExpression(type, literal, assumeTrue);
|
|
@@ -71101,11 +71113,11 @@ function createTypeChecker(host) {
|
|
|
71101
71113
|
let fileToDirective;
|
|
71102
71114
|
if (resolvedTypeReferenceDirectives) {
|
|
71103
71115
|
fileToDirective = /* @__PURE__ */ new Map();
|
|
71104
|
-
resolvedTypeReferenceDirectives.forEach((
|
|
71105
|
-
if (!
|
|
71116
|
+
resolvedTypeReferenceDirectives.forEach(({ resolvedTypeReferenceDirective }, key, mode) => {
|
|
71117
|
+
if (!(resolvedTypeReferenceDirective == null ? void 0 : resolvedTypeReferenceDirective.resolvedFileName)) {
|
|
71106
71118
|
return;
|
|
71107
71119
|
}
|
|
71108
|
-
const file = host.getSourceFile(
|
|
71120
|
+
const file = host.getSourceFile(resolvedTypeReferenceDirective.resolvedFileName);
|
|
71109
71121
|
if (file) {
|
|
71110
71122
|
addReferencedFilesToTypeDirective(file, key, mode);
|
|
71111
71123
|
}
|
|
@@ -97353,25 +97365,6 @@ function flattenDiagnosticMessageText(diag2, newLine, indent2 = 0) {
|
|
|
97353
97365
|
}
|
|
97354
97366
|
return result;
|
|
97355
97367
|
}
|
|
97356
|
-
function loadWithTypeDirectiveCache(names, containingFile, redirectedReference, containingFileMode, loader) {
|
|
97357
|
-
if (names.length === 0) {
|
|
97358
|
-
return [];
|
|
97359
|
-
}
|
|
97360
|
-
const resolutions = [];
|
|
97361
|
-
const cache = createModeAwareCache();
|
|
97362
|
-
for (const name of names) {
|
|
97363
|
-
let result;
|
|
97364
|
-
const mode = getModeForFileReference(name, containingFileMode);
|
|
97365
|
-
const strName = getResolutionName(name);
|
|
97366
|
-
if (cache.has(strName, mode)) {
|
|
97367
|
-
result = cache.get(strName, mode);
|
|
97368
|
-
} else {
|
|
97369
|
-
cache.set(strName, mode, result = loader(strName, containingFile, redirectedReference, mode));
|
|
97370
|
-
}
|
|
97371
|
-
resolutions.push(result);
|
|
97372
|
-
}
|
|
97373
|
-
return resolutions;
|
|
97374
|
-
}
|
|
97375
97368
|
function getModeForFileReference(ref, containingFileMode) {
|
|
97376
97369
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
97377
97370
|
}
|
|
@@ -97437,22 +97430,65 @@ function getResolutionModeOverrideForClause(clause, grammarErrorOnNode) {
|
|
|
97437
97430
|
}
|
|
97438
97431
|
return elem.value.text === "import" ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
97439
97432
|
}
|
|
97440
|
-
|
|
97441
|
-
|
|
97442
|
-
|
|
97443
|
-
|
|
97433
|
+
var emptyResolution = {
|
|
97434
|
+
resolvedModule: void 0,
|
|
97435
|
+
resolvedTypeReferenceDirective: void 0
|
|
97436
|
+
};
|
|
97437
|
+
function getModuleResolutionName(literal) {
|
|
97438
|
+
return literal.text;
|
|
97439
|
+
}
|
|
97440
|
+
var moduleResolutionNameAndModeGetter = {
|
|
97441
|
+
getName: getModuleResolutionName,
|
|
97442
|
+
getMode: (entry, file) => getModeForUsageLocation(file, entry)
|
|
97443
|
+
};
|
|
97444
|
+
function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
97445
|
+
return {
|
|
97446
|
+
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
97447
|
+
resolve: (moduleName, resoluionMode) => resolveModuleName(
|
|
97448
|
+
moduleName,
|
|
97449
|
+
containingFile,
|
|
97450
|
+
options,
|
|
97451
|
+
host,
|
|
97452
|
+
cache,
|
|
97453
|
+
redirectedReference,
|
|
97454
|
+
resoluionMode
|
|
97455
|
+
)
|
|
97456
|
+
};
|
|
97457
|
+
}
|
|
97458
|
+
function getTypeReferenceResolutionName(entry) {
|
|
97459
|
+
return !isString(entry) ? toFileNameLowerCase(entry.fileName) : entry;
|
|
97460
|
+
}
|
|
97461
|
+
var typeReferenceResolutionNameAndModeGetter = {
|
|
97462
|
+
getName: getTypeReferenceResolutionName,
|
|
97463
|
+
getMode: (entry, file) => getModeForFileReference(entry, file == null ? void 0 : file.impliedNodeFormat)
|
|
97464
|
+
};
|
|
97465
|
+
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
97466
|
+
return {
|
|
97467
|
+
nameAndMode: typeReferenceResolutionNameAndModeGetter,
|
|
97468
|
+
resolve: (typeRef, resoluionMode) => resolveTypeReferenceDirective(
|
|
97469
|
+
typeRef,
|
|
97470
|
+
containingFile,
|
|
97471
|
+
options,
|
|
97472
|
+
host,
|
|
97473
|
+
redirectedReference,
|
|
97474
|
+
cache,
|
|
97475
|
+
resoluionMode
|
|
97476
|
+
)
|
|
97477
|
+
};
|
|
97478
|
+
}
|
|
97479
|
+
function loadWithModeAwareCache(entries, containingFile, redirectedReference, options, containingSourceFile, host, resolutionCache, createLoader) {
|
|
97480
|
+
if (entries.length === 0)
|
|
97481
|
+
return emptyArray;
|
|
97444
97482
|
const resolutions = [];
|
|
97445
|
-
const cache =
|
|
97446
|
-
|
|
97447
|
-
for (const entry of
|
|
97448
|
-
|
|
97449
|
-
const mode =
|
|
97450
|
-
|
|
97451
|
-
|
|
97452
|
-
if (
|
|
97453
|
-
result =
|
|
97454
|
-
} else {
|
|
97455
|
-
cache.set(name, mode, result = loader(name, mode, containingFileName, redirectedReference));
|
|
97483
|
+
const cache = /* @__PURE__ */ new Map();
|
|
97484
|
+
const loader = createLoader(containingFile, redirectedReference, options, host, resolutionCache);
|
|
97485
|
+
for (const entry of entries) {
|
|
97486
|
+
const name = loader.nameAndMode.getName(entry);
|
|
97487
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
97488
|
+
const key = createModeAwareCacheKey(name, mode);
|
|
97489
|
+
let result = cache.get(key);
|
|
97490
|
+
if (!result) {
|
|
97491
|
+
cache.set(key, result = loader.resolve(name, mode));
|
|
97456
97492
|
}
|
|
97457
97493
|
resolutions.push(result);
|
|
97458
97494
|
}
|
|
@@ -97498,14 +97534,14 @@ function isReferenceFileLocation(location) {
|
|
|
97498
97534
|
return location.pos !== void 0;
|
|
97499
97535
|
}
|
|
97500
97536
|
function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
97501
|
-
var _a2, _b, _c, _d;
|
|
97537
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
97502
97538
|
const file = Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
97503
97539
|
const { kind, index } = ref;
|
|
97504
97540
|
let pos, end, packageId, resolutionMode;
|
|
97505
97541
|
switch (kind) {
|
|
97506
97542
|
case 3 /* Import */:
|
|
97507
97543
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
97508
|
-
packageId = (_b = (_a2 = file.resolvedModules) == null ? void 0 : _a2.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _b.packageId;
|
|
97544
|
+
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;
|
|
97509
97545
|
if (importLiteral.pos === -1)
|
|
97510
97546
|
return { file, packageId, text: importLiteral.text };
|
|
97511
97547
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -97516,7 +97552,7 @@ function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
|
97516
97552
|
break;
|
|
97517
97553
|
case 5 /* TypeReferenceDirective */:
|
|
97518
97554
|
({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
|
|
97519
|
-
packageId = (
|
|
97555
|
+
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;
|
|
97520
97556
|
break;
|
|
97521
97557
|
case 7 /* LibReferenceDirective */:
|
|
97522
97558
|
({ pos, end } = file.libReferenceDirectives[index]);
|
|
@@ -97705,7 +97741,7 @@ function createCreateProgramOptions(rootNames, options, host, oldProgram, config
|
|
|
97705
97741
|
};
|
|
97706
97742
|
}
|
|
97707
97743
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
97708
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
97744
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
97709
97745
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
97710
97746
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences } = createProgramOptions;
|
|
97711
97747
|
let { oldProgram } = createProgramOptions;
|
|
@@ -97722,6 +97758,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97722
97758
|
const cachedDeclarationDiagnosticsForFile = {};
|
|
97723
97759
|
let resolvedTypeReferenceDirectives = createModeAwareCache();
|
|
97724
97760
|
let fileProcessingDiagnostics;
|
|
97761
|
+
let automaticTypeDirectiveNames;
|
|
97762
|
+
let automaticTypeDirectiveResolutions;
|
|
97725
97763
|
const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
97726
97764
|
let currentNodeModulesDepth = 0;
|
|
97727
97765
|
const modulesWithElidedImports = /* @__PURE__ */ new Map();
|
|
@@ -97740,50 +97778,59 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97740
97778
|
const hasEmitBlockingDiagnostics = /* @__PURE__ */ new Map();
|
|
97741
97779
|
let _compilerOptionsObjectLiteralSyntax;
|
|
97742
97780
|
let moduleResolutionCache;
|
|
97743
|
-
let typeReferenceDirectiveResolutionCache;
|
|
97744
97781
|
let actualResolveModuleNamesWorker;
|
|
97745
97782
|
const hasInvalidatedResolutions = host.hasInvalidatedResolutions || returnFalse;
|
|
97746
|
-
if (host.
|
|
97747
|
-
actualResolveModuleNamesWorker = (
|
|
97748
|
-
var _a3;
|
|
97749
|
-
return host.resolveModuleNames(
|
|
97750
|
-
moduleNames.map((literal) => literal.text),
|
|
97751
|
-
containingFileName,
|
|
97752
|
-
(_a3 = resolutionInfo == null ? void 0 : resolutionInfo.reusedNames) == null ? void 0 : _a3.map((literal) => literal.text),
|
|
97753
|
-
redirectedReference,
|
|
97754
|
-
options,
|
|
97755
|
-
containingFile,
|
|
97756
|
-
resolutionInfo
|
|
97757
|
-
).map((resolved) => {
|
|
97758
|
-
if (!resolved || resolved.extension !== void 0) {
|
|
97759
|
-
return resolved;
|
|
97760
|
-
}
|
|
97761
|
-
const withExtension = clone(resolved);
|
|
97762
|
-
withExtension.extension = extensionFromPath(resolved.resolvedFileName);
|
|
97763
|
-
return withExtension;
|
|
97764
|
-
});
|
|
97765
|
-
};
|
|
97783
|
+
if (host.resolveModuleNameLiterals) {
|
|
97784
|
+
actualResolveModuleNamesWorker = host.resolveModuleNameLiterals.bind(host);
|
|
97766
97785
|
moduleResolutionCache = (_b = host.getModuleResolutionCache) == null ? void 0 : _b.call(host);
|
|
97786
|
+
} else if (host.resolveModuleNames) {
|
|
97787
|
+
actualResolveModuleNamesWorker = (moduleNames, containingFile, redirectedReference, options2, containingSourceFile, reusedNames) => host.resolveModuleNames(
|
|
97788
|
+
moduleNames.map(getModuleResolutionName),
|
|
97789
|
+
containingFile,
|
|
97790
|
+
reusedNames == null ? void 0 : reusedNames.map(getModuleResolutionName),
|
|
97791
|
+
redirectedReference,
|
|
97792
|
+
options2,
|
|
97793
|
+
containingSourceFile
|
|
97794
|
+
).map(
|
|
97795
|
+
(resolved) => resolved ? resolved.extension !== void 0 ? { resolvedModule: resolved } : { resolvedModule: { ...resolved, extension: extensionFromPath(resolved.resolvedFileName) } } : emptyResolution
|
|
97796
|
+
);
|
|
97797
|
+
moduleResolutionCache = (_c = host.getModuleResolutionCache) == null ? void 0 : _c.call(host);
|
|
97767
97798
|
} else {
|
|
97768
97799
|
moduleResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
97769
|
-
|
|
97770
|
-
|
|
97800
|
+
actualResolveModuleNamesWorker = (moduleNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
97801
|
+
moduleNames,
|
|
97802
|
+
containingFile,
|
|
97803
|
+
redirectedReference,
|
|
97804
|
+
options2,
|
|
97805
|
+
containingSourceFile,
|
|
97806
|
+
host,
|
|
97807
|
+
moduleResolutionCache,
|
|
97808
|
+
createModuleResolutionLoader
|
|
97809
|
+
);
|
|
97771
97810
|
}
|
|
97772
97811
|
let actualResolveTypeReferenceDirectiveNamesWorker;
|
|
97773
|
-
if (host.
|
|
97774
|
-
actualResolveTypeReferenceDirectiveNamesWorker =
|
|
97812
|
+
if (host.resolveTypeReferenceDirectiveReferences) {
|
|
97813
|
+
actualResolveTypeReferenceDirectiveNamesWorker = host.resolveTypeReferenceDirectiveReferences.bind(host);
|
|
97814
|
+
} else if (host.resolveTypeReferenceDirectives) {
|
|
97815
|
+
actualResolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => host.resolveTypeReferenceDirectives(
|
|
97816
|
+
typeDirectiveNames.map(getTypeReferenceResolutionName),
|
|
97817
|
+
containingFile,
|
|
97818
|
+
redirectedReference,
|
|
97819
|
+
options2,
|
|
97820
|
+
containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat
|
|
97821
|
+
).map((resolvedTypeReferenceDirective) => ({ resolvedTypeReferenceDirective }));
|
|
97775
97822
|
} else {
|
|
97776
|
-
typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
97777
|
-
|
|
97778
|
-
|
|
97823
|
+
const typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
97824
|
+
actualResolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
97825
|
+
typeDirectiveNames,
|
|
97779
97826
|
containingFile,
|
|
97780
|
-
options,
|
|
97781
|
-
host,
|
|
97782
97827
|
redirectedReference,
|
|
97828
|
+
options2,
|
|
97829
|
+
containingSourceFile,
|
|
97830
|
+
host,
|
|
97783
97831
|
typeReferenceDirectiveResolutionCache,
|
|
97784
|
-
|
|
97785
|
-
)
|
|
97786
|
-
actualResolveTypeReferenceDirectiveNamesWorker = (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) => loadWithTypeDirectiveCache(Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader);
|
|
97832
|
+
createTypeReferenceResolutionLoader
|
|
97833
|
+
);
|
|
97787
97834
|
}
|
|
97788
97835
|
const packageIdToSourceFile = /* @__PURE__ */ new Map();
|
|
97789
97836
|
let sourceFileToPackageName = /* @__PURE__ */ new Map();
|
|
@@ -97796,7 +97843,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97796
97843
|
let projectReferenceRedirects;
|
|
97797
97844
|
let mapFromFileToProjectReferenceRedirects;
|
|
97798
97845
|
let mapFromToProjectReferenceRedirectSource;
|
|
97799
|
-
const useSourceOfProjectReferenceRedirect = !!((
|
|
97846
|
+
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
|
|
97800
97847
|
const { onProgramCreateComplete, fileExists, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
97801
97848
|
compilerHost: host,
|
|
97802
97849
|
getSymlinkCache,
|
|
@@ -97807,13 +97854,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97807
97854
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
97808
97855
|
});
|
|
97809
97856
|
const readFile = host.readFile.bind(host);
|
|
97810
|
-
(
|
|
97857
|
+
(_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
97811
97858
|
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
97812
|
-
(
|
|
97859
|
+
(_f = tracing) == null ? void 0 : _f.pop();
|
|
97813
97860
|
let structureIsReused;
|
|
97814
|
-
(
|
|
97861
|
+
(_g = tracing) == null ? void 0 : _g.push(tracing.Phase.Program, "tryReuseStructureFromOldProgram", {});
|
|
97815
97862
|
structureIsReused = tryReuseStructureFromOldProgram();
|
|
97816
|
-
(
|
|
97863
|
+
(_h = tracing) == null ? void 0 : _h.pop();
|
|
97817
97864
|
if (structureIsReused !== 2 /* Completely */) {
|
|
97818
97865
|
processingDefaultLibFiles = [];
|
|
97819
97866
|
processingOtherFiles = [];
|
|
@@ -97847,19 +97894,30 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97847
97894
|
});
|
|
97848
97895
|
}
|
|
97849
97896
|
}
|
|
97850
|
-
(
|
|
97897
|
+
(_i = tracing) == null ? void 0 : _i.push(tracing.Phase.Program, "processRootFiles", { count: rootNames.length });
|
|
97851
97898
|
forEach(rootNames, (name, index) => processRootFile(name, false, false, { kind: 0 /* RootFile */, index }));
|
|
97852
|
-
(
|
|
97853
|
-
|
|
97854
|
-
|
|
97855
|
-
|
|
97899
|
+
(_j = tracing) == null ? void 0 : _j.pop();
|
|
97900
|
+
automaticTypeDirectiveNames != null ? automaticTypeDirectiveNames : automaticTypeDirectiveNames = rootNames.length ? getAutomaticTypeDirectiveNames(options, host) : emptyArray;
|
|
97901
|
+
automaticTypeDirectiveResolutions = createModeAwareCache();
|
|
97902
|
+
if (automaticTypeDirectiveNames.length) {
|
|
97903
|
+
(_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
97856
97904
|
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
|
|
97857
97905
|
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
97858
|
-
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(
|
|
97859
|
-
for (let i = 0; i <
|
|
97860
|
-
|
|
97906
|
+
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
|
|
97907
|
+
for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
97908
|
+
automaticTypeDirectiveResolutions.set(automaticTypeDirectiveNames[i], void 0, resolutions[i]);
|
|
97909
|
+
processTypeReferenceDirective(
|
|
97910
|
+
automaticTypeDirectiveNames[i],
|
|
97911
|
+
void 0,
|
|
97912
|
+
resolutions[i],
|
|
97913
|
+
{
|
|
97914
|
+
kind: 8 /* AutomaticTypeDirectiveFile */,
|
|
97915
|
+
typeReference: automaticTypeDirectiveNames[i],
|
|
97916
|
+
packageId: (_m = (_l = resolutions[i]) == null ? void 0 : _l.resolvedTypeReferenceDirective) == null ? void 0 : _m.packageId
|
|
97917
|
+
}
|
|
97918
|
+
);
|
|
97861
97919
|
}
|
|
97862
|
-
(
|
|
97920
|
+
(_n = tracing) == null ? void 0 : _n.pop();
|
|
97863
97921
|
}
|
|
97864
97922
|
if (rootNames.length && !skipDefaultLib) {
|
|
97865
97923
|
const defaultLibraryFileName = getDefaultLibraryFileName();
|
|
@@ -97906,7 +97964,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97906
97964
|
}
|
|
97907
97965
|
);
|
|
97908
97966
|
}
|
|
97909
|
-
typeReferenceDirectiveResolutionCache = void 0;
|
|
97910
97967
|
oldProgram = void 0;
|
|
97911
97968
|
const program = {
|
|
97912
97969
|
getRootFileNames: () => rootNames,
|
|
@@ -97939,6 +97996,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97939
97996
|
getRelationCacheSizes: () => getTypeChecker().getRelationCacheSizes(),
|
|
97940
97997
|
getFileProcessingDiagnostics: () => fileProcessingDiagnostics,
|
|
97941
97998
|
getResolvedTypeReferenceDirectives: () => resolvedTypeReferenceDirectives,
|
|
97999
|
+
getAutomaticTypeDirectiveNames: () => automaticTypeDirectiveNames,
|
|
98000
|
+
getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
|
|
97942
98001
|
isSourceFileFromExternalLibrary,
|
|
97943
98002
|
isSourceFileDefaultLibrary,
|
|
97944
98003
|
getSourceFileFromReference,
|
|
@@ -97948,7 +98007,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97948
98007
|
usesUriStyleNodeCoreModules,
|
|
97949
98008
|
isEmittedFile,
|
|
97950
98009
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
|
|
97951
|
-
getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
97952
98010
|
getProjectReferences,
|
|
97953
98011
|
getResolvedProjectReferences,
|
|
97954
98012
|
getProjectReferenceRedirect,
|
|
@@ -97961,7 +98019,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97961
98019
|
readFile,
|
|
97962
98020
|
directoryExists,
|
|
97963
98021
|
getSymlinkCache,
|
|
97964
|
-
realpath: (
|
|
98022
|
+
realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
|
|
97965
98023
|
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
|
97966
98024
|
getFileIncludeReasons: () => fileReasons,
|
|
97967
98025
|
structureIsReused,
|
|
@@ -97975,6 +98033,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97975
98033
|
case 0 /* FilePreprocessingReferencedDiagnostic */:
|
|
97976
98034
|
const { file, pos, end } = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason);
|
|
97977
98035
|
return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
|
|
98036
|
+
case 2 /* ResolutionDiagnostics */:
|
|
98037
|
+
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
|
97978
98038
|
default:
|
|
97979
98039
|
Debug.assertNever(diagnostic);
|
|
97980
98040
|
}
|
|
@@ -97982,32 +98042,30 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97982
98042
|
verifyCompilerOptions();
|
|
97983
98043
|
mark("afterProgram");
|
|
97984
98044
|
measure("Program", "beforeProgram", "afterProgram");
|
|
97985
|
-
(
|
|
98045
|
+
(_p = tracing) == null ? void 0 : _p.pop();
|
|
97986
98046
|
return program;
|
|
97987
|
-
function addResolutionDiagnostics(
|
|
97988
|
-
|
|
98047
|
+
function addResolutionDiagnostics(resolution) {
|
|
98048
|
+
var _a3;
|
|
98049
|
+
if (!((_a3 = resolution.resolutionDiagnostics) == null ? void 0 : _a3.length))
|
|
97989
98050
|
return;
|
|
97990
|
-
|
|
97991
|
-
|
|
97992
|
-
|
|
98051
|
+
(fileProcessingDiagnostics != null ? fileProcessingDiagnostics : fileProcessingDiagnostics = []).push({
|
|
98052
|
+
kind: 2 /* ResolutionDiagnostics */,
|
|
98053
|
+
diagnostics: resolution.resolutionDiagnostics
|
|
98054
|
+
});
|
|
97993
98055
|
}
|
|
97994
|
-
function
|
|
97995
|
-
|
|
97996
|
-
|
|
98056
|
+
function addResolutionDiagnosticsFromResolutionOrCache(containingFile, name, resolution, mode) {
|
|
98057
|
+
if (host.resolveModuleNameLiterals || !host.resolveModuleNames)
|
|
98058
|
+
return addResolutionDiagnostics(resolution);
|
|
98059
|
+
if (!moduleResolutionCache || isExternalModuleNameRelative(name))
|
|
97997
98060
|
return;
|
|
97998
98061
|
const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
97999
98062
|
const containingDir = getDirectoryPath(containingFileName);
|
|
98000
98063
|
const redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
98001
|
-
|
|
98002
|
-
|
|
98003
|
-
|
|
98004
|
-
if (isExternalModuleNameRelative(name))
|
|
98005
|
-
continue;
|
|
98006
|
-
const diags = (_a3 = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) == null ? void 0 : _a3.resolutionDiagnostics;
|
|
98007
|
-
addResolutionDiagnostics(diags);
|
|
98008
|
-
}
|
|
98064
|
+
const fromCache = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir);
|
|
98065
|
+
if (fromCache)
|
|
98066
|
+
addResolutionDiagnostics(fromCache);
|
|
98009
98067
|
}
|
|
98010
|
-
function resolveModuleNamesWorker(moduleNames, containingFile,
|
|
98068
|
+
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
98011
98069
|
var _a3, _b2;
|
|
98012
98070
|
if (!moduleNames.length)
|
|
98013
98071
|
return emptyArray;
|
|
@@ -98015,23 +98073,22 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98015
98073
|
const redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
98016
98074
|
(_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName });
|
|
98017
98075
|
mark("beforeResolveModule");
|
|
98018
|
-
const result = actualResolveModuleNamesWorker(moduleNames,
|
|
98076
|
+
const result = actualResolveModuleNamesWorker(moduleNames, containingFileName, redirectedReference, options, containingFile, reusedNames);
|
|
98019
98077
|
mark("afterResolveModule");
|
|
98020
98078
|
measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
98021
98079
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
98022
|
-
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
98023
98080
|
return result;
|
|
98024
98081
|
}
|
|
98025
|
-
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile,
|
|
98082
|
+
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, reusedNames) {
|
|
98026
98083
|
var _a3, _b2;
|
|
98027
98084
|
if (!typeDirectiveNames.length)
|
|
98028
98085
|
return [];
|
|
98086
|
+
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
98029
98087
|
const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
98030
|
-
const redirectedReference =
|
|
98031
|
-
const containingFileMode = !isString(containingFile) ? containingFile.impliedNodeFormat : void 0;
|
|
98088
|
+
const redirectedReference = containingSourceFile && getRedirectReferenceForResolution(containingSourceFile);
|
|
98032
98089
|
(_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName });
|
|
98033
98090
|
mark("beforeResolveTypeReference");
|
|
98034
|
-
const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference,
|
|
98091
|
+
const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, options, containingSourceFile, reusedNames);
|
|
98035
98092
|
mark("afterResolveTypeReference");
|
|
98036
98093
|
measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
98037
98094
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
@@ -98077,9 +98134,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98077
98134
|
}
|
|
98078
98135
|
return libs.length + 2;
|
|
98079
98136
|
}
|
|
98080
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
|
|
98081
|
-
return moduleResolutionCache && resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
|
|
98082
|
-
}
|
|
98083
98137
|
function toPath3(fileName) {
|
|
98084
98138
|
return toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
98085
98139
|
}
|
|
@@ -98108,6 +98162,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98108
98162
|
return classifiableNames;
|
|
98109
98163
|
}
|
|
98110
98164
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
98165
|
+
var _a3;
|
|
98111
98166
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
98112
98167
|
return resolveModuleNamesWorker(moduleNames, file, void 0);
|
|
98113
98168
|
}
|
|
@@ -98123,24 +98178,24 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98123
98178
|
let unknownModuleNames;
|
|
98124
98179
|
let result;
|
|
98125
98180
|
let reusedNames;
|
|
98126
|
-
const predictedToResolveToAmbientModuleMarker =
|
|
98181
|
+
const predictedToResolveToAmbientModuleMarker = emptyResolution;
|
|
98127
98182
|
for (let i = 0; i < moduleNames.length; i++) {
|
|
98128
98183
|
const moduleName = moduleNames[i];
|
|
98129
98184
|
if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) {
|
|
98130
98185
|
const mode = getModeForUsageLocation(file, moduleName);
|
|
98131
|
-
const
|
|
98132
|
-
if (
|
|
98186
|
+
const oldResolution = (_a3 = oldSourceFile.resolvedModules) == null ? void 0 : _a3.get(moduleName.text, mode);
|
|
98187
|
+
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
98133
98188
|
if (isTraceEnabled(options, host)) {
|
|
98134
98189
|
trace(
|
|
98135
98190
|
host,
|
|
98136
|
-
|
|
98191
|
+
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,
|
|
98137
98192
|
moduleName.text,
|
|
98138
98193
|
getNormalizedAbsolutePath(file.originalFileName, currentDirectory),
|
|
98139
|
-
|
|
98140
|
-
|
|
98194
|
+
oldResolution.resolvedModule.resolvedFileName,
|
|
98195
|
+
oldResolution.resolvedModule.packageId && packageIdToString(oldResolution.resolvedModule.packageId)
|
|
98141
98196
|
);
|
|
98142
98197
|
}
|
|
98143
|
-
(result != null ? result : result = new Array(moduleNames.length))[i] =
|
|
98198
|
+
(result != null ? result : result = new Array(moduleNames.length))[i] = oldResolution;
|
|
98144
98199
|
(reusedNames != null ? reusedNames : reusedNames = []).push(moduleName);
|
|
98145
98200
|
continue;
|
|
98146
98201
|
}
|
|
@@ -98160,18 +98215,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98160
98215
|
(unknownModuleNames != null ? unknownModuleNames : unknownModuleNames = []).push(moduleName);
|
|
98161
98216
|
}
|
|
98162
98217
|
}
|
|
98163
|
-
const resolutions = unknownModuleNames && unknownModuleNames.length ? resolveModuleNamesWorker(unknownModuleNames, file,
|
|
98218
|
+
const resolutions = unknownModuleNames && unknownModuleNames.length ? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames) : emptyArray;
|
|
98164
98219
|
if (!result) {
|
|
98165
98220
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
98166
98221
|
return resolutions;
|
|
98167
98222
|
}
|
|
98168
98223
|
let j = 0;
|
|
98169
98224
|
for (let i = 0; i < result.length; i++) {
|
|
98170
|
-
if (result[i]) {
|
|
98171
|
-
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
98172
|
-
result[i] = void 0;
|
|
98173
|
-
}
|
|
98174
|
-
} else {
|
|
98225
|
+
if (!result[i]) {
|
|
98175
98226
|
result[i] = resolutions[j];
|
|
98176
98227
|
j++;
|
|
98177
98228
|
}
|
|
@@ -98195,6 +98246,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98195
98246
|
}
|
|
98196
98247
|
}
|
|
98197
98248
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
98249
|
+
var _a3;
|
|
98198
98250
|
if (structureIsReused === 0 /* Not */) {
|
|
98199
98251
|
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, void 0);
|
|
98200
98252
|
}
|
|
@@ -98203,7 +98255,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98203
98255
|
if (oldSourceFile !== containingFile && containingFile.resolvedTypeReferenceDirectiveNames) {
|
|
98204
98256
|
const result2 = [];
|
|
98205
98257
|
for (const typeDirectiveName of typeDirectiveNames) {
|
|
98206
|
-
const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(
|
|
98258
|
+
const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getTypeReferenceResolutionName(typeDirectiveName), getModeForFileReference(typeDirectiveName, containingFile.impliedNodeFormat));
|
|
98207
98259
|
result2.push(resolvedTypeReferenceDirective);
|
|
98208
98260
|
}
|
|
98209
98261
|
return result2;
|
|
@@ -98217,21 +98269,21 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98217
98269
|
for (let i = 0; i < typeDirectiveNames.length; i++) {
|
|
98218
98270
|
const entry = typeDirectiveNames[i];
|
|
98219
98271
|
if (canReuseResolutions) {
|
|
98220
|
-
const typeDirectiveName =
|
|
98272
|
+
const typeDirectiveName = getTypeReferenceResolutionName(entry);
|
|
98221
98273
|
const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
98222
|
-
const
|
|
98223
|
-
if (
|
|
98274
|
+
const oldResolution = (_a3 = !isString(containingFile) ? oldSourceFile == null ? void 0 : oldSourceFile.resolvedTypeReferenceDirectiveNames : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a3.get(typeDirectiveName, mode);
|
|
98275
|
+
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
98224
98276
|
if (isTraceEnabled(options, host)) {
|
|
98225
98277
|
trace(
|
|
98226
98278
|
host,
|
|
98227
|
-
|
|
98279
|
+
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,
|
|
98228
98280
|
typeDirectiveName,
|
|
98229
98281
|
!isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile,
|
|
98230
|
-
|
|
98231
|
-
|
|
98282
|
+
oldResolution.resolvedTypeReferenceDirective.resolvedFileName,
|
|
98283
|
+
oldResolution.resolvedTypeReferenceDirective.packageId && packageIdToString(oldResolution.resolvedTypeReferenceDirective.packageId)
|
|
98232
98284
|
);
|
|
98233
98285
|
}
|
|
98234
|
-
(result != null ? result : result = new Array(typeDirectiveNames.length))[i] =
|
|
98286
|
+
(result != null ? result : result = new Array(typeDirectiveNames.length))[i] = oldResolution;
|
|
98235
98287
|
(reusedNames != null ? reusedNames : reusedNames = []).push(entry);
|
|
98236
98288
|
continue;
|
|
98237
98289
|
}
|
|
@@ -98243,7 +98295,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98243
98295
|
const resolutions = resolveTypeReferenceDirectiveNamesWorker(
|
|
98244
98296
|
unknownTypeReferenceDirectiveNames,
|
|
98245
98297
|
containingFile,
|
|
98246
|
-
|
|
98298
|
+
reusedNames
|
|
98247
98299
|
);
|
|
98248
98300
|
if (!result) {
|
|
98249
98301
|
Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
@@ -98279,7 +98331,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98279
98331
|
);
|
|
98280
98332
|
}
|
|
98281
98333
|
function tryReuseStructureFromOldProgram() {
|
|
98282
|
-
var _a3
|
|
98334
|
+
var _a3;
|
|
98283
98335
|
if (!oldProgram) {
|
|
98284
98336
|
return 0 /* Not */;
|
|
98285
98337
|
}
|
|
@@ -98389,19 +98441,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98389
98441
|
for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
|
|
98390
98442
|
const moduleNames = getModuleNames(newSourceFile);
|
|
98391
98443
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
98392
|
-
const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo);
|
|
98444
|
+
const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
|
|
98393
98445
|
if (resolutionsChanged) {
|
|
98394
98446
|
structureIsReused = 1 /* SafeModules */;
|
|
98395
|
-
newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
|
|
98447
|
+
newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions, moduleResolutionNameAndModeGetter);
|
|
98396
98448
|
} else {
|
|
98397
98449
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
98398
98450
|
}
|
|
98399
98451
|
const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
98400
98452
|
const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
98401
|
-
const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo);
|
|
98453
|
+
const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
|
|
98402
98454
|
if (typeReferenceResolutionsChanged) {
|
|
98403
98455
|
structureIsReused = 1 /* SafeModules */;
|
|
98404
|
-
newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
98456
|
+
newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions, typeReferenceResolutionNameAndModeGetter);
|
|
98405
98457
|
} else {
|
|
98406
98458
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
98407
98459
|
}
|
|
@@ -98409,9 +98461,17 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98409
98461
|
if (structureIsReused !== 2 /* Completely */) {
|
|
98410
98462
|
return structureIsReused;
|
|
98411
98463
|
}
|
|
98412
|
-
if (changesAffectingProgramStructure(oldOptions, options)
|
|
98464
|
+
if (changesAffectingProgramStructure(oldOptions, options)) {
|
|
98413
98465
|
return 1 /* SafeModules */;
|
|
98414
98466
|
}
|
|
98467
|
+
if (host.hasChangedAutomaticTypeDirectiveNames) {
|
|
98468
|
+
if (host.hasChangedAutomaticTypeDirectiveNames())
|
|
98469
|
+
return 1 /* SafeModules */;
|
|
98470
|
+
} else {
|
|
98471
|
+
automaticTypeDirectiveNames = getAutomaticTypeDirectiveNames(options, host);
|
|
98472
|
+
if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
98473
|
+
return 1 /* SafeModules */;
|
|
98474
|
+
}
|
|
98415
98475
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
98416
98476
|
Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
98417
98477
|
for (const newSourceFile of newSourceFiles) {
|
|
@@ -98435,6 +98495,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98435
98495
|
fileReasons = oldProgram.getFileIncludeReasons();
|
|
98436
98496
|
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
|
98437
98497
|
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
|
|
98498
|
+
automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
|
|
98499
|
+
automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
|
|
98438
98500
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
98439
98501
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
98440
98502
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
@@ -99378,7 +99440,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
99378
99440
|
}
|
|
99379
99441
|
function processTypeReferenceDirectives(file) {
|
|
99380
99442
|
const typeDirectives = file.typeReferenceDirectives;
|
|
99381
|
-
if (!typeDirectives) {
|
|
99443
|
+
if (!typeDirectives.length) {
|
|
99444
|
+
file.resolvedTypeReferenceDirectiveNames = void 0;
|
|
99382
99445
|
return;
|
|
99383
99446
|
}
|
|
99384
99447
|
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
|
|
@@ -99389,23 +99452,31 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
99389
99452
|
setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective, getModeForFileReference(ref, file.impliedNodeFormat));
|
|
99390
99453
|
const mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
99391
99454
|
if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
|
|
99392
|
-
|
|
99455
|
+
(fileProcessingDiagnostics != null ? fileProcessingDiagnostics : fileProcessingDiagnostics = []).push({
|
|
99456
|
+
kind: 2 /* ResolutionDiagnostics */,
|
|
99457
|
+
diagnostics: [
|
|
99458
|
+
createDiagnosticForRange(file, ref, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)
|
|
99459
|
+
]
|
|
99460
|
+
});
|
|
99393
99461
|
}
|
|
99394
99462
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
99395
99463
|
}
|
|
99396
99464
|
}
|
|
99397
|
-
function processTypeReferenceDirective(typeReferenceDirective, mode,
|
|
99465
|
+
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
99398
99466
|
var _a3, _b2;
|
|
99399
|
-
(_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 });
|
|
99400
|
-
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
99467
|
+
(_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 });
|
|
99468
|
+
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason);
|
|
99401
99469
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
99402
99470
|
}
|
|
99403
|
-
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
99404
|
-
|
|
99471
|
+
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason) {
|
|
99472
|
+
var _a3;
|
|
99473
|
+
addResolutionDiagnostics(resolution);
|
|
99474
|
+
const previousResolution = (_a3 = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode)) == null ? void 0 : _a3.resolvedTypeReferenceDirective;
|
|
99405
99475
|
if (previousResolution && previousResolution.primary) {
|
|
99406
99476
|
return;
|
|
99407
99477
|
}
|
|
99408
99478
|
let saveResolution = true;
|
|
99479
|
+
const { resolvedTypeReferenceDirective } = resolution;
|
|
99409
99480
|
if (resolvedTypeReferenceDirective) {
|
|
99410
99481
|
if (resolvedTypeReferenceDirective.isExternalLibraryImport)
|
|
99411
99482
|
currentNodeModulesDepth++;
|
|
@@ -99436,7 +99507,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
99436
99507
|
addFilePreprocessingFileExplainingDiagnostic(void 0, reason, Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
|
|
99437
99508
|
}
|
|
99438
99509
|
if (saveResolution) {
|
|
99439
|
-
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode,
|
|
99510
|
+
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolution);
|
|
99440
99511
|
}
|
|
99441
99512
|
}
|
|
99442
99513
|
function pathForLibFile(libFileName) {
|
|
@@ -99485,8 +99556,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
99485
99556
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
99486
99557
|
const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a3 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a3.commandLine.options : void 0) || options;
|
|
99487
99558
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
99488
|
-
const resolution = resolutions[index];
|
|
99489
|
-
|
|
99559
|
+
const resolution = resolutions[index].resolvedModule;
|
|
99560
|
+
const moduleName = moduleNames[index].text;
|
|
99561
|
+
const mode = getModeForUsageLocation(file, moduleNames[index]);
|
|
99562
|
+
setResolvedModule(file, moduleName, resolutions[index], mode);
|
|
99563
|
+
addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
|
|
99490
99564
|
if (!resolution) {
|
|
99491
99565
|
continue;
|
|
99492
99566
|
}
|
|
@@ -100127,8 +100201,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
100127
100201
|
if (!symlinks) {
|
|
100128
100202
|
symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
100129
100203
|
}
|
|
100130
|
-
if (files &&
|
|
100131
|
-
symlinks.setSymlinksFromResolutions(files,
|
|
100204
|
+
if (files && automaticTypeDirectiveResolutions && !symlinks.hasProcessedResolutions()) {
|
|
100205
|
+
symlinks.setSymlinksFromResolutions(files, automaticTypeDirectiveResolutions);
|
|
100132
100206
|
}
|
|
100133
100207
|
return symlinks;
|
|
100134
100208
|
}
|
|
@@ -100462,7 +100536,7 @@ var BuilderState;
|
|
|
100462
100536
|
}
|
|
100463
100537
|
}
|
|
100464
100538
|
if (sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
100465
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.forEach((resolvedTypeReferenceDirective) => {
|
|
100539
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
|
|
100466
100540
|
if (!resolvedTypeReferenceDirective) {
|
|
100467
100541
|
return;
|
|
100468
100542
|
}
|
|
@@ -101972,9 +102046,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
101972
102046
|
finishRecordingFilesWithChangedResolutions,
|
|
101973
102047
|
startCachingPerDirectoryResolution,
|
|
101974
102048
|
finishCachingPerDirectoryResolution,
|
|
101975
|
-
|
|
101976
|
-
|
|
101977
|
-
|
|
102049
|
+
resolveModuleNameLiterals,
|
|
102050
|
+
resolveTypeReferenceDirectiveReferences,
|
|
102051
|
+
resolveSingleModuleNameWithoutWatching,
|
|
101978
102052
|
removeResolutionsFromProjectReferenceRedirects,
|
|
101979
102053
|
removeResolutionsOfFile,
|
|
101980
102054
|
hasChangedAutomaticTypeDirectiveNames: () => hasChangedAutomaticTypeDirectiveNames,
|
|
@@ -101990,7 +102064,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
101990
102064
|
function getResolvedModule2(resolution) {
|
|
101991
102065
|
return resolution.resolvedModule;
|
|
101992
102066
|
}
|
|
101993
|
-
function
|
|
102067
|
+
function getResolvedTypeReferenceDirective(resolution) {
|
|
101994
102068
|
return resolution.resolvedTypeReferenceDirective;
|
|
101995
102069
|
}
|
|
101996
102070
|
function isInDirectoryPath(dir, file) {
|
|
@@ -102092,14 +102166,16 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102092
102166
|
});
|
|
102093
102167
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
102094
102168
|
}
|
|
102095
|
-
function resolveModuleName2(moduleName, containingFile, compilerOptions,
|
|
102169
|
+
function resolveModuleName2(moduleName, containingFile, compilerOptions, redirectedReference, mode) {
|
|
102170
|
+
var _a2;
|
|
102171
|
+
const host = ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost;
|
|
102096
102172
|
const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
102097
102173
|
if (!resolutionHost.getGlobalCache) {
|
|
102098
102174
|
return primaryResult;
|
|
102099
102175
|
}
|
|
102100
102176
|
const globalCache = resolutionHost.getGlobalCache();
|
|
102101
102177
|
if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
102102
|
-
const { resolvedModule, failedLookupLocations, affectingLocations } = loadModuleFromGlobalCache(
|
|
102178
|
+
const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
|
|
102103
102179
|
Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
|
|
102104
102180
|
resolutionHost.projectName,
|
|
102105
102181
|
compilerOptions,
|
|
@@ -102109,49 +102185,55 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102109
102185
|
);
|
|
102110
102186
|
if (resolvedModule) {
|
|
102111
102187
|
primaryResult.resolvedModule = resolvedModule;
|
|
102112
|
-
primaryResult.failedLookupLocations.
|
|
102113
|
-
primaryResult.affectingLocations.
|
|
102188
|
+
primaryResult.failedLookupLocations = updateResolutionField(primaryResult.failedLookupLocations, failedLookupLocations);
|
|
102189
|
+
primaryResult.affectingLocations = updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
102190
|
+
primaryResult.resolutionDiagnostics = updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
102114
102191
|
return primaryResult;
|
|
102115
102192
|
}
|
|
102116
102193
|
}
|
|
102117
102194
|
return primaryResult;
|
|
102118
102195
|
}
|
|
102119
|
-
function
|
|
102120
|
-
return
|
|
102196
|
+
function createModuleResolutionLoader2(containingFile, redirectedReference, options) {
|
|
102197
|
+
return {
|
|
102198
|
+
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
102199
|
+
resolve: (moduleName, resoluionMode) => resolveModuleName2(
|
|
102200
|
+
moduleName,
|
|
102201
|
+
containingFile,
|
|
102202
|
+
options,
|
|
102203
|
+
redirectedReference,
|
|
102204
|
+
resoluionMode
|
|
102205
|
+
)
|
|
102206
|
+
};
|
|
102121
102207
|
}
|
|
102122
102208
|
function resolveNamesWithLocalCache({
|
|
102123
|
-
|
|
102209
|
+
entries,
|
|
102124
102210
|
containingFile,
|
|
102211
|
+
containingSourceFile,
|
|
102125
102212
|
redirectedReference,
|
|
102213
|
+
options,
|
|
102126
102214
|
perFileCache,
|
|
102215
|
+
reusedNames,
|
|
102127
102216
|
loader,
|
|
102128
102217
|
getResolutionWithResolvedFileName,
|
|
102129
102218
|
shouldRetryResolution,
|
|
102130
|
-
|
|
102131
|
-
resolutionInfo,
|
|
102132
|
-
logChanges,
|
|
102133
|
-
containingSourceFile,
|
|
102134
|
-
containingSourceFileMode
|
|
102219
|
+
logChanges
|
|
102135
102220
|
}) {
|
|
102136
|
-
var _a2
|
|
102221
|
+
var _a2;
|
|
102137
102222
|
const path = resolutionHost.toPath(containingFile);
|
|
102138
102223
|
const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
|
|
102139
102224
|
const resolvedModules = [];
|
|
102140
|
-
const compilerOptions = resolutionHost.getCompilationSettings();
|
|
102141
102225
|
const hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
102142
102226
|
const program = resolutionHost.getCurrentProgram();
|
|
102143
102227
|
const oldRedirect = program && program.getResolvedProjectReferenceToRedirect(containingFile);
|
|
102144
102228
|
const unmatchedRedirects = oldRedirect ? !redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path : !!redirectedReference;
|
|
102145
102229
|
const seenNamesInFile = createModeAwareCache();
|
|
102146
|
-
|
|
102147
|
-
|
|
102148
|
-
const
|
|
102149
|
-
const mode = !isString(entry) ? isStringLiteralLike(entry) ? getModeForUsageLocation(containingSourceFile, entry) : getModeForFileReference(entry, containingSourceFileMode) : containingSourceFile ? getModeForResolutionAtIndex(containingSourceFile, i) : void 0;
|
|
102150
|
-
i++;
|
|
102230
|
+
for (const entry of entries) {
|
|
102231
|
+
const name = loader.nameAndMode.getName(entry);
|
|
102232
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
102151
102233
|
let resolution = resolutionsInFile.get(name, mode);
|
|
102152
102234
|
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
102153
102235
|
const existingResolution = resolution;
|
|
102154
|
-
resolution = loader(name,
|
|
102236
|
+
resolution = loader.resolve(name, mode);
|
|
102155
102237
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
102156
102238
|
resolutionHost.onDiscoveredSymlink();
|
|
102157
102239
|
}
|
|
@@ -102165,12 +102247,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102165
102247
|
logChanges = false;
|
|
102166
102248
|
}
|
|
102167
102249
|
} else {
|
|
102168
|
-
const host = ((
|
|
102169
|
-
if (isTraceEnabled(
|
|
102250
|
+
const host = ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost;
|
|
102251
|
+
if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) {
|
|
102170
102252
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
102171
102253
|
trace(
|
|
102172
102254
|
host,
|
|
102173
|
-
|
|
102255
|
+
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,
|
|
102174
102256
|
name,
|
|
102175
102257
|
containingFile,
|
|
102176
102258
|
resolved == null ? void 0 : resolved.resolvedFileName,
|
|
@@ -102180,19 +102262,16 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102180
102262
|
}
|
|
102181
102263
|
Debug.assert(resolution !== void 0 && !resolution.isInvalidated);
|
|
102182
102264
|
seenNamesInFile.set(name, mode, true);
|
|
102183
|
-
resolvedModules.push(
|
|
102184
|
-
}
|
|
102185
|
-
if (resolutionInfo && (loader === resolveTypeReferenceDirective2 || containingSourceFile)) {
|
|
102186
|
-
(_c = resolutionInfo.reusedNames) == null ? void 0 : _c.forEach((entry) => seenNamesInFile.set(
|
|
102187
|
-
getResolutionName(entry),
|
|
102188
|
-
!isString(entry) && isStringLiteralLike(entry) ? getModeForUsageLocation(containingSourceFile, entry) : getModeForFileReference(entry, containingSourceFileMode),
|
|
102189
|
-
true
|
|
102190
|
-
));
|
|
102191
|
-
reusedNames = void 0;
|
|
102265
|
+
resolvedModules.push(resolution);
|
|
102192
102266
|
}
|
|
102267
|
+
reusedNames == null ? void 0 : reusedNames.forEach((entry) => seenNamesInFile.set(
|
|
102268
|
+
loader.nameAndMode.getName(entry),
|
|
102269
|
+
loader.nameAndMode.getMode(entry, containingSourceFile),
|
|
102270
|
+
true
|
|
102271
|
+
));
|
|
102193
102272
|
if (resolutionsInFile.size() !== seenNamesInFile.size()) {
|
|
102194
102273
|
resolutionsInFile.forEach((resolution, name, mode) => {
|
|
102195
|
-
if (!seenNamesInFile.has(name, mode)
|
|
102274
|
+
if (!seenNamesInFile.has(name, mode)) {
|
|
102196
102275
|
stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
102197
102276
|
resolutionsInFile.delete(name, mode);
|
|
102198
102277
|
}
|
|
@@ -102217,39 +102296,53 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102217
102296
|
return oldResult.resolvedFileName === newResult.resolvedFileName;
|
|
102218
102297
|
}
|
|
102219
102298
|
}
|
|
102220
|
-
function
|
|
102299
|
+
function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
102300
|
+
var _a2;
|
|
102221
102301
|
return resolveNamesWithLocalCache({
|
|
102222
|
-
|
|
102302
|
+
entries: typeDirectiveReferences,
|
|
102223
102303
|
containingFile,
|
|
102304
|
+
containingSourceFile,
|
|
102224
102305
|
redirectedReference,
|
|
102306
|
+
options,
|
|
102307
|
+
reusedNames,
|
|
102225
102308
|
perFileCache: resolvedTypeReferenceDirectives,
|
|
102226
|
-
loader:
|
|
102227
|
-
|
|
102228
|
-
|
|
102229
|
-
|
|
102230
|
-
|
|
102309
|
+
loader: createTypeReferenceResolutionLoader(
|
|
102310
|
+
containingFile,
|
|
102311
|
+
redirectedReference,
|
|
102312
|
+
options,
|
|
102313
|
+
((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost,
|
|
102314
|
+
typeReferenceDirectiveResolutionCache
|
|
102315
|
+
),
|
|
102316
|
+
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
102317
|
+
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0
|
|
102231
102318
|
});
|
|
102232
102319
|
}
|
|
102233
|
-
function
|
|
102320
|
+
function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
102234
102321
|
return resolveNamesWithLocalCache({
|
|
102235
|
-
|
|
102322
|
+
entries: moduleLiterals,
|
|
102236
102323
|
containingFile,
|
|
102324
|
+
containingSourceFile,
|
|
102237
102325
|
redirectedReference,
|
|
102326
|
+
options,
|
|
102327
|
+
reusedNames,
|
|
102238
102328
|
perFileCache: resolvedModuleNames,
|
|
102239
|
-
loader:
|
|
102329
|
+
loader: createModuleResolutionLoader2(
|
|
102330
|
+
containingFile,
|
|
102331
|
+
redirectedReference,
|
|
102332
|
+
options
|
|
102333
|
+
),
|
|
102240
102334
|
getResolutionWithResolvedFileName: getResolvedModule2,
|
|
102241
102335
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
102242
|
-
|
|
102243
|
-
resolutionInfo,
|
|
102244
|
-
logChanges: logChangesWhenResolvingModule,
|
|
102245
|
-
containingSourceFile
|
|
102336
|
+
logChanges: logChangesWhenResolvingModule
|
|
102246
102337
|
});
|
|
102247
102338
|
}
|
|
102248
|
-
function
|
|
102249
|
-
const
|
|
102250
|
-
|
|
102251
|
-
|
|
102252
|
-
|
|
102339
|
+
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
102340
|
+
const path = resolutionHost.toPath(containingFile);
|
|
102341
|
+
const resolutionsInFile = resolvedModuleNames.get(path);
|
|
102342
|
+
const resolution = resolutionsInFile == null ? void 0 : resolutionsInFile.get(moduleName, void 0);
|
|
102343
|
+
if (resolution && !resolution.isInvalidated)
|
|
102344
|
+
return resolution;
|
|
102345
|
+
return resolveModuleName2(moduleName, containingFile, resolutionHost.getCompilationSettings());
|
|
102253
102346
|
}
|
|
102254
102347
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
102255
102348
|
return endsWith(dirPath, "/node_modules/@types");
|
|
@@ -102328,37 +102421,39 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102328
102421
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
102329
102422
|
Debug.assert(!!resolution.refCount);
|
|
102330
102423
|
const { failedLookupLocations, affectingLocations } = resolution;
|
|
102331
|
-
if (!failedLookupLocations.length && !affectingLocations.length)
|
|
102424
|
+
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length))
|
|
102332
102425
|
return;
|
|
102333
|
-
if (failedLookupLocations.length)
|
|
102426
|
+
if (failedLookupLocations == null ? void 0 : failedLookupLocations.length)
|
|
102334
102427
|
resolutionsWithFailedLookups.push(resolution);
|
|
102335
102428
|
let setAtRoot = false;
|
|
102336
|
-
|
|
102337
|
-
const
|
|
102338
|
-
|
|
102339
|
-
|
|
102340
|
-
|
|
102341
|
-
|
|
102342
|
-
|
|
102343
|
-
|
|
102344
|
-
|
|
102345
|
-
|
|
102346
|
-
|
|
102347
|
-
|
|
102348
|
-
|
|
102349
|
-
|
|
102429
|
+
if (failedLookupLocations) {
|
|
102430
|
+
for (const failedLookupLocation of failedLookupLocations) {
|
|
102431
|
+
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
102432
|
+
const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
102433
|
+
if (toWatch) {
|
|
102434
|
+
const { dir, dirPath, nonRecursive } = toWatch;
|
|
102435
|
+
if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
|
|
102436
|
+
const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
|
|
102437
|
+
customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
|
|
102438
|
+
}
|
|
102439
|
+
if (dirPath === rootPath) {
|
|
102440
|
+
Debug.assert(!nonRecursive);
|
|
102441
|
+
setAtRoot = true;
|
|
102442
|
+
} else {
|
|
102443
|
+
setDirectoryWatcher(dir, dirPath, nonRecursive);
|
|
102444
|
+
}
|
|
102350
102445
|
}
|
|
102351
102446
|
}
|
|
102447
|
+
if (setAtRoot) {
|
|
102448
|
+
setDirectoryWatcher(rootDir, rootPath, true);
|
|
102449
|
+
}
|
|
102352
102450
|
}
|
|
102353
|
-
|
|
102354
|
-
setDirectoryWatcher(rootDir, rootPath, true);
|
|
102355
|
-
}
|
|
102356
|
-
watchAffectingLocationsOfResolution(resolution, !failedLookupLocations.length);
|
|
102451
|
+
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length));
|
|
102357
102452
|
}
|
|
102358
102453
|
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
102359
102454
|
Debug.assert(!!resolution.refCount);
|
|
102360
102455
|
const { affectingLocations } = resolution;
|
|
102361
|
-
if (!affectingLocations.length)
|
|
102456
|
+
if (!(affectingLocations == null ? void 0 : affectingLocations.length))
|
|
102362
102457
|
return;
|
|
102363
102458
|
if (addToResolutionsWithOnlyAffectingLocations)
|
|
102364
102459
|
resolutionsWithOnlyAffectingLocations.push(resolution);
|
|
@@ -102476,12 +102571,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102476
102571
|
if (removeAtRoot) {
|
|
102477
102572
|
removeDirectoryWatcher(rootPath);
|
|
102478
102573
|
}
|
|
102479
|
-
} else if (affectingLocations.length) {
|
|
102574
|
+
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
102480
102575
|
unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
|
|
102481
102576
|
}
|
|
102482
|
-
|
|
102483
|
-
const
|
|
102484
|
-
|
|
102577
|
+
if (affectingLocations) {
|
|
102578
|
+
for (const affectingLocation of affectingLocations) {
|
|
102579
|
+
const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
102580
|
+
watcher.resolutions--;
|
|
102581
|
+
}
|
|
102485
102582
|
}
|
|
102486
102583
|
}
|
|
102487
102584
|
function removeDirectoryWatcher(dirPath) {
|
|
@@ -102517,7 +102614,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102517
102614
|
}
|
|
102518
102615
|
function removeResolutionsOfFile(filePath) {
|
|
102519
102616
|
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule2);
|
|
102520
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath,
|
|
102617
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
102521
102618
|
}
|
|
102522
102619
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
102523
102620
|
if (!resolutions)
|
|
@@ -102603,17 +102700,19 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102603
102700
|
return invalidated;
|
|
102604
102701
|
}
|
|
102605
102702
|
function canInvalidateFailedLookupResolution(resolution) {
|
|
102703
|
+
var _a2;
|
|
102606
102704
|
if (canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution))
|
|
102607
102705
|
return true;
|
|
102608
102706
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
|
|
102609
102707
|
return false;
|
|
102610
|
-
return resolution.failedLookupLocations.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
|
|
102708
|
+
return (_a2 = resolution.failedLookupLocations) == null ? void 0 : _a2.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
|
|
102611
102709
|
}
|
|
102612
102710
|
function isInvalidatedFailedLookup(locationPath) {
|
|
102613
102711
|
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);
|
|
102614
102712
|
}
|
|
102615
102713
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
102616
|
-
|
|
102714
|
+
var _a2;
|
|
102715
|
+
return !!affectingPathChecks && ((_a2 = resolution.affectingLocations) == null ? void 0 : _a2.some((location) => affectingPathChecks.has(location)));
|
|
102617
102716
|
}
|
|
102618
102717
|
function closeTypeRootsWatch() {
|
|
102619
102718
|
clearMap(typeRootsWatches, closeFileWatcher);
|
|
@@ -103379,10 +103478,18 @@ function createWatchProgram(host) {
|
|
|
103379
103478
|
configFileName ? getDirectoryPath(getNormalizedAbsolutePath(configFileName, currentDirectory)) : currentDirectory,
|
|
103380
103479
|
false
|
|
103381
103480
|
);
|
|
103382
|
-
compilerHost.
|
|
103383
|
-
compilerHost.
|
|
103384
|
-
compilerHost.
|
|
103385
|
-
|
|
103481
|
+
compilerHost.resolveModuleNameLiterals = maybeBind(host, host.resolveModuleNameLiterals);
|
|
103482
|
+
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
103483
|
+
if (!compilerHost.resolveModuleNameLiterals && !compilerHost.resolveModuleNames) {
|
|
103484
|
+
compilerHost.resolveModuleNameLiterals = resolutionCache.resolveModuleNameLiterals.bind(resolutionCache);
|
|
103485
|
+
}
|
|
103486
|
+
compilerHost.resolveTypeReferenceDirectiveReferences = maybeBind(host, host.resolveTypeReferenceDirectiveReferences);
|
|
103487
|
+
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
103488
|
+
if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) {
|
|
103489
|
+
compilerHost.resolveTypeReferenceDirectiveReferences = resolutionCache.resolveTypeReferenceDirectiveReferences.bind(resolutionCache);
|
|
103490
|
+
}
|
|
103491
|
+
compilerHost.getModuleResolutionCache = host.resolveModuleNameLiterals || host.resolveModuleNames ? maybeBind(host, host.getModuleResolutionCache) : () => resolutionCache.getModuleResolutionCache();
|
|
103492
|
+
const userProvidedResolution = !!host.resolveModuleNameLiterals || !!host.resolveTypeReferenceDirectiveReferences || !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
103386
103493
|
const customHasInvalidatedResolutions = userProvidedResolution ? maybeBind(host, host.hasInvalidatedResolutions) || returnTrue : returnFalse;
|
|
103387
103494
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
103388
103495
|
synchronizeProgram();
|
|
@@ -104021,19 +104128,38 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
104021
104128
|
const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions);
|
|
104022
104129
|
setGetSourceFileAsHashVersioned(compilerHost);
|
|
104023
104130
|
compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
|
|
104131
|
+
compilerHost.resolveModuleNameLiterals = maybeBind(host, host.resolveModuleNameLiterals);
|
|
104132
|
+
compilerHost.resolveTypeReferenceDirectiveReferences = maybeBind(host, host.resolveTypeReferenceDirectiveReferences);
|
|
104024
104133
|
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
104025
104134
|
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
104026
104135
|
compilerHost.getModuleResolutionCache = maybeBind(host, host.getModuleResolutionCache);
|
|
104027
|
-
|
|
104028
|
-
|
|
104029
|
-
|
|
104030
|
-
|
|
104031
|
-
|
|
104136
|
+
let moduleResolutionCache, typeReferenceDirectiveResolutionCache;
|
|
104137
|
+
if (!compilerHost.resolveModuleNameLiterals && !compilerHost.resolveModuleNames) {
|
|
104138
|
+
moduleResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName);
|
|
104139
|
+
compilerHost.resolveModuleNameLiterals = (moduleNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
104140
|
+
moduleNames,
|
|
104141
|
+
containingFile,
|
|
104142
|
+
redirectedReference,
|
|
104143
|
+
options2,
|
|
104144
|
+
containingSourceFile,
|
|
104145
|
+
host,
|
|
104146
|
+
moduleResolutionCache,
|
|
104147
|
+
createModuleResolutionLoader
|
|
104148
|
+
);
|
|
104032
104149
|
compilerHost.getModuleResolutionCache = () => moduleResolutionCache;
|
|
104033
104150
|
}
|
|
104034
|
-
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
104035
|
-
|
|
104036
|
-
compilerHost.
|
|
104151
|
+
if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) {
|
|
104152
|
+
typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
104153
|
+
compilerHost.resolveTypeReferenceDirectiveReferences = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
104154
|
+
typeDirectiveNames,
|
|
104155
|
+
containingFile,
|
|
104156
|
+
redirectedReference,
|
|
104157
|
+
options2,
|
|
104158
|
+
containingSourceFile,
|
|
104159
|
+
host,
|
|
104160
|
+
typeReferenceDirectiveResolutionCache,
|
|
104161
|
+
createTypeReferenceResolutionLoader
|
|
104162
|
+
);
|
|
104037
104163
|
}
|
|
104038
104164
|
compilerHost.getBuildInfo = (fileName, configFilePath) => getBuildInfo3(state, fileName, toResolvedConfigFilePath(state, configFilePath), void 0);
|
|
104039
104165
|
const { watchFile: watchFile2, watchDirectory, writeLog } = createWatchFactory(hostWithWatch, options);
|