typescript 5.0.0-dev.20221205 → 5.0.0-dev.20221207
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 +592 -435
- package/lib/tsserver.js +153270 -150849
- package/lib/tsserverlibrary.d.ts +46 -24
- package/lib/tsserverlibrary.js +683 -493
- package/lib/typescript.d.ts +46 -21
- package/lib/typescript.js +662 -476
- package/lib/typingsInstaller.js +72 -77
- 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-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20221207`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -1695,22 +1695,8 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1695
1695
|
function enableDebugInfo() {
|
|
1696
1696
|
if (isDebugInfoEnabled)
|
|
1697
1697
|
return;
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
function getWeakTypeTextMap() {
|
|
1701
|
-
if (weakTypeTextMap === void 0) {
|
|
1702
|
-
if (typeof WeakMap === "function")
|
|
1703
|
-
weakTypeTextMap = /* @__PURE__ */ new WeakMap();
|
|
1704
|
-
}
|
|
1705
|
-
return weakTypeTextMap;
|
|
1706
|
-
}
|
|
1707
|
-
function getWeakNodeTextMap() {
|
|
1708
|
-
if (weakNodeTextMap === void 0) {
|
|
1709
|
-
if (typeof WeakMap === "function")
|
|
1710
|
-
weakNodeTextMap = /* @__PURE__ */ new WeakMap();
|
|
1711
|
-
}
|
|
1712
|
-
return weakNodeTextMap;
|
|
1713
|
-
}
|
|
1698
|
+
const weakTypeTextMap = /* @__PURE__ */ new WeakMap();
|
|
1699
|
+
const weakNodeTextMap = /* @__PURE__ */ new WeakMap();
|
|
1714
1700
|
Object.defineProperties(objectAllocator.getSymbolConstructor().prototype, {
|
|
1715
1701
|
__tsDebuggerDisplay: {
|
|
1716
1702
|
value() {
|
|
@@ -1739,11 +1725,10 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1739
1725
|
} },
|
|
1740
1726
|
__debugTypeToString: {
|
|
1741
1727
|
value() {
|
|
1742
|
-
|
|
1743
|
-
let text = map2 == null ? void 0 : map2.get(this);
|
|
1728
|
+
let text = weakTypeTextMap.get(this);
|
|
1744
1729
|
if (text === void 0) {
|
|
1745
1730
|
text = this.checker.typeToString(this);
|
|
1746
|
-
|
|
1731
|
+
weakTypeTextMap.set(this, text);
|
|
1747
1732
|
}
|
|
1748
1733
|
return text;
|
|
1749
1734
|
}
|
|
@@ -1795,13 +1780,12 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1795
1780
|
value(includeTrivia) {
|
|
1796
1781
|
if (nodeIsSynthesized(this))
|
|
1797
1782
|
return "";
|
|
1798
|
-
|
|
1799
|
-
let text = map2 == null ? void 0 : map2.get(this);
|
|
1783
|
+
let text = weakNodeTextMap.get(this);
|
|
1800
1784
|
if (text === void 0) {
|
|
1801
1785
|
const parseNode = getParseTreeNode(this);
|
|
1802
1786
|
const sourceFile = parseNode && getSourceFileOfNode(parseNode);
|
|
1803
1787
|
text = sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
|
|
1804
|
-
|
|
1788
|
+
weakNodeTextMap.set(this, text);
|
|
1805
1789
|
}
|
|
1806
1790
|
return text;
|
|
1807
1791
|
}
|
|
@@ -10702,7 +10686,8 @@ function getFullWidth(node) {
|
|
|
10702
10686
|
return node.end - node.pos;
|
|
10703
10687
|
}
|
|
10704
10688
|
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
10705
|
-
|
|
10689
|
+
var _a2, _b;
|
|
10690
|
+
return (_b = (_a2 = sourceFile == null ? void 0 : sourceFile.resolvedModules) == null ? void 0 : _a2.get(moduleNameText, mode)) == null ? void 0 : _b.resolvedModule;
|
|
10706
10691
|
}
|
|
10707
10692
|
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
10708
10693
|
if (!sourceFile.resolvedModules) {
|
|
@@ -10716,15 +10701,11 @@ function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveNam
|
|
|
10716
10701
|
}
|
|
10717
10702
|
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
|
|
10718
10703
|
}
|
|
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
10704
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
10724
10705
|
return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
|
|
10725
10706
|
}
|
|
10726
10707
|
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);
|
|
10708
|
+
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
10709
|
}
|
|
10729
10710
|
function packageIdIsEqual(a, b) {
|
|
10730
10711
|
return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
|
|
@@ -10736,15 +10717,15 @@ function packageIdToString(packageId) {
|
|
|
10736
10717
|
return `${packageIdToPackageName(packageId)}@${packageId.version}`;
|
|
10737
10718
|
}
|
|
10738
10719
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
10739
|
-
return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary && oldResolution.originalPath === newResolution.originalPath;
|
|
10720
|
+
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
10721
|
}
|
|
10741
|
-
function hasChangesInResolutions(names, newSourceFile, newResolutions, oldResolutions, comparer) {
|
|
10722
|
+
function hasChangesInResolutions(names, newSourceFile, newResolutions, oldResolutions, comparer, nameAndModeGetter) {
|
|
10742
10723
|
Debug.assert(names.length === newResolutions.length);
|
|
10743
10724
|
for (let i = 0; i < names.length; i++) {
|
|
10744
10725
|
const newResolution = newResolutions[i];
|
|
10745
10726
|
const entry = names[i];
|
|
10746
|
-
const name =
|
|
10747
|
-
const mode =
|
|
10727
|
+
const name = nameAndModeGetter.getName(entry);
|
|
10728
|
+
const mode = nameAndModeGetter.getMode(entry, newSourceFile);
|
|
10748
10729
|
const oldResolution = oldResolutions && oldResolutions.get(name, mode);
|
|
10749
10730
|
const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
|
|
10750
10731
|
if (changed) {
|
|
@@ -14824,13 +14805,14 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
|
|
|
14824
14805
|
}
|
|
14825
14806
|
},
|
|
14826
14807
|
setSymlinksFromResolutions(files, typeReferenceDirectives) {
|
|
14827
|
-
var _a2;
|
|
14808
|
+
var _a2, _b;
|
|
14828
14809
|
Debug.assert(!hasProcessedResolutions);
|
|
14829
14810
|
hasProcessedResolutions = true;
|
|
14830
14811
|
for (const file of files) {
|
|
14831
|
-
(_a2 = file.resolvedModules) == null ? void 0 : _a2.forEach((resolution) => processResolution(this, resolution));
|
|
14812
|
+
(_a2 = file.resolvedModules) == null ? void 0 : _a2.forEach((resolution) => processResolution(this, resolution.resolvedModule));
|
|
14813
|
+
(_b = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _b.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
14832
14814
|
}
|
|
14833
|
-
typeReferenceDirectives
|
|
14815
|
+
typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
14834
14816
|
},
|
|
14835
14817
|
hasProcessedResolutions: () => hasProcessedResolutions
|
|
14836
14818
|
};
|
|
@@ -32721,17 +32703,29 @@ function resolvedTypeScriptOnly(resolved) {
|
|
|
32721
32703
|
}
|
|
32722
32704
|
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
32723
32705
|
if (resultFromCache) {
|
|
32724
|
-
resultFromCache.failedLookupLocations.
|
|
32725
|
-
resultFromCache.affectingLocations.
|
|
32706
|
+
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
32707
|
+
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
32708
|
+
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
32726
32709
|
return resultFromCache;
|
|
32727
32710
|
}
|
|
32728
32711
|
return {
|
|
32729
32712
|
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
|
|
32713
|
+
failedLookupLocations: initializeResolutionField(failedLookupLocations),
|
|
32714
|
+
affectingLocations: initializeResolutionField(affectingLocations),
|
|
32715
|
+
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
32733
32716
|
};
|
|
32734
32717
|
}
|
|
32718
|
+
function initializeResolutionField(value) {
|
|
32719
|
+
return value.length ? value : void 0;
|
|
32720
|
+
}
|
|
32721
|
+
function updateResolutionField(to, value) {
|
|
32722
|
+
if (!(value == null ? void 0 : value.length))
|
|
32723
|
+
return to;
|
|
32724
|
+
if (!(to == null ? void 0 : to.length))
|
|
32725
|
+
return value;
|
|
32726
|
+
to.push(...value);
|
|
32727
|
+
return to;
|
|
32728
|
+
}
|
|
32735
32729
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
32736
32730
|
if (!hasProperty(jsonContent, fieldName)) {
|
|
32737
32731
|
if (state.traceEnabled) {
|
|
@@ -32866,8 +32860,10 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
32866
32860
|
options = redirectedReference.commandLine.options;
|
|
32867
32861
|
}
|
|
32868
32862
|
const containingDirectory = containingFile ? getDirectoryPath(containingFile) : void 0;
|
|
32869
|
-
|
|
32870
|
-
|
|
32863
|
+
let result = containingDirectory ? cache == null ? void 0 : cache.getFromDirectoryCache(typeReferenceDirectiveName, resolutionMode, containingDirectory, redirectedReference) : void 0;
|
|
32864
|
+
if (!result && containingDirectory && !isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
32865
|
+
result = cache == null ? void 0 : cache.getFromNonRelativeNameCache(typeReferenceDirectiveName, resolutionMode, containingDirectory, redirectedReference);
|
|
32866
|
+
}
|
|
32871
32867
|
if (result) {
|
|
32872
32868
|
if (traceEnabled) {
|
|
32873
32869
|
trace(host, Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -32937,8 +32933,18 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
32937
32933
|
isExternalLibraryImport: pathContainsNodeModules(fileName)
|
|
32938
32934
|
};
|
|
32939
32935
|
}
|
|
32940
|
-
result = {
|
|
32941
|
-
|
|
32936
|
+
result = {
|
|
32937
|
+
resolvedTypeReferenceDirective,
|
|
32938
|
+
failedLookupLocations: initializeResolutionField(failedLookupLocations),
|
|
32939
|
+
affectingLocations: initializeResolutionField(affectingLocations),
|
|
32940
|
+
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
32941
|
+
};
|
|
32942
|
+
if (containingDirectory) {
|
|
32943
|
+
cache == null ? void 0 : cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(typeReferenceDirectiveName, resolutionMode, result);
|
|
32944
|
+
if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
32945
|
+
cache == null ? void 0 : cache.getOrCreateCacheForNonRelativeName(typeReferenceDirectiveName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
32946
|
+
}
|
|
32947
|
+
}
|
|
32942
32948
|
if (traceEnabled)
|
|
32943
32949
|
traceResult(result);
|
|
32944
32950
|
return result;
|
|
@@ -33058,23 +33064,27 @@ function createCacheWithRedirects(ownOptions) {
|
|
|
33058
33064
|
if (ownOptions)
|
|
33059
33065
|
redirectsMap.set(ownOptions, ownMap);
|
|
33060
33066
|
return {
|
|
33067
|
+
getMapOfCacheRedirects,
|
|
33061
33068
|
getOrCreateMapOfCacheRedirects,
|
|
33062
33069
|
update,
|
|
33063
33070
|
clear: clear2
|
|
33064
33071
|
};
|
|
33072
|
+
function getMapOfCacheRedirects(redirectedReference) {
|
|
33073
|
+
return redirectedReference ? getOrCreateMap(redirectedReference.commandLine.options, false) : ownMap;
|
|
33074
|
+
}
|
|
33065
33075
|
function getOrCreateMapOfCacheRedirects(redirectedReference) {
|
|
33066
|
-
return redirectedReference ? getOrCreateMap(redirectedReference.commandLine.options) : ownMap;
|
|
33076
|
+
return redirectedReference ? getOrCreateMap(redirectedReference.commandLine.options, true) : ownMap;
|
|
33067
33077
|
}
|
|
33068
33078
|
function update(newOptions) {
|
|
33069
33079
|
if (ownOptions !== newOptions) {
|
|
33070
33080
|
if (ownOptions)
|
|
33071
|
-
ownMap = getOrCreateMap(newOptions);
|
|
33081
|
+
ownMap = getOrCreateMap(newOptions, true);
|
|
33072
33082
|
else
|
|
33073
33083
|
redirectsMap.set(newOptions, ownMap);
|
|
33074
33084
|
ownOptions = newOptions;
|
|
33075
33085
|
}
|
|
33076
33086
|
}
|
|
33077
|
-
function getOrCreateMap(redirectOptions) {
|
|
33087
|
+
function getOrCreateMap(redirectOptions, create) {
|
|
33078
33088
|
let result = redirectsMap.get(redirectOptions);
|
|
33079
33089
|
if (result)
|
|
33080
33090
|
return result;
|
|
@@ -33088,9 +33098,13 @@ function createCacheWithRedirects(ownOptions) {
|
|
|
33088
33098
|
else if (!redirectsKeyToMap.has(ownKey))
|
|
33089
33099
|
redirectsKeyToMap.set(ownKey, ownMap);
|
|
33090
33100
|
}
|
|
33091
|
-
|
|
33101
|
+
if (create)
|
|
33102
|
+
result != null ? result : result = /* @__PURE__ */ new Map();
|
|
33103
|
+
if (result)
|
|
33104
|
+
redirectsKeyToMap.set(key, result);
|
|
33092
33105
|
}
|
|
33093
|
-
|
|
33106
|
+
if (result)
|
|
33107
|
+
redirectsMap.set(redirectOptions, result);
|
|
33094
33108
|
return result;
|
|
33095
33109
|
}
|
|
33096
33110
|
function clear2() {
|
|
@@ -33142,8 +33156,10 @@ function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create)
|
|
|
33142
33156
|
}
|
|
33143
33157
|
return result;
|
|
33144
33158
|
}
|
|
33145
|
-
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName,
|
|
33159
|
+
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
33160
|
+
const directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
33146
33161
|
return {
|
|
33162
|
+
getFromDirectoryCache,
|
|
33147
33163
|
getOrCreateCacheForDirectory,
|
|
33148
33164
|
clear: clear2,
|
|
33149
33165
|
update
|
|
@@ -33151,13 +33167,18 @@ function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileNam
|
|
|
33151
33167
|
function clear2() {
|
|
33152
33168
|
directoryToModuleNameMap.clear();
|
|
33153
33169
|
}
|
|
33154
|
-
function update(
|
|
33155
|
-
directoryToModuleNameMap.update(
|
|
33170
|
+
function update(options2) {
|
|
33171
|
+
directoryToModuleNameMap.update(options2);
|
|
33156
33172
|
}
|
|
33157
33173
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
33158
33174
|
const path = toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
33159
33175
|
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, () => createModeAwareCache());
|
|
33160
33176
|
}
|
|
33177
|
+
function getFromDirectoryCache(name, mode, directoryName, redirectedReference) {
|
|
33178
|
+
var _a2, _b;
|
|
33179
|
+
const path = toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
33180
|
+
return (_b = (_a2 = directoryToModuleNameMap.getMapOfCacheRedirects(redirectedReference)) == null ? void 0 : _a2.get(path)) == null ? void 0 : _b.get(name, mode);
|
|
33181
|
+
}
|
|
33161
33182
|
}
|
|
33162
33183
|
function createModeAwareCacheKey(specifier, mode) {
|
|
33163
33184
|
return mode === void 0 ? specifier : `${mode}|${specifier}`;
|
|
@@ -33197,48 +33218,41 @@ function createModeAwareCache() {
|
|
|
33197
33218
|
return result;
|
|
33198
33219
|
}
|
|
33199
33220
|
}
|
|
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) {
|
|
33221
|
+
function zipToModeAwareCache(file, keys, values, nameAndModeGetter) {
|
|
33207
33222
|
Debug.assert(keys.length === values.length);
|
|
33208
33223
|
const map2 = createModeAwareCache();
|
|
33209
33224
|
for (let i = 0; i < keys.length; ++i) {
|
|
33210
33225
|
const entry = keys[i];
|
|
33211
|
-
map2.set(
|
|
33226
|
+
map2.set(nameAndModeGetter.getName(entry), nameAndModeGetter.getMode(entry, file), values[i]);
|
|
33212
33227
|
}
|
|
33213
33228
|
return map2;
|
|
33214
33229
|
}
|
|
33215
|
-
function
|
|
33216
|
-
|
|
33217
|
-
|
|
33230
|
+
function getOriginalOrResolvedModuleFileName(result) {
|
|
33231
|
+
return result.resolvedModule && (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
33232
|
+
}
|
|
33233
|
+
function getOriginalOrResolvedTypeReferenceFileName(result) {
|
|
33234
|
+
return result.resolvedTypeReferenceDirective && (result.resolvedTypeReferenceDirective.originalPath || result.resolvedTypeReferenceDirective.resolvedFileName);
|
|
33235
|
+
}
|
|
33236
|
+
function createNonRelativeNameResolutionCache(currentDirectory, getCanonicalFileName, options, getResolvedFileName) {
|
|
33218
33237
|
const moduleNameToDirectoryMap = createCacheWithRedirects(options);
|
|
33219
|
-
const packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
33220
33238
|
return {
|
|
33221
|
-
|
|
33222
|
-
|
|
33223
|
-
getOrCreateCacheForModuleName,
|
|
33239
|
+
getFromNonRelativeNameCache,
|
|
33240
|
+
getOrCreateCacheForNonRelativeName,
|
|
33224
33241
|
clear: clear2,
|
|
33225
|
-
update
|
|
33226
|
-
getPackageJsonInfoCache: () => packageJsonInfoCache,
|
|
33227
|
-
clearAllExceptPackageJsonInfoCache
|
|
33242
|
+
update
|
|
33228
33243
|
};
|
|
33229
33244
|
function clear2() {
|
|
33230
|
-
clearAllExceptPackageJsonInfoCache();
|
|
33231
|
-
packageJsonInfoCache.clear();
|
|
33232
|
-
}
|
|
33233
|
-
function clearAllExceptPackageJsonInfoCache() {
|
|
33234
|
-
perDirectoryResolutionCache.clear();
|
|
33235
33245
|
moduleNameToDirectoryMap.clear();
|
|
33236
33246
|
}
|
|
33237
33247
|
function update(options2) {
|
|
33238
|
-
directoryToModuleNameMap.update(options2);
|
|
33239
33248
|
moduleNameToDirectoryMap.update(options2);
|
|
33240
33249
|
}
|
|
33241
|
-
function
|
|
33250
|
+
function getFromNonRelativeNameCache(nonRelativeModuleName, mode, directoryName, redirectedReference) {
|
|
33251
|
+
var _a2, _b;
|
|
33252
|
+
Debug.assert(!isExternalModuleNameRelative(nonRelativeModuleName));
|
|
33253
|
+
return (_b = (_a2 = moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) == null ? void 0 : _a2.get(createModeAwareCacheKey(nonRelativeModuleName, mode))) == null ? void 0 : _b.get(directoryName);
|
|
33254
|
+
}
|
|
33255
|
+
function getOrCreateCacheForNonRelativeName(nonRelativeModuleName, mode, redirectedReference) {
|
|
33242
33256
|
Debug.assert(!isExternalModuleNameRelative(nonRelativeModuleName));
|
|
33243
33257
|
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, createModeAwareCacheKey(nonRelativeModuleName, mode), createPerModuleNameCache);
|
|
33244
33258
|
}
|
|
@@ -33254,7 +33268,7 @@ function createModuleResolutionCache(currentDirectory, getCanonicalFileName, opt
|
|
|
33254
33268
|
return;
|
|
33255
33269
|
}
|
|
33256
33270
|
directoryPathMap.set(path, result);
|
|
33257
|
-
const resolvedFileName =
|
|
33271
|
+
const resolvedFileName = getResolvedFileName(result);
|
|
33258
33272
|
const commonPrefix = resolvedFileName && getCommonPrefix(path, resolvedFileName);
|
|
33259
33273
|
let current = path;
|
|
33260
33274
|
while (current !== commonPrefix) {
|
|
@@ -33288,14 +33302,22 @@ function createModuleResolutionCache(currentDirectory, getCanonicalFileName, opt
|
|
|
33288
33302
|
}
|
|
33289
33303
|
}
|
|
33290
33304
|
}
|
|
33291
|
-
function
|
|
33292
|
-
const
|
|
33293
|
-
const
|
|
33294
|
-
|
|
33305
|
+
function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, getResolvedFileName) {
|
|
33306
|
+
const perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
33307
|
+
const nonRelativeNameResolutionCache = createNonRelativeNameResolutionCache(
|
|
33308
|
+
currentDirectory,
|
|
33309
|
+
getCanonicalFileName,
|
|
33310
|
+
options,
|
|
33311
|
+
getResolvedFileName
|
|
33312
|
+
);
|
|
33313
|
+
packageJsonInfoCache != null ? packageJsonInfoCache : packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
33295
33314
|
return {
|
|
33296
33315
|
...packageJsonInfoCache,
|
|
33297
33316
|
...perDirectoryResolutionCache,
|
|
33317
|
+
...nonRelativeNameResolutionCache,
|
|
33298
33318
|
clear: clear2,
|
|
33319
|
+
update,
|
|
33320
|
+
getPackageJsonInfoCache: () => packageJsonInfoCache,
|
|
33299
33321
|
clearAllExceptPackageJsonInfoCache
|
|
33300
33322
|
};
|
|
33301
33323
|
function clear2() {
|
|
@@ -33304,14 +33326,32 @@ function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanoni
|
|
|
33304
33326
|
}
|
|
33305
33327
|
function clearAllExceptPackageJsonInfoCache() {
|
|
33306
33328
|
perDirectoryResolutionCache.clear();
|
|
33329
|
+
nonRelativeNameResolutionCache.clear();
|
|
33330
|
+
}
|
|
33331
|
+
function update(options2) {
|
|
33332
|
+
perDirectoryResolutionCache.update(options2);
|
|
33333
|
+
nonRelativeNameResolutionCache.update(options2);
|
|
33307
33334
|
}
|
|
33308
33335
|
}
|
|
33309
|
-
function
|
|
33310
|
-
const
|
|
33311
|
-
|
|
33312
|
-
|
|
33313
|
-
|
|
33314
|
-
|
|
33336
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
33337
|
+
const result = createModuleOrTypeReferenceResolutionCache(
|
|
33338
|
+
currentDirectory,
|
|
33339
|
+
getCanonicalFileName,
|
|
33340
|
+
options,
|
|
33341
|
+
void 0,
|
|
33342
|
+
getOriginalOrResolvedModuleFileName
|
|
33343
|
+
);
|
|
33344
|
+
result.getOrCreateCacheForModuleName = (nonRelativeName, mode, redirectedReference) => result.getOrCreateCacheForNonRelativeName(nonRelativeName, mode, redirectedReference);
|
|
33345
|
+
return result;
|
|
33346
|
+
}
|
|
33347
|
+
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
33348
|
+
return createModuleOrTypeReferenceResolutionCache(
|
|
33349
|
+
currentDirectory,
|
|
33350
|
+
getCanonicalFileName,
|
|
33351
|
+
options,
|
|
33352
|
+
packageJsonInfoCache,
|
|
33353
|
+
getOriginalOrResolvedTypeReferenceFileName
|
|
33354
|
+
);
|
|
33315
33355
|
}
|
|
33316
33356
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
33317
33357
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
@@ -33325,8 +33365,7 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
33325
33365
|
}
|
|
33326
33366
|
}
|
|
33327
33367
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
33328
|
-
|
|
33329
|
-
let result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
|
|
33368
|
+
let result = cache == null ? void 0 : cache.getFromDirectoryCache(moduleName, resolutionMode, containingDirectory, redirectedReference);
|
|
33330
33369
|
if (result) {
|
|
33331
33370
|
if (traceEnabled) {
|
|
33332
33371
|
trace(host, Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -33376,11 +33415,9 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
33376
33415
|
if (result && result.resolvedModule)
|
|
33377
33416
|
perfLogger.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
|
|
33378
33417
|
perfLogger.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
33379
|
-
|
|
33380
|
-
|
|
33381
|
-
|
|
33382
|
-
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
33383
|
-
}
|
|
33418
|
+
cache == null ? void 0 : cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
33419
|
+
if (!isExternalModuleNameRelative(moduleName)) {
|
|
33420
|
+
cache == null ? void 0 : cache.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
33384
33421
|
}
|
|
33385
33422
|
}
|
|
33386
33423
|
if (traceEnabled) {
|
|
@@ -33497,7 +33534,7 @@ function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, state) {
|
|
|
33497
33534
|
function resolveJSModule(moduleName, initialDir, host) {
|
|
33498
33535
|
const { resolvedModule, failedLookupLocations } = tryResolveJSModuleWorker(moduleName, initialDir, host);
|
|
33499
33536
|
if (!resolvedModule) {
|
|
33500
|
-
throw new Error(`Could not resolve JS module '${moduleName}' starting at '${initialDir}'. Looked in: ${failedLookupLocations.join(", ")}`);
|
|
33537
|
+
throw new Error(`Could not resolve JS module '${moduleName}' starting at '${initialDir}'. Looked in: ${failedLookupLocations == null ? void 0 : failedLookupLocations.join(", ")}`);
|
|
33501
33538
|
}
|
|
33502
33539
|
return resolvedModule.resolvedFileName;
|
|
33503
33540
|
}
|
|
@@ -34290,7 +34327,7 @@ function loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, directo
|
|
|
34290
34327
|
return loadModuleFromNearestNodeModulesDirectoryWorker(4 /* Declaration */, moduleName, directory, state, true, void 0, void 0);
|
|
34291
34328
|
}
|
|
34292
34329
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
34293
|
-
const
|
|
34330
|
+
const mode = state.features === 0 ? void 0 : state.features & 32 /* EsmMode */ ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
34294
34331
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
34295
34332
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
34296
34333
|
if (priorityExtensions) {
|
|
@@ -34304,7 +34341,7 @@ function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName,
|
|
|
34304
34341
|
function lookup(extensions2) {
|
|
34305
34342
|
return forEachAncestorDirectory(normalizeSlashes(directory), (ancestorDirectory) => {
|
|
34306
34343
|
if (getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
34307
|
-
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
34344
|
+
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, ancestorDirectory, redirectedReference, state);
|
|
34308
34345
|
if (resolutionFromCache) {
|
|
34309
34346
|
return resolutionFromCache;
|
|
34310
34347
|
}
|
|
@@ -34450,8 +34487,8 @@ function getPackageNameFromTypesPackageName(mangledName) {
|
|
|
34450
34487
|
function unmangleScopedPackageName(typesPackageName) {
|
|
34451
34488
|
return stringContains(typesPackageName, mangledScopedPackageSeparator) ? "@" + typesPackageName.replace(mangledScopedPackageSeparator, directorySeparator) : typesPackageName;
|
|
34452
34489
|
}
|
|
34453
|
-
function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, state) {
|
|
34454
|
-
const result = cache && cache.
|
|
34490
|
+
function tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, containingDirectory, redirectedReference, state) {
|
|
34491
|
+
const result = cache && cache.getFromNonRelativeNameCache(moduleName, mode, containingDirectory, redirectedReference);
|
|
34455
34492
|
if (result) {
|
|
34456
34493
|
if (state.traceEnabled) {
|
|
34457
34494
|
trace(state.host, Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -34494,9 +34531,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
34494
34531
|
return { value: resolvedUsingSettings };
|
|
34495
34532
|
}
|
|
34496
34533
|
if (!isExternalModuleNameRelative(moduleName)) {
|
|
34497
|
-
const perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, void 0, redirectedReference);
|
|
34498
34534
|
const resolved2 = forEachAncestorDirectory(containingDirectory, (directory) => {
|
|
34499
|
-
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
34535
|
+
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, void 0, directory, redirectedReference, state);
|
|
34500
34536
|
if (resolutionFromCache) {
|
|
34501
34537
|
return resolutionFromCache;
|
|
34502
34538
|
}
|
|
@@ -37837,7 +37873,7 @@ function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory,
|
|
|
37837
37873
|
if (!shortest) {
|
|
37838
37874
|
return void 0;
|
|
37839
37875
|
}
|
|
37840
|
-
return getEmitModuleResolutionKind(compilerOptions) ===
|
|
37876
|
+
return getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */ ? removeFileExtension(shortest) : removeExtensionAndIndexPostFix(shortest, ending, compilerOptions);
|
|
37841
37877
|
}
|
|
37842
37878
|
function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileName, sourceDirectory }, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
37843
37879
|
if (!host.fileExists || !host.readFile) {
|
|
@@ -38169,9 +38205,9 @@ function createTypeChecker(host) {
|
|
|
38169
38205
|
host.getSourceFiles().forEach((sf) => {
|
|
38170
38206
|
if (!sf.resolvedModules)
|
|
38171
38207
|
return;
|
|
38172
|
-
sf.resolvedModules.forEach((
|
|
38173
|
-
if (
|
|
38174
|
-
map2.set(
|
|
38208
|
+
sf.resolvedModules.forEach(({ resolvedModule }) => {
|
|
38209
|
+
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
38210
|
+
map2.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!map2.get(resolvedModule.packageId.name));
|
|
38175
38211
|
});
|
|
38176
38212
|
});
|
|
38177
38213
|
return map2;
|
|
@@ -38975,6 +39011,12 @@ function createTypeChecker(host) {
|
|
|
38975
39011
|
return diagnostic;
|
|
38976
39012
|
}
|
|
38977
39013
|
function isDeprecatedSymbol(symbol) {
|
|
39014
|
+
if (length(symbol.declarations) > 1) {
|
|
39015
|
+
const parentSymbol = getParentOfSymbol(symbol);
|
|
39016
|
+
if (parentSymbol && parentSymbol.flags & 64 /* Interface */) {
|
|
39017
|
+
return some(symbol.declarations, (d) => !!(getCombinedNodeFlags(d) & 268435456 /* Deprecated */));
|
|
39018
|
+
}
|
|
39019
|
+
}
|
|
38978
39020
|
return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 268435456 /* Deprecated */);
|
|
38979
39021
|
}
|
|
38980
39022
|
function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
|
|
@@ -48668,7 +48710,7 @@ function createTypeChecker(host) {
|
|
|
48668
48710
|
const resolved = resolveAlias(aliasSymbol2);
|
|
48669
48711
|
if (resolved && resolved.flags & 524288 /* TypeAlias */) {
|
|
48670
48712
|
newAliasSymbol = resolved;
|
|
48671
|
-
aliasTypeArguments = typeArgumentsFromTypeReferenceNode(node);
|
|
48713
|
+
aliasTypeArguments = typeArgumentsFromTypeReferenceNode(node) || (typeParameters ? [] : void 0);
|
|
48672
48714
|
}
|
|
48673
48715
|
}
|
|
48674
48716
|
}
|
|
@@ -57484,13 +57526,13 @@ function createTypeChecker(host) {
|
|
|
57484
57526
|
}
|
|
57485
57527
|
const target = getReferenceCandidate(typeOfExpr.expression);
|
|
57486
57528
|
if (!isMatchingReference(reference, target)) {
|
|
57487
|
-
|
|
57529
|
+
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
57530
|
+
type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
57531
|
+
}
|
|
57532
|
+
const propertyAccess = getDiscriminantPropertyAccess(target, type);
|
|
57488
57533
|
if (propertyAccess) {
|
|
57489
57534
|
return narrowTypeByDiscriminant(type, propertyAccess, (t) => narrowTypeByLiteralExpression(t, literal, assumeTrue));
|
|
57490
57535
|
}
|
|
57491
|
-
if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
|
|
57492
|
-
return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
57493
|
-
}
|
|
57494
57536
|
return type;
|
|
57495
57537
|
}
|
|
57496
57538
|
return narrowTypeByLiteralExpression(type, literal, assumeTrue);
|
|
@@ -67973,7 +68015,6 @@ function createTypeChecker(host) {
|
|
|
67973
68015
|
let firstDefaultClause;
|
|
67974
68016
|
let hasDuplicateDefaultClause = false;
|
|
67975
68017
|
const expressionType = checkExpression(node.expression);
|
|
67976
|
-
const expressionIsLiteral = isLiteralType(expressionType);
|
|
67977
68018
|
forEach(node.caseBlock.clauses, (clause) => {
|
|
67978
68019
|
if (clause.kind === 293 /* DefaultClause */ && !hasDuplicateDefaultClause) {
|
|
67979
68020
|
if (firstDefaultClause === void 0) {
|
|
@@ -67992,15 +68033,9 @@ function createTypeChecker(host) {
|
|
|
67992
68033
|
}
|
|
67993
68034
|
function createLazyCaseClauseDiagnostics(clause2) {
|
|
67994
68035
|
return () => {
|
|
67995
|
-
|
|
67996
|
-
|
|
67997
|
-
|
|
67998
|
-
if (!caseIsLiteral || !expressionIsLiteral) {
|
|
67999
|
-
caseType = caseIsLiteral ? getBaseTypeOfLiteralType(caseType) : caseType;
|
|
68000
|
-
comparedExpressionType = getBaseTypeOfLiteralType(expressionType);
|
|
68001
|
-
}
|
|
68002
|
-
if (!isTypeEqualityComparableTo(comparedExpressionType, caseType)) {
|
|
68003
|
-
checkTypeComparableTo(caseType, comparedExpressionType, clause2.expression, void 0);
|
|
68036
|
+
const caseType = checkExpression(clause2.expression);
|
|
68037
|
+
if (!isTypeEqualityComparableTo(expressionType, caseType)) {
|
|
68038
|
+
checkTypeComparableTo(caseType, expressionType, clause2.expression, void 0);
|
|
68004
68039
|
}
|
|
68005
68040
|
};
|
|
68006
68041
|
}
|
|
@@ -71101,11 +71136,11 @@ function createTypeChecker(host) {
|
|
|
71101
71136
|
let fileToDirective;
|
|
71102
71137
|
if (resolvedTypeReferenceDirectives) {
|
|
71103
71138
|
fileToDirective = /* @__PURE__ */ new Map();
|
|
71104
|
-
resolvedTypeReferenceDirectives.forEach((
|
|
71105
|
-
if (!
|
|
71139
|
+
resolvedTypeReferenceDirectives.forEach(({ resolvedTypeReferenceDirective }, key, mode) => {
|
|
71140
|
+
if (!(resolvedTypeReferenceDirective == null ? void 0 : resolvedTypeReferenceDirective.resolvedFileName)) {
|
|
71106
71141
|
return;
|
|
71107
71142
|
}
|
|
71108
|
-
const file = host.getSourceFile(
|
|
71143
|
+
const file = host.getSourceFile(resolvedTypeReferenceDirective.resolvedFileName);
|
|
71109
71144
|
if (file) {
|
|
71110
71145
|
addReferencedFilesToTypeDirective(file, key, mode);
|
|
71111
71146
|
}
|
|
@@ -97353,25 +97388,6 @@ function flattenDiagnosticMessageText(diag2, newLine, indent2 = 0) {
|
|
|
97353
97388
|
}
|
|
97354
97389
|
return result;
|
|
97355
97390
|
}
|
|
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
97391
|
function getModeForFileReference(ref, containingFileMode) {
|
|
97376
97392
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
97377
97393
|
}
|
|
@@ -97437,22 +97453,65 @@ function getResolutionModeOverrideForClause(clause, grammarErrorOnNode) {
|
|
|
97437
97453
|
}
|
|
97438
97454
|
return elem.value.text === "import" ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
97439
97455
|
}
|
|
97440
|
-
|
|
97441
|
-
|
|
97442
|
-
|
|
97443
|
-
|
|
97456
|
+
var emptyResolution = {
|
|
97457
|
+
resolvedModule: void 0,
|
|
97458
|
+
resolvedTypeReferenceDirective: void 0
|
|
97459
|
+
};
|
|
97460
|
+
function getModuleResolutionName(literal) {
|
|
97461
|
+
return literal.text;
|
|
97462
|
+
}
|
|
97463
|
+
var moduleResolutionNameAndModeGetter = {
|
|
97464
|
+
getName: getModuleResolutionName,
|
|
97465
|
+
getMode: (entry, file) => getModeForUsageLocation(file, entry)
|
|
97466
|
+
};
|
|
97467
|
+
function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
97468
|
+
return {
|
|
97469
|
+
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
97470
|
+
resolve: (moduleName, resoluionMode) => resolveModuleName(
|
|
97471
|
+
moduleName,
|
|
97472
|
+
containingFile,
|
|
97473
|
+
options,
|
|
97474
|
+
host,
|
|
97475
|
+
cache,
|
|
97476
|
+
redirectedReference,
|
|
97477
|
+
resoluionMode
|
|
97478
|
+
)
|
|
97479
|
+
};
|
|
97480
|
+
}
|
|
97481
|
+
function getTypeReferenceResolutionName(entry) {
|
|
97482
|
+
return !isString(entry) ? toFileNameLowerCase(entry.fileName) : entry;
|
|
97483
|
+
}
|
|
97484
|
+
var typeReferenceResolutionNameAndModeGetter = {
|
|
97485
|
+
getName: getTypeReferenceResolutionName,
|
|
97486
|
+
getMode: (entry, file) => getModeForFileReference(entry, file == null ? void 0 : file.impliedNodeFormat)
|
|
97487
|
+
};
|
|
97488
|
+
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
97489
|
+
return {
|
|
97490
|
+
nameAndMode: typeReferenceResolutionNameAndModeGetter,
|
|
97491
|
+
resolve: (typeRef, resoluionMode) => resolveTypeReferenceDirective(
|
|
97492
|
+
typeRef,
|
|
97493
|
+
containingFile,
|
|
97494
|
+
options,
|
|
97495
|
+
host,
|
|
97496
|
+
redirectedReference,
|
|
97497
|
+
cache,
|
|
97498
|
+
resoluionMode
|
|
97499
|
+
)
|
|
97500
|
+
};
|
|
97501
|
+
}
|
|
97502
|
+
function loadWithModeAwareCache(entries, containingFile, redirectedReference, options, containingSourceFile, host, resolutionCache, createLoader) {
|
|
97503
|
+
if (entries.length === 0)
|
|
97504
|
+
return emptyArray;
|
|
97444
97505
|
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));
|
|
97506
|
+
const cache = /* @__PURE__ */ new Map();
|
|
97507
|
+
const loader = createLoader(containingFile, redirectedReference, options, host, resolutionCache);
|
|
97508
|
+
for (const entry of entries) {
|
|
97509
|
+
const name = loader.nameAndMode.getName(entry);
|
|
97510
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
97511
|
+
const key = createModeAwareCacheKey(name, mode);
|
|
97512
|
+
let result = cache.get(key);
|
|
97513
|
+
if (!result) {
|
|
97514
|
+
cache.set(key, result = loader.resolve(name, mode));
|
|
97456
97515
|
}
|
|
97457
97516
|
resolutions.push(result);
|
|
97458
97517
|
}
|
|
@@ -97498,14 +97557,14 @@ function isReferenceFileLocation(location) {
|
|
|
97498
97557
|
return location.pos !== void 0;
|
|
97499
97558
|
}
|
|
97500
97559
|
function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
97501
|
-
var _a2, _b, _c, _d;
|
|
97560
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
97502
97561
|
const file = Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
97503
97562
|
const { kind, index } = ref;
|
|
97504
97563
|
let pos, end, packageId, resolutionMode;
|
|
97505
97564
|
switch (kind) {
|
|
97506
97565
|
case 3 /* Import */:
|
|
97507
97566
|
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;
|
|
97567
|
+
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
97568
|
if (importLiteral.pos === -1)
|
|
97510
97569
|
return { file, packageId, text: importLiteral.text };
|
|
97511
97570
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -97516,7 +97575,7 @@ function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
|
97516
97575
|
break;
|
|
97517
97576
|
case 5 /* TypeReferenceDirective */:
|
|
97518
97577
|
({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
|
|
97519
|
-
packageId = (
|
|
97578
|
+
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
97579
|
break;
|
|
97521
97580
|
case 7 /* LibReferenceDirective */:
|
|
97522
97581
|
({ pos, end } = file.libReferenceDirectives[index]);
|
|
@@ -97705,7 +97764,7 @@ function createCreateProgramOptions(rootNames, options, host, oldProgram, config
|
|
|
97705
97764
|
};
|
|
97706
97765
|
}
|
|
97707
97766
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
97708
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
97767
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
97709
97768
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
97710
97769
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences } = createProgramOptions;
|
|
97711
97770
|
let { oldProgram } = createProgramOptions;
|
|
@@ -97722,6 +97781,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97722
97781
|
const cachedDeclarationDiagnosticsForFile = {};
|
|
97723
97782
|
let resolvedTypeReferenceDirectives = createModeAwareCache();
|
|
97724
97783
|
let fileProcessingDiagnostics;
|
|
97784
|
+
let automaticTypeDirectiveNames;
|
|
97785
|
+
let automaticTypeDirectiveResolutions;
|
|
97725
97786
|
const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
97726
97787
|
let currentNodeModulesDepth = 0;
|
|
97727
97788
|
const modulesWithElidedImports = /* @__PURE__ */ new Map();
|
|
@@ -97740,50 +97801,59 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97740
97801
|
const hasEmitBlockingDiagnostics = /* @__PURE__ */ new Map();
|
|
97741
97802
|
let _compilerOptionsObjectLiteralSyntax;
|
|
97742
97803
|
let moduleResolutionCache;
|
|
97743
|
-
let typeReferenceDirectiveResolutionCache;
|
|
97744
97804
|
let actualResolveModuleNamesWorker;
|
|
97745
97805
|
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
|
-
};
|
|
97806
|
+
if (host.resolveModuleNameLiterals) {
|
|
97807
|
+
actualResolveModuleNamesWorker = host.resolveModuleNameLiterals.bind(host);
|
|
97766
97808
|
moduleResolutionCache = (_b = host.getModuleResolutionCache) == null ? void 0 : _b.call(host);
|
|
97809
|
+
} else if (host.resolveModuleNames) {
|
|
97810
|
+
actualResolveModuleNamesWorker = (moduleNames, containingFile, redirectedReference, options2, containingSourceFile, reusedNames) => host.resolveModuleNames(
|
|
97811
|
+
moduleNames.map(getModuleResolutionName),
|
|
97812
|
+
containingFile,
|
|
97813
|
+
reusedNames == null ? void 0 : reusedNames.map(getModuleResolutionName),
|
|
97814
|
+
redirectedReference,
|
|
97815
|
+
options2,
|
|
97816
|
+
containingSourceFile
|
|
97817
|
+
).map(
|
|
97818
|
+
(resolved) => resolved ? resolved.extension !== void 0 ? { resolvedModule: resolved } : { resolvedModule: { ...resolved, extension: extensionFromPath(resolved.resolvedFileName) } } : emptyResolution
|
|
97819
|
+
);
|
|
97820
|
+
moduleResolutionCache = (_c = host.getModuleResolutionCache) == null ? void 0 : _c.call(host);
|
|
97767
97821
|
} else {
|
|
97768
97822
|
moduleResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
97769
|
-
|
|
97770
|
-
|
|
97823
|
+
actualResolveModuleNamesWorker = (moduleNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
97824
|
+
moduleNames,
|
|
97825
|
+
containingFile,
|
|
97826
|
+
redirectedReference,
|
|
97827
|
+
options2,
|
|
97828
|
+
containingSourceFile,
|
|
97829
|
+
host,
|
|
97830
|
+
moduleResolutionCache,
|
|
97831
|
+
createModuleResolutionLoader
|
|
97832
|
+
);
|
|
97771
97833
|
}
|
|
97772
97834
|
let actualResolveTypeReferenceDirectiveNamesWorker;
|
|
97773
|
-
if (host.
|
|
97774
|
-
actualResolveTypeReferenceDirectiveNamesWorker =
|
|
97835
|
+
if (host.resolveTypeReferenceDirectiveReferences) {
|
|
97836
|
+
actualResolveTypeReferenceDirectiveNamesWorker = host.resolveTypeReferenceDirectiveReferences.bind(host);
|
|
97837
|
+
} else if (host.resolveTypeReferenceDirectives) {
|
|
97838
|
+
actualResolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => host.resolveTypeReferenceDirectives(
|
|
97839
|
+
typeDirectiveNames.map(getTypeReferenceResolutionName),
|
|
97840
|
+
containingFile,
|
|
97841
|
+
redirectedReference,
|
|
97842
|
+
options2,
|
|
97843
|
+
containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat
|
|
97844
|
+
).map((resolvedTypeReferenceDirective) => ({ resolvedTypeReferenceDirective }));
|
|
97775
97845
|
} else {
|
|
97776
|
-
typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
97777
|
-
|
|
97778
|
-
|
|
97846
|
+
const typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
97847
|
+
actualResolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
97848
|
+
typeDirectiveNames,
|
|
97779
97849
|
containingFile,
|
|
97780
|
-
options,
|
|
97781
|
-
host,
|
|
97782
97850
|
redirectedReference,
|
|
97851
|
+
options2,
|
|
97852
|
+
containingSourceFile,
|
|
97853
|
+
host,
|
|
97783
97854
|
typeReferenceDirectiveResolutionCache,
|
|
97784
|
-
|
|
97785
|
-
)
|
|
97786
|
-
actualResolveTypeReferenceDirectiveNamesWorker = (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) => loadWithTypeDirectiveCache(Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader);
|
|
97855
|
+
createTypeReferenceResolutionLoader
|
|
97856
|
+
);
|
|
97787
97857
|
}
|
|
97788
97858
|
const packageIdToSourceFile = /* @__PURE__ */ new Map();
|
|
97789
97859
|
let sourceFileToPackageName = /* @__PURE__ */ new Map();
|
|
@@ -97796,7 +97866,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97796
97866
|
let projectReferenceRedirects;
|
|
97797
97867
|
let mapFromFileToProjectReferenceRedirects;
|
|
97798
97868
|
let mapFromToProjectReferenceRedirectSource;
|
|
97799
|
-
const useSourceOfProjectReferenceRedirect = !!((
|
|
97869
|
+
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
|
|
97800
97870
|
const { onProgramCreateComplete, fileExists, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
97801
97871
|
compilerHost: host,
|
|
97802
97872
|
getSymlinkCache,
|
|
@@ -97807,13 +97877,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97807
97877
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
97808
97878
|
});
|
|
97809
97879
|
const readFile = host.readFile.bind(host);
|
|
97810
|
-
(
|
|
97880
|
+
(_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
97811
97881
|
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
97812
|
-
(
|
|
97882
|
+
(_f = tracing) == null ? void 0 : _f.pop();
|
|
97813
97883
|
let structureIsReused;
|
|
97814
|
-
(
|
|
97884
|
+
(_g = tracing) == null ? void 0 : _g.push(tracing.Phase.Program, "tryReuseStructureFromOldProgram", {});
|
|
97815
97885
|
structureIsReused = tryReuseStructureFromOldProgram();
|
|
97816
|
-
(
|
|
97886
|
+
(_h = tracing) == null ? void 0 : _h.pop();
|
|
97817
97887
|
if (structureIsReused !== 2 /* Completely */) {
|
|
97818
97888
|
processingDefaultLibFiles = [];
|
|
97819
97889
|
processingOtherFiles = [];
|
|
@@ -97847,19 +97917,30 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97847
97917
|
});
|
|
97848
97918
|
}
|
|
97849
97919
|
}
|
|
97850
|
-
(
|
|
97920
|
+
(_i = tracing) == null ? void 0 : _i.push(tracing.Phase.Program, "processRootFiles", { count: rootNames.length });
|
|
97851
97921
|
forEach(rootNames, (name, index) => processRootFile(name, false, false, { kind: 0 /* RootFile */, index }));
|
|
97852
|
-
(
|
|
97853
|
-
|
|
97854
|
-
|
|
97855
|
-
|
|
97922
|
+
(_j = tracing) == null ? void 0 : _j.pop();
|
|
97923
|
+
automaticTypeDirectiveNames != null ? automaticTypeDirectiveNames : automaticTypeDirectiveNames = rootNames.length ? getAutomaticTypeDirectiveNames(options, host) : emptyArray;
|
|
97924
|
+
automaticTypeDirectiveResolutions = createModeAwareCache();
|
|
97925
|
+
if (automaticTypeDirectiveNames.length) {
|
|
97926
|
+
(_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
97856
97927
|
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
|
|
97857
97928
|
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
97858
|
-
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(
|
|
97859
|
-
for (let i = 0; i <
|
|
97860
|
-
|
|
97929
|
+
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
|
|
97930
|
+
for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
97931
|
+
automaticTypeDirectiveResolutions.set(automaticTypeDirectiveNames[i], void 0, resolutions[i]);
|
|
97932
|
+
processTypeReferenceDirective(
|
|
97933
|
+
automaticTypeDirectiveNames[i],
|
|
97934
|
+
void 0,
|
|
97935
|
+
resolutions[i],
|
|
97936
|
+
{
|
|
97937
|
+
kind: 8 /* AutomaticTypeDirectiveFile */,
|
|
97938
|
+
typeReference: automaticTypeDirectiveNames[i],
|
|
97939
|
+
packageId: (_m = (_l = resolutions[i]) == null ? void 0 : _l.resolvedTypeReferenceDirective) == null ? void 0 : _m.packageId
|
|
97940
|
+
}
|
|
97941
|
+
);
|
|
97861
97942
|
}
|
|
97862
|
-
(
|
|
97943
|
+
(_n = tracing) == null ? void 0 : _n.pop();
|
|
97863
97944
|
}
|
|
97864
97945
|
if (rootNames.length && !skipDefaultLib) {
|
|
97865
97946
|
const defaultLibraryFileName = getDefaultLibraryFileName();
|
|
@@ -97906,7 +97987,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97906
97987
|
}
|
|
97907
97988
|
);
|
|
97908
97989
|
}
|
|
97909
|
-
typeReferenceDirectiveResolutionCache = void 0;
|
|
97910
97990
|
oldProgram = void 0;
|
|
97911
97991
|
const program = {
|
|
97912
97992
|
getRootFileNames: () => rootNames,
|
|
@@ -97939,6 +98019,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97939
98019
|
getRelationCacheSizes: () => getTypeChecker().getRelationCacheSizes(),
|
|
97940
98020
|
getFileProcessingDiagnostics: () => fileProcessingDiagnostics,
|
|
97941
98021
|
getResolvedTypeReferenceDirectives: () => resolvedTypeReferenceDirectives,
|
|
98022
|
+
getAutomaticTypeDirectiveNames: () => automaticTypeDirectiveNames,
|
|
98023
|
+
getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
|
|
97942
98024
|
isSourceFileFromExternalLibrary,
|
|
97943
98025
|
isSourceFileDefaultLibrary,
|
|
97944
98026
|
getSourceFileFromReference,
|
|
@@ -97948,7 +98030,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97948
98030
|
usesUriStyleNodeCoreModules,
|
|
97949
98031
|
isEmittedFile,
|
|
97950
98032
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
|
|
97951
|
-
getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
97952
98033
|
getProjectReferences,
|
|
97953
98034
|
getResolvedProjectReferences,
|
|
97954
98035
|
getProjectReferenceRedirect,
|
|
@@ -97961,7 +98042,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97961
98042
|
readFile,
|
|
97962
98043
|
directoryExists,
|
|
97963
98044
|
getSymlinkCache,
|
|
97964
|
-
realpath: (
|
|
98045
|
+
realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
|
|
97965
98046
|
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
|
97966
98047
|
getFileIncludeReasons: () => fileReasons,
|
|
97967
98048
|
structureIsReused,
|
|
@@ -97975,6 +98056,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97975
98056
|
case 0 /* FilePreprocessingReferencedDiagnostic */:
|
|
97976
98057
|
const { file, pos, end } = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason);
|
|
97977
98058
|
return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
|
|
98059
|
+
case 2 /* ResolutionDiagnostics */:
|
|
98060
|
+
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
|
97978
98061
|
default:
|
|
97979
98062
|
Debug.assertNever(diagnostic);
|
|
97980
98063
|
}
|
|
@@ -97982,32 +98065,30 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
97982
98065
|
verifyCompilerOptions();
|
|
97983
98066
|
mark("afterProgram");
|
|
97984
98067
|
measure("Program", "beforeProgram", "afterProgram");
|
|
97985
|
-
(
|
|
98068
|
+
(_p = tracing) == null ? void 0 : _p.pop();
|
|
97986
98069
|
return program;
|
|
97987
|
-
function addResolutionDiagnostics(
|
|
97988
|
-
|
|
98070
|
+
function addResolutionDiagnostics(resolution) {
|
|
98071
|
+
var _a3;
|
|
98072
|
+
if (!((_a3 = resolution.resolutionDiagnostics) == null ? void 0 : _a3.length))
|
|
97989
98073
|
return;
|
|
97990
|
-
|
|
97991
|
-
|
|
97992
|
-
|
|
98074
|
+
(fileProcessingDiagnostics != null ? fileProcessingDiagnostics : fileProcessingDiagnostics = []).push({
|
|
98075
|
+
kind: 2 /* ResolutionDiagnostics */,
|
|
98076
|
+
diagnostics: resolution.resolutionDiagnostics
|
|
98077
|
+
});
|
|
97993
98078
|
}
|
|
97994
|
-
function
|
|
97995
|
-
|
|
97996
|
-
|
|
98079
|
+
function addResolutionDiagnosticsFromResolutionOrCache(containingFile, name, resolution, mode) {
|
|
98080
|
+
if (host.resolveModuleNameLiterals || !host.resolveModuleNames)
|
|
98081
|
+
return addResolutionDiagnostics(resolution);
|
|
98082
|
+
if (!moduleResolutionCache || isExternalModuleNameRelative(name))
|
|
97997
98083
|
return;
|
|
97998
98084
|
const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
97999
98085
|
const containingDir = getDirectoryPath(containingFileName);
|
|
98000
98086
|
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
|
-
}
|
|
98087
|
+
const fromCache = moduleResolutionCache.getFromNonRelativeNameCache(name, mode, containingDir, redirectedReference);
|
|
98088
|
+
if (fromCache)
|
|
98089
|
+
addResolutionDiagnostics(fromCache);
|
|
98009
98090
|
}
|
|
98010
|
-
function resolveModuleNamesWorker(moduleNames, containingFile,
|
|
98091
|
+
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
98011
98092
|
var _a3, _b2;
|
|
98012
98093
|
if (!moduleNames.length)
|
|
98013
98094
|
return emptyArray;
|
|
@@ -98015,23 +98096,22 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98015
98096
|
const redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
98016
98097
|
(_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName });
|
|
98017
98098
|
mark("beforeResolveModule");
|
|
98018
|
-
const result = actualResolveModuleNamesWorker(moduleNames,
|
|
98099
|
+
const result = actualResolveModuleNamesWorker(moduleNames, containingFileName, redirectedReference, options, containingFile, reusedNames);
|
|
98019
98100
|
mark("afterResolveModule");
|
|
98020
98101
|
measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
98021
98102
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
98022
|
-
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
98023
98103
|
return result;
|
|
98024
98104
|
}
|
|
98025
|
-
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile,
|
|
98105
|
+
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, reusedNames) {
|
|
98026
98106
|
var _a3, _b2;
|
|
98027
98107
|
if (!typeDirectiveNames.length)
|
|
98028
98108
|
return [];
|
|
98109
|
+
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
98029
98110
|
const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
98030
|
-
const redirectedReference =
|
|
98031
|
-
const containingFileMode = !isString(containingFile) ? containingFile.impliedNodeFormat : void 0;
|
|
98111
|
+
const redirectedReference = containingSourceFile && getRedirectReferenceForResolution(containingSourceFile);
|
|
98032
98112
|
(_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName });
|
|
98033
98113
|
mark("beforeResolveTypeReference");
|
|
98034
|
-
const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference,
|
|
98114
|
+
const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, options, containingSourceFile, reusedNames);
|
|
98035
98115
|
mark("afterResolveTypeReference");
|
|
98036
98116
|
measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
98037
98117
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
@@ -98077,9 +98157,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98077
98157
|
}
|
|
98078
98158
|
return libs.length + 2;
|
|
98079
98159
|
}
|
|
98080
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
|
|
98081
|
-
return moduleResolutionCache && resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
|
|
98082
|
-
}
|
|
98083
98160
|
function toPath3(fileName) {
|
|
98084
98161
|
return toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
98085
98162
|
}
|
|
@@ -98108,6 +98185,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98108
98185
|
return classifiableNames;
|
|
98109
98186
|
}
|
|
98110
98187
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
98188
|
+
var _a3;
|
|
98111
98189
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
98112
98190
|
return resolveModuleNamesWorker(moduleNames, file, void 0);
|
|
98113
98191
|
}
|
|
@@ -98123,24 +98201,24 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98123
98201
|
let unknownModuleNames;
|
|
98124
98202
|
let result;
|
|
98125
98203
|
let reusedNames;
|
|
98126
|
-
const predictedToResolveToAmbientModuleMarker =
|
|
98204
|
+
const predictedToResolveToAmbientModuleMarker = emptyResolution;
|
|
98127
98205
|
for (let i = 0; i < moduleNames.length; i++) {
|
|
98128
98206
|
const moduleName = moduleNames[i];
|
|
98129
98207
|
if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) {
|
|
98130
98208
|
const mode = getModeForUsageLocation(file, moduleName);
|
|
98131
|
-
const
|
|
98132
|
-
if (
|
|
98209
|
+
const oldResolution = (_a3 = oldSourceFile.resolvedModules) == null ? void 0 : _a3.get(moduleName.text, mode);
|
|
98210
|
+
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
98133
98211
|
if (isTraceEnabled(options, host)) {
|
|
98134
98212
|
trace(
|
|
98135
98213
|
host,
|
|
98136
|
-
|
|
98214
|
+
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
98215
|
moduleName.text,
|
|
98138
98216
|
getNormalizedAbsolutePath(file.originalFileName, currentDirectory),
|
|
98139
|
-
|
|
98140
|
-
|
|
98217
|
+
oldResolution.resolvedModule.resolvedFileName,
|
|
98218
|
+
oldResolution.resolvedModule.packageId && packageIdToString(oldResolution.resolvedModule.packageId)
|
|
98141
98219
|
);
|
|
98142
98220
|
}
|
|
98143
|
-
(result != null ? result : result = new Array(moduleNames.length))[i] =
|
|
98221
|
+
(result != null ? result : result = new Array(moduleNames.length))[i] = oldResolution;
|
|
98144
98222
|
(reusedNames != null ? reusedNames : reusedNames = []).push(moduleName);
|
|
98145
98223
|
continue;
|
|
98146
98224
|
}
|
|
@@ -98160,18 +98238,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98160
98238
|
(unknownModuleNames != null ? unknownModuleNames : unknownModuleNames = []).push(moduleName);
|
|
98161
98239
|
}
|
|
98162
98240
|
}
|
|
98163
|
-
const resolutions = unknownModuleNames && unknownModuleNames.length ? resolveModuleNamesWorker(unknownModuleNames, file,
|
|
98241
|
+
const resolutions = unknownModuleNames && unknownModuleNames.length ? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames) : emptyArray;
|
|
98164
98242
|
if (!result) {
|
|
98165
98243
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
98166
98244
|
return resolutions;
|
|
98167
98245
|
}
|
|
98168
98246
|
let j = 0;
|
|
98169
98247
|
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 {
|
|
98248
|
+
if (!result[i]) {
|
|
98175
98249
|
result[i] = resolutions[j];
|
|
98176
98250
|
j++;
|
|
98177
98251
|
}
|
|
@@ -98195,6 +98269,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98195
98269
|
}
|
|
98196
98270
|
}
|
|
98197
98271
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
98272
|
+
var _a3;
|
|
98198
98273
|
if (structureIsReused === 0 /* Not */) {
|
|
98199
98274
|
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, void 0);
|
|
98200
98275
|
}
|
|
@@ -98203,7 +98278,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98203
98278
|
if (oldSourceFile !== containingFile && containingFile.resolvedTypeReferenceDirectiveNames) {
|
|
98204
98279
|
const result2 = [];
|
|
98205
98280
|
for (const typeDirectiveName of typeDirectiveNames) {
|
|
98206
|
-
const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(
|
|
98281
|
+
const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getTypeReferenceResolutionName(typeDirectiveName), getModeForFileReference(typeDirectiveName, containingFile.impliedNodeFormat));
|
|
98207
98282
|
result2.push(resolvedTypeReferenceDirective);
|
|
98208
98283
|
}
|
|
98209
98284
|
return result2;
|
|
@@ -98217,21 +98292,21 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98217
98292
|
for (let i = 0; i < typeDirectiveNames.length; i++) {
|
|
98218
98293
|
const entry = typeDirectiveNames[i];
|
|
98219
98294
|
if (canReuseResolutions) {
|
|
98220
|
-
const typeDirectiveName =
|
|
98295
|
+
const typeDirectiveName = getTypeReferenceResolutionName(entry);
|
|
98221
98296
|
const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
98222
|
-
const
|
|
98223
|
-
if (
|
|
98297
|
+
const oldResolution = (_a3 = !isString(containingFile) ? oldSourceFile == null ? void 0 : oldSourceFile.resolvedTypeReferenceDirectiveNames : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a3.get(typeDirectiveName, mode);
|
|
98298
|
+
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
98224
98299
|
if (isTraceEnabled(options, host)) {
|
|
98225
98300
|
trace(
|
|
98226
98301
|
host,
|
|
98227
|
-
|
|
98302
|
+
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
98303
|
typeDirectiveName,
|
|
98229
98304
|
!isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile,
|
|
98230
|
-
|
|
98231
|
-
|
|
98305
|
+
oldResolution.resolvedTypeReferenceDirective.resolvedFileName,
|
|
98306
|
+
oldResolution.resolvedTypeReferenceDirective.packageId && packageIdToString(oldResolution.resolvedTypeReferenceDirective.packageId)
|
|
98232
98307
|
);
|
|
98233
98308
|
}
|
|
98234
|
-
(result != null ? result : result = new Array(typeDirectiveNames.length))[i] =
|
|
98309
|
+
(result != null ? result : result = new Array(typeDirectiveNames.length))[i] = oldResolution;
|
|
98235
98310
|
(reusedNames != null ? reusedNames : reusedNames = []).push(entry);
|
|
98236
98311
|
continue;
|
|
98237
98312
|
}
|
|
@@ -98243,7 +98318,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98243
98318
|
const resolutions = resolveTypeReferenceDirectiveNamesWorker(
|
|
98244
98319
|
unknownTypeReferenceDirectiveNames,
|
|
98245
98320
|
containingFile,
|
|
98246
|
-
|
|
98321
|
+
reusedNames
|
|
98247
98322
|
);
|
|
98248
98323
|
if (!result) {
|
|
98249
98324
|
Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
@@ -98279,7 +98354,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98279
98354
|
);
|
|
98280
98355
|
}
|
|
98281
98356
|
function tryReuseStructureFromOldProgram() {
|
|
98282
|
-
var _a3
|
|
98357
|
+
var _a3;
|
|
98283
98358
|
if (!oldProgram) {
|
|
98284
98359
|
return 0 /* Not */;
|
|
98285
98360
|
}
|
|
@@ -98389,19 +98464,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98389
98464
|
for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
|
|
98390
98465
|
const moduleNames = getModuleNames(newSourceFile);
|
|
98391
98466
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
98392
|
-
const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo);
|
|
98467
|
+
const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
|
|
98393
98468
|
if (resolutionsChanged) {
|
|
98394
98469
|
structureIsReused = 1 /* SafeModules */;
|
|
98395
|
-
newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
|
|
98470
|
+
newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions, moduleResolutionNameAndModeGetter);
|
|
98396
98471
|
} else {
|
|
98397
98472
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
98398
98473
|
}
|
|
98399
98474
|
const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
98400
98475
|
const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
98401
|
-
const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo);
|
|
98476
|
+
const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
|
|
98402
98477
|
if (typeReferenceResolutionsChanged) {
|
|
98403
98478
|
structureIsReused = 1 /* SafeModules */;
|
|
98404
|
-
newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
98479
|
+
newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions, typeReferenceResolutionNameAndModeGetter);
|
|
98405
98480
|
} else {
|
|
98406
98481
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
98407
98482
|
}
|
|
@@ -98409,9 +98484,17 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98409
98484
|
if (structureIsReused !== 2 /* Completely */) {
|
|
98410
98485
|
return structureIsReused;
|
|
98411
98486
|
}
|
|
98412
|
-
if (changesAffectingProgramStructure(oldOptions, options)
|
|
98487
|
+
if (changesAffectingProgramStructure(oldOptions, options)) {
|
|
98413
98488
|
return 1 /* SafeModules */;
|
|
98414
98489
|
}
|
|
98490
|
+
if (host.hasChangedAutomaticTypeDirectiveNames) {
|
|
98491
|
+
if (host.hasChangedAutomaticTypeDirectiveNames())
|
|
98492
|
+
return 1 /* SafeModules */;
|
|
98493
|
+
} else {
|
|
98494
|
+
automaticTypeDirectiveNames = getAutomaticTypeDirectiveNames(options, host);
|
|
98495
|
+
if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
98496
|
+
return 1 /* SafeModules */;
|
|
98497
|
+
}
|
|
98415
98498
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
98416
98499
|
Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
98417
98500
|
for (const newSourceFile of newSourceFiles) {
|
|
@@ -98435,6 +98518,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
98435
98518
|
fileReasons = oldProgram.getFileIncludeReasons();
|
|
98436
98519
|
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
|
98437
98520
|
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
|
|
98521
|
+
automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
|
|
98522
|
+
automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
|
|
98438
98523
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
98439
98524
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
98440
98525
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
@@ -99378,7 +99463,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
99378
99463
|
}
|
|
99379
99464
|
function processTypeReferenceDirectives(file) {
|
|
99380
99465
|
const typeDirectives = file.typeReferenceDirectives;
|
|
99381
|
-
if (!typeDirectives) {
|
|
99466
|
+
if (!typeDirectives.length) {
|
|
99467
|
+
file.resolvedTypeReferenceDirectiveNames = void 0;
|
|
99382
99468
|
return;
|
|
99383
99469
|
}
|
|
99384
99470
|
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
|
|
@@ -99389,23 +99475,31 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
99389
99475
|
setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective, getModeForFileReference(ref, file.impliedNodeFormat));
|
|
99390
99476
|
const mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
99391
99477
|
if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
|
|
99392
|
-
|
|
99478
|
+
(fileProcessingDiagnostics != null ? fileProcessingDiagnostics : fileProcessingDiagnostics = []).push({
|
|
99479
|
+
kind: 2 /* ResolutionDiagnostics */,
|
|
99480
|
+
diagnostics: [
|
|
99481
|
+
createDiagnosticForRange(file, ref, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)
|
|
99482
|
+
]
|
|
99483
|
+
});
|
|
99393
99484
|
}
|
|
99394
99485
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
99395
99486
|
}
|
|
99396
99487
|
}
|
|
99397
|
-
function processTypeReferenceDirective(typeReferenceDirective, mode,
|
|
99488
|
+
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
99398
99489
|
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,
|
|
99490
|
+
(_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 });
|
|
99491
|
+
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason);
|
|
99401
99492
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
99402
99493
|
}
|
|
99403
|
-
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
99404
|
-
|
|
99494
|
+
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason) {
|
|
99495
|
+
var _a3;
|
|
99496
|
+
addResolutionDiagnostics(resolution);
|
|
99497
|
+
const previousResolution = (_a3 = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode)) == null ? void 0 : _a3.resolvedTypeReferenceDirective;
|
|
99405
99498
|
if (previousResolution && previousResolution.primary) {
|
|
99406
99499
|
return;
|
|
99407
99500
|
}
|
|
99408
99501
|
let saveResolution = true;
|
|
99502
|
+
const { resolvedTypeReferenceDirective } = resolution;
|
|
99409
99503
|
if (resolvedTypeReferenceDirective) {
|
|
99410
99504
|
if (resolvedTypeReferenceDirective.isExternalLibraryImport)
|
|
99411
99505
|
currentNodeModulesDepth++;
|
|
@@ -99436,7 +99530,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
99436
99530
|
addFilePreprocessingFileExplainingDiagnostic(void 0, reason, Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
|
|
99437
99531
|
}
|
|
99438
99532
|
if (saveResolution) {
|
|
99439
|
-
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode,
|
|
99533
|
+
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolution);
|
|
99440
99534
|
}
|
|
99441
99535
|
}
|
|
99442
99536
|
function pathForLibFile(libFileName) {
|
|
@@ -99485,8 +99579,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
99485
99579
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
99486
99580
|
const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a3 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a3.commandLine.options : void 0) || options;
|
|
99487
99581
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
99488
|
-
const resolution = resolutions[index];
|
|
99489
|
-
|
|
99582
|
+
const resolution = resolutions[index].resolvedModule;
|
|
99583
|
+
const moduleName = moduleNames[index].text;
|
|
99584
|
+
const mode = getModeForUsageLocation(file, moduleNames[index]);
|
|
99585
|
+
setResolvedModule(file, moduleName, resolutions[index], mode);
|
|
99586
|
+
addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
|
|
99490
99587
|
if (!resolution) {
|
|
99491
99588
|
continue;
|
|
99492
99589
|
}
|
|
@@ -100127,8 +100224,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
100127
100224
|
if (!symlinks) {
|
|
100128
100225
|
symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
100129
100226
|
}
|
|
100130
|
-
if (files &&
|
|
100131
|
-
symlinks.setSymlinksFromResolutions(files,
|
|
100227
|
+
if (files && automaticTypeDirectiveResolutions && !symlinks.hasProcessedResolutions()) {
|
|
100228
|
+
symlinks.setSymlinksFromResolutions(files, automaticTypeDirectiveResolutions);
|
|
100132
100229
|
}
|
|
100133
100230
|
return symlinks;
|
|
100134
100231
|
}
|
|
@@ -100462,7 +100559,7 @@ var BuilderState;
|
|
|
100462
100559
|
}
|
|
100463
100560
|
}
|
|
100464
100561
|
if (sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
100465
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.forEach((resolvedTypeReferenceDirective) => {
|
|
100562
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
|
|
100466
100563
|
if (!resolvedTypeReferenceDirective) {
|
|
100467
100564
|
return;
|
|
100468
100565
|
}
|
|
@@ -100584,6 +100681,26 @@ var BuilderState;
|
|
|
100584
100681
|
(state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = /* @__PURE__ */ new Set())).add(path);
|
|
100585
100682
|
}
|
|
100586
100683
|
BuilderState2.updateSignatureOfFile = updateSignatureOfFile;
|
|
100684
|
+
function computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, onNewSignature) {
|
|
100685
|
+
programOfThisState.emit(
|
|
100686
|
+
sourceFile,
|
|
100687
|
+
(fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) => {
|
|
100688
|
+
Debug.assert(isDeclarationFileName(fileName), `File extension for signature expected to be dts: Got:: ${fileName}`);
|
|
100689
|
+
onNewSignature(computeSignatureWithDiagnostics(
|
|
100690
|
+
programOfThisState,
|
|
100691
|
+
sourceFile,
|
|
100692
|
+
text,
|
|
100693
|
+
host,
|
|
100694
|
+
data
|
|
100695
|
+
), sourceFiles);
|
|
100696
|
+
},
|
|
100697
|
+
cancellationToken,
|
|
100698
|
+
true,
|
|
100699
|
+
void 0,
|
|
100700
|
+
true
|
|
100701
|
+
);
|
|
100702
|
+
}
|
|
100703
|
+
BuilderState2.computeDtsSignature = computeDtsSignature;
|
|
100587
100704
|
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host, useFileVersionAsSignature = state.useFileVersionAsSignature) {
|
|
100588
100705
|
var _a2;
|
|
100589
100706
|
if ((_a2 = state.hasCalledUpdateShapeSignature) == null ? void 0 : _a2.has(sourceFile.resolvedPath))
|
|
@@ -100592,26 +100709,12 @@ var BuilderState;
|
|
|
100592
100709
|
const prevSignature = info.signature;
|
|
100593
100710
|
let latestSignature;
|
|
100594
100711
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
100595
|
-
programOfThisState
|
|
100596
|
-
|
|
100597
|
-
(
|
|
100598
|
-
|
|
100599
|
-
|
|
100600
|
-
|
|
100601
|
-
sourceFile,
|
|
100602
|
-
text,
|
|
100603
|
-
host,
|
|
100604
|
-
data
|
|
100605
|
-
);
|
|
100606
|
-
if (latestSignature !== prevSignature) {
|
|
100607
|
-
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
100608
|
-
}
|
|
100609
|
-
},
|
|
100610
|
-
cancellationToken,
|
|
100611
|
-
true,
|
|
100612
|
-
void 0,
|
|
100613
|
-
true
|
|
100614
|
-
);
|
|
100712
|
+
computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, (signature, sourceFiles) => {
|
|
100713
|
+
latestSignature = signature;
|
|
100714
|
+
if (latestSignature !== prevSignature) {
|
|
100715
|
+
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
100716
|
+
}
|
|
100717
|
+
});
|
|
100615
100718
|
}
|
|
100616
100719
|
if (latestSignature === void 0) {
|
|
100617
100720
|
latestSignature = sourceFile.version;
|
|
@@ -100635,27 +100738,24 @@ var BuilderState;
|
|
|
100635
100738
|
if (!state.exportedModulesMap)
|
|
100636
100739
|
return;
|
|
100637
100740
|
(state.oldExportedModulesMap || (state.oldExportedModulesMap = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
|
|
100638
|
-
|
|
100639
|
-
state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
|
|
100640
|
-
return;
|
|
100641
|
-
}
|
|
100642
|
-
let exportedModules;
|
|
100643
|
-
exportedModulesFromDeclarationEmit.forEach((symbol) => addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)));
|
|
100741
|
+
const exportedModules = getExportedModules(exportedModulesFromDeclarationEmit);
|
|
100644
100742
|
if (exportedModules) {
|
|
100645
100743
|
state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
|
|
100646
100744
|
} else {
|
|
100647
100745
|
state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
|
|
100648
100746
|
}
|
|
100649
|
-
function addExportedModule(exportedModulePaths) {
|
|
100650
|
-
if (exportedModulePaths == null ? void 0 : exportedModulePaths.length) {
|
|
100651
|
-
if (!exportedModules) {
|
|
100652
|
-
exportedModules = /* @__PURE__ */ new Set();
|
|
100653
|
-
}
|
|
100654
|
-
exportedModulePaths.forEach((path) => exportedModules.add(path));
|
|
100655
|
-
}
|
|
100656
|
-
}
|
|
100657
100747
|
}
|
|
100658
100748
|
BuilderState2.updateExportedModules = updateExportedModules;
|
|
100749
|
+
function getExportedModules(exportedModulesFromDeclarationEmit) {
|
|
100750
|
+
let exportedModules;
|
|
100751
|
+
exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.forEach(
|
|
100752
|
+
(symbol) => getReferencedFilesFromImportedModuleSymbol(symbol).forEach(
|
|
100753
|
+
(path) => (exportedModules != null ? exportedModules : exportedModules = /* @__PURE__ */ new Set()).add(path)
|
|
100754
|
+
)
|
|
100755
|
+
);
|
|
100756
|
+
return exportedModules;
|
|
100757
|
+
}
|
|
100758
|
+
BuilderState2.getExportedModules = getExportedModules;
|
|
100659
100759
|
function getAllDependencies(state, programOfThisState, sourceFile) {
|
|
100660
100760
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
100661
100761
|
if (outFile(compilerOptions)) {
|
|
@@ -100797,9 +100897,9 @@ function getPendingEmitKind(optionsOrEmitKind, oldOptionsOrEmitKind) {
|
|
|
100797
100897
|
function hasSameKeys(map1, map2) {
|
|
100798
100898
|
return map1 === map2 || map1 !== void 0 && map2 !== void 0 && map1.size === map2.size && !forEachKey(map1, (key) => !map2.has(key));
|
|
100799
100899
|
}
|
|
100800
|
-
function createBuilderProgramState(newProgram, oldState
|
|
100900
|
+
function createBuilderProgramState(newProgram, oldState) {
|
|
100801
100901
|
var _a2, _b;
|
|
100802
|
-
const state = BuilderState.create(newProgram, oldState,
|
|
100902
|
+
const state = BuilderState.create(newProgram, oldState, false);
|
|
100803
100903
|
state.program = newProgram;
|
|
100804
100904
|
const compilerOptions = newProgram.getCompilerOptions();
|
|
100805
100905
|
state.compilerOptions = compilerOptions;
|
|
@@ -101091,7 +101191,7 @@ function handleDtsMayChangeOf(state, path, cancellationToken, host) {
|
|
|
101091
101191
|
sourceFile,
|
|
101092
101192
|
cancellationToken,
|
|
101093
101193
|
host,
|
|
101094
|
-
|
|
101194
|
+
true
|
|
101095
101195
|
);
|
|
101096
101196
|
if (getEmitDeclarations(state.compilerOptions)) {
|
|
101097
101197
|
addToAffectedFilesPendingEmit(state, path, state.compilerOptions.declarationMap ? 24 /* AllDts */ : 8 /* Dts */);
|
|
@@ -101474,7 +101574,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
101474
101574
|
oldState = void 0;
|
|
101475
101575
|
return oldProgram;
|
|
101476
101576
|
}
|
|
101477
|
-
const state = createBuilderProgramState(newProgram, oldState
|
|
101577
|
+
const state = createBuilderProgramState(newProgram, oldState);
|
|
101478
101578
|
newProgram.getBuildInfo = (bundle) => getBuildInfo2(state, bundle);
|
|
101479
101579
|
newProgram = void 0;
|
|
101480
101580
|
oldProgram = void 0;
|
|
@@ -101933,9 +102033,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
101933
102033
|
let filesWithInvalidatedResolutions;
|
|
101934
102034
|
let filesWithInvalidatedNonRelativeUnresolvedImports;
|
|
101935
102035
|
const nonRelativeExternalModuleResolutions = createMultiMap();
|
|
101936
|
-
const resolutionsWithFailedLookups =
|
|
101937
|
-
const resolutionsWithOnlyAffectingLocations =
|
|
101938
|
-
const resolvedFileToResolution =
|
|
102036
|
+
const resolutionsWithFailedLookups = /* @__PURE__ */ new Set();
|
|
102037
|
+
const resolutionsWithOnlyAffectingLocations = /* @__PURE__ */ new Set();
|
|
102038
|
+
const resolvedFileToResolution = /* @__PURE__ */ new Map();
|
|
101939
102039
|
const impliedFormatPackageJsons = /* @__PURE__ */ new Map();
|
|
101940
102040
|
let hasChangedAutomaticTypeDirectiveNames = false;
|
|
101941
102041
|
let affectingPathChecksForFile;
|
|
@@ -101972,9 +102072,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
101972
102072
|
finishRecordingFilesWithChangedResolutions,
|
|
101973
102073
|
startCachingPerDirectoryResolution,
|
|
101974
102074
|
finishCachingPerDirectoryResolution,
|
|
101975
|
-
|
|
101976
|
-
|
|
101977
|
-
|
|
102075
|
+
resolveModuleNameLiterals,
|
|
102076
|
+
resolveTypeReferenceDirectiveReferences,
|
|
102077
|
+
resolveSingleModuleNameWithoutWatching,
|
|
101978
102078
|
removeResolutionsFromProjectReferenceRedirects,
|
|
101979
102079
|
removeResolutionsOfFile,
|
|
101980
102080
|
hasChangedAutomaticTypeDirectiveNames: () => hasChangedAutomaticTypeDirectiveNames,
|
|
@@ -101990,7 +102090,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
101990
102090
|
function getResolvedModule2(resolution) {
|
|
101991
102091
|
return resolution.resolvedModule;
|
|
101992
102092
|
}
|
|
101993
|
-
function
|
|
102093
|
+
function getResolvedTypeReferenceDirective(resolution) {
|
|
101994
102094
|
return resolution.resolvedTypeReferenceDirective;
|
|
101995
102095
|
}
|
|
101996
102096
|
function isInDirectoryPath(dir, file) {
|
|
@@ -102008,8 +102108,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102008
102108
|
resolvedModuleNames.clear();
|
|
102009
102109
|
resolvedTypeReferenceDirectives.clear();
|
|
102010
102110
|
resolvedFileToResolution.clear();
|
|
102011
|
-
resolutionsWithFailedLookups.
|
|
102012
|
-
resolutionsWithOnlyAffectingLocations.
|
|
102111
|
+
resolutionsWithFailedLookups.clear();
|
|
102112
|
+
resolutionsWithOnlyAffectingLocations.clear();
|
|
102013
102113
|
failedLookupChecks = void 0;
|
|
102014
102114
|
startsWithPathChecks = void 0;
|
|
102015
102115
|
isInDirectoryChecks = void 0;
|
|
@@ -102092,14 +102192,16 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102092
102192
|
});
|
|
102093
102193
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
102094
102194
|
}
|
|
102095
|
-
function resolveModuleName2(moduleName, containingFile, compilerOptions,
|
|
102195
|
+
function resolveModuleName2(moduleName, containingFile, compilerOptions, redirectedReference, mode) {
|
|
102196
|
+
var _a2;
|
|
102197
|
+
const host = ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost;
|
|
102096
102198
|
const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
102097
102199
|
if (!resolutionHost.getGlobalCache) {
|
|
102098
102200
|
return primaryResult;
|
|
102099
102201
|
}
|
|
102100
102202
|
const globalCache = resolutionHost.getGlobalCache();
|
|
102101
102203
|
if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
102102
|
-
const { resolvedModule, failedLookupLocations, affectingLocations } = loadModuleFromGlobalCache(
|
|
102204
|
+
const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
|
|
102103
102205
|
Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
|
|
102104
102206
|
resolutionHost.projectName,
|
|
102105
102207
|
compilerOptions,
|
|
@@ -102109,49 +102211,55 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102109
102211
|
);
|
|
102110
102212
|
if (resolvedModule) {
|
|
102111
102213
|
primaryResult.resolvedModule = resolvedModule;
|
|
102112
|
-
primaryResult.failedLookupLocations.
|
|
102113
|
-
primaryResult.affectingLocations.
|
|
102214
|
+
primaryResult.failedLookupLocations = updateResolutionField(primaryResult.failedLookupLocations, failedLookupLocations);
|
|
102215
|
+
primaryResult.affectingLocations = updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
102216
|
+
primaryResult.resolutionDiagnostics = updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
102114
102217
|
return primaryResult;
|
|
102115
102218
|
}
|
|
102116
102219
|
}
|
|
102117
102220
|
return primaryResult;
|
|
102118
102221
|
}
|
|
102119
|
-
function
|
|
102120
|
-
return
|
|
102222
|
+
function createModuleResolutionLoader2(containingFile, redirectedReference, options) {
|
|
102223
|
+
return {
|
|
102224
|
+
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
102225
|
+
resolve: (moduleName, resoluionMode) => resolveModuleName2(
|
|
102226
|
+
moduleName,
|
|
102227
|
+
containingFile,
|
|
102228
|
+
options,
|
|
102229
|
+
redirectedReference,
|
|
102230
|
+
resoluionMode
|
|
102231
|
+
)
|
|
102232
|
+
};
|
|
102121
102233
|
}
|
|
102122
102234
|
function resolveNamesWithLocalCache({
|
|
102123
|
-
|
|
102235
|
+
entries,
|
|
102124
102236
|
containingFile,
|
|
102237
|
+
containingSourceFile,
|
|
102125
102238
|
redirectedReference,
|
|
102239
|
+
options,
|
|
102126
102240
|
perFileCache,
|
|
102241
|
+
reusedNames,
|
|
102127
102242
|
loader,
|
|
102128
102243
|
getResolutionWithResolvedFileName,
|
|
102129
102244
|
shouldRetryResolution,
|
|
102130
|
-
|
|
102131
|
-
resolutionInfo,
|
|
102132
|
-
logChanges,
|
|
102133
|
-
containingSourceFile,
|
|
102134
|
-
containingSourceFileMode
|
|
102245
|
+
logChanges
|
|
102135
102246
|
}) {
|
|
102136
|
-
var _a2
|
|
102247
|
+
var _a2;
|
|
102137
102248
|
const path = resolutionHost.toPath(containingFile);
|
|
102138
102249
|
const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
|
|
102139
102250
|
const resolvedModules = [];
|
|
102140
|
-
const compilerOptions = resolutionHost.getCompilationSettings();
|
|
102141
102251
|
const hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
102142
102252
|
const program = resolutionHost.getCurrentProgram();
|
|
102143
102253
|
const oldRedirect = program && program.getResolvedProjectReferenceToRedirect(containingFile);
|
|
102144
102254
|
const unmatchedRedirects = oldRedirect ? !redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path : !!redirectedReference;
|
|
102145
102255
|
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++;
|
|
102256
|
+
for (const entry of entries) {
|
|
102257
|
+
const name = loader.nameAndMode.getName(entry);
|
|
102258
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
102151
102259
|
let resolution = resolutionsInFile.get(name, mode);
|
|
102152
102260
|
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
102153
102261
|
const existingResolution = resolution;
|
|
102154
|
-
resolution = loader(name,
|
|
102262
|
+
resolution = loader.resolve(name, mode);
|
|
102155
102263
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
102156
102264
|
resolutionHost.onDiscoveredSymlink();
|
|
102157
102265
|
}
|
|
@@ -102165,12 +102273,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102165
102273
|
logChanges = false;
|
|
102166
102274
|
}
|
|
102167
102275
|
} else {
|
|
102168
|
-
const host = ((
|
|
102169
|
-
if (isTraceEnabled(
|
|
102276
|
+
const host = ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost;
|
|
102277
|
+
if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) {
|
|
102170
102278
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
102171
102279
|
trace(
|
|
102172
102280
|
host,
|
|
102173
|
-
|
|
102281
|
+
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
102282
|
name,
|
|
102175
102283
|
containingFile,
|
|
102176
102284
|
resolved == null ? void 0 : resolved.resolvedFileName,
|
|
@@ -102180,19 +102288,16 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102180
102288
|
}
|
|
102181
102289
|
Debug.assert(resolution !== void 0 && !resolution.isInvalidated);
|
|
102182
102290
|
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;
|
|
102291
|
+
resolvedModules.push(resolution);
|
|
102192
102292
|
}
|
|
102293
|
+
reusedNames == null ? void 0 : reusedNames.forEach((entry) => seenNamesInFile.set(
|
|
102294
|
+
loader.nameAndMode.getName(entry),
|
|
102295
|
+
loader.nameAndMode.getMode(entry, containingSourceFile),
|
|
102296
|
+
true
|
|
102297
|
+
));
|
|
102193
102298
|
if (resolutionsInFile.size() !== seenNamesInFile.size()) {
|
|
102194
102299
|
resolutionsInFile.forEach((resolution, name, mode) => {
|
|
102195
|
-
if (!seenNamesInFile.has(name, mode)
|
|
102300
|
+
if (!seenNamesInFile.has(name, mode)) {
|
|
102196
102301
|
stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
102197
102302
|
resolutionsInFile.delete(name, mode);
|
|
102198
102303
|
}
|
|
@@ -102217,39 +102322,53 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102217
102322
|
return oldResult.resolvedFileName === newResult.resolvedFileName;
|
|
102218
102323
|
}
|
|
102219
102324
|
}
|
|
102220
|
-
function
|
|
102325
|
+
function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
102326
|
+
var _a2;
|
|
102221
102327
|
return resolveNamesWithLocalCache({
|
|
102222
|
-
|
|
102328
|
+
entries: typeDirectiveReferences,
|
|
102223
102329
|
containingFile,
|
|
102330
|
+
containingSourceFile,
|
|
102224
102331
|
redirectedReference,
|
|
102332
|
+
options,
|
|
102333
|
+
reusedNames,
|
|
102225
102334
|
perFileCache: resolvedTypeReferenceDirectives,
|
|
102226
|
-
loader:
|
|
102227
|
-
|
|
102228
|
-
|
|
102229
|
-
|
|
102230
|
-
|
|
102335
|
+
loader: createTypeReferenceResolutionLoader(
|
|
102336
|
+
containingFile,
|
|
102337
|
+
redirectedReference,
|
|
102338
|
+
options,
|
|
102339
|
+
((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost,
|
|
102340
|
+
typeReferenceDirectiveResolutionCache
|
|
102341
|
+
),
|
|
102342
|
+
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
102343
|
+
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0
|
|
102231
102344
|
});
|
|
102232
102345
|
}
|
|
102233
|
-
function
|
|
102346
|
+
function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
102234
102347
|
return resolveNamesWithLocalCache({
|
|
102235
|
-
|
|
102348
|
+
entries: moduleLiterals,
|
|
102236
102349
|
containingFile,
|
|
102350
|
+
containingSourceFile,
|
|
102237
102351
|
redirectedReference,
|
|
102352
|
+
options,
|
|
102353
|
+
reusedNames,
|
|
102238
102354
|
perFileCache: resolvedModuleNames,
|
|
102239
|
-
loader:
|
|
102355
|
+
loader: createModuleResolutionLoader2(
|
|
102356
|
+
containingFile,
|
|
102357
|
+
redirectedReference,
|
|
102358
|
+
options
|
|
102359
|
+
),
|
|
102240
102360
|
getResolutionWithResolvedFileName: getResolvedModule2,
|
|
102241
102361
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
102242
|
-
|
|
102243
|
-
resolutionInfo,
|
|
102244
|
-
logChanges: logChangesWhenResolvingModule,
|
|
102245
|
-
containingSourceFile
|
|
102362
|
+
logChanges: logChangesWhenResolvingModule
|
|
102246
102363
|
});
|
|
102247
102364
|
}
|
|
102248
|
-
function
|
|
102249
|
-
const
|
|
102250
|
-
|
|
102251
|
-
|
|
102252
|
-
|
|
102365
|
+
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
102366
|
+
const path = resolutionHost.toPath(containingFile);
|
|
102367
|
+
const resolutionsInFile = resolvedModuleNames.get(path);
|
|
102368
|
+
const resolution = resolutionsInFile == null ? void 0 : resolutionsInFile.get(moduleName, void 0);
|
|
102369
|
+
if (resolution && !resolution.isInvalidated)
|
|
102370
|
+
return resolution;
|
|
102371
|
+
return resolveModuleName2(moduleName, containingFile, resolutionHost.getCompilationSettings());
|
|
102253
102372
|
}
|
|
102254
102373
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
102255
102374
|
return endsWith(dirPath, "/node_modules/@types");
|
|
@@ -102307,12 +102426,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102307
102426
|
return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
102308
102427
|
}
|
|
102309
102428
|
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
102429
|
+
var _a2, _b;
|
|
102310
102430
|
if (resolution.refCount) {
|
|
102311
102431
|
resolution.refCount++;
|
|
102312
102432
|
Debug.assertIsDefined(resolution.files);
|
|
102313
102433
|
} else {
|
|
102314
102434
|
resolution.refCount = 1;
|
|
102315
|
-
Debug.assert(
|
|
102435
|
+
Debug.assert(!((_a2 = resolution.files) == null ? void 0 : _a2.size));
|
|
102316
102436
|
if (isExternalModuleNameRelative(name)) {
|
|
102317
102437
|
watchFailedLookupLocationOfResolution(resolution);
|
|
102318
102438
|
} else {
|
|
@@ -102320,48 +102440,54 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102320
102440
|
}
|
|
102321
102441
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
102322
102442
|
if (resolved && resolved.resolvedFileName) {
|
|
102323
|
-
|
|
102443
|
+
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
102444
|
+
let resolutions = resolvedFileToResolution.get(key);
|
|
102445
|
+
if (!resolutions)
|
|
102446
|
+
resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
|
|
102447
|
+
resolutions.add(resolution);
|
|
102324
102448
|
}
|
|
102325
102449
|
}
|
|
102326
|
-
(resolution.files
|
|
102450
|
+
((_b = resolution.files) != null ? _b : resolution.files = /* @__PURE__ */ new Set()).add(filePath);
|
|
102327
102451
|
}
|
|
102328
102452
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
102329
102453
|
Debug.assert(!!resolution.refCount);
|
|
102330
102454
|
const { failedLookupLocations, affectingLocations } = resolution;
|
|
102331
|
-
if (!failedLookupLocations.length && !affectingLocations.length)
|
|
102455
|
+
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length))
|
|
102332
102456
|
return;
|
|
102333
|
-
if (failedLookupLocations.length)
|
|
102334
|
-
resolutionsWithFailedLookups.
|
|
102457
|
+
if (failedLookupLocations == null ? void 0 : failedLookupLocations.length)
|
|
102458
|
+
resolutionsWithFailedLookups.add(resolution);
|
|
102335
102459
|
let setAtRoot = false;
|
|
102336
|
-
|
|
102337
|
-
const
|
|
102338
|
-
|
|
102339
|
-
|
|
102340
|
-
|
|
102341
|
-
|
|
102342
|
-
|
|
102343
|
-
|
|
102344
|
-
|
|
102345
|
-
|
|
102346
|
-
|
|
102347
|
-
|
|
102348
|
-
|
|
102349
|
-
|
|
102460
|
+
if (failedLookupLocations) {
|
|
102461
|
+
for (const failedLookupLocation of failedLookupLocations) {
|
|
102462
|
+
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
102463
|
+
const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
102464
|
+
if (toWatch) {
|
|
102465
|
+
const { dir, dirPath, nonRecursive } = toWatch;
|
|
102466
|
+
if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
|
|
102467
|
+
const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
|
|
102468
|
+
customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
|
|
102469
|
+
}
|
|
102470
|
+
if (dirPath === rootPath) {
|
|
102471
|
+
Debug.assert(!nonRecursive);
|
|
102472
|
+
setAtRoot = true;
|
|
102473
|
+
} else {
|
|
102474
|
+
setDirectoryWatcher(dir, dirPath, nonRecursive);
|
|
102475
|
+
}
|
|
102350
102476
|
}
|
|
102351
102477
|
}
|
|
102478
|
+
if (setAtRoot) {
|
|
102479
|
+
setDirectoryWatcher(rootDir, rootPath, true);
|
|
102480
|
+
}
|
|
102352
102481
|
}
|
|
102353
|
-
|
|
102354
|
-
setDirectoryWatcher(rootDir, rootPath, true);
|
|
102355
|
-
}
|
|
102356
|
-
watchAffectingLocationsOfResolution(resolution, !failedLookupLocations.length);
|
|
102482
|
+
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length));
|
|
102357
102483
|
}
|
|
102358
102484
|
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
102359
102485
|
Debug.assert(!!resolution.refCount);
|
|
102360
102486
|
const { affectingLocations } = resolution;
|
|
102361
|
-
if (!affectingLocations.length)
|
|
102487
|
+
if (!(affectingLocations == null ? void 0 : affectingLocations.length))
|
|
102362
102488
|
return;
|
|
102363
102489
|
if (addToResolutionsWithOnlyAffectingLocations)
|
|
102364
|
-
resolutionsWithOnlyAffectingLocations.
|
|
102490
|
+
resolutionsWithOnlyAffectingLocations.add(resolution);
|
|
102365
102491
|
for (const affectingLocation of affectingLocations) {
|
|
102366
102492
|
createFileWatcherOfAffectingLocation(affectingLocation, true);
|
|
102367
102493
|
}
|
|
@@ -102440,17 +102566,20 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102440
102566
|
}
|
|
102441
102567
|
}
|
|
102442
102568
|
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
102443
|
-
|
|
102569
|
+
Debug.checkDefined(resolution.files).delete(filePath);
|
|
102444
102570
|
resolution.refCount--;
|
|
102445
102571
|
if (resolution.refCount) {
|
|
102446
102572
|
return;
|
|
102447
102573
|
}
|
|
102448
102574
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
102449
102575
|
if (resolved && resolved.resolvedFileName) {
|
|
102450
|
-
|
|
102576
|
+
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
102577
|
+
const resolutions = resolvedFileToResolution.get(key);
|
|
102578
|
+
if ((resolutions == null ? void 0 : resolutions.delete(resolution)) && !resolutions.size)
|
|
102579
|
+
resolvedFileToResolution.delete(key);
|
|
102451
102580
|
}
|
|
102452
102581
|
const { failedLookupLocations, affectingLocations } = resolution;
|
|
102453
|
-
if (
|
|
102582
|
+
if (resolutionsWithFailedLookups.delete(resolution)) {
|
|
102454
102583
|
let removeAtRoot = false;
|
|
102455
102584
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
102456
102585
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
@@ -102476,12 +102605,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102476
102605
|
if (removeAtRoot) {
|
|
102477
102606
|
removeDirectoryWatcher(rootPath);
|
|
102478
102607
|
}
|
|
102479
|
-
} else if (affectingLocations.length) {
|
|
102480
|
-
|
|
102608
|
+
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
102609
|
+
resolutionsWithOnlyAffectingLocations.delete(resolution);
|
|
102481
102610
|
}
|
|
102482
|
-
|
|
102483
|
-
const
|
|
102484
|
-
|
|
102611
|
+
if (affectingLocations) {
|
|
102612
|
+
for (const affectingLocation of affectingLocations) {
|
|
102613
|
+
const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
102614
|
+
watcher.resolutions--;
|
|
102615
|
+
}
|
|
102485
102616
|
}
|
|
102486
102617
|
}
|
|
102487
102618
|
function removeDirectoryWatcher(dirPath) {
|
|
@@ -102517,21 +102648,21 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102517
102648
|
}
|
|
102518
102649
|
function removeResolutionsOfFile(filePath) {
|
|
102519
102650
|
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule2);
|
|
102520
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath,
|
|
102651
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
102521
102652
|
}
|
|
102522
102653
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
102523
102654
|
if (!resolutions)
|
|
102524
102655
|
return false;
|
|
102525
102656
|
let invalidated = false;
|
|
102526
|
-
|
|
102657
|
+
resolutions.forEach((resolution) => {
|
|
102527
102658
|
if (resolution.isInvalidated || !canInvalidate(resolution))
|
|
102528
|
-
|
|
102659
|
+
return;
|
|
102529
102660
|
resolution.isInvalidated = invalidated = true;
|
|
102530
102661
|
for (const containingFilePath of Debug.checkDefined(resolution.files)) {
|
|
102531
102662
|
(filesWithInvalidatedResolutions != null ? filesWithInvalidatedResolutions : filesWithInvalidatedResolutions = /* @__PURE__ */ new Set()).add(containingFilePath);
|
|
102532
102663
|
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || endsWith(containingFilePath, inferredTypesContainingFile);
|
|
102533
102664
|
}
|
|
102534
|
-
}
|
|
102665
|
+
});
|
|
102535
102666
|
return invalidated;
|
|
102536
102667
|
}
|
|
102537
102668
|
function invalidateResolutionOfFile(filePath) {
|
|
@@ -102603,17 +102734,19 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
102603
102734
|
return invalidated;
|
|
102604
102735
|
}
|
|
102605
102736
|
function canInvalidateFailedLookupResolution(resolution) {
|
|
102737
|
+
var _a2;
|
|
102606
102738
|
if (canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution))
|
|
102607
102739
|
return true;
|
|
102608
102740
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
|
|
102609
102741
|
return false;
|
|
102610
|
-
return resolution.failedLookupLocations.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
|
|
102742
|
+
return (_a2 = resolution.failedLookupLocations) == null ? void 0 : _a2.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
|
|
102611
102743
|
}
|
|
102612
102744
|
function isInvalidatedFailedLookup(locationPath) {
|
|
102613
102745
|
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
102746
|
}
|
|
102615
102747
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
102616
|
-
|
|
102748
|
+
var _a2;
|
|
102749
|
+
return !!affectingPathChecks && ((_a2 = resolution.affectingLocations) == null ? void 0 : _a2.some((location) => affectingPathChecks.has(location)));
|
|
102617
102750
|
}
|
|
102618
102751
|
function closeTypeRootsWatch() {
|
|
102619
102752
|
clearMap(typeRootsWatches, closeFileWatcher);
|
|
@@ -103119,7 +103252,6 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
|
|
|
103119
103252
|
getEnvironmentVariable: maybeBind(host, host.getEnvironmentVariable) || (() => ""),
|
|
103120
103253
|
createHash: maybeBind(host, host.createHash),
|
|
103121
103254
|
readDirectory: maybeBind(host, host.readDirectory),
|
|
103122
|
-
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
103123
103255
|
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
103124
103256
|
};
|
|
103125
103257
|
return compilerHost;
|
|
@@ -103186,7 +103318,6 @@ function createProgramHost(system, createProgram2) {
|
|
|
103186
103318
|
writeFile: (path, data, writeByteOrderMark) => system.writeFile(path, data, writeByteOrderMark),
|
|
103187
103319
|
createHash: maybeBind(system, system.createHash),
|
|
103188
103320
|
createProgram: createProgram2 || createEmitAndSemanticDiagnosticsBuilderProgram,
|
|
103189
|
-
disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
|
|
103190
103321
|
storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
|
|
103191
103322
|
now: maybeBind(system, system.now)
|
|
103192
103323
|
};
|
|
@@ -103288,7 +103419,6 @@ function readBuilderProgram(compilerOptions, host) {
|
|
|
103288
103419
|
function createIncrementalCompilerHost(options, system = sys) {
|
|
103289
103420
|
const host = createCompilerHostWorker(options, void 0, system);
|
|
103290
103421
|
host.createHash = maybeBind(system, system.createHash);
|
|
103291
|
-
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
103292
103422
|
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
103293
103423
|
setGetSourceFileAsHashVersioned(host);
|
|
103294
103424
|
changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
|
|
@@ -103379,10 +103509,18 @@ function createWatchProgram(host) {
|
|
|
103379
103509
|
configFileName ? getDirectoryPath(getNormalizedAbsolutePath(configFileName, currentDirectory)) : currentDirectory,
|
|
103380
103510
|
false
|
|
103381
103511
|
);
|
|
103382
|
-
compilerHost.
|
|
103383
|
-
compilerHost.
|
|
103384
|
-
compilerHost.
|
|
103385
|
-
|
|
103512
|
+
compilerHost.resolveModuleNameLiterals = maybeBind(host, host.resolveModuleNameLiterals);
|
|
103513
|
+
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
103514
|
+
if (!compilerHost.resolveModuleNameLiterals && !compilerHost.resolveModuleNames) {
|
|
103515
|
+
compilerHost.resolveModuleNameLiterals = resolutionCache.resolveModuleNameLiterals.bind(resolutionCache);
|
|
103516
|
+
}
|
|
103517
|
+
compilerHost.resolveTypeReferenceDirectiveReferences = maybeBind(host, host.resolveTypeReferenceDirectiveReferences);
|
|
103518
|
+
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
103519
|
+
if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) {
|
|
103520
|
+
compilerHost.resolveTypeReferenceDirectiveReferences = resolutionCache.resolveTypeReferenceDirectiveReferences.bind(resolutionCache);
|
|
103521
|
+
}
|
|
103522
|
+
compilerHost.getModuleResolutionCache = host.resolveModuleNameLiterals || host.resolveModuleNames ? maybeBind(host, host.getModuleResolutionCache) : () => resolutionCache.getModuleResolutionCache();
|
|
103523
|
+
const userProvidedResolution = !!host.resolveModuleNameLiterals || !!host.resolveTypeReferenceDirectiveReferences || !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
103386
103524
|
const customHasInvalidatedResolutions = userProvidedResolution ? maybeBind(host, host.hasInvalidatedResolutions) || returnTrue : returnFalse;
|
|
103387
103525
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
103388
103526
|
synchronizeProgram();
|
|
@@ -104021,19 +104159,38 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
104021
104159
|
const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions);
|
|
104022
104160
|
setGetSourceFileAsHashVersioned(compilerHost);
|
|
104023
104161
|
compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
|
|
104162
|
+
compilerHost.resolveModuleNameLiterals = maybeBind(host, host.resolveModuleNameLiterals);
|
|
104163
|
+
compilerHost.resolveTypeReferenceDirectiveReferences = maybeBind(host, host.resolveTypeReferenceDirectiveReferences);
|
|
104024
104164
|
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
104025
104165
|
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
104026
104166
|
compilerHost.getModuleResolutionCache = maybeBind(host, host.getModuleResolutionCache);
|
|
104027
|
-
|
|
104028
|
-
|
|
104029
|
-
|
|
104030
|
-
|
|
104031
|
-
|
|
104167
|
+
let moduleResolutionCache, typeReferenceDirectiveResolutionCache;
|
|
104168
|
+
if (!compilerHost.resolveModuleNameLiterals && !compilerHost.resolveModuleNames) {
|
|
104169
|
+
moduleResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName);
|
|
104170
|
+
compilerHost.resolveModuleNameLiterals = (moduleNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
104171
|
+
moduleNames,
|
|
104172
|
+
containingFile,
|
|
104173
|
+
redirectedReference,
|
|
104174
|
+
options2,
|
|
104175
|
+
containingSourceFile,
|
|
104176
|
+
host,
|
|
104177
|
+
moduleResolutionCache,
|
|
104178
|
+
createModuleResolutionLoader
|
|
104179
|
+
);
|
|
104032
104180
|
compilerHost.getModuleResolutionCache = () => moduleResolutionCache;
|
|
104033
104181
|
}
|
|
104034
|
-
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
104035
|
-
|
|
104036
|
-
compilerHost.
|
|
104182
|
+
if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) {
|
|
104183
|
+
typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
104184
|
+
compilerHost.resolveTypeReferenceDirectiveReferences = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
|
|
104185
|
+
typeDirectiveNames,
|
|
104186
|
+
containingFile,
|
|
104187
|
+
redirectedReference,
|
|
104188
|
+
options2,
|
|
104189
|
+
containingSourceFile,
|
|
104190
|
+
host,
|
|
104191
|
+
typeReferenceDirectiveResolutionCache,
|
|
104192
|
+
createTypeReferenceResolutionLoader
|
|
104193
|
+
);
|
|
104037
104194
|
}
|
|
104038
104195
|
compilerHost.getBuildInfo = (fileName, configFilePath) => getBuildInfo3(state, fileName, toResolvedConfigFilePath(state, configFilePath), void 0);
|
|
104039
104196
|
const { watchFile: watchFile2, watchDirectory, writeLog } = createWatchFactory(hostWithWatch, options);
|