@typescript-deploys/pr-build 5.9.0-pr-61732-3 → 5.9.0-pr-61746-2
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 +762 -1690
- package/lib/typescript.d.ts +0 -3
- package/lib/typescript.js +829 -1862
- package/package.json +1 -1
package/lib/_tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.9";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20250521`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -16534,7 +16534,7 @@ function sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit) {
|
|
|
16534
16534
|
if (forceDtsEmit) return true;
|
|
16535
16535
|
if (host.isSourceOfProjectReferenceRedirect(sourceFile.fileName)) return false;
|
|
16536
16536
|
if (!isJsonSourceFile(sourceFile)) return true;
|
|
16537
|
-
if (host.
|
|
16537
|
+
if (host.getRedirectFromSourceFile(sourceFile.fileName)) return false;
|
|
16538
16538
|
if (options.outFile) return true;
|
|
16539
16539
|
if (!options.outDir) return false;
|
|
16540
16540
|
if (options.rootDir || options.composite && options.configFilePath) {
|
|
@@ -19967,7 +19967,7 @@ function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
|
|
|
19967
19967
|
/*projectReferences*/
|
|
19968
19968
|
void 0,
|
|
19969
19969
|
resolvedProjectReferences,
|
|
19970
|
-
(resolvedRef
|
|
19970
|
+
(resolvedRef) => resolvedRef && cb(resolvedRef)
|
|
19971
19971
|
);
|
|
19972
19972
|
}
|
|
19973
19973
|
function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) {
|
|
@@ -39622,40 +39622,19 @@ function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName
|
|
|
39622
39622
|
alternateResult
|
|
39623
39623
|
);
|
|
39624
39624
|
}
|
|
39625
|
-
function updateResultFromCache(resultFromCache, failedLookupLocations, affectingLocations, diagnostics) {
|
|
39626
|
-
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
39627
|
-
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
39628
|
-
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
39629
|
-
}
|
|
39630
|
-
function updatePrimaryAndGlobalCacheResolution(primaryWithGlobalCacheResult, failedLookupLocations, affectingLocations, diagnostics) {
|
|
39631
|
-
updateResultFromCache(primaryWithGlobalCacheResult, failedLookupLocations, affectingLocations, diagnostics);
|
|
39632
|
-
if (primaryWithGlobalCacheResult.globalCacheResolution.globalResult.resolvedModule) {
|
|
39633
|
-
updateResultFromCache(primaryWithGlobalCacheResult.globalCacheResolution.globalResult, failedLookupLocations, affectingLocations, diagnostics);
|
|
39634
|
-
} else {
|
|
39635
|
-
primaryWithGlobalCacheResult.globalCacheResolution.globalResult.failedLookupLocations = primaryWithGlobalCacheResult.failedLookupLocations;
|
|
39636
|
-
primaryWithGlobalCacheResult.globalCacheResolution.globalResult.affectingLocations = primaryWithGlobalCacheResult.affectingLocations;
|
|
39637
|
-
primaryWithGlobalCacheResult.globalCacheResolution.globalResult.resolutionDiagnostics = primaryWithGlobalCacheResult.resolutionDiagnostics;
|
|
39638
|
-
}
|
|
39639
|
-
}
|
|
39640
39625
|
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, cache, alternateResult) {
|
|
39641
|
-
var _a;
|
|
39642
39626
|
if (resultFromCache) {
|
|
39643
39627
|
if (!(cache == null ? void 0 : cache.isReadonly)) {
|
|
39644
|
-
|
|
39645
|
-
|
|
39646
|
-
|
|
39647
|
-
updatePrimaryAndGlobalCacheResolution(resultFromCache, failedLookupLocations, affectingLocations, diagnostics);
|
|
39648
|
-
} else {
|
|
39649
|
-
updateResultFromCache(resultFromCache, failedLookupLocations, affectingLocations, diagnostics);
|
|
39650
|
-
}
|
|
39628
|
+
resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
|
|
39629
|
+
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
39630
|
+
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
39651
39631
|
return resultFromCache;
|
|
39652
39632
|
} else {
|
|
39653
39633
|
return {
|
|
39654
|
-
|
|
39634
|
+
...resultFromCache,
|
|
39655
39635
|
failedLookupLocations: initializeResolutionFieldForReadonlyCache(resultFromCache.failedLookupLocations, failedLookupLocations),
|
|
39656
39636
|
affectingLocations: initializeResolutionFieldForReadonlyCache(resultFromCache.affectingLocations, affectingLocations),
|
|
39657
|
-
resolutionDiagnostics: initializeResolutionFieldForReadonlyCache(resultFromCache.resolutionDiagnostics, diagnostics)
|
|
39658
|
-
alternateResult: resultFromCache.alternateResult
|
|
39637
|
+
resolutionDiagnostics: initializeResolutionFieldForReadonlyCache(resultFromCache.resolutionDiagnostics, diagnostics)
|
|
39659
39638
|
};
|
|
39660
39639
|
}
|
|
39661
39640
|
}
|
|
@@ -39909,14 +39888,16 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
39909
39888
|
affectingLocations: initializeResolutionField(affectingLocations),
|
|
39910
39889
|
resolutionDiagnostics: initializeResolutionField(diagnostics)
|
|
39911
39890
|
};
|
|
39912
|
-
if (containingDirectory) {
|
|
39913
|
-
cache
|
|
39891
|
+
if (containingDirectory && cache && !cache.isReadonly) {
|
|
39892
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(
|
|
39914
39893
|
typeReferenceDirectiveName,
|
|
39894
|
+
/*mode*/
|
|
39915
39895
|
resolutionMode,
|
|
39916
|
-
containingDirectory,
|
|
39917
|
-
redirectedReference,
|
|
39918
39896
|
result
|
|
39919
39897
|
);
|
|
39898
|
+
if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
39899
|
+
cache.getOrCreateCacheForNonRelativeName(typeReferenceDirectiveName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
39900
|
+
}
|
|
39920
39901
|
}
|
|
39921
39902
|
if (traceEnabled) traceResult(result);
|
|
39922
39903
|
return result;
|
|
@@ -40102,9 +40083,6 @@ function compilerOptionValueToString(value) {
|
|
|
40102
40083
|
function getKeyForCompilerOptions(options, affectingOptionDeclarations) {
|
|
40103
40084
|
return affectingOptionDeclarations.map((option) => compilerOptionValueToString(getCompilerOptionValue(options, option))).join("|") + `|${options.pathsBasePath}`;
|
|
40104
40085
|
}
|
|
40105
|
-
function computeRedirectsCacheKey(options) {
|
|
40106
|
-
return getKeyForCompilerOptions(options, moduleResolutionOptionDeclarations);
|
|
40107
|
-
}
|
|
40108
40086
|
function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
|
|
40109
40087
|
const redirectsMap = /* @__PURE__ */ new Map();
|
|
40110
40088
|
const redirectsKeyToMap = /* @__PURE__ */ new Map();
|
|
@@ -40115,11 +40093,7 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
|
|
|
40115
40093
|
getOrCreateMapOfCacheRedirects,
|
|
40116
40094
|
update,
|
|
40117
40095
|
clear: clear2,
|
|
40118
|
-
|
|
40119
|
-
compact: compact2,
|
|
40120
|
-
getOwnMap: () => ownMap,
|
|
40121
|
-
getOwnOptions: () => ownOptions,
|
|
40122
|
-
redirectsKeyToMap
|
|
40096
|
+
getOwnMap: () => ownMap
|
|
40123
40097
|
};
|
|
40124
40098
|
function getMapOfCacheRedirects(redirectedReference) {
|
|
40125
40099
|
return redirectedReference ? getOrCreateMap(
|
|
@@ -40177,33 +40151,10 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
|
|
|
40177
40151
|
function getRedirectsCacheKey(options) {
|
|
40178
40152
|
let result = optionsToRedirectsKey.get(options);
|
|
40179
40153
|
if (!result) {
|
|
40180
|
-
optionsToRedirectsKey.set(options, result =
|
|
40154
|
+
optionsToRedirectsKey.set(options, result = getKeyForCompilerOptions(options, moduleResolutionOptionDeclarations));
|
|
40181
40155
|
}
|
|
40182
40156
|
return result;
|
|
40183
40157
|
}
|
|
40184
|
-
function forEach2(cb) {
|
|
40185
|
-
ownMap.forEach((value, key) => cb(
|
|
40186
|
-
value,
|
|
40187
|
-
key,
|
|
40188
|
-
/*redirectsCacheKey*/
|
|
40189
|
-
void 0,
|
|
40190
|
-
ownMap
|
|
40191
|
-
));
|
|
40192
|
-
redirectsKeyToMap.forEach((map2, redirectsCacheKey) => {
|
|
40193
|
-
if (map2 !== ownMap) map2.forEach((value, key) => cb(value, key, redirectsCacheKey, map2));
|
|
40194
|
-
});
|
|
40195
|
-
}
|
|
40196
|
-
function compact2(availableOptions) {
|
|
40197
|
-
const toDeleteRedirectsCacheKeys = new Set(redirectsKeyToMap.keys());
|
|
40198
|
-
optionsToRedirectsKey.forEach((key, options) => {
|
|
40199
|
-
if (options === ownOptions || availableOptions.has(options)) {
|
|
40200
|
-
toDeleteRedirectsCacheKeys.delete(key);
|
|
40201
|
-
} else {
|
|
40202
|
-
redirectsMap.delete(options);
|
|
40203
|
-
}
|
|
40204
|
-
});
|
|
40205
|
-
toDeleteRedirectsCacheKeys.forEach((key) => redirectsKeyToMap.delete(key));
|
|
40206
|
-
}
|
|
40207
40158
|
}
|
|
40208
40159
|
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
40209
40160
|
let cache;
|
|
@@ -40230,7 +40181,7 @@ function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create)
|
|
|
40230
40181
|
}
|
|
40231
40182
|
return result;
|
|
40232
40183
|
}
|
|
40233
|
-
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options, optionsToRedirectsKey
|
|
40184
|
+
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options, optionsToRedirectsKey) {
|
|
40234
40185
|
const directoryToModuleNameMap = createCacheWithRedirects(options, optionsToRedirectsKey);
|
|
40235
40186
|
return {
|
|
40236
40187
|
getFromDirectoryCache,
|
|
@@ -40252,7 +40203,7 @@ function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileNam
|
|
|
40252
40203
|
function getFromDirectoryCache(name, mode, directoryName, redirectedReference) {
|
|
40253
40204
|
var _a, _b;
|
|
40254
40205
|
const path = toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
40255
|
-
return
|
|
40206
|
+
return (_b = (_a = directoryToModuleNameMap.getMapOfCacheRedirects(redirectedReference)) == null ? void 0 : _a.get(path)) == null ? void 0 : _b.get(name, mode);
|
|
40256
40207
|
}
|
|
40257
40208
|
}
|
|
40258
40209
|
function createModeAwareCacheKey(specifier, mode) {
|
|
@@ -40279,7 +40230,7 @@ function createModeAwareCache() {
|
|
|
40279
40230
|
forEach(cb) {
|
|
40280
40231
|
return underlying.forEach((elem, key) => {
|
|
40281
40232
|
const [specifier, mode] = memoizedReverseKeys.get(key);
|
|
40282
|
-
return cb(elem, specifier, mode
|
|
40233
|
+
return cb(elem, specifier, mode);
|
|
40283
40234
|
});
|
|
40284
40235
|
},
|
|
40285
40236
|
size() {
|
|
@@ -40294,20 +40245,18 @@ function createModeAwareCache() {
|
|
|
40294
40245
|
}
|
|
40295
40246
|
}
|
|
40296
40247
|
function getOriginalOrResolvedModuleFileName(result) {
|
|
40297
|
-
|
|
40298
|
-
return resolvedModule && (resolvedModule.originalPath || resolvedModule.resolvedFileName);
|
|
40248
|
+
return result.resolvedModule && (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
40299
40249
|
}
|
|
40300
40250
|
function getOriginalOrResolvedTypeReferenceFileName(result) {
|
|
40301
40251
|
return result.resolvedTypeReferenceDirective && (result.resolvedTypeReferenceDirective.originalPath || result.resolvedTypeReferenceDirective.resolvedFileName);
|
|
40302
40252
|
}
|
|
40303
|
-
function createNonRelativeNameResolutionCache(currentDirectory, getCanonicalFileName, options, getResolvedFileName, optionsToRedirectsKey
|
|
40253
|
+
function createNonRelativeNameResolutionCache(currentDirectory, getCanonicalFileName, options, getResolvedFileName, optionsToRedirectsKey) {
|
|
40304
40254
|
const moduleNameToDirectoryMap = createCacheWithRedirects(options, optionsToRedirectsKey);
|
|
40305
40255
|
return {
|
|
40306
40256
|
getFromNonRelativeNameCache,
|
|
40307
40257
|
getOrCreateCacheForNonRelativeName,
|
|
40308
40258
|
clear: clear2,
|
|
40309
|
-
update
|
|
40310
|
-
moduleNameToDirectoryMap
|
|
40259
|
+
update
|
|
40311
40260
|
};
|
|
40312
40261
|
function clear2() {
|
|
40313
40262
|
moduleNameToDirectoryMap.clear();
|
|
@@ -40318,79 +40267,38 @@ function createNonRelativeNameResolutionCache(currentDirectory, getCanonicalFile
|
|
|
40318
40267
|
function getFromNonRelativeNameCache(nonRelativeModuleName, mode, directoryName, redirectedReference) {
|
|
40319
40268
|
var _a, _b;
|
|
40320
40269
|
Debug.assert(!isExternalModuleNameRelative(nonRelativeModuleName));
|
|
40321
|
-
return (_b = (_a = moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) == null ? void 0 : _a.get(
|
|
40322
|
-
createModeAwareCacheKey(nonRelativeModuleName, mode)
|
|
40323
|
-
)) == null ? void 0 : _b.get(directoryName);
|
|
40270
|
+
return (_b = (_a = moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) == null ? void 0 : _a.get(createModeAwareCacheKey(nonRelativeModuleName, mode))) == null ? void 0 : _b.get(directoryName);
|
|
40324
40271
|
}
|
|
40325
40272
|
function getOrCreateCacheForNonRelativeName(nonRelativeModuleName, mode, redirectedReference) {
|
|
40326
40273
|
Debug.assert(!isExternalModuleNameRelative(nonRelativeModuleName));
|
|
40327
|
-
return getOrCreateCache(
|
|
40328
|
-
moduleNameToDirectoryMap,
|
|
40329
|
-
redirectedReference,
|
|
40330
|
-
createModeAwareCacheKey(nonRelativeModuleName, mode),
|
|
40331
|
-
createPerModuleNameCache
|
|
40332
|
-
);
|
|
40274
|
+
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, createModeAwareCacheKey(nonRelativeModuleName, mode), createPerModuleNameCache);
|
|
40333
40275
|
}
|
|
40334
40276
|
function createPerModuleNameCache() {
|
|
40335
40277
|
const directoryPathMap = /* @__PURE__ */ new Map();
|
|
40336
|
-
return { get, set
|
|
40278
|
+
return { get, set };
|
|
40337
40279
|
function get(directory) {
|
|
40338
|
-
return
|
|
40280
|
+
return directoryPathMap.get(toPath(directory, currentDirectory, getCanonicalFileName));
|
|
40339
40281
|
}
|
|
40340
|
-
function
|
|
40341
|
-
const result = getValidResolution(directoryPathMap.get(directoryPath), forSet);
|
|
40342
|
-
return !result || result === primary ? void 0 : result;
|
|
40343
|
-
}
|
|
40344
|
-
function deleteByPath(directory) {
|
|
40345
|
-
const existing = directoryPathMap.get(directory);
|
|
40346
|
-
if (existing) {
|
|
40347
|
-
directoryPathMap.delete(directory);
|
|
40348
|
-
withCommonPrefix(
|
|
40349
|
-
directory,
|
|
40350
|
-
getCommonPrefix(directory, existing),
|
|
40351
|
-
(parent) => directoryPathMap.delete(parent)
|
|
40352
|
-
);
|
|
40353
|
-
}
|
|
40354
|
-
}
|
|
40355
|
-
function set(directory, result, primary) {
|
|
40282
|
+
function set(directory, result) {
|
|
40356
40283
|
const path = toPath(directory, currentDirectory, getCanonicalFileName);
|
|
40357
|
-
if (
|
|
40358
|
-
path,
|
|
40359
|
-
primary,
|
|
40360
|
-
/*forSet*/
|
|
40361
|
-
true
|
|
40362
|
-
)) {
|
|
40284
|
+
if (directoryPathMap.has(path)) {
|
|
40363
40285
|
return;
|
|
40364
40286
|
}
|
|
40365
|
-
if (!primary) deleteByPath(path);
|
|
40366
40287
|
directoryPathMap.set(path, result);
|
|
40367
|
-
|
|
40368
|
-
|
|
40369
|
-
getCommonPrefix(path, result),
|
|
40370
|
-
(parent) => directoryPathMap.set(parent, result),
|
|
40371
|
-
primary
|
|
40372
|
-
);
|
|
40373
|
-
}
|
|
40374
|
-
function withCommonPrefix(path, commonPrefix, action, primary) {
|
|
40288
|
+
const resolvedFileName = getResolvedFileName(result);
|
|
40289
|
+
const commonPrefix = resolvedFileName && getCommonPrefix(path, resolvedFileName);
|
|
40375
40290
|
let current = path;
|
|
40376
40291
|
while (current !== commonPrefix) {
|
|
40377
40292
|
const parent = getDirectoryPath(current);
|
|
40378
|
-
if (parent === current ||
|
|
40379
|
-
parent,
|
|
40380
|
-
primary,
|
|
40381
|
-
/*forSet*/
|
|
40382
|
-
true
|
|
40383
|
-
)) {
|
|
40293
|
+
if (parent === current || directoryPathMap.has(parent)) {
|
|
40384
40294
|
break;
|
|
40385
40295
|
}
|
|
40386
|
-
|
|
40296
|
+
directoryPathMap.set(parent, result);
|
|
40387
40297
|
current = parent;
|
|
40388
40298
|
}
|
|
40389
40299
|
}
|
|
40390
40300
|
function getCommonPrefix(directory, resolution) {
|
|
40391
|
-
const
|
|
40392
|
-
if (!resolvedFileName) return void 0;
|
|
40393
|
-
const resolutionDirectory = toPath(getDirectoryPath(resolvedFileName), currentDirectory, getCanonicalFileName);
|
|
40301
|
+
const resolutionDirectory = toPath(getDirectoryPath(resolution), currentDirectory, getCanonicalFileName);
|
|
40394
40302
|
let i = 0;
|
|
40395
40303
|
const limit = Math.min(directory.length, resolutionDirectory.length);
|
|
40396
40304
|
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
@@ -40411,130 +40319,69 @@ function createNonRelativeNameResolutionCache(currentDirectory, getCanonicalFile
|
|
|
40411
40319
|
}
|
|
40412
40320
|
}
|
|
40413
40321
|
}
|
|
40414
|
-
function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, getResolvedFileName, optionsToRedirectsKey
|
|
40322
|
+
function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, getResolvedFileName, optionsToRedirectsKey) {
|
|
40415
40323
|
optionsToRedirectsKey ?? (optionsToRedirectsKey = /* @__PURE__ */ new Map());
|
|
40416
|
-
getValidResolution ?? (getValidResolution = identity);
|
|
40417
40324
|
const perDirectoryResolutionCache = createPerDirectoryResolutionCache(
|
|
40418
40325
|
currentDirectory,
|
|
40419
40326
|
getCanonicalFileName,
|
|
40420
40327
|
options,
|
|
40421
|
-
optionsToRedirectsKey
|
|
40422
|
-
getValidResolution
|
|
40328
|
+
optionsToRedirectsKey
|
|
40423
40329
|
);
|
|
40424
40330
|
const nonRelativeNameResolutionCache = createNonRelativeNameResolutionCache(
|
|
40425
40331
|
currentDirectory,
|
|
40426
40332
|
getCanonicalFileName,
|
|
40427
40333
|
options,
|
|
40428
40334
|
getResolvedFileName,
|
|
40429
|
-
optionsToRedirectsKey
|
|
40430
|
-
getValidResolution
|
|
40335
|
+
optionsToRedirectsKey
|
|
40431
40336
|
);
|
|
40432
40337
|
packageJsonInfoCache ?? (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
|
|
40433
|
-
|
|
40338
|
+
return {
|
|
40434
40339
|
...packageJsonInfoCache,
|
|
40435
40340
|
...perDirectoryResolutionCache,
|
|
40436
40341
|
...nonRelativeNameResolutionCache,
|
|
40437
40342
|
clear: clear2,
|
|
40438
40343
|
update,
|
|
40439
|
-
gc,
|
|
40440
|
-
compact: compact2,
|
|
40441
|
-
setPerDirectoryAndNonRelativeNameCacheResult,
|
|
40442
|
-
options: () => options,
|
|
40443
40344
|
getPackageJsonInfoCache: () => packageJsonInfoCache,
|
|
40444
|
-
|
|
40445
|
-
|
|
40345
|
+
clearAllExceptPackageJsonInfoCache,
|
|
40346
|
+
optionsToRedirectsKey
|
|
40446
40347
|
};
|
|
40447
|
-
return cache;
|
|
40448
40348
|
function clear2() {
|
|
40449
|
-
|
|
40450
|
-
nonRelativeNameResolutionCache.clear();
|
|
40349
|
+
clearAllExceptPackageJsonInfoCache();
|
|
40451
40350
|
packageJsonInfoCache.clear();
|
|
40452
40351
|
}
|
|
40453
|
-
function
|
|
40454
|
-
|
|
40455
|
-
|
|
40456
|
-
nonRelativeNameResolutionCache.update(updatedOptions);
|
|
40457
|
-
}
|
|
40458
|
-
function gc(setOrMapToCheckPresence) {
|
|
40459
|
-
perDirectoryResolutionCache.directoryToModuleNameMap.forEach((resolutions, dir, redirectsCacheKey, directoryToModuleNameMap) => {
|
|
40460
|
-
resolutions.forEach((resolution, name, mode, key) => {
|
|
40461
|
-
if (setOrMapToCheckPresence.has(resolution)) return;
|
|
40462
|
-
resolutions.delete(name, mode);
|
|
40463
|
-
if (!isExternalModuleNameRelative(name)) {
|
|
40464
|
-
const moduleNameToDirectoryMap = !redirectsCacheKey ? nonRelativeNameResolutionCache.moduleNameToDirectoryMap.getOwnMap() : nonRelativeNameResolutionCache.moduleNameToDirectoryMap.redirectsKeyToMap.get(redirectsCacheKey);
|
|
40465
|
-
const directoryMap = moduleNameToDirectoryMap == null ? void 0 : moduleNameToDirectoryMap.get(key);
|
|
40466
|
-
directoryMap == null ? void 0 : directoryMap.deleteByPath(dir);
|
|
40467
|
-
if (!(directoryMap == null ? void 0 : directoryMap.directoryPathMap.size)) moduleNameToDirectoryMap.delete(key);
|
|
40468
|
-
}
|
|
40469
|
-
});
|
|
40470
|
-
if (!resolutions.size()) directoryToModuleNameMap.delete(dir);
|
|
40471
|
-
});
|
|
40472
|
-
}
|
|
40473
|
-
function compact2(availableOptions = new Set(optionsToRedirectsKey.keys()), skipOptionsToRedirectsKeyCleanup) {
|
|
40474
|
-
perDirectoryResolutionCache.directoryToModuleNameMap.compact(availableOptions);
|
|
40475
|
-
nonRelativeNameResolutionCache.moduleNameToDirectoryMap.compact(availableOptions);
|
|
40476
|
-
if (!skipOptionsToRedirectsKeyCleanup) {
|
|
40477
|
-
optionsToRedirectsKey.forEach(
|
|
40478
|
-
(_redirectsKey, options2) => {
|
|
40479
|
-
if (!availableOptions.has(options2)) optionsToRedirectsKey.delete(options2);
|
|
40480
|
-
}
|
|
40481
|
-
);
|
|
40482
|
-
}
|
|
40483
|
-
}
|
|
40484
|
-
function setPerDirectoryAndNonRelativeNameCacheResult(name, mode, directoryName, redirectedReference, result, primary) {
|
|
40485
|
-
if (cache.isReadonly) return;
|
|
40486
|
-
cache.getOrCreateCacheForDirectory(directoryName, redirectedReference).set(name, mode, result);
|
|
40487
|
-
if (!isExternalModuleNameRelative(name)) {
|
|
40488
|
-
cache.getOrCreateCacheForNonRelativeName(name, mode, redirectedReference).set(directoryName, result, primary);
|
|
40489
|
-
}
|
|
40352
|
+
function clearAllExceptPackageJsonInfoCache() {
|
|
40353
|
+
perDirectoryResolutionCache.clear();
|
|
40354
|
+
nonRelativeNameResolutionCache.clear();
|
|
40490
40355
|
}
|
|
40491
|
-
function
|
|
40492
|
-
|
|
40493
|
-
|
|
40494
|
-
if (!redirectsCacheKey) console.log(" OwnMap");
|
|
40495
|
-
else console.log(` redirectsCacheKey:: ${redirectsCacheKey}`);
|
|
40496
|
-
console.log(` directoryPath:: ${directoryPath}`);
|
|
40497
|
-
moduleNameMap.forEach((value, key, mode) => {
|
|
40498
|
-
console.log(` ${key} ${mode} ${JSON.stringify(value, void 0, " ")}`);
|
|
40499
|
-
});
|
|
40500
|
-
});
|
|
40501
|
-
console.log(`moduleNameToDirectoryMap::`);
|
|
40502
|
-
nonRelativeNameResolutionCache.moduleNameToDirectoryMap.forEach((perNonRelativeNameCache, key, redirectsCacheKey) => {
|
|
40503
|
-
if (!redirectsCacheKey) console.log(" OwnMap");
|
|
40504
|
-
else console.log(` redirectsCacheKey:: ${redirectsCacheKey}`);
|
|
40505
|
-
console.log(` modeAwareCacheKey:: ${key}`);
|
|
40506
|
-
perNonRelativeNameCache.directoryPathMap.forEach((value, key2) => {
|
|
40507
|
-
console.log(` ${key2} ${JSON.stringify(value, void 0, " ")}`);
|
|
40508
|
-
});
|
|
40509
|
-
});
|
|
40356
|
+
function update(options2) {
|
|
40357
|
+
perDirectoryResolutionCache.update(options2);
|
|
40358
|
+
nonRelativeNameResolutionCache.update(options2);
|
|
40510
40359
|
}
|
|
40511
40360
|
}
|
|
40512
|
-
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, optionsToRedirectsKey
|
|
40361
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, optionsToRedirectsKey) {
|
|
40513
40362
|
const result = createModuleOrTypeReferenceResolutionCache(
|
|
40514
40363
|
currentDirectory,
|
|
40515
40364
|
getCanonicalFileName,
|
|
40516
40365
|
options,
|
|
40517
40366
|
packageJsonInfoCache,
|
|
40518
40367
|
getOriginalOrResolvedModuleFileName,
|
|
40519
|
-
optionsToRedirectsKey
|
|
40520
|
-
getValidResolution
|
|
40368
|
+
optionsToRedirectsKey
|
|
40521
40369
|
);
|
|
40522
40370
|
result.getOrCreateCacheForModuleName = (nonRelativeName, mode, redirectedReference) => result.getOrCreateCacheForNonRelativeName(nonRelativeName, mode, redirectedReference);
|
|
40523
40371
|
return result;
|
|
40524
40372
|
}
|
|
40525
|
-
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, optionsToRedirectsKey
|
|
40373
|
+
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, optionsToRedirectsKey) {
|
|
40526
40374
|
return createModuleOrTypeReferenceResolutionCache(
|
|
40527
40375
|
currentDirectory,
|
|
40528
40376
|
getCanonicalFileName,
|
|
40529
40377
|
options,
|
|
40530
40378
|
packageJsonInfoCache,
|
|
40531
40379
|
getOriginalOrResolvedTypeReferenceFileName,
|
|
40532
|
-
optionsToRedirectsKey
|
|
40533
|
-
getValidResolution
|
|
40380
|
+
optionsToRedirectsKey
|
|
40534
40381
|
);
|
|
40535
40382
|
}
|
|
40536
40383
|
function getOptionsForLibraryResolution(options) {
|
|
40537
|
-
return { moduleResolution: 2 /* Node10 */, traceResolution: options
|
|
40384
|
+
return { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution };
|
|
40538
40385
|
}
|
|
40539
40386
|
function resolveLibrary(libraryName, resolveFrom, compilerOptions, host, cache) {
|
|
40540
40387
|
return resolveModuleName(libraryName, resolveFrom, getOptionsForLibraryResolution(compilerOptions), host, cache);
|
|
@@ -40587,13 +40434,12 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
40587
40434
|
default:
|
|
40588
40435
|
return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`);
|
|
40589
40436
|
}
|
|
40590
|
-
cache
|
|
40591
|
-
moduleName,
|
|
40592
|
-
|
|
40593
|
-
|
|
40594
|
-
|
|
40595
|
-
|
|
40596
|
-
);
|
|
40437
|
+
if (cache && !cache.isReadonly) {
|
|
40438
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
40439
|
+
if (!isExternalModuleNameRelative(moduleName)) {
|
|
40440
|
+
cache.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
40441
|
+
}
|
|
40442
|
+
}
|
|
40597
40443
|
}
|
|
40598
40444
|
if (traceEnabled) {
|
|
40599
40445
|
if (result.resolvedModule) {
|
|
@@ -40872,7 +40718,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
40872
40718
|
result = tryResolve(extensions, state);
|
|
40873
40719
|
}
|
|
40874
40720
|
let alternateResult;
|
|
40875
|
-
if (
|
|
40721
|
+
if (state.resolvedPackageDirectory && !isConfigLookup && !isExternalModuleNameRelative(moduleName)) {
|
|
40876
40722
|
const wantedTypesButGotJs = (result == null ? void 0 : result.value) && extensions & (1 /* TypeScript */ | 4 /* Declaration */) && !extensionIsOk(1 /* TypeScript */ | 4 /* Declaration */, result.value.resolved.extension);
|
|
40877
40723
|
if (((_a = result == null ? void 0 : result.value) == null ? void 0 : _a.isExternalLibraryImport) && wantedTypesButGotJs && features & 8 /* Exports */ && (conditions == null ? void 0 : conditions.includes("import"))) {
|
|
40878
40724
|
traceIfEnabled(state, Diagnostics.Resolution_of_non_relative_name_failed_trying_with_modern_Node_resolution_features_disabled_to_see_if_npm_library_needs_configuration_update);
|
|
@@ -45616,10 +45462,10 @@ function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
|
|
|
45616
45462
|
);
|
|
45617
45463
|
}
|
|
45618
45464
|
function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
|
|
45619
|
-
var _a;
|
|
45465
|
+
var _a, _b;
|
|
45620
45466
|
const getCanonicalFileName = hostGetCanonicalFileName(host);
|
|
45621
45467
|
const cwd = host.getCurrentDirectory();
|
|
45622
|
-
const referenceRedirect = host.isSourceOfProjectReferenceRedirect(importedFileName) ? host.
|
|
45468
|
+
const referenceRedirect = host.isSourceOfProjectReferenceRedirect(importedFileName) ? (_a = host.getRedirectFromSourceFile(importedFileName)) == null ? void 0 : _a.outputDts : void 0;
|
|
45623
45469
|
const importedPath = toPath(importedFileName, cwd, getCanonicalFileName);
|
|
45624
45470
|
const redirects = host.redirectTargetsMap.get(importedPath) || emptyArray;
|
|
45625
45471
|
const importedFileNames = [...referenceRedirect ? [referenceRedirect] : emptyArray, importedFileName, ...redirects];
|
|
@@ -45629,7 +45475,7 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
|
|
|
45629
45475
|
const result2 = forEach(targets, (p) => !(shouldFilterIgnoredPaths && containsIgnoredPath(p)) && cb(p, referenceRedirect === p));
|
|
45630
45476
|
if (result2) return result2;
|
|
45631
45477
|
}
|
|
45632
|
-
const symlinkedDirectories = (
|
|
45478
|
+
const symlinkedDirectories = (_b = host.getSymlinkCache) == null ? void 0 : _b.call(host).getSymlinkedDirectoriesByRealpath();
|
|
45633
45479
|
const fullImportedFileName = getNormalizedAbsolutePath(importedFileName, cwd);
|
|
45634
45480
|
const result = symlinkedDirectories && forEachAncestorDirectoryStoppingAtGlobalCache(
|
|
45635
45481
|
host,
|
|
@@ -49376,7 +49222,7 @@ function createTypeChecker(host) {
|
|
|
49376
49222
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
|
|
49377
49223
|
}
|
|
49378
49224
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
49379
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
49225
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
49380
49226
|
if (errorNode && startsWith(moduleReference, "@types/")) {
|
|
49381
49227
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
49382
49228
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -49435,7 +49281,7 @@ function createTypeChecker(host) {
|
|
|
49435
49281
|
getAnyExtensionFromPath(moduleReference)
|
|
49436
49282
|
);
|
|
49437
49283
|
} else if (resolvedModule.resolvedUsingTsExtension && shouldRewrite) {
|
|
49438
|
-
const redirect = host.
|
|
49284
|
+
const redirect = (_i = host.getRedirectFromSourceFile(sourceFile.path)) == null ? void 0 : _i.resolvedRef;
|
|
49439
49285
|
if (redirect) {
|
|
49440
49286
|
const ignoreCase = !host.useCaseSensitiveFileNames();
|
|
49441
49287
|
const ownRootDir = host.getCommonSourceDirectory();
|
|
@@ -49475,7 +49321,7 @@ function createTypeChecker(host) {
|
|
|
49475
49321
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
49476
49322
|
diagnosticDetails = createModeMismatchDetails(currentSourceFile);
|
|
49477
49323
|
}
|
|
49478
|
-
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((
|
|
49324
|
+
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((_j = overrideHost.importClause) == null ? void 0 : _j.isTypeOnly) ? Diagnostics.Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : (overrideHost == null ? void 0 : overrideHost.kind) === 205 /* ImportType */ ? Diagnostics.Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead;
|
|
49479
49325
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
49480
49326
|
getSourceFileOfNode(errorNode),
|
|
49481
49327
|
errorNode,
|
|
@@ -49523,9 +49369,9 @@ function createTypeChecker(host) {
|
|
|
49523
49369
|
}
|
|
49524
49370
|
if (moduleNotFoundError) {
|
|
49525
49371
|
if (resolvedModule) {
|
|
49526
|
-
const redirect = host.
|
|
49527
|
-
if (redirect) {
|
|
49528
|
-
error(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, resolvedModule.resolvedFileName);
|
|
49372
|
+
const redirect = host.getRedirectFromSourceFile(resolvedModule.resolvedFileName);
|
|
49373
|
+
if (redirect == null ? void 0 : redirect.outputDts) {
|
|
49374
|
+
error(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect.outputDts, resolvedModule.resolvedFileName);
|
|
49529
49375
|
return void 0;
|
|
49530
49376
|
}
|
|
49531
49377
|
}
|
|
@@ -49538,14 +49384,14 @@ function createTypeChecker(host) {
|
|
|
49538
49384
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
49539
49385
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
49540
49386
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
49541
|
-
const suggestedExt = (
|
|
49387
|
+
const suggestedExt = (_k = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _k[1];
|
|
49542
49388
|
if (suggestedExt) {
|
|
49543
49389
|
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
49544
49390
|
} else {
|
|
49545
49391
|
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
49546
49392
|
}
|
|
49547
49393
|
} else {
|
|
49548
|
-
if ((
|
|
49394
|
+
if ((_l = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _l.alternateResult) {
|
|
49549
49395
|
const errorInfo = createModuleNotFoundChain(currentSourceFile, host, moduleReference, mode, moduleReference);
|
|
49550
49396
|
errorOrSuggestion(
|
|
49551
49397
|
/*isError*/
|
|
@@ -90148,7 +89994,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
90148
89994
|
},
|
|
90149
89995
|
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
|
90150
89996
|
redirectTargetsMap: host.redirectTargetsMap,
|
|
90151
|
-
|
|
89997
|
+
getRedirectFromSourceFile: (fileName) => host.getRedirectFromSourceFile(fileName),
|
|
90152
89998
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
90153
89999
|
fileExists: (fileName) => host.fileExists(fileName),
|
|
90154
90000
|
getFileIncludeReasons: () => host.getFileIncludeReasons(),
|
|
@@ -121647,10 +121493,6 @@ function loadWithModeAwareCache(entries, containingFile, redirectedReference, op
|
|
|
121647
121493
|
return resolutions;
|
|
121648
121494
|
}
|
|
121649
121495
|
var inferredTypesContainingFile = "__inferred type names__.ts";
|
|
121650
|
-
function getAutomaticTypeDirectiveContainingFile(options, currentDirectory) {
|
|
121651
|
-
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
121652
|
-
return combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
121653
|
-
}
|
|
121654
121496
|
function getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName) {
|
|
121655
121497
|
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
121656
121498
|
return combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
@@ -121879,7 +121721,7 @@ function createCreateProgramOptions(rootNames, options, host, oldProgram, config
|
|
|
121879
121721
|
};
|
|
121880
121722
|
}
|
|
121881
121723
|
function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
121882
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p
|
|
121724
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
121883
121725
|
let _createProgramOptions = isArray(_rootNamesOrOptions) ? createCreateProgramOptions(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : _rootNamesOrOptions;
|
|
121884
121726
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2, host: createProgramOptionsHost } = _createProgramOptions;
|
|
121885
121727
|
let { oldProgram } = _createProgramOptions;
|
|
@@ -122018,8 +121860,8 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122018
121860
|
const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
|
|
122019
121861
|
let resolvedProjectReferences;
|
|
122020
121862
|
let projectReferenceRedirects;
|
|
122021
|
-
let
|
|
122022
|
-
let
|
|
121863
|
+
let mapSourceFileToResolvedRef;
|
|
121864
|
+
let mapOutputFileToResolvedRef;
|
|
122023
121865
|
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
|
|
122024
121866
|
const { onProgramCreateComplete, fileExists, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
122025
121867
|
compilerHost: host,
|
|
@@ -122027,7 +121869,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122027
121869
|
useSourceOfProjectReferenceRedirect,
|
|
122028
121870
|
toPath: toPath3,
|
|
122029
121871
|
getResolvedProjectReferences,
|
|
122030
|
-
|
|
121872
|
+
getRedirectFromOutput,
|
|
122031
121873
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
122032
121874
|
});
|
|
122033
121875
|
const readFile = host.readFile.bind(host);
|
|
@@ -122084,10 +121926,9 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122084
121926
|
automaticTypeDirectiveResolutions = createModeAwareCache();
|
|
122085
121927
|
if (automaticTypeDirectiveNames.length) {
|
|
122086
121928
|
(_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
122087
|
-
const
|
|
122088
|
-
|
|
122089
|
-
|
|
122090
|
-
);
|
|
121929
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
121930
|
+
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
121931
|
+
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
|
|
122091
121932
|
for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
122092
121933
|
automaticTypeDirectiveResolutions.set(
|
|
122093
121934
|
automaticTypeDirectiveNames[i],
|
|
@@ -122108,17 +121949,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122108
121949
|
);
|
|
122109
121950
|
}
|
|
122110
121951
|
(_n = tracing) == null ? void 0 : _n.pop();
|
|
122111
|
-
} else {
|
|
122112
|
-
(_o = host.onReusedTypeReferenceDirectiveResolutions) == null ? void 0 : _o.call(
|
|
122113
|
-
host,
|
|
122114
|
-
/*reusedNames*/
|
|
122115
|
-
void 0,
|
|
122116
|
-
/*containingSourceFile*/
|
|
122117
|
-
void 0,
|
|
122118
|
-
/*redirectedReference*/
|
|
122119
|
-
void 0,
|
|
122120
|
-
options
|
|
122121
|
-
);
|
|
122122
121952
|
}
|
|
122123
121953
|
if (rootNames.length && !skipDefaultLib) {
|
|
122124
121954
|
const defaultLibraryFileName = getDefaultLibraryFileName();
|
|
@@ -122249,12 +122079,10 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122249
122079
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
|
|
122250
122080
|
getProjectReferences,
|
|
122251
122081
|
getResolvedProjectReferences,
|
|
122252
|
-
|
|
122253
|
-
getResolvedProjectReferenceToRedirect,
|
|
122082
|
+
getRedirectFromSourceFile,
|
|
122254
122083
|
getResolvedProjectReferenceByPath,
|
|
122255
122084
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
122256
122085
|
isSourceOfProjectReferenceRedirect,
|
|
122257
|
-
getRedirectReferenceForResolution,
|
|
122258
122086
|
getRedirectReferenceForResolutionFromSourceOfProject,
|
|
122259
122087
|
getCompilerOptionsForFile,
|
|
122260
122088
|
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
@@ -122266,7 +122094,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122266
122094
|
readFile,
|
|
122267
122095
|
directoryExists,
|
|
122268
122096
|
getSymlinkCache,
|
|
122269
|
-
realpath: (
|
|
122097
|
+
realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
|
|
122270
122098
|
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
|
122271
122099
|
getCanonicalFileName,
|
|
122272
122100
|
getFileIncludeReasons: () => programDiagnostics.getFileReasons(),
|
|
@@ -122280,7 +122108,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122280
122108
|
}
|
|
122281
122109
|
mark("afterProgram");
|
|
122282
122110
|
measure("Program", "beforeProgram", "afterProgram");
|
|
122283
|
-
(
|
|
122111
|
+
(_p = tracing) == null ? void 0 : _p.pop();
|
|
122284
122112
|
return program;
|
|
122285
122113
|
function getResolvedModule(file, moduleName, mode) {
|
|
122286
122114
|
var _a2;
|
|
@@ -122384,8 +122212,8 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122384
122212
|
return result;
|
|
122385
122213
|
}
|
|
122386
122214
|
function getRedirectReferenceForResolution(file) {
|
|
122387
|
-
const redirect =
|
|
122388
|
-
if (redirect || !isDeclarationFileName(file.originalFileName)) return redirect;
|
|
122215
|
+
const redirect = getRedirectFromSourceFile(file.originalFileName);
|
|
122216
|
+
if (redirect || !isDeclarationFileName(file.originalFileName)) return redirect == null ? void 0 : redirect.resolvedRef;
|
|
122389
122217
|
const resultFromDts = getRedirectReferenceForResolutionFromSourceOfProject(file.path);
|
|
122390
122218
|
if (resultFromDts) return resultFromDts;
|
|
122391
122219
|
if (!host.realpath || !options.preserveSymlinks || !file.originalFileName.includes(nodeModulesPathPart)) return void 0;
|
|
@@ -122393,14 +122221,8 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122393
122221
|
return realDeclarationPath === file.path ? void 0 : getRedirectReferenceForResolutionFromSourceOfProject(realDeclarationPath);
|
|
122394
122222
|
}
|
|
122395
122223
|
function getRedirectReferenceForResolutionFromSourceOfProject(filePath) {
|
|
122396
|
-
|
|
122397
|
-
|
|
122398
|
-
if (!source) return void 0;
|
|
122399
|
-
return forEachResolvedProjectReference2((resolvedRef) => {
|
|
122400
|
-
const out = resolvedRef.commandLine.options.outFile;
|
|
122401
|
-
if (!out) return void 0;
|
|
122402
|
-
return toPath3(out) === filePath ? resolvedRef : void 0;
|
|
122403
|
-
});
|
|
122224
|
+
var _a2;
|
|
122225
|
+
return (_a2 = getRedirectFromOutput(filePath)) == null ? void 0 : _a2.resolvedRef;
|
|
122404
122226
|
}
|
|
122405
122227
|
function compareDefaultLibFiles(a, b) {
|
|
122406
122228
|
return compareValues(getDefaultLibFilePriority(a), getDefaultLibFilePriority(b));
|
|
@@ -122458,7 +122280,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122458
122280
|
redirectedReference: getRedirectReferenceForResolution(containingFile),
|
|
122459
122281
|
nameAndModeGetter: moduleResolutionNameAndModeGetter,
|
|
122460
122282
|
resolutionWorker: resolveModuleNamesWorker,
|
|
122461
|
-
onReusedResolutions: maybeBind(host, host.onReusedModuleResolutions),
|
|
122462
122283
|
getResolutionFromOldProgram: (name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedModule(containingFile, name, mode),
|
|
122463
122284
|
getResolved: getResolvedModuleFromResolution,
|
|
122464
122285
|
canReuseResolutionsInFile: () => containingFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingFile.fileName)) && !hasInvalidatedResolutions(containingFile.path),
|
|
@@ -122474,7 +122295,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122474
122295
|
redirectedReference: containingSourceFile && getRedirectReferenceForResolution(containingSourceFile),
|
|
122475
122296
|
nameAndModeGetter: typeReferenceResolutionNameAndModeGetter,
|
|
122476
122297
|
resolutionWorker: resolveTypeReferenceDirectiveNamesWorker,
|
|
122477
|
-
onReusedResolutions: maybeBind(host, host.onReusedTypeReferenceDirectiveResolutions),
|
|
122478
122298
|
getResolutionFromOldProgram: (name, mode) => {
|
|
122479
122299
|
var _a2;
|
|
122480
122300
|
return containingSourceFile ? oldProgram == null ? void 0 : oldProgram.getResolvedTypeReferenceDirective(containingSourceFile, name, mode) : (_a2 = oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a2.get(name, mode);
|
|
@@ -122490,21 +122310,12 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122490
122310
|
redirectedReference,
|
|
122491
122311
|
nameAndModeGetter,
|
|
122492
122312
|
resolutionWorker,
|
|
122493
|
-
onReusedResolutions,
|
|
122494
122313
|
getResolutionFromOldProgram,
|
|
122495
122314
|
getResolved,
|
|
122496
122315
|
canReuseResolutionsInFile,
|
|
122497
122316
|
resolveToOwnAmbientModule
|
|
122498
122317
|
}) {
|
|
122499
|
-
if (!entries.length)
|
|
122500
|
-
onReusedResolutions == null ? void 0 : onReusedResolutions(
|
|
122501
|
-
entries,
|
|
122502
|
-
containingSourceFile,
|
|
122503
|
-
redirectedReference,
|
|
122504
|
-
options
|
|
122505
|
-
);
|
|
122506
|
-
return emptyArray;
|
|
122507
|
-
}
|
|
122318
|
+
if (!entries.length) return emptyArray;
|
|
122508
122319
|
if (structureIsReused === 0 /* Not */ && (!resolveToOwnAmbientModule || !containingSourceFile.ambientModuleNames.length)) {
|
|
122509
122320
|
return resolutionWorker(
|
|
122510
122321
|
entries,
|
|
@@ -122559,20 +122370,8 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122559
122370
|
(unknownEntries ?? (unknownEntries = [])).push(entry);
|
|
122560
122371
|
(unknownEntryIndices ?? (unknownEntryIndices = [])).push(i);
|
|
122561
122372
|
}
|
|
122562
|
-
if (!unknownEntries)
|
|
122563
|
-
|
|
122564
|
-
reusedNames,
|
|
122565
|
-
containingSourceFile,
|
|
122566
|
-
redirectedReference,
|
|
122567
|
-
options
|
|
122568
|
-
);
|
|
122569
|
-
return result;
|
|
122570
|
-
}
|
|
122571
|
-
const resolutions = resolutionWorker(
|
|
122572
|
-
unknownEntries,
|
|
122573
|
-
containingFile,
|
|
122574
|
-
reusedNames
|
|
122575
|
-
);
|
|
122373
|
+
if (!unknownEntries) return result;
|
|
122374
|
+
const resolutions = resolutionWorker(unknownEntries, containingFile, reusedNames);
|
|
122576
122375
|
if (!result) return resolutions;
|
|
122577
122376
|
resolutions.forEach((resolution, index) => result[unknownEntryIndices[index]] = resolution);
|
|
122578
122377
|
return result;
|
|
@@ -122795,8 +122594,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122795
122594
|
getSourceFileByPath: program.getSourceFileByPath,
|
|
122796
122595
|
getSourceFiles: program.getSourceFiles,
|
|
122797
122596
|
isSourceFileFromExternalLibrary,
|
|
122798
|
-
|
|
122799
|
-
getProjectReferenceRedirect,
|
|
122597
|
+
getRedirectFromSourceFile,
|
|
122800
122598
|
isSourceOfProjectReferenceRedirect,
|
|
122801
122599
|
getSymlinkCache,
|
|
122802
122600
|
writeFile: writeFileCallback || writeFile2,
|
|
@@ -123511,9 +123309,9 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123511
123309
|
const sourceFile = getSourceFile2(fileName);
|
|
123512
123310
|
if (fail) {
|
|
123513
123311
|
if (!sourceFile) {
|
|
123514
|
-
const redirect =
|
|
123515
|
-
if (redirect) {
|
|
123516
|
-
fail(Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, fileName);
|
|
123312
|
+
const redirect = getRedirectFromSourceFile(fileName);
|
|
123313
|
+
if (redirect == null ? void 0 : redirect.outputDts) {
|
|
123314
|
+
fail(Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect.outputDts, fileName);
|
|
123517
123315
|
} else {
|
|
123518
123316
|
fail(Diagnostics.File_0_not_found, fileName);
|
|
123519
123317
|
}
|
|
@@ -123599,16 +123397,16 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123599
123397
|
return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode };
|
|
123600
123398
|
}
|
|
123601
123399
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
123602
|
-
var _a2, _b2;
|
|
123400
|
+
var _a2, _b2, _c2, _d2;
|
|
123603
123401
|
const path = toPath3(fileName);
|
|
123604
123402
|
if (useSourceOfProjectReferenceRedirect) {
|
|
123605
|
-
let source =
|
|
123403
|
+
let source = (_a2 = getRedirectFromOutput(path)) == null ? void 0 : _a2.source;
|
|
123606
123404
|
if (!source && host.realpath && options.preserveSymlinks && isDeclarationFileName(fileName) && fileName.includes(nodeModulesPathPart)) {
|
|
123607
123405
|
const realPath2 = toPath3(host.realpath(fileName));
|
|
123608
|
-
if (realPath2 !== path) source =
|
|
123406
|
+
if (realPath2 !== path) source = (_b2 = getRedirectFromOutput(realPath2)) == null ? void 0 : _b2.source;
|
|
123609
123407
|
}
|
|
123610
123408
|
if (source) {
|
|
123611
|
-
const file2 =
|
|
123409
|
+
const file2 = findSourceFile(source, isDefaultLib, ignoreNoDefaultLib, reason, packageId);
|
|
123612
123410
|
if (file2) addFileToFilesByName(
|
|
123613
123411
|
file2,
|
|
123614
123412
|
path,
|
|
@@ -123632,7 +123430,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123632
123430
|
const checkedName = file2.fileName;
|
|
123633
123431
|
const isRedirect = toPath3(checkedName) !== toPath3(fileName);
|
|
123634
123432
|
if (isRedirect) {
|
|
123635
|
-
fileName =
|
|
123433
|
+
fileName = ((_c2 = getRedirectFromSourceFile(fileName)) == null ? void 0 : _c2.outputDts) || fileName;
|
|
123636
123434
|
}
|
|
123637
123435
|
const checkedAbsolutePath = getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory);
|
|
123638
123436
|
const inputAbsolutePath = getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory);
|
|
@@ -123661,14 +123459,13 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123661
123459
|
}
|
|
123662
123460
|
let redirectedPath;
|
|
123663
123461
|
if (!useSourceOfProjectReferenceRedirect) {
|
|
123664
|
-
const redirectProject =
|
|
123665
|
-
if (redirectProject) {
|
|
123666
|
-
if (redirectProject.commandLine.options.outFile) {
|
|
123462
|
+
const redirectProject = getRedirectFromSourceFile(fileName);
|
|
123463
|
+
if (redirectProject == null ? void 0 : redirectProject.outputDts) {
|
|
123464
|
+
if (redirectProject.resolvedRef.commandLine.options.outFile) {
|
|
123667
123465
|
return void 0;
|
|
123668
123466
|
}
|
|
123669
|
-
|
|
123670
|
-
|
|
123671
|
-
redirectedPath = toPath3(redirect);
|
|
123467
|
+
fileName = redirectProject.outputDts;
|
|
123468
|
+
redirectedPath = toPath3(redirectProject.outputDts);
|
|
123672
123469
|
}
|
|
123673
123470
|
}
|
|
123674
123471
|
const sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options);
|
|
@@ -123712,7 +123509,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123712
123509
|
file.path = path;
|
|
123713
123510
|
file.resolvedPath = toPath3(fileName);
|
|
123714
123511
|
file.originalFileName = originalFileName;
|
|
123715
|
-
file.packageJsonLocations = ((
|
|
123512
|
+
file.packageJsonLocations = ((_d2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _d2.length) ? sourceFileOptions.packageJsonLocations : void 0;
|
|
123716
123513
|
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
123717
123514
|
addFileIncludeReason(
|
|
123718
123515
|
file,
|
|
@@ -123744,8 +123541,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123744
123541
|
processingOtherFiles.push(file);
|
|
123745
123542
|
}
|
|
123746
123543
|
(filesWithReferencesProcessed ?? (filesWithReferencesProcessed = /* @__PURE__ */ new Set())).add(file.path);
|
|
123747
|
-
} else {
|
|
123748
|
-
(_b2 = host.onSourceFileNotCreated) == null ? void 0 : _b2.call(host, sourceFileOptions);
|
|
123749
123544
|
}
|
|
123750
123545
|
return file;
|
|
123751
123546
|
}
|
|
@@ -123769,59 +123564,17 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123769
123564
|
if (file !== void 0) missingFileNames.delete(path);
|
|
123770
123565
|
else missingFileNames.set(path, fileName);
|
|
123771
123566
|
}
|
|
123772
|
-
function
|
|
123773
|
-
|
|
123774
|
-
return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
|
|
123775
|
-
}
|
|
123776
|
-
function getProjectReferenceRedirectProject(fileName) {
|
|
123777
|
-
if (!resolvedProjectReferences || !resolvedProjectReferences.length || isDeclarationFileName(fileName) || fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
123778
|
-
return void 0;
|
|
123779
|
-
}
|
|
123780
|
-
return getResolvedProjectReferenceToRedirect(fileName);
|
|
123781
|
-
}
|
|
123782
|
-
function getProjectReferenceOutputName(referencedProject, fileName) {
|
|
123783
|
-
const out = referencedProject.commandLine.options.outFile;
|
|
123784
|
-
return out ? changeExtension(out, ".d.ts" /* Dts */) : getOutputDeclarationFileName(fileName, referencedProject.commandLine, !host.useCaseSensitiveFileNames());
|
|
123785
|
-
}
|
|
123786
|
-
function getResolvedProjectReferenceToRedirect(fileName) {
|
|
123787
|
-
if (mapFromFileToProjectReferenceRedirects === void 0) {
|
|
123788
|
-
mapFromFileToProjectReferenceRedirects = /* @__PURE__ */ new Map();
|
|
123789
|
-
forEachResolvedProjectReference2((referencedProject) => {
|
|
123790
|
-
if (toPath3(options.configFilePath) !== referencedProject.sourceFile.path) {
|
|
123791
|
-
referencedProject.commandLine.fileNames.forEach((f) => mapFromFileToProjectReferenceRedirects.set(toPath3(f), referencedProject.sourceFile.path));
|
|
123792
|
-
}
|
|
123793
|
-
});
|
|
123794
|
-
}
|
|
123795
|
-
const referencedProjectPath = mapFromFileToProjectReferenceRedirects.get(toPath3(fileName));
|
|
123796
|
-
return referencedProjectPath && getResolvedProjectReferenceByPath(referencedProjectPath);
|
|
123567
|
+
function getRedirectFromSourceFile(fileName) {
|
|
123568
|
+
return mapSourceFileToResolvedRef == null ? void 0 : mapSourceFileToResolvedRef.get(toPath3(fileName));
|
|
123797
123569
|
}
|
|
123798
123570
|
function forEachResolvedProjectReference2(cb) {
|
|
123799
123571
|
return forEachResolvedProjectReference(resolvedProjectReferences, cb);
|
|
123800
123572
|
}
|
|
123801
|
-
function
|
|
123802
|
-
|
|
123803
|
-
if (mapFromToProjectReferenceRedirectSource === void 0) {
|
|
123804
|
-
mapFromToProjectReferenceRedirectSource = /* @__PURE__ */ new Map();
|
|
123805
|
-
forEachResolvedProjectReference2((resolvedRef) => {
|
|
123806
|
-
const out = resolvedRef.commandLine.options.outFile;
|
|
123807
|
-
if (out) {
|
|
123808
|
-
const outputDts = changeExtension(out, ".d.ts" /* Dts */);
|
|
123809
|
-
mapFromToProjectReferenceRedirectSource.set(toPath3(outputDts), true);
|
|
123810
|
-
} else {
|
|
123811
|
-
const getCommonSourceDirectory3 = memoize(() => getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()));
|
|
123812
|
-
forEach(resolvedRef.commandLine.fileNames, (fileName) => {
|
|
123813
|
-
if (!isDeclarationFileName(fileName) && !fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
123814
|
-
const outputDts = getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory3);
|
|
123815
|
-
mapFromToProjectReferenceRedirectSource.set(toPath3(outputDts), fileName);
|
|
123816
|
-
}
|
|
123817
|
-
});
|
|
123818
|
-
}
|
|
123819
|
-
});
|
|
123820
|
-
}
|
|
123821
|
-
return mapFromToProjectReferenceRedirectSource.get(path);
|
|
123573
|
+
function getRedirectFromOutput(path) {
|
|
123574
|
+
return mapOutputFileToResolvedRef == null ? void 0 : mapOutputFileToResolvedRef.get(path);
|
|
123822
123575
|
}
|
|
123823
123576
|
function isSourceOfProjectReferenceRedirect(fileName) {
|
|
123824
|
-
return useSourceOfProjectReferenceRedirect && !!
|
|
123577
|
+
return useSourceOfProjectReferenceRedirect && !!getRedirectFromSourceFile(fileName);
|
|
123825
123578
|
}
|
|
123826
123579
|
function getResolvedProjectReferenceByPath(projectReferencePath) {
|
|
123827
123580
|
if (!projectReferenceRedirects) {
|
|
@@ -123843,19 +123596,8 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123843
123596
|
});
|
|
123844
123597
|
}
|
|
123845
123598
|
function processTypeReferenceDirectives(file) {
|
|
123846
|
-
var _a2;
|
|
123847
123599
|
const typeDirectives = file.typeReferenceDirectives;
|
|
123848
|
-
if (!typeDirectives.length)
|
|
123849
|
-
(_a2 = host.onReusedTypeReferenceDirectiveResolutions) == null ? void 0 : _a2.call(
|
|
123850
|
-
host,
|
|
123851
|
-
/*reusedNames*/
|
|
123852
|
-
void 0,
|
|
123853
|
-
file,
|
|
123854
|
-
getRedirectReferenceForResolution(file),
|
|
123855
|
-
options
|
|
123856
|
-
);
|
|
123857
|
-
return;
|
|
123858
|
-
}
|
|
123600
|
+
if (!typeDirectives.length) return;
|
|
123859
123601
|
const resolutions = (resolvedTypeReferenceDirectiveNamesProcessing == null ? void 0 : resolvedTypeReferenceDirectiveNamesProcessing.get(file.path)) || resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
|
|
123860
123602
|
const resolutionsInFile = createModeAwareCache();
|
|
123861
123603
|
(resolvedTypeReferenceDirectiveNames ?? (resolvedTypeReferenceDirectiveNames = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
@@ -123982,7 +123724,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123982
123724
|
return host.getCanonicalFileName(fileName);
|
|
123983
123725
|
}
|
|
123984
123726
|
function processImportedModules(file) {
|
|
123985
|
-
var _a2;
|
|
123986
123727
|
collectExternalModuleReferences(file);
|
|
123987
123728
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
123988
123729
|
const moduleNames = getModuleNames(file);
|
|
@@ -124001,7 +123742,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
124001
123742
|
continue;
|
|
124002
123743
|
}
|
|
124003
123744
|
const isFromNodeModulesSearch = resolution.isExternalLibraryImport;
|
|
124004
|
-
const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension) && !
|
|
123745
|
+
const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension) && !getRedirectFromSourceFile(resolution.resolvedFileName);
|
|
124005
123746
|
const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile && (!resolution.originalPath || pathContainsNodeModules(resolution.resolvedFileName));
|
|
124006
123747
|
const resolvedFileName = resolution.resolvedFileName;
|
|
124007
123748
|
if (isFromNodeModulesSearch) {
|
|
@@ -124026,15 +123767,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
124026
123767
|
currentNodeModulesDepth--;
|
|
124027
123768
|
}
|
|
124028
123769
|
}
|
|
124029
|
-
} else {
|
|
124030
|
-
(_a2 = host.onReusedModuleResolutions) == null ? void 0 : _a2.call(
|
|
124031
|
-
host,
|
|
124032
|
-
/*reusedNames*/
|
|
124033
|
-
void 0,
|
|
124034
|
-
file,
|
|
124035
|
-
getRedirectReferenceForResolution(file),
|
|
124036
|
-
options
|
|
124037
|
-
);
|
|
124038
123770
|
}
|
|
124039
123771
|
}
|
|
124040
123772
|
function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {
|
|
@@ -124120,6 +123852,30 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
124120
123852
|
sourceFile.originalFileName = refPath;
|
|
124121
123853
|
const resolvedRef = { commandLine, sourceFile };
|
|
124122
123854
|
projectReferenceRedirects.set(sourceFilePath, resolvedRef);
|
|
123855
|
+
if (options.configFile !== sourceFile) {
|
|
123856
|
+
mapSourceFileToResolvedRef ?? (mapSourceFileToResolvedRef = /* @__PURE__ */ new Map());
|
|
123857
|
+
mapOutputFileToResolvedRef ?? (mapOutputFileToResolvedRef = /* @__PURE__ */ new Map());
|
|
123858
|
+
let outDts;
|
|
123859
|
+
if (commandLine.options.outFile) {
|
|
123860
|
+
outDts = changeExtension(commandLine.options.outFile, ".d.ts" /* Dts */);
|
|
123861
|
+
mapOutputFileToResolvedRef == null ? void 0 : mapOutputFileToResolvedRef.set(toPath3(outDts), { resolvedRef });
|
|
123862
|
+
}
|
|
123863
|
+
const getCommonSourceDirectory3 = memoize(() => getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()));
|
|
123864
|
+
commandLine.fileNames.forEach((fileName) => {
|
|
123865
|
+
if (isDeclarationFileName(fileName)) return;
|
|
123866
|
+
const path = toPath3(fileName);
|
|
123867
|
+
let outputDts;
|
|
123868
|
+
if (!fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
123869
|
+
if (!commandLine.options.outFile) {
|
|
123870
|
+
outputDts = getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory3);
|
|
123871
|
+
mapOutputFileToResolvedRef.set(toPath3(outputDts), { resolvedRef, source: fileName });
|
|
123872
|
+
} else {
|
|
123873
|
+
outputDts = outDts;
|
|
123874
|
+
}
|
|
123875
|
+
}
|
|
123876
|
+
mapSourceFileToResolvedRef.set(path, { resolvedRef, outputDts });
|
|
123877
|
+
});
|
|
123878
|
+
}
|
|
124123
123879
|
if (commandLine.projectReferences) {
|
|
124124
123880
|
resolvedRef.references = commandLine.projectReferences.map(parseProjectReferenceConfigFile);
|
|
124125
123881
|
}
|
|
@@ -124840,7 +124596,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
|
124840
124596
|
);
|
|
124841
124597
|
}
|
|
124842
124598
|
function fileExistsIfProjectReferenceDts(file) {
|
|
124843
|
-
const source = host.
|
|
124599
|
+
const source = host.getRedirectFromOutput(host.toPath(file));
|
|
124844
124600
|
return source !== void 0 ? isString(source) ? originalFileExists.call(host.compilerHost, source) : true : void 0;
|
|
124845
124601
|
}
|
|
124846
124602
|
function directoryExistsIfProjectReferenceDeclDir(dir) {
|
|
@@ -125370,7 +125126,8 @@ var BuilderState;
|
|
|
125370
125126
|
return symbol && getReferencedFilesFromImportedModuleSymbol(symbol);
|
|
125371
125127
|
}
|
|
125372
125128
|
function getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName) {
|
|
125373
|
-
|
|
125129
|
+
var _a;
|
|
125130
|
+
return toPath(((_a = program.getRedirectFromSourceFile(fileName)) == null ? void 0 : _a.outputDts) || fileName, sourceFileDirectory, getCanonicalFileName);
|
|
125374
125131
|
}
|
|
125375
125132
|
function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
|
|
125376
125133
|
let referencedFiles;
|
|
@@ -127201,7 +126958,7 @@ function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, h
|
|
|
127201
126958
|
);
|
|
127202
126959
|
}
|
|
127203
126960
|
|
|
127204
|
-
// src/compiler/
|
|
126961
|
+
// src/compiler/resolutionCache.ts
|
|
127205
126962
|
function removeIgnoredPath(path) {
|
|
127206
126963
|
if (endsWith(path, "/node_modules/.staging")) {
|
|
127207
126964
|
return removeSuffix(path, "/.staging");
|
|
@@ -127332,930 +127089,24 @@ function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, lengt
|
|
|
127332
127089
|
packageDirPath: packageDirLength !== void 0 ? getPathFromPathComponents(dirPathComponents, packageDirLength) : void 0
|
|
127333
127090
|
};
|
|
127334
127091
|
}
|
|
127335
|
-
function
|
|
127336
|
-
|
|
127337
|
-
|
|
127338
|
-
|
|
127339
|
-
|
|
127340
|
-
|
|
127341
|
-
const
|
|
127342
|
-
|
|
127343
|
-
|
|
127344
|
-
|
|
127345
|
-
|
|
127346
|
-
|
|
127347
|
-
|
|
127348
|
-
|
|
127349
|
-
|
|
127350
|
-
let isInDirectoryChecks;
|
|
127351
|
-
let cachesNeedingGc;
|
|
127352
|
-
let potentiallyUnreferencedDirWatchers;
|
|
127353
|
-
let considerNonWatchedResolutionAsInvalidated = false;
|
|
127354
|
-
const getCurrentDirectory = memoize(() => sharedCacheHost.getCurrentDirectory());
|
|
127355
|
-
const moduleResolutionCache = createModuleResolutionCache(
|
|
127356
|
-
getCurrentDirectory(),
|
|
127357
|
-
sharedCacheHost.getCanonicalFileName,
|
|
127358
|
-
/*options*/
|
|
127359
|
-
void 0,
|
|
127360
|
-
/*packageJsonInfoCache*/
|
|
127361
|
-
void 0,
|
|
127362
|
-
/*optionsToRedirectsKey*/
|
|
127363
|
-
void 0,
|
|
127364
|
-
getValidModuleResolution
|
|
127365
|
-
);
|
|
127366
|
-
const typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(
|
|
127367
|
-
getCurrentDirectory(),
|
|
127368
|
-
sharedCacheHost.getCanonicalFileName,
|
|
127369
|
-
/*options*/
|
|
127370
|
-
void 0,
|
|
127371
|
-
moduleResolutionCache.getPackageJsonInfoCache(),
|
|
127372
|
-
moduleResolutionCache.optionsToRedirectsKey,
|
|
127373
|
-
getValidResolution
|
|
127374
|
-
);
|
|
127375
|
-
const libraryResolutionCache = createModuleResolutionCache(
|
|
127376
|
-
getCurrentDirectory(),
|
|
127377
|
-
sharedCacheHost.getCanonicalFileName,
|
|
127378
|
-
getOptionsForLibraryResolution(
|
|
127379
|
-
/*options*/
|
|
127380
|
-
void 0
|
|
127381
|
-
),
|
|
127382
|
-
moduleResolutionCache.getPackageJsonInfoCache(),
|
|
127383
|
-
/*optionsToRedirectsKey*/
|
|
127384
|
-
void 0,
|
|
127385
|
-
getValidResolution
|
|
127386
|
-
);
|
|
127387
|
-
const packageJsonRefCount = /* @__PURE__ */ new Map();
|
|
127388
|
-
let potentiallyUnwatchedPackageJsons;
|
|
127389
|
-
const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
|
|
127390
|
-
const nonRecursiveDirectoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
|
|
127391
|
-
const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
|
|
127392
|
-
const isSymlinkCache = /* @__PURE__ */ new Map();
|
|
127393
|
-
const packageDirWatchers = /* @__PURE__ */ new Map();
|
|
127394
|
-
const dirPathToSymlinkPackageRefCount = /* @__PURE__ */ new Map();
|
|
127395
|
-
let currentCache;
|
|
127396
|
-
return {
|
|
127397
|
-
sharedCacheHost,
|
|
127398
|
-
moduleResolutionCache,
|
|
127399
|
-
typeReferenceDirectiveResolutionCache,
|
|
127400
|
-
libraryResolutionCache,
|
|
127401
|
-
resolvedFileToResolution,
|
|
127402
|
-
resolutionsWithFailedLookups,
|
|
127403
|
-
resolutionsWithOnlyAffectingLocations,
|
|
127404
|
-
packageJsonRefCount,
|
|
127405
|
-
watchedResolutionInfoMap,
|
|
127406
|
-
typeRootsWatches,
|
|
127407
|
-
inUseResolutionCaches,
|
|
127408
|
-
cacheToOptions,
|
|
127409
|
-
directoryWatchesOfFailedLookups,
|
|
127410
|
-
nonRecursiveDirectoryWatchesOfFailedLookups,
|
|
127411
|
-
fileWatchesOfAffectingLocations,
|
|
127412
|
-
packageDirWatchers,
|
|
127413
|
-
dirPathToSymlinkPackageRefCount,
|
|
127414
|
-
clear: clear2,
|
|
127415
|
-
startCachingPerDirectoryResolution,
|
|
127416
|
-
finishCachingPerDirectoryResolution,
|
|
127417
|
-
compactCaches,
|
|
127418
|
-
watchResolution,
|
|
127419
|
-
releaseResolution,
|
|
127420
|
-
createFileWatcherOfAffectingLocation,
|
|
127421
|
-
releaseFileWatcherOfAffectingLocation,
|
|
127422
|
-
closeFileWatcherOfAffectingLocation,
|
|
127423
|
-
addToPotentiallyUnwatchedPackageJsons,
|
|
127424
|
-
invalidateResolutionsOfFailedLookupLocations,
|
|
127425
|
-
invalidateResolutionOfFile,
|
|
127426
|
-
invalidateResolution,
|
|
127427
|
-
createTypeRootsWatch,
|
|
127428
|
-
currentCache: () => currentCache
|
|
127429
|
-
};
|
|
127430
|
-
function clearForCache(cache) {
|
|
127431
|
-
let gcCaches = false;
|
|
127432
|
-
currentCache = cache;
|
|
127433
|
-
watchedResolutionInfoMap.forEach((watchedResolutionInfo, resolution) => {
|
|
127434
|
-
if (watchedResolutionInfo.caches.has(cache)) {
|
|
127435
|
-
gcCaches = releaseResolution(
|
|
127436
|
-
resolution,
|
|
127437
|
-
/*moduleOrTypeRefCache*/
|
|
127438
|
-
void 0
|
|
127439
|
-
) || gcCaches;
|
|
127440
|
-
}
|
|
127441
|
-
});
|
|
127442
|
-
fileWatchesOfAffectingLocations.forEach((watcher, location) => {
|
|
127443
|
-
var _a;
|
|
127444
|
-
if ((_a = watcher.files) == null ? void 0 : _a.delete(cache)) closeFileWatcherOfAffectingLocation(location, watcher);
|
|
127445
|
-
});
|
|
127446
|
-
inUseResolutionCaches.delete(cache);
|
|
127447
|
-
if (gcCaches) {
|
|
127448
|
-
gcModuleOrTypeRefCache(moduleResolutionCache);
|
|
127449
|
-
gcModuleOrTypeRefCache(typeReferenceDirectiveResolutionCache);
|
|
127450
|
-
gcModuleOrTypeRefCache(libraryResolutionCache);
|
|
127451
|
-
}
|
|
127452
|
-
currentCache = void 0;
|
|
127453
|
-
if (cacheToOptions.delete(cache)) compactCachesWoker();
|
|
127454
|
-
}
|
|
127455
|
-
function clear2(cache) {
|
|
127456
|
-
if (!inUseResolutionCaches.has(cache)) return;
|
|
127457
|
-
if (inUseResolutionCaches.size !== 1) return clearForCache(cache);
|
|
127458
|
-
currentCache = void 0;
|
|
127459
|
-
inUseResolutionCaches.clear();
|
|
127460
|
-
cacheToOptions.clear();
|
|
127461
|
-
cachesNeedingGc = void 0;
|
|
127462
|
-
potentiallyUnwatchedPackageJsons = void 0;
|
|
127463
|
-
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
127464
|
-
clearMap(nonRecursiveDirectoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
127465
|
-
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
|
|
127466
|
-
clearMap(typeRootsWatches, closeFileWatcherOf);
|
|
127467
|
-
packageJsonRefCount.clear();
|
|
127468
|
-
isSymlinkCache.clear();
|
|
127469
|
-
packageDirWatchers.clear();
|
|
127470
|
-
dirPathToSymlinkPackageRefCount.clear();
|
|
127471
|
-
resolvedFileToResolution.clear();
|
|
127472
|
-
resolutionsWithFailedLookups.clear();
|
|
127473
|
-
resolutionsWithOnlyAffectingLocations.clear();
|
|
127474
|
-
watchedResolutionInfoMap.clear();
|
|
127475
|
-
failedLookupChecks = void 0;
|
|
127476
|
-
startsWithPathChecks = void 0;
|
|
127477
|
-
isInDirectoryChecks = void 0;
|
|
127478
|
-
affectingPathChecks = void 0;
|
|
127479
|
-
moduleResolutionCache.clear();
|
|
127480
|
-
typeReferenceDirectiveResolutionCache.clear();
|
|
127481
|
-
libraryResolutionCache.clear();
|
|
127482
|
-
impliedFormatPackageJsons.clear();
|
|
127483
|
-
}
|
|
127484
|
-
function startCachingPerDirectoryResolution(cache) {
|
|
127485
|
-
currentCache = cache;
|
|
127486
|
-
moduleResolutionCache.isReadonly = void 0;
|
|
127487
|
-
typeReferenceDirectiveResolutionCache.isReadonly = void 0;
|
|
127488
|
-
libraryResolutionCache.isReadonly = void 0;
|
|
127489
|
-
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = void 0;
|
|
127490
|
-
isSymlinkCache.clear();
|
|
127491
|
-
}
|
|
127492
|
-
function finishCachingPerDirectoryResolution() {
|
|
127493
|
-
potentiallyUnreferencedDirWatchers == null ? void 0 : potentiallyUnreferencedDirWatchers.forEach(
|
|
127494
|
-
(path) => closeDirectoryWatchesOfFailedLookup(
|
|
127495
|
-
getDirectoryWatchesOfFailedLookup(
|
|
127496
|
-
path,
|
|
127497
|
-
/*nonRecursive*/
|
|
127498
|
-
false
|
|
127499
|
-
),
|
|
127500
|
-
path,
|
|
127501
|
-
/*nonRecursive*/
|
|
127502
|
-
false
|
|
127503
|
-
)
|
|
127504
|
-
);
|
|
127505
|
-
potentiallyUnreferencedDirWatchers = void 0;
|
|
127506
|
-
cachesNeedingGc == null ? void 0 : cachesNeedingGc.forEach(gcModuleOrTypeRefCache);
|
|
127507
|
-
cachesNeedingGc = void 0;
|
|
127508
|
-
potentiallyUnwatchedPackageJsons == null ? void 0 : potentiallyUnwatchedPackageJsons.forEach(releasePotentiallyUnwatchedPackageJson);
|
|
127509
|
-
potentiallyUnwatchedPackageJsons = void 0;
|
|
127510
|
-
moduleResolutionCache.isReadonly = true;
|
|
127511
|
-
typeReferenceDirectiveResolutionCache.isReadonly = true;
|
|
127512
|
-
libraryResolutionCache.isReadonly = true;
|
|
127513
|
-
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = true;
|
|
127514
|
-
isSymlinkCache.clear();
|
|
127515
|
-
currentCache = void 0;
|
|
127516
|
-
}
|
|
127517
|
-
function compactCaches(availableOptions, cache) {
|
|
127518
|
-
if (availableOptions.size) cacheToOptions.set(cache, availableOptions);
|
|
127519
|
-
else cacheToOptions.delete(cache);
|
|
127520
|
-
compactCachesWoker();
|
|
127521
|
-
}
|
|
127522
|
-
function compactCachesWoker() {
|
|
127523
|
-
let availableOptions;
|
|
127524
|
-
if (cacheToOptions.size === 1) availableOptions = firstDefinedIterator(cacheToOptions.values(), identity);
|
|
127525
|
-
else {
|
|
127526
|
-
availableOptions = /* @__PURE__ */ new Set();
|
|
127527
|
-
cacheToOptions.forEach((setOfOptions) => setOfOptions.forEach((options) => availableOptions.add(options)));
|
|
127528
|
-
}
|
|
127529
|
-
moduleResolutionCache.compact(
|
|
127530
|
-
availableOptions,
|
|
127531
|
-
/*skipOptionsToRedirectsKeyCleanup*/
|
|
127532
|
-
true
|
|
127533
|
-
);
|
|
127534
|
-
typeReferenceDirectiveResolutionCache.compact(availableOptions);
|
|
127535
|
-
libraryResolutionCache.compact();
|
|
127536
|
-
}
|
|
127537
|
-
function gcModuleOrTypeRefCache(cache) {
|
|
127538
|
-
considerNonWatchedResolutionAsInvalidated = true;
|
|
127539
|
-
cache.gc(watchedResolutionInfoMap);
|
|
127540
|
-
considerNonWatchedResolutionAsInvalidated = false;
|
|
127541
|
-
}
|
|
127542
|
-
function getValidResolution(resolution) {
|
|
127543
|
-
return isInvalidatedResolution(resolution) ? void 0 : resolution;
|
|
127544
|
-
}
|
|
127545
|
-
function getValidModuleResolution(resolution, forSet) {
|
|
127546
|
-
var _a, _b, _c;
|
|
127547
|
-
resolution = getValidResolution(resolution);
|
|
127548
|
-
return resolution && (forSet ? resolution.globalCacheResolution && isInvalidatedResolution(resolution.globalCacheResolution.globalResult) ? void 0 : resolution : ((_b = currentCache == null ? void 0 : (_a = currentCache.resolutionHost).getGlobalTypingsCacheLocation) == null ? void 0 : _b.call(_a)) && ((_c = resolution == null ? void 0 : resolution.globalCacheResolution) == null ? void 0 : _c.globalResult) ? currentCache.getValidResolution(resolution.globalCacheResolution.globalResult) : resolution);
|
|
127549
|
-
}
|
|
127550
|
-
function isInvalidatedResolution(resolution) {
|
|
127551
|
-
var _a;
|
|
127552
|
-
return !resolution || considerNonWatchedResolutionAsInvalidated && !watchedResolutionInfoMap.has(resolution) || ((_a = watchedResolutionInfoMap.get(resolution)) == null ? void 0 : _a.isInvalidated);
|
|
127553
|
-
}
|
|
127554
|
-
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
127555
|
-
return endsWith(dirPath, "/node_modules/@types");
|
|
127556
|
-
}
|
|
127557
|
-
function watchResolution(resolution, getResolutionWithResolvedFileName, redirectedReference) {
|
|
127558
|
-
var _a, _b, _c;
|
|
127559
|
-
let watchedResolutionInfo = watchedResolutionInfoMap.get(resolution);
|
|
127560
|
-
if (!(watchedResolutionInfo == null ? void 0 : watchedResolutionInfo.caches.has(currentCache))) addRefCountToCacheMap(inUseResolutionCaches, currentCache);
|
|
127561
|
-
if (!(watchedResolutionInfo == null ? void 0 : watchedResolutionInfo.caches.size)) {
|
|
127562
|
-
if (!watchedResolutionInfo) {
|
|
127563
|
-
watchedResolutionInfoMap.set(resolution, watchedResolutionInfo = { caches: /* @__PURE__ */ new Set() });
|
|
127564
|
-
if (isResolvedWithGlobalCachePass(resolution) && !watchedResolutionInfoMap.has(resolution.globalCacheResolution.primary)) {
|
|
127565
|
-
watchedResolutionInfoMap.set(resolution.globalCacheResolution.primary, { caches: /* @__PURE__ */ new Set() });
|
|
127566
|
-
}
|
|
127567
|
-
}
|
|
127568
|
-
if (isResolvedWithGlobalCachePassButStillUnresolved(resolution)) {
|
|
127569
|
-
(_a = resolution.globalCacheResolution.globalResolution.failedLookupLocations) == null ? void 0 : _a.forEach(
|
|
127570
|
-
addToPotentiallyUnwatchedPackageJsonsIfPackageJson
|
|
127571
|
-
);
|
|
127572
|
-
if (resolution.globalCacheResolution.globalResolution.alternateResult) addToPotentiallyUnwatchedPackageJsonsIfPackageJson(resolution.globalCacheResolution.globalResolution.alternateResult);
|
|
127573
|
-
(_b = resolution.globalCacheResolution.globalResolution.affectingLocations) == null ? void 0 : _b.forEach(addToPotentiallyUnwatchedPackageJsons);
|
|
127574
|
-
}
|
|
127575
|
-
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
127576
|
-
if (resolved && resolved.resolvedFileName) {
|
|
127577
|
-
const key = sharedCacheHost.toPath(resolved.resolvedFileName);
|
|
127578
|
-
let resolutions = resolvedFileToResolution.get(key);
|
|
127579
|
-
if (!resolutions) resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
|
|
127580
|
-
resolutions.add(resolution);
|
|
127581
|
-
}
|
|
127582
|
-
}
|
|
127583
|
-
watchFailedLookupLocationOfResolution(resolution, redirectedReference, watchedResolutionInfo);
|
|
127584
|
-
watchAffectingLocationsOfResolution(resolution, watchedResolutionInfo);
|
|
127585
|
-
watchedResolutionInfo.caches.add(currentCache);
|
|
127586
|
-
if (isResolvedWithGlobalCachePass(resolution)) {
|
|
127587
|
-
watchPrimaryOrGlobalResultFailedAndAffectedLookups(resolution.globalCacheResolution.primary);
|
|
127588
|
-
} else if ((_c = resolution.globalCacheResolution) == null ? void 0 : _c.globalResult) {
|
|
127589
|
-
watchPrimaryOrGlobalResultFailedAndAffectedLookups(resolution.globalCacheResolution.globalResult);
|
|
127590
|
-
}
|
|
127591
|
-
}
|
|
127592
|
-
function watchPrimaryOrGlobalResultFailedAndAffectedLookups(primaryOrGlobalResult) {
|
|
127593
|
-
const watchInfo = watchedResolutionInfoMap.get(primaryOrGlobalResult);
|
|
127594
|
-
if (!(watchInfo == null ? void 0 : watchInfo.caches.size)) return;
|
|
127595
|
-
const first2 = firstDefinedIterator(watchInfo.caches, identity);
|
|
127596
|
-
const savedCurrentCache = currentCache;
|
|
127597
|
-
currentCache = first2;
|
|
127598
|
-
watchFailedLookupLocationOfResolution(
|
|
127599
|
-
primaryOrGlobalResult,
|
|
127600
|
-
/*redirectedReference*/
|
|
127601
|
-
void 0,
|
|
127602
|
-
watchInfo
|
|
127603
|
-
);
|
|
127604
|
-
watchAffectingLocationsOfResolution(primaryOrGlobalResult, watchInfo);
|
|
127605
|
-
currentCache = savedCurrentCache;
|
|
127606
|
-
}
|
|
127607
|
-
function watchFailedLookupLocation(failedLookupLocation, resolution, redirectedReference, watchedResolutionInfo) {
|
|
127608
|
-
var _a, _b;
|
|
127609
|
-
watchedResolutionInfo.rootDirInfo ?? (watchedResolutionInfo.rootDirInfo = currentCache.getRootDirInfoForResolution(redirectedReference, resolution));
|
|
127610
|
-
const failedLookupLocationPath = sharedCacheHost.toPath(failedLookupLocation);
|
|
127611
|
-
if (endsWith(failedLookupLocationPath, "/package.json")) addRefToPackageJson(failedLookupLocationPath);
|
|
127612
|
-
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
127613
|
-
failedLookupLocation,
|
|
127614
|
-
failedLookupLocationPath,
|
|
127615
|
-
watchedResolutionInfo.rootDirInfo.rootDir,
|
|
127616
|
-
watchedResolutionInfo.rootDirInfo.rootPath,
|
|
127617
|
-
watchedResolutionInfo.rootDirInfo.rootPathComponents,
|
|
127618
|
-
watchedResolutionInfo.rootDirInfo.canWatch,
|
|
127619
|
-
getCurrentDirectory,
|
|
127620
|
-
sharedCacheHost.preferNonRecursiveWatch
|
|
127621
|
-
);
|
|
127622
|
-
if (!toWatch) return;
|
|
127623
|
-
const { dir, dirPath, nonRecursive, packageDir, packageDirPath } = toWatch;
|
|
127624
|
-
if (!packageDirPath || !currentCache.resolutionHost.realpath) {
|
|
127625
|
-
if (!((_a = !nonRecursive ? watchedResolutionInfo.dirWatches : watchedResolutionInfo.nonRecursiveDirWatches) == null ? void 0 : _a.has(dirPath))) {
|
|
127626
|
-
const dirWatcher = createOrAddRefToDirectoryWatchOfFailedLookups(dir, dirPath, nonRecursive, currentCache);
|
|
127627
|
-
(!nonRecursive ? watchedResolutionInfo.dirWatches ?? (watchedResolutionInfo.dirWatches = /* @__PURE__ */ new Set()) : watchedResolutionInfo.nonRecursiveDirWatches ?? (watchedResolutionInfo.nonRecursiveDirWatches = /* @__PURE__ */ new Set())).add(dirPath);
|
|
127628
|
-
addRefCountToMapForCaches(dirWatcher.refCount, watchedResolutionInfo.caches, currentCache);
|
|
127629
|
-
}
|
|
127630
|
-
} else {
|
|
127631
|
-
Debug.assert(!nonRecursive);
|
|
127632
|
-
const forDirPath = (_b = watchedResolutionInfo.packageDirWatchers) == null ? void 0 : _b.get(packageDirPath);
|
|
127633
|
-
if (!(forDirPath == null ? void 0 : forDirPath.has(dirPath))) {
|
|
127634
|
-
const packageDirWatcher = createDirectoryWatcherForPackageDir(dir, dirPath, packageDir, packageDirPath);
|
|
127635
|
-
if (forDirPath) forDirPath.add(dirPath);
|
|
127636
|
-
else (watchedResolutionInfo.packageDirWatchers ?? (watchedResolutionInfo.packageDirWatchers = /* @__PURE__ */ new Map())).set(packageDirPath, /* @__PURE__ */ new Set([dirPath]));
|
|
127637
|
-
forRefCountCaches(watchedResolutionInfo.caches, (cache) => addRefToDirPathWatcherOfPackageDir(packageDirWatcher, dirPath, cache), currentCache);
|
|
127638
|
-
}
|
|
127639
|
-
}
|
|
127640
|
-
}
|
|
127641
|
-
function addRefToPackageJson(path) {
|
|
127642
|
-
addRefCountToCacheMap(packageJsonRefCount, path);
|
|
127643
|
-
}
|
|
127644
|
-
function releasePackageJsonCachePath(path) {
|
|
127645
|
-
var _a;
|
|
127646
|
-
(_a = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap()) == null ? void 0 : _a.delete(path);
|
|
127647
|
-
packageJsonRefCount.delete(path);
|
|
127648
|
-
}
|
|
127649
|
-
function addToPotentiallyUnwatchedPackageJsons(location) {
|
|
127650
|
-
(potentiallyUnwatchedPackageJsons ?? (potentiallyUnwatchedPackageJsons = /* @__PURE__ */ new Set())).add(sharedCacheHost.toPath(location));
|
|
127651
|
-
}
|
|
127652
|
-
function addToPotentiallyUnwatchedPackageJsonsIfPackageJson(location) {
|
|
127653
|
-
if (endsWith(location, "/package.json")) addToPotentiallyUnwatchedPackageJsons(location);
|
|
127654
|
-
}
|
|
127655
|
-
function releasePotentiallyUnwatchedPackageJson(path) {
|
|
127656
|
-
var _a;
|
|
127657
|
-
if (!packageJsonRefCount.has(path)) (_a = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap()) == null ? void 0 : _a.delete(path);
|
|
127658
|
-
}
|
|
127659
|
-
function releasePackageJson(path) {
|
|
127660
|
-
const existing = packageJsonRefCount.get(path);
|
|
127661
|
-
if (existing !== 1) packageJsonRefCount.set(path, existing - 1);
|
|
127662
|
-
else releasePackageJsonCachePath(path);
|
|
127663
|
-
}
|
|
127664
|
-
function releaseIfPackageJson(failedLookupLocation) {
|
|
127665
|
-
if (endsWith(failedLookupLocation, "/package.json")) releasePackageJson(sharedCacheHost.toPath(failedLookupLocation));
|
|
127666
|
-
}
|
|
127667
|
-
function watchFailedLookupLocationOfResolution(resolution, redirectedReference, watchedResolutionInfo) {
|
|
127668
|
-
var _a, _b, _c, _d, _e;
|
|
127669
|
-
if (!watchedResolutionInfo.caches.has(currentCache)) {
|
|
127670
|
-
(_a = watchedResolutionInfo.dirWatches) == null ? void 0 : _a.forEach((dirPath) => addRefCountToCacheMap(getDirectoryWatchesOfFailedLookup(
|
|
127671
|
-
dirPath,
|
|
127672
|
-
/*nonRecursive*/
|
|
127673
|
-
false
|
|
127674
|
-
).refCount, currentCache));
|
|
127675
|
-
(_b = watchedResolutionInfo.nonRecursiveDirWatches) == null ? void 0 : _b.forEach((dirPath) => addRefCountToCacheMap(getDirectoryWatchesOfFailedLookup(
|
|
127676
|
-
dirPath,
|
|
127677
|
-
/*nonRecursive*/
|
|
127678
|
-
true
|
|
127679
|
-
).refCount, currentCache));
|
|
127680
|
-
(_c = watchedResolutionInfo.packageDirWatchers) == null ? void 0 : _c.forEach((dirPaths, packageDirPath) => {
|
|
127681
|
-
const packageDirWatcher = packageDirWatchers.get(packageDirPath);
|
|
127682
|
-
dirPaths.forEach((dirPath) => addRefToDirPathWatcherOfPackageDir(packageDirWatcher, dirPath, currentCache));
|
|
127683
|
-
});
|
|
127684
|
-
}
|
|
127685
|
-
if (watchedResolutionInfo.watchedFailed === ((_d = resolution.failedLookupLocations) == null ? void 0 : _d.length)) return;
|
|
127686
|
-
if (!watchedResolutionInfo.watchedFailed) {
|
|
127687
|
-
resolutionsWithFailedLookups.add(resolution);
|
|
127688
|
-
if (watchedResolutionInfo.watchedAffected) resolutionsWithOnlyAffectingLocations.delete(resolution);
|
|
127689
|
-
}
|
|
127690
|
-
for (let i = watchedResolutionInfo.watchedFailed || 0; i < resolution.failedLookupLocations.length; i++) {
|
|
127691
|
-
watchFailedLookupLocation(
|
|
127692
|
-
resolution.failedLookupLocations[i],
|
|
127693
|
-
resolution,
|
|
127694
|
-
redirectedReference,
|
|
127695
|
-
watchedResolutionInfo
|
|
127696
|
-
);
|
|
127697
|
-
}
|
|
127698
|
-
if (!watchedResolutionInfo.watchedFailed && resolution.alternateResult) {
|
|
127699
|
-
watchFailedLookupLocation(
|
|
127700
|
-
resolution.alternateResult,
|
|
127701
|
-
resolution,
|
|
127702
|
-
redirectedReference,
|
|
127703
|
-
watchedResolutionInfo
|
|
127704
|
-
);
|
|
127705
|
-
}
|
|
127706
|
-
watchedResolutionInfo.watchedFailed = (_e = resolution.failedLookupLocations) == null ? void 0 : _e.length;
|
|
127707
|
-
}
|
|
127708
|
-
function createDirectoryWatcherForPackageDir(dir, dirPath, packageDir, packageDirPath) {
|
|
127709
|
-
let isSymlink = isSymlinkCache.get(packageDirPath);
|
|
127710
|
-
let packageDirWatcher = packageDirWatchers.get(packageDirPath);
|
|
127711
|
-
if (isSymlink === void 0) {
|
|
127712
|
-
const realPath2 = currentCache.resolutionHost.realpath(packageDir);
|
|
127713
|
-
isSymlink = realPath2 !== packageDir && sharedCacheHost.toPath(realPath2) !== packageDirPath;
|
|
127714
|
-
isSymlinkCache.set(packageDirPath, isSymlink);
|
|
127715
|
-
if (!packageDirWatcher) {
|
|
127716
|
-
packageDirWatchers.set(
|
|
127717
|
-
packageDirPath,
|
|
127718
|
-
packageDirWatcher = {
|
|
127719
|
-
dirPathToWatcher: /* @__PURE__ */ new Map(),
|
|
127720
|
-
isSymlink
|
|
127721
|
-
}
|
|
127722
|
-
);
|
|
127723
|
-
} else if (packageDirWatcher.isSymlink !== isSymlink) {
|
|
127724
|
-
packageDirWatcher.dirPathToWatcher.forEach((watcher, dirPath2, map2) => {
|
|
127725
|
-
releaseRefCountFromMapForCaches(watcher.watcher.refCount, watcher.refCount);
|
|
127726
|
-
(potentiallyUnreferencedDirWatchers ?? (potentiallyUnreferencedDirWatchers = /* @__PURE__ */ new Set())).add(packageDirWatcher.isSymlink ? packageDirPath : dirPath2);
|
|
127727
|
-
const firstCache = firstDefinedIterator(watcher.refCount.keys(), identity);
|
|
127728
|
-
if (firstCache) {
|
|
127729
|
-
watcher.watcher = createDirPathToWatcher(firstCache);
|
|
127730
|
-
addRefCountToMapForCaches(watcher.watcher.refCount, watcher.refCount, firstCache);
|
|
127731
|
-
} else {
|
|
127732
|
-
map2.delete(dirPath2);
|
|
127733
|
-
}
|
|
127734
|
-
});
|
|
127735
|
-
packageDirWatcher.isSymlink = isSymlink;
|
|
127736
|
-
}
|
|
127737
|
-
} else {
|
|
127738
|
-
Debug.assertIsDefined(packageDirWatcher);
|
|
127739
|
-
Debug.assert(isSymlink === packageDirWatcher.isSymlink);
|
|
127740
|
-
}
|
|
127741
|
-
if (packageDirWatcher.dirPathToWatcher.has(dirPath)) {
|
|
127742
|
-
addRefToDirPathWatcherOfPackageDir(packageDirWatcher, dirPath, currentCache);
|
|
127743
|
-
} else {
|
|
127744
|
-
packageDirWatcher.dirPathToWatcher.set(dirPath, {
|
|
127745
|
-
watcher: createDirPathToWatcher(currentCache),
|
|
127746
|
-
refCount: /* @__PURE__ */ new Map([[currentCache, 1]])
|
|
127747
|
-
});
|
|
127748
|
-
if (isSymlink) addRefCountToCacheMap(dirPathToSymlinkPackageRefCount, dirPath);
|
|
127749
|
-
}
|
|
127750
|
-
return packageDirWatcher;
|
|
127751
|
-
function createDirPathToWatcher(cache) {
|
|
127752
|
-
return isSymlink ? createOrAddRefToDirectoryWatchOfFailedLookups(
|
|
127753
|
-
packageDir,
|
|
127754
|
-
packageDirPath,
|
|
127755
|
-
/*nonRecursive*/
|
|
127756
|
-
false,
|
|
127757
|
-
cache
|
|
127758
|
-
) : createOrAddRefToDirectoryWatchOfFailedLookups(
|
|
127759
|
-
dir,
|
|
127760
|
-
dirPath,
|
|
127761
|
-
/*nonRecursive*/
|
|
127762
|
-
false,
|
|
127763
|
-
cache
|
|
127764
|
-
);
|
|
127765
|
-
}
|
|
127766
|
-
}
|
|
127767
|
-
function addRefToDirPathWatcherOfPackageDir(packageDirWatcher, dirPath, cache) {
|
|
127768
|
-
const forDirPath = packageDirWatcher.dirPathToWatcher.get(dirPath);
|
|
127769
|
-
if (!forDirPath.refCount.has(cache)) addRefCountToCacheMap(forDirPath.watcher.refCount, cache);
|
|
127770
|
-
addRefCountToCacheMap(forDirPath.refCount, cache);
|
|
127771
|
-
}
|
|
127772
|
-
function removeRefToDirPathWatcherOfPackageDir(packageDirPath, dirPath) {
|
|
127773
|
-
const packageDirWatcher = packageDirWatchers.get(packageDirPath);
|
|
127774
|
-
if (!packageDirWatcher) return;
|
|
127775
|
-
const forDirPath = packageDirWatcher.dirPathToWatcher.get(dirPath);
|
|
127776
|
-
if (!forDirPath) return;
|
|
127777
|
-
releaseRefCountFromMap(forDirPath.refCount, currentCache);
|
|
127778
|
-
if (forDirPath.refCount.has(currentCache)) return;
|
|
127779
|
-
releaseRefCountFromMap(forDirPath.watcher.refCount, currentCache);
|
|
127780
|
-
if (forDirPath.refCount.size !== 0) return;
|
|
127781
|
-
closeDirectoryWatchesOfFailedLookup(
|
|
127782
|
-
forDirPath.watcher,
|
|
127783
|
-
packageDirWatcher.isSymlink ? packageDirPath : dirPath,
|
|
127784
|
-
/*nonRecursive*/
|
|
127785
|
-
false
|
|
127786
|
-
);
|
|
127787
|
-
packageDirWatcher.dirPathToWatcher.delete(dirPath);
|
|
127788
|
-
if (packageDirWatcher.isSymlink) releaseRefCountFromMap(dirPathToSymlinkPackageRefCount, dirPath);
|
|
127789
|
-
if (packageDirWatcher.dirPathToWatcher.size === 0) {
|
|
127790
|
-
packageDirWatchers.delete(packageDirPath);
|
|
127791
|
-
}
|
|
127792
|
-
}
|
|
127793
|
-
function getDirectoryWatchesOfFailedLookup(dirPath, nonRecursive) {
|
|
127794
|
-
const watchMap = !nonRecursive ? directoryWatchesOfFailedLookups : nonRecursiveDirectoryWatchesOfFailedLookups;
|
|
127795
|
-
return watchMap.get(dirPath);
|
|
127796
|
-
}
|
|
127797
|
-
function createOrAddRefToDirectoryWatchOfFailedLookups(dir, dirPath, nonRecursive, cache) {
|
|
127798
|
-
const watchMap = !nonRecursive ? directoryWatchesOfFailedLookups : nonRecursiveDirectoryWatchesOfFailedLookups;
|
|
127799
|
-
let dirWatcher = watchMap.get(dirPath);
|
|
127800
|
-
if (dirWatcher) {
|
|
127801
|
-
addRefCountToCacheMap(dirWatcher.refCount, cache);
|
|
127802
|
-
} else {
|
|
127803
|
-
watchMap.set(
|
|
127804
|
-
dirPath,
|
|
127805
|
-
dirWatcher = {
|
|
127806
|
-
watcher: cache.resolutionHost.watchDirectoryOfFailedLookupLocation(
|
|
127807
|
-
dir,
|
|
127808
|
-
(fileOrDirectory) => onDirectoryWatcher(dirPath, nonRecursive, fileOrDirectory),
|
|
127809
|
-
nonRecursive ? 0 /* None */ : 1 /* Recursive */
|
|
127810
|
-
),
|
|
127811
|
-
refCount: /* @__PURE__ */ new Map([[cache, 1]])
|
|
127812
|
-
}
|
|
127813
|
-
);
|
|
127814
|
-
}
|
|
127815
|
-
return dirWatcher;
|
|
127816
|
-
}
|
|
127817
|
-
function removeDirectoryWatcher(dirPath, nonRecursive, forCaches) {
|
|
127818
|
-
const dirWatcher = getDirectoryWatchesOfFailedLookup(dirPath, nonRecursive);
|
|
127819
|
-
if (dirWatcher) releaseRefCountFromMapForCaches(dirWatcher.refCount, forCaches);
|
|
127820
|
-
closeDirectoryWatchesOfFailedLookup(dirWatcher, dirPath, nonRecursive);
|
|
127821
|
-
}
|
|
127822
|
-
function closeDirectoryWatchesOfFailedLookup(watcher, path, nonRecursive) {
|
|
127823
|
-
if (watcher && watcher.refCount.size === 0) {
|
|
127824
|
-
if (!nonRecursive) directoryWatchesOfFailedLookups.delete(path);
|
|
127825
|
-
else nonRecursiveDirectoryWatchesOfFailedLookups.delete(path);
|
|
127826
|
-
watcher.watcher.close();
|
|
127827
|
-
}
|
|
127828
|
-
}
|
|
127829
|
-
function onDirectoryWatcher(dirPath, nonRecursive, fileOrDirectory, fileOrDirectoryPath) {
|
|
127830
|
-
var _a;
|
|
127831
|
-
const refCountCache = (_a = getDirectoryWatchesOfFailedLookup(dirPath, nonRecursive)) == null ? void 0 : _a.refCount;
|
|
127832
|
-
if (!refCountCache) return;
|
|
127833
|
-
fileOrDirectoryPath ?? (fileOrDirectoryPath = sharedCacheHost.toPath(fileOrDirectory));
|
|
127834
|
-
refCountCache.forEach((_refCount, cache) => {
|
|
127835
|
-
var _a2;
|
|
127836
|
-
(_a2 = cache.resolutionHost.getCachedDirectoryStructureHost()) == null ? void 0 : _a2.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
127837
|
-
});
|
|
127838
|
-
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath, refCountCache);
|
|
127839
|
-
}
|
|
127840
|
-
function watchAffectingLocationsOfResolution(resolution, watchedResolutionInfo) {
|
|
127841
|
-
var _a, _b, _c;
|
|
127842
|
-
if (((_a = resolution.affectingLocations) == null ? void 0 : _a.length) === watchedResolutionInfo.watchedAffected) {
|
|
127843
|
-
if (!watchedResolutionInfo.caches.has(currentCache)) {
|
|
127844
|
-
(_b = resolution.affectingLocations) == null ? void 0 : _b.forEach(
|
|
127845
|
-
(affectingLocation) => addRefCountToCacheMap(
|
|
127846
|
-
fileWatchesOfAffectingLocations.get(affectingLocation).resolutions,
|
|
127847
|
-
currentCache
|
|
127848
|
-
)
|
|
127849
|
-
);
|
|
127850
|
-
}
|
|
127851
|
-
return;
|
|
127852
|
-
}
|
|
127853
|
-
if (!watchedResolutionInfo.watchedAffected && !watchedResolutionInfo.watchedFailed) resolutionsWithOnlyAffectingLocations.add(resolution);
|
|
127854
|
-
for (let i = watchedResolutionInfo.watchedAffected || 0; i < resolution.affectingLocations.length; i++) {
|
|
127855
|
-
createFileWatcherOfAffectingLocation(
|
|
127856
|
-
resolution.affectingLocations[i],
|
|
127857
|
-
/*forResolution*/
|
|
127858
|
-
true
|
|
127859
|
-
);
|
|
127860
|
-
addRefCountToMapForCaches(
|
|
127861
|
-
fileWatchesOfAffectingLocations.get(resolution.affectingLocations[i]).resolutions,
|
|
127862
|
-
watchedResolutionInfo.caches,
|
|
127863
|
-
currentCache
|
|
127864
|
-
);
|
|
127865
|
-
}
|
|
127866
|
-
watchedResolutionInfo.watchedAffected = (_c = resolution.affectingLocations) == null ? void 0 : _c.length;
|
|
127867
|
-
}
|
|
127868
|
-
function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
|
|
127869
|
-
if (!forResolution) addRefCountToCacheMap(inUseResolutionCaches, currentCache);
|
|
127870
|
-
const fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
127871
|
-
if (fileWatcher) {
|
|
127872
|
-
addRefCountToCacheMap(forResolution ? fileWatcher.resolutions ?? (fileWatcher.resolutions = /* @__PURE__ */ new Map()) : fileWatcher.files ?? (fileWatcher.files = /* @__PURE__ */ new Map()), currentCache);
|
|
127873
|
-
return;
|
|
127874
|
-
}
|
|
127875
|
-
let locationToWatch = affectingLocation;
|
|
127876
|
-
let isSymlink = false;
|
|
127877
|
-
let symlinkWatcher;
|
|
127878
|
-
if (currentCache.resolutionHost.realpath) {
|
|
127879
|
-
locationToWatch = currentCache.resolutionHost.realpath(affectingLocation);
|
|
127880
|
-
if (affectingLocation !== locationToWatch) {
|
|
127881
|
-
isSymlink = true;
|
|
127882
|
-
symlinkWatcher = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
127883
|
-
}
|
|
127884
|
-
}
|
|
127885
|
-
const resolutions = forResolution ? /* @__PURE__ */ new Map([[currentCache, 1]]) : void 0;
|
|
127886
|
-
const files = forResolution ? void 0 : /* @__PURE__ */ new Map([[currentCache, 1]]);
|
|
127887
|
-
if (!isSymlink || !symlinkWatcher) {
|
|
127888
|
-
const watcher = {
|
|
127889
|
-
watcher: canWatchAffectingLocation(sharedCacheHost.toPath(locationToWatch)) ? currentCache.resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
|
|
127890
|
-
const refCountCaches = /* @__PURE__ */ new Set();
|
|
127891
|
-
onFileWatcherOfAffectingLocation(locationToWatch, refCountCaches);
|
|
127892
|
-
const seenCaches = /* @__PURE__ */ new Set();
|
|
127893
|
-
refCountCaches.forEach(
|
|
127894
|
-
(caches) => forRefCountCaches(
|
|
127895
|
-
caches,
|
|
127896
|
-
(cache) => {
|
|
127897
|
-
var _a;
|
|
127898
|
-
if (!tryAddToSet(seenCaches, cache)) return;
|
|
127899
|
-
(_a = cache.resolutionHost.getCachedDirectoryStructureHost()) == null ? void 0 : _a.addOrDeleteFile(fileName, sharedCacheHost.toPath(locationToWatch), eventKind);
|
|
127900
|
-
cache.resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
127901
|
-
},
|
|
127902
|
-
/*skipCache*/
|
|
127903
|
-
void 0
|
|
127904
|
-
)
|
|
127905
|
-
);
|
|
127906
|
-
}) : noopFileWatcher,
|
|
127907
|
-
resolutions: isSymlink ? void 0 : resolutions,
|
|
127908
|
-
files: isSymlink ? void 0 : files,
|
|
127909
|
-
symlinks: void 0
|
|
127910
|
-
};
|
|
127911
|
-
fileWatchesOfAffectingLocations.set(locationToWatch, watcher);
|
|
127912
|
-
addRefToPackageJson(sharedCacheHost.toPath(locationToWatch));
|
|
127913
|
-
if (isSymlink) symlinkWatcher = watcher;
|
|
127914
|
-
}
|
|
127915
|
-
if (isSymlink) {
|
|
127916
|
-
Debug.assert(!!symlinkWatcher);
|
|
127917
|
-
const watcher = {
|
|
127918
|
-
watcher: {
|
|
127919
|
-
close: () => {
|
|
127920
|
-
var _a, _b, _c;
|
|
127921
|
-
const symlinkWatcher2 = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
127922
|
-
if (((_a = symlinkWatcher2 == null ? void 0 : symlinkWatcher2.symlinks) == null ? void 0 : _a.delete(affectingLocation)) && !symlinkWatcher2.symlinks.size && !((_b = symlinkWatcher2.resolutions) == null ? void 0 : _b.size) && !((_c = symlinkWatcher2.files) == null ? void 0 : _c.size)) {
|
|
127923
|
-
fileWatchesOfAffectingLocations.delete(locationToWatch);
|
|
127924
|
-
releasePackageJson(sharedCacheHost.toPath(locationToWatch));
|
|
127925
|
-
symlinkWatcher2.watcher.close();
|
|
127926
|
-
}
|
|
127927
|
-
}
|
|
127928
|
-
},
|
|
127929
|
-
resolutions,
|
|
127930
|
-
files,
|
|
127931
|
-
symlinks: void 0
|
|
127932
|
-
};
|
|
127933
|
-
fileWatchesOfAffectingLocations.set(affectingLocation, watcher);
|
|
127934
|
-
addRefToPackageJson(sharedCacheHost.toPath(affectingLocation));
|
|
127935
|
-
(symlinkWatcher.symlinks ?? (symlinkWatcher.symlinks = /* @__PURE__ */ new Set())).add(affectingLocation);
|
|
127936
|
-
}
|
|
127937
|
-
}
|
|
127938
|
-
function releaseFileWatcherOfAffectingLocation(location) {
|
|
127939
|
-
releaseRefCountFromMap(inUseResolutionCaches, currentCache);
|
|
127940
|
-
const watcher = fileWatchesOfAffectingLocations.get(location);
|
|
127941
|
-
releaseRefCountFromMap(watcher.files, currentCache);
|
|
127942
|
-
}
|
|
127943
|
-
function closeFileWatcherOfAffectingLocation(path, watcher) {
|
|
127944
|
-
var _a, _b, _c;
|
|
127945
|
-
watcher ?? (watcher = fileWatchesOfAffectingLocations.get(path));
|
|
127946
|
-
if (watcher && !((_a = watcher.files) == null ? void 0 : _a.size) && !((_b = watcher.resolutions) == null ? void 0 : _b.size) && !((_c = watcher.symlinks) == null ? void 0 : _c.size)) {
|
|
127947
|
-
fileWatchesOfAffectingLocations.delete(path);
|
|
127948
|
-
releasePackageJson(sharedCacheHost.toPath(path));
|
|
127949
|
-
watcher.watcher.close();
|
|
127950
|
-
}
|
|
127951
|
-
}
|
|
127952
|
-
function onFileWatcherOfAffectingLocation(path, seenCaches) {
|
|
127953
|
-
var _a, _b, _c, _d;
|
|
127954
|
-
const watcher = fileWatchesOfAffectingLocations.get(path);
|
|
127955
|
-
if ((_a = watcher == null ? void 0 : watcher.resolutions) == null ? void 0 : _a.size) {
|
|
127956
|
-
(affectingPathChecks ?? (affectingPathChecks = /* @__PURE__ */ new Set())).add(path);
|
|
127957
|
-
seenCaches.add(watcher.resolutions);
|
|
127958
|
-
}
|
|
127959
|
-
if ((_b = watcher == null ? void 0 : watcher.files) == null ? void 0 : _b.size) {
|
|
127960
|
-
watcher.files.forEach((_refCount, cache) => cache.invalidateAffectingFileWatcher(path));
|
|
127961
|
-
seenCaches.add(watcher.files);
|
|
127962
|
-
}
|
|
127963
|
-
(_c = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap()) == null ? void 0 : _c.delete(sharedCacheHost.toPath(path));
|
|
127964
|
-
(_d = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _d.forEach((path2) => onFileWatcherOfAffectingLocation(path2, seenCaches));
|
|
127965
|
-
}
|
|
127966
|
-
function releaseResolution(resolution, moduleOrTypeRefCache) {
|
|
127967
|
-
var _a, _b, _c, _d, _e, _f;
|
|
127968
|
-
releaseRefCountFromMap(inUseResolutionCaches, currentCache);
|
|
127969
|
-
const watchedResolutionInfo = watchedResolutionInfoMap.get(resolution);
|
|
127970
|
-
watchedResolutionInfo.caches.delete(currentCache);
|
|
127971
|
-
const forCaches = /* @__PURE__ */ new Set([currentCache]);
|
|
127972
|
-
(_a = watchedResolutionInfo.dirWatches) == null ? void 0 : _a.forEach((dirPath) => removeDirectoryWatcher(
|
|
127973
|
-
dirPath,
|
|
127974
|
-
/*nonRecursive*/
|
|
127975
|
-
false,
|
|
127976
|
-
forCaches
|
|
127977
|
-
));
|
|
127978
|
-
(_b = watchedResolutionInfo.nonRecursiveDirWatches) == null ? void 0 : _b.forEach((dirPath) => removeDirectoryWatcher(
|
|
127979
|
-
dirPath,
|
|
127980
|
-
/*nonRecursive*/
|
|
127981
|
-
true,
|
|
127982
|
-
forCaches
|
|
127983
|
-
));
|
|
127984
|
-
(_c = watchedResolutionInfo.packageDirWatchers) == null ? void 0 : _c.forEach(
|
|
127985
|
-
(dirPaths, packageDirPath) => dirPaths.forEach(
|
|
127986
|
-
(dirPath) => removeRefToDirPathWatcherOfPackageDir(packageDirPath, dirPath)
|
|
127987
|
-
)
|
|
127988
|
-
);
|
|
127989
|
-
(_d = resolution.affectingLocations) == null ? void 0 : _d.forEach((affectingLocation) => {
|
|
127990
|
-
const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
127991
|
-
if (watcher == null ? void 0 : watcher.resolutions) releaseRefCountFromMap(watcher.resolutions, currentCache);
|
|
127992
|
-
closeFileWatcherOfAffectingLocation(affectingLocation, watcher);
|
|
127993
|
-
});
|
|
127994
|
-
if (watchedResolutionInfo.caches.size) return false;
|
|
127995
|
-
watchedResolutionInfoMap.delete(resolution);
|
|
127996
|
-
if (resolutionsWithFailedLookups.delete(resolution)) {
|
|
127997
|
-
(_e = resolution.failedLookupLocations) == null ? void 0 : _e.forEach(releaseIfPackageJson);
|
|
127998
|
-
if (resolution.alternateResult) releaseIfPackageJson(resolution.alternateResult);
|
|
127999
|
-
}
|
|
128000
|
-
resolutionsWithOnlyAffectingLocations.delete(resolution);
|
|
128001
|
-
const resolved = getModuleOrTypeRefResolved(resolution);
|
|
128002
|
-
if (resolved && resolved.resolvedFileName) {
|
|
128003
|
-
const key = sharedCacheHost.toPath(resolved.resolvedFileName);
|
|
128004
|
-
const resolutions = resolvedFileToResolution.get(key);
|
|
128005
|
-
if ((resolutions == null ? void 0 : resolutions.delete(resolution)) && !resolutions.size) resolvedFileToResolution.delete(key);
|
|
128006
|
-
}
|
|
128007
|
-
if (isResolvedWithGlobalCachePass(resolution)) {
|
|
128008
|
-
const primary = resolution.globalCacheResolution.primary;
|
|
128009
|
-
const primaryWatchedInfo = watchedResolutionInfoMap.get(primary);
|
|
128010
|
-
if (primaryWatchedInfo.caches.size) {
|
|
128011
|
-
primary.globalCacheResolution = { primary };
|
|
128012
|
-
} else {
|
|
128013
|
-
watchedResolutionInfoMap.delete(primary);
|
|
128014
|
-
}
|
|
128015
|
-
} else if ((_f = resolution.globalCacheResolution) == null ? void 0 : _f.globalResult) {
|
|
128016
|
-
watchedResolutionInfoMap.set(resolution, watchedResolutionInfo);
|
|
128017
|
-
watchedResolutionInfo.dirWatches = void 0;
|
|
128018
|
-
watchedResolutionInfo.nonRecursiveDirWatches = void 0;
|
|
128019
|
-
watchedResolutionInfo.packageDirWatchers = void 0;
|
|
128020
|
-
watchedResolutionInfo.watchedFailed = void 0;
|
|
128021
|
-
watchedResolutionInfo.watchedAffected = void 0;
|
|
128022
|
-
watchedResolutionInfo.isInvalidated = void 0;
|
|
128023
|
-
watchedResolutionInfo.rootDirInfo = void 0;
|
|
128024
|
-
}
|
|
128025
|
-
if (moduleOrTypeRefCache) (cachesNeedingGc ?? (cachesNeedingGc = /* @__PURE__ */ new Set())).add(moduleOrTypeRefCache.sharedCache);
|
|
128026
|
-
return true;
|
|
128027
|
-
}
|
|
128028
|
-
function invalidateResolutions(resolutions, canInvalidate) {
|
|
128029
|
-
if (!resolutions) return false;
|
|
128030
|
-
let invalidated = false;
|
|
128031
|
-
resolutions.forEach((resolution) => invalidated = invalidateResolution(resolution, canInvalidate) || invalidated);
|
|
128032
|
-
return invalidated;
|
|
128033
|
-
}
|
|
128034
|
-
function invalidateResolution(resolution, canInvalidate) {
|
|
128035
|
-
const watchedResolutionInfo = watchedResolutionInfoMap.get(resolution);
|
|
128036
|
-
if (watchedResolutionInfo.isInvalidated || !canInvalidate(resolution)) return false;
|
|
128037
|
-
watchedResolutionInfo.isInvalidated = true;
|
|
128038
|
-
watchedResolutionInfo.caches.forEach(
|
|
128039
|
-
(cache) => cache !== currentCache ? cache.invalidateResolution(resolution) : void 0
|
|
128040
|
-
);
|
|
128041
|
-
return true;
|
|
128042
|
-
}
|
|
128043
|
-
function invalidateResolutionOfFile(filePath) {
|
|
128044
|
-
return invalidateResolutions(resolvedFileToResolution.get(filePath), returnTrue);
|
|
128045
|
-
}
|
|
128046
|
-
function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory, refCountCache) {
|
|
128047
|
-
if (isCreatingWatchedDirectory) {
|
|
128048
|
-
(isInDirectoryChecks || (isInDirectoryChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
128049
|
-
} else {
|
|
128050
|
-
const updatedPath = removeIgnoredPath(fileOrDirectoryPath);
|
|
128051
|
-
if (!updatedPath) return false;
|
|
128052
|
-
fileOrDirectoryPath = updatedPath;
|
|
128053
|
-
if (sharedCacheHost.fileIsOpen(fileOrDirectoryPath)) {
|
|
128054
|
-
return false;
|
|
128055
|
-
}
|
|
128056
|
-
const dirOfFileOrDirectory = getDirectoryPath(fileOrDirectoryPath);
|
|
128057
|
-
if (isNodeModulesAtTypesDirectory(fileOrDirectoryPath) || isNodeModulesDirectory(fileOrDirectoryPath) || isNodeModulesAtTypesDirectory(dirOfFileOrDirectory) || isNodeModulesDirectory(dirOfFileOrDirectory)) {
|
|
128058
|
-
(failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
128059
|
-
(startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
128060
|
-
} else {
|
|
128061
|
-
if (fileExtensionIs(fileOrDirectoryPath, ".map")) {
|
|
128062
|
-
return false;
|
|
128063
|
-
}
|
|
128064
|
-
if (!forEachKey(
|
|
128065
|
-
refCountCache,
|
|
128066
|
-
(cache) => !isEmittedFileOfProgram(
|
|
128067
|
-
cache.resolutionHost.getCurrentProgram(),
|
|
128068
|
-
fileOrDirectoryPath
|
|
128069
|
-
)
|
|
128070
|
-
)) return false;
|
|
128071
|
-
(failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
128072
|
-
(startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
128073
|
-
const packagePath = parseNodeModuleFromPath(
|
|
128074
|
-
fileOrDirectoryPath,
|
|
128075
|
-
/*isFolder*/
|
|
128076
|
-
true
|
|
128077
|
-
);
|
|
128078
|
-
if (packagePath) (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(packagePath);
|
|
128079
|
-
}
|
|
128080
|
-
}
|
|
128081
|
-
refCountCache.forEach((_refCount, cache) => cache.resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations());
|
|
128082
|
-
}
|
|
128083
|
-
function invalidatePackageJsonMap() {
|
|
128084
|
-
const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
128085
|
-
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
128086
|
-
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
128087
|
-
}
|
|
128088
|
-
}
|
|
128089
|
-
function invalidateResolutionsOfFailedLookupLocations() {
|
|
128090
|
-
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) {
|
|
128091
|
-
return false;
|
|
128092
|
-
}
|
|
128093
|
-
let invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution);
|
|
128094
|
-
invalidatePackageJsonMap();
|
|
128095
|
-
failedLookupChecks = void 0;
|
|
128096
|
-
startsWithPathChecks = void 0;
|
|
128097
|
-
isInDirectoryChecks = void 0;
|
|
128098
|
-
invalidated = invalidateResolutions(resolutionsWithOnlyAffectingLocations, canInvalidatedFailedLookupResolutionWithAffectingLocation) || invalidated;
|
|
128099
|
-
affectingPathChecks = void 0;
|
|
128100
|
-
return invalidated;
|
|
128101
|
-
}
|
|
128102
|
-
function canInvalidateFailedLookupResolution(resolution) {
|
|
128103
|
-
var _a;
|
|
128104
|
-
if (canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution)) return true;
|
|
128105
|
-
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks) return false;
|
|
128106
|
-
return ((_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(sharedCacheHost.toPath(location)))) || !!resolution.alternateResult && isInvalidatedFailedLookup(sharedCacheHost.toPath(resolution.alternateResult));
|
|
128107
|
-
}
|
|
128108
|
-
function isInvalidatedFailedLookup(locationPath) {
|
|
128109
|
-
return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (dirPath) => locationPath.length > dirPath.length && startsWith(locationPath, dirPath) && (isDiskPathRoot(dirPath) || locationPath[dirPath.length] === directorySeparator) ? true : void 0);
|
|
128110
|
-
}
|
|
128111
|
-
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
128112
|
-
var _a;
|
|
128113
|
-
return !!affectingPathChecks && ((_a = resolution.affectingLocations) == null ? void 0 : _a.some((location) => affectingPathChecks.has(location)));
|
|
128114
|
-
}
|
|
128115
|
-
function createTypeRootsWatch(typeRoot, cache) {
|
|
128116
|
-
let watcher = typeRootsWatches.get(typeRoot);
|
|
128117
|
-
if (watcher) {
|
|
128118
|
-
watcher.refCount.add(cache);
|
|
128119
|
-
} else {
|
|
128120
|
-
typeRootsWatches.set(
|
|
128121
|
-
typeRoot,
|
|
128122
|
-
watcher = {
|
|
128123
|
-
watcher: canWatchAtTypes(sharedCacheHost.toPath(typeRoot)) ? cache.resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
128124
|
-
var _a;
|
|
128125
|
-
const fileOrDirectoryPath = sharedCacheHost.toPath(fileOrDirectory);
|
|
128126
|
-
(_a = typeRootsWatches.get(typeRoot)) == null ? void 0 : _a.refCount.forEach((cache2) => {
|
|
128127
|
-
var _a2;
|
|
128128
|
-
(_a2 = cache2.resolutionHost.getCachedDirectoryStructureHost()) == null ? void 0 : _a2.addOrDeleteFileOrDirectory(
|
|
128129
|
-
fileOrDirectory,
|
|
128130
|
-
fileOrDirectoryPath
|
|
128131
|
-
);
|
|
128132
|
-
cache2.invalidateTypeRoot();
|
|
128133
|
-
});
|
|
128134
|
-
const fileOrDirectoryPathComponents = getPathComponents(fileOrDirectoryPath);
|
|
128135
|
-
directoryWatchesOfFailedLookups.forEach((_watcher, dirPath) => {
|
|
128136
|
-
if (isInDirectoryPath(getPathComponents(dirPath), fileOrDirectoryPathComponents)) {
|
|
128137
|
-
onDirectoryWatcher(
|
|
128138
|
-
dirPath,
|
|
128139
|
-
/*nonRecursive*/
|
|
128140
|
-
false,
|
|
128141
|
-
fileOrDirectory,
|
|
128142
|
-
fileOrDirectoryPath
|
|
128143
|
-
);
|
|
128144
|
-
}
|
|
128145
|
-
});
|
|
128146
|
-
nonRecursiveDirectoryWatchesOfFailedLookups.forEach((_watcher, dirPath) => {
|
|
128147
|
-
const dirPathComponents = getPathComponents(dirPath);
|
|
128148
|
-
if (isInDirectoryPath(dirPathComponents, fileOrDirectoryPathComponents) && (dirPathComponents.length === fileOrDirectoryPathComponents.length || dirPathComponents.length + 1 === fileOrDirectoryPathComponents.length)) {
|
|
128149
|
-
onDirectoryWatcher(
|
|
128150
|
-
dirPath,
|
|
128151
|
-
/*nonRecursive*/
|
|
128152
|
-
true,
|
|
128153
|
-
fileOrDirectory,
|
|
128154
|
-
fileOrDirectoryPath
|
|
128155
|
-
);
|
|
128156
|
-
}
|
|
128157
|
-
});
|
|
128158
|
-
}, 1 /* Recursive */) : noopFileWatcher,
|
|
128159
|
-
refCount: /* @__PURE__ */ new Set([cache])
|
|
128160
|
-
}
|
|
128161
|
-
);
|
|
128162
|
-
}
|
|
128163
|
-
const result = {
|
|
128164
|
-
close: () => {
|
|
128165
|
-
const existing = typeRootsWatches.get(typeRoot);
|
|
128166
|
-
if (existing == null ? void 0 : existing.refCount.delete(cache)) {
|
|
128167
|
-
releaseRefCountFromMap(inUseResolutionCaches, cache);
|
|
128168
|
-
closeTypeRootsWatch(typeRoot, existing);
|
|
128169
|
-
}
|
|
128170
|
-
}
|
|
128171
|
-
};
|
|
128172
|
-
addRefCountToCacheMap(inUseResolutionCaches, cache);
|
|
128173
|
-
return result;
|
|
128174
|
-
}
|
|
128175
|
-
function closeTypeRootsWatch(typeRoot, watcher) {
|
|
128176
|
-
if (!watcher.refCount.size) {
|
|
128177
|
-
typeRootsWatches.delete(typeRoot);
|
|
128178
|
-
watcher.watcher.close();
|
|
128179
|
-
}
|
|
128180
|
-
}
|
|
128181
|
-
}
|
|
128182
|
-
function enableSharingModuleOrTypeReferenceResolutionCache(moduleOrTypeRefCache, sharedCache) {
|
|
128183
|
-
const getFromDirectoryCache = moduleOrTypeRefCache.getFromDirectoryCache;
|
|
128184
|
-
moduleOrTypeRefCache.getFromDirectoryCache = (name, mode, directoryName, redirectedReference) => {
|
|
128185
|
-
let result = getFromDirectoryCache.call(moduleOrTypeRefCache, name, mode, directoryName, redirectedReference);
|
|
128186
|
-
if (result) return result;
|
|
128187
|
-
result = withSharingModuleOrTypeReferenceResolutionCache(
|
|
128188
|
-
moduleOrTypeRefCache,
|
|
128189
|
-
(sharedCache2) => sharedCache2.getFromDirectoryCache(name, mode, directoryName, redirectedReference)
|
|
128190
|
-
);
|
|
128191
|
-
if (result) {
|
|
128192
|
-
moduleOrTypeRefCache.setPerDirectoryAndNonRelativeNameCacheResult(
|
|
128193
|
-
name,
|
|
128194
|
-
mode,
|
|
128195
|
-
directoryName,
|
|
128196
|
-
redirectedReference,
|
|
128197
|
-
result
|
|
128198
|
-
);
|
|
128199
|
-
}
|
|
128200
|
-
return result;
|
|
128201
|
-
};
|
|
128202
|
-
const getFromNonRelativeNameCache = moduleOrTypeRefCache.getFromNonRelativeNameCache;
|
|
128203
|
-
moduleOrTypeRefCache.getFromNonRelativeNameCache = (nonRelativeModuleName, mode, directoryName, redirectedReference) => getFromNonRelativeNameCache.call(moduleOrTypeRefCache, nonRelativeModuleName, mode, directoryName, redirectedReference) || withSharingModuleOrTypeReferenceResolutionCache(
|
|
128204
|
-
moduleOrTypeRefCache,
|
|
128205
|
-
(sharedCache2) => sharedCache2 == null ? void 0 : sharedCache2.getFromNonRelativeNameCache(nonRelativeModuleName, mode, directoryName, redirectedReference)
|
|
128206
|
-
);
|
|
128207
|
-
const setPerDirectoryAndNonRelativeNameCacheResult = moduleOrTypeRefCache.setPerDirectoryAndNonRelativeNameCacheResult;
|
|
128208
|
-
moduleOrTypeRefCache.setPerDirectoryAndNonRelativeNameCacheResult = (name, mode, directoryName, redirectedReference, result, primary) => {
|
|
128209
|
-
var _a;
|
|
128210
|
-
setPerDirectoryAndNonRelativeNameCacheResult.call(moduleOrTypeRefCache, name, mode, directoryName, redirectedReference, result, primary);
|
|
128211
|
-
if (primary) return;
|
|
128212
|
-
result = ((_a = result.globalCacheResolution) == null ? void 0 : _a.primary) || result;
|
|
128213
|
-
withSharingModuleOrTypeReferenceResolutionCache(
|
|
128214
|
-
moduleOrTypeRefCache,
|
|
128215
|
-
(sharedCache2) => sharedCache2.setPerDirectoryAndNonRelativeNameCacheResult(name, mode, directoryName, redirectedReference, result)
|
|
128216
|
-
);
|
|
128217
|
-
};
|
|
128218
|
-
const update = moduleOrTypeRefCache.update;
|
|
128219
|
-
moduleOrTypeRefCache.update = (options) => {
|
|
128220
|
-
var _a;
|
|
128221
|
-
update.call(moduleOrTypeRefCache, options);
|
|
128222
|
-
(_a = moduleOrTypeRefCache.sharedCache) == null ? void 0 : _a.update(options);
|
|
128223
|
-
};
|
|
128224
|
-
moduleOrTypeRefCache.sharedCache = sharedCache;
|
|
128225
|
-
return moduleOrTypeRefCache;
|
|
128226
|
-
}
|
|
128227
|
-
function withSharingModuleOrTypeReferenceResolutionCache(moduleOrTypeRefCache, cb) {
|
|
128228
|
-
if (!moduleOrTypeRefCache.sharedCache) return;
|
|
128229
|
-
moduleOrTypeRefCache.sharedCache.update(moduleOrTypeRefCache.options());
|
|
128230
|
-
return cb(moduleOrTypeRefCache.sharedCache);
|
|
128231
|
-
}
|
|
128232
|
-
function addRefCountToCacheMap(refCountCache, key) {
|
|
128233
|
-
refCountCache.set(key, (refCountCache.get(key) ?? 0) + 1);
|
|
128234
|
-
}
|
|
128235
|
-
function releaseRefCountFromMap(refCountCache, key) {
|
|
128236
|
-
const existing = refCountCache.get(key);
|
|
128237
|
-
if (existing !== 1) refCountCache.set(key, existing - 1);
|
|
128238
|
-
else refCountCache.delete(key);
|
|
128239
|
-
}
|
|
128240
|
-
function addRefCountToMapForCaches(refCountCache, forCaches, alreadyAddedCache) {
|
|
128241
|
-
forRefCountCaches(forCaches, (cache) => addRefCountToCacheMap(refCountCache, cache), alreadyAddedCache);
|
|
128242
|
-
}
|
|
128243
|
-
function releaseRefCountFromMapForCaches(refCountCache, forCaches) {
|
|
128244
|
-
forRefCountCaches(
|
|
128245
|
-
forCaches,
|
|
128246
|
-
(cache) => releaseRefCountFromMap(refCountCache, cache),
|
|
128247
|
-
/*skipCache*/
|
|
128248
|
-
void 0
|
|
127092
|
+
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, isRootWatchable, getCurrentDirectory, preferNonRecursiveWatch, filterCustomPath) {
|
|
127093
|
+
const typeRootPathComponents = getPathComponents(typeRootPath);
|
|
127094
|
+
if (isRootWatchable && isInDirectoryPath(rootPathComponents, typeRootPathComponents)) {
|
|
127095
|
+
return rootPath;
|
|
127096
|
+
}
|
|
127097
|
+
typeRoot = isRootedDiskPath(typeRoot) ? normalizePath(typeRoot) : getNormalizedAbsolutePath(typeRoot, getCurrentDirectory());
|
|
127098
|
+
const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(
|
|
127099
|
+
getPathComponents(typeRoot),
|
|
127100
|
+
typeRootPathComponents,
|
|
127101
|
+
typeRootPathComponents.length,
|
|
127102
|
+
perceivedOsRootLengthForWatching(typeRootPathComponents, typeRootPathComponents.length),
|
|
127103
|
+
typeRootPathComponents.indexOf("node_modules"),
|
|
127104
|
+
rootPathComponents,
|
|
127105
|
+
typeRootPathComponents.lastIndexOf("node_modules"),
|
|
127106
|
+
preferNonRecursiveWatch
|
|
128249
127107
|
);
|
|
127108
|
+
return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
|
|
128250
127109
|
}
|
|
128251
|
-
function forRefCountCaches(forCaches, cb, skipCache) {
|
|
128252
|
-
forCaches.forEach((_refCount, cache) => {
|
|
128253
|
-
if (cache === skipCache) return;
|
|
128254
|
-
cb(cache);
|
|
128255
|
-
});
|
|
128256
|
-
}
|
|
128257
|
-
|
|
128258
|
-
// src/compiler/resolutionCache.ts
|
|
128259
127110
|
function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory) {
|
|
128260
127111
|
const normalized = getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory());
|
|
128261
127112
|
return !isDiskPathRoot(normalized) ? removeTrailingDirectorySeparator(normalized) : normalized;
|
|
@@ -128278,157 +127129,103 @@ function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirected
|
|
|
128278
127129
|
)
|
|
128279
127130
|
};
|
|
128280
127131
|
}
|
|
128281
|
-
function needsResolutionFromGlobalCache(moduleName, resolution) {
|
|
128282
|
-
return !isExternalModuleNameRelative(moduleName) && isUnresolvedOrResolvedToJs(resolution);
|
|
128283
|
-
}
|
|
128284
|
-
function isUnresolvedOrResolvedToJs(resolution) {
|
|
128285
|
-
return !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension);
|
|
128286
|
-
}
|
|
128287
|
-
function isResolvedWithGlobalCachePass(resolution) {
|
|
128288
|
-
var _a;
|
|
128289
|
-
return ((_a = resolution.globalCacheResolution) == null ? void 0 : _a.globalResult) === resolution;
|
|
128290
|
-
}
|
|
128291
|
-
function isResolvedWithoutGlobalCachePass(resolution) {
|
|
128292
|
-
var _a;
|
|
128293
|
-
return ((_a = resolution.globalCacheResolution) == null ? void 0 : _a.primary) === resolution;
|
|
128294
|
-
}
|
|
128295
|
-
function isResolvedWithGlobalCachePassButStillUnresolved(resolution) {
|
|
128296
|
-
return isResolvedWithGlobalCachePass(resolution) && !resolution.globalCacheResolution.globalResolution.resolvedModule;
|
|
128297
|
-
}
|
|
128298
|
-
function createGlobalResolutionResultField(primary, global2) {
|
|
128299
|
-
if (!primary) return global2 == null ? void 0 : global2.slice();
|
|
128300
|
-
if (!global2) return primary.slice();
|
|
128301
|
-
return primary.concat(global2);
|
|
128302
|
-
}
|
|
128303
127132
|
function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
|
|
128304
|
-
var _a;
|
|
128305
127133
|
const host = getModuleResolutionHost(resolutionHost);
|
|
128306
|
-
const
|
|
128307
|
-
if (!resolutionHost.getGlobalTypingsCacheLocation)
|
|
128308
|
-
|
|
128309
|
-
|
|
128310
|
-
|
|
128311
|
-
|
|
128312
|
-
|
|
128313
|
-
|
|
128314
|
-
|
|
128315
|
-
|
|
128316
|
-
|
|
128317
|
-
|
|
128318
|
-
|
|
128319
|
-
|
|
128320
|
-
|
|
128321
|
-
|
|
128322
|
-
|
|
128323
|
-
|
|
128324
|
-
|
|
128325
|
-
|
|
128326
|
-
|
|
128327
|
-
globalResolution.alternateResult = primary.alternateResult;
|
|
128328
|
-
} else {
|
|
128329
|
-
primary.globalCacheResolution = {
|
|
128330
|
-
primary,
|
|
128331
|
-
globalResolution,
|
|
128332
|
-
globalResult: { ...primary }
|
|
128333
|
-
};
|
|
127134
|
+
const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
127135
|
+
if (!resolutionHost.getGlobalTypingsCacheLocation) {
|
|
127136
|
+
return primaryResult;
|
|
127137
|
+
}
|
|
127138
|
+
const globalCache = resolutionHost.getGlobalTypingsCacheLocation();
|
|
127139
|
+
if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
127140
|
+
const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
|
|
127141
|
+
Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
|
|
127142
|
+
resolutionHost.projectName,
|
|
127143
|
+
compilerOptions,
|
|
127144
|
+
host,
|
|
127145
|
+
globalCache,
|
|
127146
|
+
moduleResolutionCache
|
|
127147
|
+
);
|
|
127148
|
+
if (resolvedModule) {
|
|
127149
|
+
primaryResult.resolvedModule = resolvedModule;
|
|
127150
|
+
primaryResult.failedLookupLocations = updateResolutionField(primaryResult.failedLookupLocations, failedLookupLocations);
|
|
127151
|
+
primaryResult.affectingLocations = updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
127152
|
+
primaryResult.resolutionDiagnostics = updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
127153
|
+
return primaryResult;
|
|
127154
|
+
}
|
|
128334
127155
|
}
|
|
128335
|
-
|
|
128336
|
-
primary.globalCacheResolution.globalResult.globalCacheResolution = primary.globalCacheResolution;
|
|
128337
|
-
moduleResolutionCache.setPerDirectoryAndNonRelativeNameCacheResult(
|
|
128338
|
-
moduleName,
|
|
128339
|
-
mode,
|
|
128340
|
-
getDirectoryPath(containingFile),
|
|
128341
|
-
redirectedReference,
|
|
128342
|
-
primary.globalCacheResolution.globalResult,
|
|
128343
|
-
primary
|
|
128344
|
-
);
|
|
128345
|
-
return primary.globalCacheResolution.globalResult;
|
|
127156
|
+
return primaryResult;
|
|
128346
127157
|
}
|
|
128347
|
-
function createResolutionCache(resolutionHost, rootDirForResolution,
|
|
127158
|
+
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
127159
|
+
let filesWithChangedSetOfUnresolvedImports;
|
|
128348
127160
|
let filesWithInvalidatedResolutions;
|
|
127161
|
+
let filesWithInvalidatedNonRelativeUnresolvedImports;
|
|
127162
|
+
const nonRelativeExternalModuleResolutions = /* @__PURE__ */ new Set();
|
|
127163
|
+
const resolutionsWithFailedLookups = /* @__PURE__ */ new Set();
|
|
127164
|
+
const resolutionsWithOnlyAffectingLocations = /* @__PURE__ */ new Set();
|
|
127165
|
+
const resolvedFileToResolution = /* @__PURE__ */ new Map();
|
|
128349
127166
|
const impliedFormatPackageJsons = /* @__PURE__ */ new Map();
|
|
128350
|
-
const filesReferencingResolution = /* @__PURE__ */ new Map();
|
|
128351
127167
|
let hasChangedAutomaticTypeDirectiveNames = false;
|
|
128352
127168
|
let affectingPathChecksForFile;
|
|
127169
|
+
let affectingPathChecks;
|
|
127170
|
+
let failedLookupChecks;
|
|
127171
|
+
let startsWithPathChecks;
|
|
127172
|
+
let isInDirectoryChecks;
|
|
128353
127173
|
let allModuleAndTypeResolutionsAreInvalidated = false;
|
|
128354
|
-
let resolutionsWithGlobalCachePassAreInvalidated = false;
|
|
128355
|
-
let resolutionsWithoutGlobalCachePassAreInvalidated = false;
|
|
128356
|
-
let unresolvedResolutionsWithGlobalCachePassAreInvalidated = false;
|
|
128357
|
-
let pendingRemoveResolutionsOfFile;
|
|
128358
|
-
let potentiallyUnreferencedResolutions;
|
|
128359
|
-
let newUnresolvedResolutionCachePassResolutions;
|
|
128360
|
-
let considerNonWatchedResolutionAsInvalidated = false;
|
|
128361
127174
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
127175
|
+
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
128362
127176
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
128363
|
-
const moduleResolutionCache =
|
|
128364
|
-
|
|
128365
|
-
|
|
128366
|
-
|
|
128367
|
-
/*options*/
|
|
128368
|
-
void 0,
|
|
128369
|
-
sharedCache.moduleResolutionCache.getPackageJsonInfoCache(),
|
|
128370
|
-
/*optionsToRedirectsKey*/
|
|
128371
|
-
void 0,
|
|
128372
|
-
getValidResolution
|
|
128373
|
-
),
|
|
128374
|
-
sharedCache.moduleResolutionCache
|
|
127177
|
+
const moduleResolutionCache = createModuleResolutionCache(
|
|
127178
|
+
getCurrentDirectory(),
|
|
127179
|
+
resolutionHost.getCanonicalFileName,
|
|
127180
|
+
resolutionHost.getCompilationSettings()
|
|
128375
127181
|
);
|
|
128376
127182
|
const resolvedTypeReferenceDirectives = /* @__PURE__ */ new Map();
|
|
128377
|
-
const typeReferenceDirectiveResolutionCache =
|
|
128378
|
-
|
|
128379
|
-
|
|
128380
|
-
|
|
128381
|
-
|
|
128382
|
-
|
|
128383
|
-
moduleResolutionCache.getPackageJsonInfoCache(),
|
|
128384
|
-
moduleResolutionCache.optionsToRedirectsKey,
|
|
128385
|
-
getValidResolution
|
|
128386
|
-
),
|
|
128387
|
-
sharedCache.typeReferenceDirectiveResolutionCache
|
|
127183
|
+
const typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(
|
|
127184
|
+
getCurrentDirectory(),
|
|
127185
|
+
resolutionHost.getCanonicalFileName,
|
|
127186
|
+
resolutionHost.getCompilationSettings(),
|
|
127187
|
+
moduleResolutionCache.getPackageJsonInfoCache(),
|
|
127188
|
+
moduleResolutionCache.optionsToRedirectsKey
|
|
128388
127189
|
);
|
|
128389
127190
|
const resolvedLibraries = /* @__PURE__ */ new Map();
|
|
128390
|
-
const libraryResolutionCache =
|
|
128391
|
-
|
|
128392
|
-
|
|
128393
|
-
|
|
128394
|
-
|
|
128395
|
-
moduleResolutionCache.getPackageJsonInfoCache(),
|
|
128396
|
-
/*optionsToRedirectsKey*/
|
|
128397
|
-
void 0,
|
|
128398
|
-
getValidResolution
|
|
128399
|
-
),
|
|
128400
|
-
sharedCache.libraryResolutionCache
|
|
127191
|
+
const libraryResolutionCache = createModuleResolutionCache(
|
|
127192
|
+
getCurrentDirectory(),
|
|
127193
|
+
resolutionHost.getCanonicalFileName,
|
|
127194
|
+
getOptionsForLibraryResolution(resolutionHost.getCompilationSettings()),
|
|
127195
|
+
moduleResolutionCache.getPackageJsonInfoCache()
|
|
128401
127196
|
);
|
|
128402
|
-
|
|
128403
|
-
|
|
128404
|
-
const
|
|
128405
|
-
const
|
|
127197
|
+
const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
|
|
127198
|
+
const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
|
|
127199
|
+
const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
|
|
127200
|
+
const rootPath = resolutionHost.toPath(rootDir);
|
|
127201
|
+
const rootPathComponents = getPathComponents(rootPath);
|
|
127202
|
+
const isRootWatchable = canWatchDirectoryOrFile(rootPathComponents);
|
|
127203
|
+
const isSymlinkCache = /* @__PURE__ */ new Map();
|
|
127204
|
+
const packageDirWatchers = /* @__PURE__ */ new Map();
|
|
127205
|
+
const dirPathToSymlinkPackageRefCount = /* @__PURE__ */ new Map();
|
|
128406
127206
|
const typeRootsWatches = /* @__PURE__ */ new Map();
|
|
128407
|
-
|
|
128408
|
-
resolutionHost,
|
|
128409
|
-
sharedCache,
|
|
127207
|
+
return {
|
|
128410
127208
|
rootDirForResolution,
|
|
128411
127209
|
resolvedModuleNames,
|
|
128412
127210
|
resolvedTypeReferenceDirectives,
|
|
128413
127211
|
resolvedLibraries,
|
|
128414
|
-
|
|
128415
|
-
|
|
128416
|
-
|
|
128417
|
-
|
|
128418
|
-
|
|
128419
|
-
|
|
128420
|
-
|
|
128421
|
-
|
|
127212
|
+
resolvedFileToResolution,
|
|
127213
|
+
resolutionsWithFailedLookups,
|
|
127214
|
+
resolutionsWithOnlyAffectingLocations,
|
|
127215
|
+
directoryWatchesOfFailedLookups,
|
|
127216
|
+
fileWatchesOfAffectingLocations,
|
|
127217
|
+
packageDirWatchers,
|
|
127218
|
+
dirPathToSymlinkPackageRefCount,
|
|
127219
|
+
watchFailedLookupLocationsOfExternalModuleResolutions,
|
|
127220
|
+
getModuleResolutionCache: () => moduleResolutionCache,
|
|
127221
|
+
startRecordingFilesWithChangedResolutions,
|
|
127222
|
+
finishRecordingFilesWithChangedResolutions,
|
|
128422
127223
|
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
128423
127224
|
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
128424
127225
|
startCachingPerDirectoryResolution,
|
|
128425
127226
|
finishCachingPerDirectoryResolution,
|
|
128426
|
-
compactCaches,
|
|
128427
127227
|
resolveModuleNameLiterals,
|
|
128428
127228
|
resolveTypeReferenceDirectiveReferences,
|
|
128429
|
-
onReusedModuleResolutions,
|
|
128430
|
-
onReusedTypeReferenceDirectiveResolutions,
|
|
128431
|
-
onSourceFileNotCreated,
|
|
128432
127229
|
resolveLibrary: resolveLibrary2,
|
|
128433
127230
|
resolveSingleModuleNameWithoutWatching,
|
|
128434
127231
|
removeResolutionsFromProjectReferenceRedirects,
|
|
@@ -128436,72 +127233,37 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128436
127233
|
hasChangedAutomaticTypeDirectiveNames: () => hasChangedAutomaticTypeDirectiveNames,
|
|
128437
127234
|
invalidateResolutionOfFile,
|
|
128438
127235
|
invalidateResolutionsOfFailedLookupLocations,
|
|
128439
|
-
|
|
128440
|
-
invalidateResolutionsWithoutGlobalCachePass,
|
|
128441
|
-
invalidateUnresolvedResolutionsWithGlobalCachePass,
|
|
127236
|
+
setFilesWithInvalidatedNonRelativeUnresolvedImports,
|
|
128442
127237
|
createHasInvalidatedResolutions,
|
|
127238
|
+
isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
128443
127239
|
updateTypeRootsWatch,
|
|
128444
127240
|
closeTypeRootsWatch,
|
|
128445
127241
|
clear: clear2,
|
|
128446
|
-
onChangesAffectModuleResolution
|
|
128447
|
-
// Used by shared cache
|
|
128448
|
-
getRootDirInfoForResolution: maybeBind(resolutionHost, resolutionHost.getRootDirInfoForResolution) ?? getRootDirInfoOfRedirectedReference,
|
|
128449
|
-
invalidateAffectingFileWatcher,
|
|
128450
|
-
invalidateResolution,
|
|
128451
|
-
invalidateTypeRoot,
|
|
128452
|
-
getValidResolution
|
|
127242
|
+
onChangesAffectModuleResolution
|
|
128453
127243
|
};
|
|
128454
|
-
return cache;
|
|
128455
|
-
function getRootDirInfo(rootDirForResolution2) {
|
|
128456
|
-
const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution2, getCurrentDirectory);
|
|
128457
|
-
const rootPath = resolutionHost.toPath(rootDir);
|
|
128458
|
-
const rootPathComponents = getPathComponents(rootPath);
|
|
128459
|
-
return {
|
|
128460
|
-
rootDir,
|
|
128461
|
-
rootPath,
|
|
128462
|
-
rootPathComponents,
|
|
128463
|
-
canWatch: canWatchDirectoryOrFile(rootPathComponents)
|
|
128464
|
-
};
|
|
128465
|
-
}
|
|
128466
|
-
function getRootDirInfoOfRedirectedReference(redirectedReference) {
|
|
128467
|
-
if (!redirectedReference) return rootDirInfo;
|
|
128468
|
-
let result = redirectsToRootDirInfo.get(redirectedReference);
|
|
128469
|
-
if (!result) {
|
|
128470
|
-
redirectsToRootDirInfo.set(
|
|
128471
|
-
redirectedReference,
|
|
128472
|
-
result = getRootDirInfo(
|
|
128473
|
-
getDirectoryPath(redirectedReference.sourceFile.fileName)
|
|
128474
|
-
)
|
|
128475
|
-
);
|
|
128476
|
-
}
|
|
128477
|
-
return result;
|
|
128478
|
-
}
|
|
128479
|
-
function cleanupRedirectRootDirInfo(newProgram) {
|
|
128480
|
-
const toDeleteRedirectToRootDirInfo = new Set(redirectsToRootDirInfo.keys());
|
|
128481
|
-
newProgram == null ? void 0 : newProgram.forEachResolvedProjectReference((redirect) => {
|
|
128482
|
-
toDeleteRedirectToRootDirInfo.delete(redirect);
|
|
128483
|
-
});
|
|
128484
|
-
toDeleteRedirectToRootDirInfo.forEach((redirect) => redirectsToRootDirInfo.delete(redirect));
|
|
128485
|
-
}
|
|
128486
127244
|
function clear2() {
|
|
128487
|
-
|
|
128488
|
-
|
|
128489
|
-
|
|
128490
|
-
|
|
127245
|
+
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
127246
|
+
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
|
|
127247
|
+
isSymlinkCache.clear();
|
|
127248
|
+
packageDirWatchers.clear();
|
|
127249
|
+
dirPathToSymlinkPackageRefCount.clear();
|
|
127250
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
128491
127251
|
closeTypeRootsWatch();
|
|
128492
|
-
sharedCache.clear(cache);
|
|
128493
127252
|
resolvedModuleNames.clear();
|
|
128494
127253
|
resolvedTypeReferenceDirectives.clear();
|
|
128495
|
-
|
|
128496
|
-
|
|
128497
|
-
|
|
127254
|
+
resolvedFileToResolution.clear();
|
|
127255
|
+
resolutionsWithFailedLookups.clear();
|
|
127256
|
+
resolutionsWithOnlyAffectingLocations.clear();
|
|
127257
|
+
failedLookupChecks = void 0;
|
|
127258
|
+
startsWithPathChecks = void 0;
|
|
127259
|
+
isInDirectoryChecks = void 0;
|
|
127260
|
+
affectingPathChecks = void 0;
|
|
128498
127261
|
affectingPathChecksForFile = void 0;
|
|
128499
127262
|
allModuleAndTypeResolutionsAreInvalidated = false;
|
|
128500
|
-
resolutionsWithGlobalCachePassAreInvalidated = false;
|
|
128501
|
-
resolutionsWithoutGlobalCachePassAreInvalidated = false;
|
|
128502
|
-
unresolvedResolutionsWithGlobalCachePassAreInvalidated = false;
|
|
128503
127263
|
moduleResolutionCache.clear();
|
|
128504
127264
|
typeReferenceDirectiveResolutionCache.clear();
|
|
127265
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
127266
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
128505
127267
|
libraryResolutionCache.clear();
|
|
128506
127268
|
impliedFormatPackageJsons.clear();
|
|
128507
127269
|
resolvedLibraries.clear();
|
|
@@ -128509,28 +127271,48 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128509
127271
|
}
|
|
128510
127272
|
function onChangesAffectModuleResolution() {
|
|
128511
127273
|
allModuleAndTypeResolutionsAreInvalidated = true;
|
|
127274
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
127275
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
127276
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
127277
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
127278
|
+
}
|
|
127279
|
+
function startRecordingFilesWithChangedResolutions() {
|
|
127280
|
+
filesWithChangedSetOfUnresolvedImports = [];
|
|
127281
|
+
}
|
|
127282
|
+
function finishRecordingFilesWithChangedResolutions() {
|
|
127283
|
+
const collected = filesWithChangedSetOfUnresolvedImports;
|
|
127284
|
+
filesWithChangedSetOfUnresolvedImports = void 0;
|
|
127285
|
+
return collected;
|
|
127286
|
+
}
|
|
127287
|
+
function isFileWithInvalidatedNonRelativeUnresolvedImports(path) {
|
|
127288
|
+
if (!filesWithInvalidatedNonRelativeUnresolvedImports) {
|
|
127289
|
+
return false;
|
|
127290
|
+
}
|
|
127291
|
+
const value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
127292
|
+
return !!value && !!value.length;
|
|
128512
127293
|
}
|
|
128513
127294
|
function createHasInvalidatedResolutions(customHasInvalidatedResolutions, customHasInvalidatedLibResolutions) {
|
|
128514
127295
|
invalidateResolutionsOfFailedLookupLocations();
|
|
128515
127296
|
const collected = filesWithInvalidatedResolutions;
|
|
128516
127297
|
filesWithInvalidatedResolutions = void 0;
|
|
128517
127298
|
return {
|
|
128518
|
-
hasInvalidatedResolutions: (path) => customHasInvalidatedResolutions(path) || allModuleAndTypeResolutionsAreInvalidated ||
|
|
127299
|
+
hasInvalidatedResolutions: (path) => customHasInvalidatedResolutions(path) || allModuleAndTypeResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path),
|
|
128519
127300
|
hasInvalidatedLibResolutions: (libFileName) => {
|
|
128520
127301
|
var _a;
|
|
128521
|
-
return customHasInvalidatedLibResolutions(libFileName) || !!((_a =
|
|
127302
|
+
return customHasInvalidatedLibResolutions(libFileName) || !!((_a = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName)) == null ? void 0 : _a.isInvalidated);
|
|
128522
127303
|
}
|
|
128523
127304
|
};
|
|
128524
127305
|
}
|
|
128525
|
-
function startCachingPerDirectoryResolution(
|
|
127306
|
+
function startCachingPerDirectoryResolution() {
|
|
128526
127307
|
moduleResolutionCache.isReadonly = void 0;
|
|
128527
127308
|
typeReferenceDirectiveResolutionCache.isReadonly = void 0;
|
|
128528
127309
|
libraryResolutionCache.isReadonly = void 0;
|
|
128529
|
-
moduleResolutionCache.
|
|
128530
|
-
|
|
128531
|
-
|
|
128532
|
-
|
|
128533
|
-
|
|
127310
|
+
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = void 0;
|
|
127311
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
127312
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
127313
|
+
libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
127314
|
+
watchFailedLookupLocationOfNonRelativeModuleResolutions();
|
|
127315
|
+
isSymlinkCache.clear();
|
|
128534
127316
|
}
|
|
128535
127317
|
function cleanupLibResolutionWatching(newProgram) {
|
|
128536
127318
|
resolvedLibraries.forEach((resolution, libFileName) => {
|
|
@@ -128539,35 +127321,32 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128539
127321
|
stopWatchFailedLookupLocationOfResolution(
|
|
128540
127322
|
resolution,
|
|
128541
127323
|
resolutionHost.toPath(getInferredLibraryNameResolveFrom(resolutionHost.getCompilationSettings(), getCurrentDirectory(), libFileName)),
|
|
128542
|
-
|
|
127324
|
+
getResolvedModuleFromResolution
|
|
128543
127325
|
);
|
|
128544
127326
|
resolvedLibraries.delete(libFileName);
|
|
128545
127327
|
}
|
|
128546
127328
|
});
|
|
128547
127329
|
}
|
|
128548
|
-
function finishCachingPerDirectoryResolution(newProgram, oldProgram
|
|
127330
|
+
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
127331
|
+
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
128549
127332
|
allModuleAndTypeResolutionsAreInvalidated = false;
|
|
128550
|
-
|
|
128551
|
-
resolutionsWithoutGlobalCachePassAreInvalidated = false;
|
|
128552
|
-
unresolvedResolutionsWithGlobalCachePassAreInvalidated = false;
|
|
128553
|
-
newUnresolvedResolutionCachePassResolutions = void 0;
|
|
128554
|
-
let potentiallyUnReferencedFileWatcherOfAffectingLocation;
|
|
127333
|
+
watchFailedLookupLocationOfNonRelativeModuleResolutions();
|
|
128555
127334
|
if (newProgram !== oldProgram) {
|
|
128556
|
-
const releaseFileWatcherOfAffectingLocation = (location) => {
|
|
128557
|
-
sharedCache.releaseFileWatcherOfAffectingLocation(location);
|
|
128558
|
-
(potentiallyUnReferencedFileWatcherOfAffectingLocation ?? (potentiallyUnReferencedFileWatcherOfAffectingLocation = /* @__PURE__ */ new Set())).add(location);
|
|
128559
|
-
};
|
|
128560
127335
|
cleanupLibResolutionWatching(newProgram);
|
|
128561
127336
|
newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
|
|
128562
127337
|
var _a;
|
|
128563
127338
|
const expected = ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0;
|
|
128564
127339
|
const existing = impliedFormatPackageJsons.get(newFile.resolvedPath) ?? emptyArray;
|
|
128565
127340
|
for (let i = existing.length; i < expected; i++) {
|
|
128566
|
-
|
|
127341
|
+
createFileWatcherOfAffectingLocation(
|
|
127342
|
+
newFile.packageJsonLocations[i],
|
|
127343
|
+
/*forResolution*/
|
|
127344
|
+
false
|
|
127345
|
+
);
|
|
128567
127346
|
}
|
|
128568
127347
|
if (existing.length > expected) {
|
|
128569
127348
|
for (let i = expected; i < existing.length; i++) {
|
|
128570
|
-
|
|
127349
|
+
fileWatchesOfAffectingLocations.get(existing[i]).files--;
|
|
128571
127350
|
}
|
|
128572
127351
|
}
|
|
128573
127352
|
if (expected) impliedFormatPackageJsons.set(newFile.resolvedPath, newFile.packageJsonLocations);
|
|
@@ -128576,68 +127355,38 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128576
127355
|
impliedFormatPackageJsons.forEach((existing, path) => {
|
|
128577
127356
|
const newFile = newProgram == null ? void 0 : newProgram.getSourceFileByPath(path);
|
|
128578
127357
|
if (!newFile || newFile.resolvedPath !== path) {
|
|
128579
|
-
existing.forEach(
|
|
127358
|
+
existing.forEach((location) => fileWatchesOfAffectingLocations.get(location).files--);
|
|
128580
127359
|
impliedFormatPackageJsons.delete(path);
|
|
128581
127360
|
}
|
|
128582
127361
|
});
|
|
128583
|
-
cleanupRedirectRootDirInfo(newProgram);
|
|
128584
|
-
}
|
|
128585
|
-
potentiallyUnReferencedFileWatcherOfAffectingLocation == null ? void 0 : potentiallyUnReferencedFileWatcherOfAffectingLocation.forEach((location) => sharedCache.closeFileWatcherOfAffectingLocation(location));
|
|
128586
|
-
potentiallyUnReferencedFileWatcherOfAffectingLocation = void 0;
|
|
128587
|
-
if (potentiallyUnreferencedResolutions) {
|
|
128588
|
-
potentiallyUnreferencedResolutions.forEach(gcModuleOrTypeRefCache);
|
|
128589
|
-
potentiallyUnreferencedResolutions = void 0;
|
|
128590
127362
|
}
|
|
128591
|
-
|
|
127363
|
+
directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
|
|
127364
|
+
fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
|
|
127365
|
+
packageDirWatchers.forEach(closePackageDirWatcher);
|
|
128592
127366
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
128593
|
-
if (!skipCacheCompact) compactCaches(newProgram);
|
|
128594
127367
|
moduleResolutionCache.isReadonly = true;
|
|
128595
127368
|
typeReferenceDirectiveResolutionCache.isReadonly = true;
|
|
128596
127369
|
libraryResolutionCache.isReadonly = true;
|
|
128597
127370
|
moduleResolutionCache.getPackageJsonInfoCache().isReadonly = true;
|
|
127371
|
+
isSymlinkCache.clear();
|
|
128598
127372
|
}
|
|
128599
|
-
function
|
|
128600
|
-
|
|
128601
|
-
|
|
128602
|
-
availableOptions.add(newProgram.getCompilerOptions());
|
|
128603
|
-
newProgram.forEachResolvedProjectReference((ref) => {
|
|
128604
|
-
availableOptions.add(ref.commandLine.options);
|
|
128605
|
-
});
|
|
127373
|
+
function closePackageDirWatcher(watcher, packageDirPath) {
|
|
127374
|
+
if (watcher.dirPathToWatcher.size === 0) {
|
|
127375
|
+
packageDirWatchers.delete(packageDirPath);
|
|
128606
127376
|
}
|
|
128607
|
-
moduleResolutionCache.compact(
|
|
128608
|
-
availableOptions,
|
|
128609
|
-
/*skipOptionsToRedirectsKeyCleanup*/
|
|
128610
|
-
true
|
|
128611
|
-
);
|
|
128612
|
-
typeReferenceDirectiveResolutionCache.compact(availableOptions);
|
|
128613
|
-
libraryResolutionCache.compact();
|
|
128614
|
-
sharedCache.compactCaches(availableOptions, cache);
|
|
128615
127377
|
}
|
|
128616
|
-
function
|
|
128617
|
-
|
|
128618
|
-
|
|
128619
|
-
|
|
128620
|
-
considerNonWatchedResolutionAsInvalidated = true;
|
|
128621
|
-
cache2.gc(filesReferencingResolution);
|
|
128622
|
-
considerNonWatchedResolutionAsInvalidated = false;
|
|
127378
|
+
function closeDirectoryWatchesOfFailedLookup(watcher, path) {
|
|
127379
|
+
if (watcher.refCount === 0) {
|
|
127380
|
+
directoryWatchesOfFailedLookups.delete(path);
|
|
127381
|
+
watcher.watcher.close();
|
|
128623
127382
|
}
|
|
128624
127383
|
}
|
|
128625
|
-
function
|
|
127384
|
+
function closeFileWatcherOfAffectingLocation(watcher, path) {
|
|
128626
127385
|
var _a;
|
|
128627
|
-
(_a =
|
|
128628
|
-
|
|
128629
|
-
|
|
128630
|
-
|
|
128631
|
-
}
|
|
128632
|
-
function isInvalidatedResolution(resolution) {
|
|
128633
|
-
var _a;
|
|
128634
|
-
if (!resolution || considerNonWatchedResolutionAsInvalidated && !filesReferencingResolution.has(resolution) || ((_a = sharedCache.watchedResolutionInfoMap.get(resolution)) == null ? void 0 : _a.isInvalidated) || resolutionsWithGlobalCachePassAreInvalidated && isResolvedWithGlobalCachePass(resolution) || resolutionsWithoutGlobalCachePassAreInvalidated && isResolvedWithoutGlobalCachePass(resolution)) return true;
|
|
128635
|
-
if ((newUnresolvedResolutionCachePassResolutions == null ? void 0 : newUnresolvedResolutionCachePassResolutions.has(resolution)) || !isInvalidatedUnResolvedGlobalCachePassResolution(resolution)) return false;
|
|
128636
|
-
sharedCache.invalidateResolution(resolution, returnTrue);
|
|
128637
|
-
return true;
|
|
128638
|
-
}
|
|
128639
|
-
function isInvalidatedUnResolvedGlobalCachePassResolution(resolution) {
|
|
128640
|
-
return unresolvedResolutionsWithGlobalCachePassAreInvalidated && isResolvedWithGlobalCachePassButStillUnresolved(resolution);
|
|
127386
|
+
if (watcher.files === 0 && watcher.resolutions === 0 && !((_a = watcher.symlinks) == null ? void 0 : _a.size)) {
|
|
127387
|
+
fileWatchesOfAffectingLocations.delete(path);
|
|
127388
|
+
watcher.watcher.close();
|
|
127389
|
+
}
|
|
128641
127390
|
}
|
|
128642
127391
|
function resolveNamesWithLocalCache({
|
|
128643
127392
|
entries,
|
|
@@ -128646,24 +127395,28 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128646
127395
|
redirectedReference,
|
|
128647
127396
|
options,
|
|
128648
127397
|
perFileCache,
|
|
128649
|
-
moduleOrTypeRefCache,
|
|
128650
127398
|
reusedNames,
|
|
128651
127399
|
loader,
|
|
128652
127400
|
getResolutionWithResolvedFileName,
|
|
128653
|
-
|
|
127401
|
+
deferWatchingNonRelativeResolution,
|
|
127402
|
+
shouldRetryResolution,
|
|
127403
|
+
logChanges
|
|
128654
127404
|
}) {
|
|
127405
|
+
var _a;
|
|
128655
127406
|
const path = resolutionHost.toPath(containingFile);
|
|
128656
127407
|
const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
|
|
128657
127408
|
const resolvedModules = [];
|
|
127409
|
+
const hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
128658
127410
|
const program = resolutionHost.getCurrentProgram();
|
|
128659
|
-
const oldRedirect = program && program.
|
|
127411
|
+
const oldRedirect = program && ((_a = program.getRedirectFromSourceFile(containingFile)) == null ? void 0 : _a.resolvedRef);
|
|
128660
127412
|
const unmatchedRedirects = oldRedirect ? !redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path : !!redirectedReference;
|
|
128661
127413
|
const seenNamesInFile = createModeAwareCache();
|
|
128662
127414
|
for (const entry of entries) {
|
|
128663
127415
|
const name = loader.nameAndMode.getName(entry);
|
|
128664
127416
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options);
|
|
128665
127417
|
let resolution = resolutionsInFile.get(name, mode);
|
|
128666
|
-
if (!seenNamesInFile.has(name, mode) && (allModuleAndTypeResolutionsAreInvalidated || unmatchedRedirects ||
|
|
127418
|
+
if (!seenNamesInFile.has(name, mode) && (allModuleAndTypeResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
127419
|
+
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
128667
127420
|
const existingResolution = resolution;
|
|
128668
127421
|
resolution = loader.resolve(name, mode);
|
|
128669
127422
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
@@ -128671,15 +127424,15 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128671
127424
|
}
|
|
128672
127425
|
resolutionsInFile.set(name, mode, resolution);
|
|
128673
127426
|
if (resolution !== existingResolution) {
|
|
128674
|
-
|
|
127427
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution);
|
|
128675
127428
|
if (existingResolution) {
|
|
128676
|
-
stopWatchFailedLookupLocationOfResolution(existingResolution, path,
|
|
127429
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
128677
127430
|
}
|
|
128678
127431
|
}
|
|
128679
|
-
if (
|
|
128680
|
-
|
|
127432
|
+
if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
|
|
127433
|
+
filesWithChangedSetOfUnresolvedImports.push(path);
|
|
127434
|
+
logChanges = false;
|
|
128681
127435
|
}
|
|
128682
|
-
onNewResolution == null ? void 0 : onNewResolution(existingResolution, resolution, path, name, mode);
|
|
128683
127436
|
} else {
|
|
128684
127437
|
const host = getModuleResolutionHost(resolutionHost);
|
|
128685
127438
|
if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) {
|
|
@@ -128694,76 +127447,43 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128694
127447
|
);
|
|
128695
127448
|
}
|
|
128696
127449
|
}
|
|
128697
|
-
Debug.assert(resolution !== void 0 && !
|
|
127450
|
+
Debug.assert(resolution !== void 0 && !resolution.isInvalidated);
|
|
128698
127451
|
seenNamesInFile.set(name, mode, true);
|
|
128699
127452
|
resolvedModules.push(resolution);
|
|
128700
127453
|
}
|
|
128701
|
-
onReusedResolutions({
|
|
128702
|
-
reusedNames,
|
|
128703
|
-
containingSourceFile,
|
|
128704
|
-
redirectedReference,
|
|
128705
|
-
options,
|
|
128706
|
-
path,
|
|
128707
|
-
resolutionsInFile,
|
|
128708
|
-
seenNamesInFile,
|
|
128709
|
-
nameAndModeGetter: loader.nameAndMode,
|
|
128710
|
-
moduleOrTypeRefCache
|
|
128711
|
-
});
|
|
128712
|
-
return resolvedModules;
|
|
128713
|
-
}
|
|
128714
|
-
function onReusedResolutions({
|
|
128715
|
-
reusedNames,
|
|
128716
|
-
containingSourceFile,
|
|
128717
|
-
redirectedReference,
|
|
128718
|
-
options,
|
|
128719
|
-
path,
|
|
128720
|
-
resolutionsInFile,
|
|
128721
|
-
seenNamesInFile,
|
|
128722
|
-
nameAndModeGetter,
|
|
128723
|
-
moduleOrTypeRefCache
|
|
128724
|
-
}) {
|
|
128725
|
-
if (!resolutionsInFile) return;
|
|
128726
|
-
if (!seenNamesInFile) seenNamesInFile = createModeAwareCache();
|
|
128727
127454
|
reusedNames == null ? void 0 : reusedNames.forEach(
|
|
128728
127455
|
(entry) => seenNamesInFile.set(
|
|
128729
|
-
|
|
128730
|
-
|
|
127456
|
+
loader.nameAndMode.getName(entry),
|
|
127457
|
+
loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options),
|
|
128731
127458
|
true
|
|
128732
127459
|
)
|
|
128733
127460
|
);
|
|
128734
127461
|
if (resolutionsInFile.size() !== seenNamesInFile.size()) {
|
|
128735
127462
|
resolutionsInFile.forEach((resolution, name, mode) => {
|
|
128736
127463
|
if (!seenNamesInFile.has(name, mode)) {
|
|
128737
|
-
stopWatchFailedLookupLocationOfResolution(resolution, path,
|
|
127464
|
+
stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
128738
127465
|
resolutionsInFile.delete(name, mode);
|
|
128739
127466
|
}
|
|
128740
127467
|
});
|
|
128741
127468
|
}
|
|
128742
|
-
|
|
128743
|
-
|
|
128744
|
-
|
|
128745
|
-
|
|
128746
|
-
|
|
128747
|
-
|
|
128748
|
-
|
|
128749
|
-
|
|
128750
|
-
|
|
128751
|
-
|
|
128752
|
-
|
|
128753
|
-
|
|
128754
|
-
|
|
128755
|
-
|
|
128756
|
-
|
|
128757
|
-
|
|
128758
|
-
|
|
128759
|
-
|
|
128760
|
-
redirectedReference,
|
|
128761
|
-
options,
|
|
128762
|
-
path,
|
|
128763
|
-
resolutionsInFile: resolvedTypeReferenceDirectives.get(path),
|
|
128764
|
-
nameAndModeGetter: typeReferenceResolutionNameAndModeGetter,
|
|
128765
|
-
moduleOrTypeRefCache: typeReferenceDirectiveResolutionCache
|
|
128766
|
-
});
|
|
127469
|
+
return resolvedModules;
|
|
127470
|
+
function resolutionIsEqualTo(oldResolution, newResolution) {
|
|
127471
|
+
if (oldResolution === newResolution) {
|
|
127472
|
+
return true;
|
|
127473
|
+
}
|
|
127474
|
+
if (!oldResolution || !newResolution) {
|
|
127475
|
+
return false;
|
|
127476
|
+
}
|
|
127477
|
+
const oldResult = getResolutionWithResolvedFileName(oldResolution);
|
|
127478
|
+
const newResult = getResolutionWithResolvedFileName(newResolution);
|
|
127479
|
+
if (oldResult === newResult) {
|
|
127480
|
+
return true;
|
|
127481
|
+
}
|
|
127482
|
+
if (!oldResult || !newResult) {
|
|
127483
|
+
return false;
|
|
127484
|
+
}
|
|
127485
|
+
return oldResult.resolvedFileName === newResult.resolvedFileName;
|
|
127486
|
+
}
|
|
128767
127487
|
}
|
|
128768
127488
|
function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
128769
127489
|
return resolveNamesWithLocalCache({
|
|
@@ -128774,7 +127494,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128774
127494
|
options,
|
|
128775
127495
|
reusedNames,
|
|
128776
127496
|
perFileCache: resolvedTypeReferenceDirectives,
|
|
128777
|
-
moduleOrTypeRefCache: typeReferenceDirectiveResolutionCache,
|
|
128778
127497
|
loader: createTypeReferenceResolutionLoader(
|
|
128779
127498
|
containingFile,
|
|
128780
127499
|
redirectedReference,
|
|
@@ -128782,10 +127501,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128782
127501
|
getModuleResolutionHost(resolutionHost),
|
|
128783
127502
|
typeReferenceDirectiveResolutionCache
|
|
128784
127503
|
),
|
|
128785
|
-
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirectiveFromResolution
|
|
127504
|
+
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirectiveFromResolution,
|
|
127505
|
+
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
127506
|
+
deferWatchingNonRelativeResolution: false
|
|
128786
127507
|
});
|
|
128787
127508
|
}
|
|
128788
|
-
function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames
|
|
127509
|
+
function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
128789
127510
|
return resolveNamesWithLocalCache({
|
|
128790
127511
|
entries: moduleLiterals,
|
|
128791
127512
|
containingFile,
|
|
@@ -128794,7 +127515,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128794
127515
|
options,
|
|
128795
127516
|
reusedNames,
|
|
128796
127517
|
perFileCache: resolvedModuleNames,
|
|
128797
|
-
moduleOrTypeRefCache: moduleResolutionCache,
|
|
128798
127518
|
loader: createModuleResolutionLoaderUsingGlobalCache(
|
|
128799
127519
|
containingFile,
|
|
128800
127520
|
redirectedReference,
|
|
@@ -128803,26 +127523,30 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128803
127523
|
moduleResolutionCache
|
|
128804
127524
|
),
|
|
128805
127525
|
getResolutionWithResolvedFileName: getResolvedModuleFromResolution,
|
|
128806
|
-
|
|
127526
|
+
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
127527
|
+
logChanges: logChangesWhenResolvingModule,
|
|
127528
|
+
deferWatchingNonRelativeResolution: true
|
|
127529
|
+
// Defer non relative resolution watch because we could be using ambient modules
|
|
128807
127530
|
});
|
|
128808
127531
|
}
|
|
128809
127532
|
function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
|
|
128810
127533
|
const host = getModuleResolutionHost(resolutionHost);
|
|
128811
127534
|
let resolution = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName);
|
|
128812
|
-
if (
|
|
127535
|
+
if (!resolution || resolution.isInvalidated) {
|
|
128813
127536
|
const existingResolution = resolution;
|
|
128814
127537
|
resolution = resolveLibrary(libraryName, resolveFrom, options, host, libraryResolutionCache);
|
|
128815
127538
|
const path = resolutionHost.toPath(resolveFrom);
|
|
128816
|
-
|
|
127539
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(
|
|
127540
|
+
libraryName,
|
|
128817
127541
|
resolution,
|
|
128818
127542
|
path,
|
|
128819
127543
|
getResolvedModuleFromResolution,
|
|
128820
|
-
/*
|
|
128821
|
-
|
|
127544
|
+
/*deferWatchingNonRelativeResolution*/
|
|
127545
|
+
false
|
|
128822
127546
|
);
|
|
128823
127547
|
resolvedLibraries.set(libFileName, resolution);
|
|
128824
127548
|
if (existingResolution) {
|
|
128825
|
-
stopWatchFailedLookupLocationOfResolution(existingResolution, path,
|
|
127549
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModuleFromResolution);
|
|
128826
127550
|
}
|
|
128827
127551
|
} else {
|
|
128828
127552
|
if (isTraceEnabled(options, host)) {
|
|
@@ -128848,7 +127572,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128848
127572
|
/*mode*/
|
|
128849
127573
|
void 0
|
|
128850
127574
|
);
|
|
128851
|
-
if (resolution && !
|
|
127575
|
+
if (resolution && !resolution.isInvalidated) return resolution;
|
|
128852
127576
|
const data = (_a = resolutionHost.beforeResolveSingleModuleNameWithoutWatching) == null ? void 0 : _a.call(resolutionHost, moduleResolutionCache);
|
|
128853
127577
|
const host = getModuleResolutionHost(resolutionHost);
|
|
128854
127578
|
const result = resolveModuleName(
|
|
@@ -128861,48 +127585,306 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128861
127585
|
(_b = resolutionHost.afterResolveSingleModuleNameWithoutWatching) == null ? void 0 : _b.call(resolutionHost, moduleResolutionCache, moduleName, containingFile, result, data);
|
|
128862
127586
|
return result;
|
|
128863
127587
|
}
|
|
128864
|
-
function
|
|
128865
|
-
|
|
128866
|
-
|
|
128867
|
-
|
|
128868
|
-
|
|
128869
|
-
|
|
127588
|
+
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
127589
|
+
return endsWith(dirPath, "/node_modules/@types");
|
|
127590
|
+
}
|
|
127591
|
+
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
|
|
127592
|
+
(resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
|
|
127593
|
+
if (resolution.files.size !== 1) return;
|
|
127594
|
+
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
127595
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
128870
127596
|
} else {
|
|
128871
|
-
|
|
128872
|
-
}
|
|
128873
|
-
|
|
128874
|
-
|
|
128875
|
-
|
|
128876
|
-
|
|
128877
|
-
|
|
128878
|
-
|
|
128879
|
-
|
|
128880
|
-
|
|
128881
|
-
|
|
128882
|
-
|
|
128883
|
-
|
|
128884
|
-
|
|
128885
|
-
|
|
128886
|
-
|
|
128887
|
-
|
|
128888
|
-
|
|
128889
|
-
|
|
128890
|
-
|
|
128891
|
-
|
|
128892
|
-
|
|
128893
|
-
|
|
127597
|
+
nonRelativeExternalModuleResolutions.add(resolution);
|
|
127598
|
+
}
|
|
127599
|
+
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
127600
|
+
if (resolved && resolved.resolvedFileName) {
|
|
127601
|
+
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
127602
|
+
let resolutions = resolvedFileToResolution.get(key);
|
|
127603
|
+
if (!resolutions) resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
|
|
127604
|
+
resolutions.add(resolution);
|
|
127605
|
+
}
|
|
127606
|
+
}
|
|
127607
|
+
function watchFailedLookupLocation(failedLookupLocation, setAtRoot) {
|
|
127608
|
+
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
127609
|
+
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
127610
|
+
failedLookupLocation,
|
|
127611
|
+
failedLookupLocationPath,
|
|
127612
|
+
rootDir,
|
|
127613
|
+
rootPath,
|
|
127614
|
+
rootPathComponents,
|
|
127615
|
+
isRootWatchable,
|
|
127616
|
+
getCurrentDirectory,
|
|
127617
|
+
resolutionHost.preferNonRecursiveWatch
|
|
127618
|
+
);
|
|
127619
|
+
if (toWatch) {
|
|
127620
|
+
const { dir, dirPath, nonRecursive, packageDir, packageDirPath } = toWatch;
|
|
127621
|
+
if (dirPath === rootPath) {
|
|
127622
|
+
Debug.assert(nonRecursive);
|
|
127623
|
+
Debug.assert(!packageDir);
|
|
127624
|
+
setAtRoot = true;
|
|
127625
|
+
} else {
|
|
127626
|
+
setDirectoryWatcher(dir, dirPath, packageDir, packageDirPath, nonRecursive);
|
|
127627
|
+
}
|
|
127628
|
+
}
|
|
127629
|
+
return setAtRoot;
|
|
127630
|
+
}
|
|
127631
|
+
function watchFailedLookupLocationOfResolution(resolution) {
|
|
127632
|
+
var _a;
|
|
127633
|
+
Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
127634
|
+
const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
|
|
127635
|
+
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !alternateResult) return;
|
|
127636
|
+
if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || alternateResult) resolutionsWithFailedLookups.add(resolution);
|
|
127637
|
+
let setAtRoot = false;
|
|
127638
|
+
if (failedLookupLocations) {
|
|
127639
|
+
for (const failedLookupLocation of failedLookupLocations) {
|
|
127640
|
+
setAtRoot = watchFailedLookupLocation(failedLookupLocation, setAtRoot);
|
|
127641
|
+
}
|
|
127642
|
+
}
|
|
127643
|
+
if (alternateResult) setAtRoot = watchFailedLookupLocation(alternateResult, setAtRoot);
|
|
127644
|
+
if (setAtRoot) {
|
|
127645
|
+
setDirectoryWatcher(
|
|
127646
|
+
rootDir,
|
|
127647
|
+
rootPath,
|
|
127648
|
+
/*packageDir*/
|
|
127649
|
+
void 0,
|
|
127650
|
+
/*packageDirPath*/
|
|
127651
|
+
void 0,
|
|
127652
|
+
/*nonRecursive*/
|
|
127653
|
+
true
|
|
127654
|
+
);
|
|
127655
|
+
}
|
|
127656
|
+
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !alternateResult);
|
|
127657
|
+
}
|
|
127658
|
+
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
127659
|
+
var _a;
|
|
127660
|
+
Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
127661
|
+
const { affectingLocations } = resolution;
|
|
127662
|
+
if (!(affectingLocations == null ? void 0 : affectingLocations.length)) return;
|
|
127663
|
+
if (addToResolutionsWithOnlyAffectingLocations) resolutionsWithOnlyAffectingLocations.add(resolution);
|
|
127664
|
+
for (const affectingLocation of affectingLocations) {
|
|
127665
|
+
createFileWatcherOfAffectingLocation(
|
|
127666
|
+
affectingLocation,
|
|
127667
|
+
/*forResolution*/
|
|
127668
|
+
true
|
|
127669
|
+
);
|
|
127670
|
+
}
|
|
127671
|
+
}
|
|
127672
|
+
function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
|
|
127673
|
+
const fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
127674
|
+
if (fileWatcher) {
|
|
127675
|
+
if (forResolution) fileWatcher.resolutions++;
|
|
127676
|
+
else fileWatcher.files++;
|
|
127677
|
+
return;
|
|
127678
|
+
}
|
|
127679
|
+
let locationToWatch = affectingLocation;
|
|
127680
|
+
let isSymlink = false;
|
|
127681
|
+
let symlinkWatcher;
|
|
127682
|
+
if (resolutionHost.realpath) {
|
|
127683
|
+
locationToWatch = resolutionHost.realpath(affectingLocation);
|
|
127684
|
+
if (affectingLocation !== locationToWatch) {
|
|
127685
|
+
isSymlink = true;
|
|
127686
|
+
symlinkWatcher = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
127687
|
+
}
|
|
127688
|
+
}
|
|
127689
|
+
const resolutions = forResolution ? 1 : 0;
|
|
127690
|
+
const files = forResolution ? 0 : 1;
|
|
127691
|
+
if (!isSymlink || !symlinkWatcher) {
|
|
127692
|
+
const watcher = {
|
|
127693
|
+
watcher: canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
|
|
127694
|
+
cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
|
|
127695
|
+
invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache().getInternalMap());
|
|
127696
|
+
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
127697
|
+
}) : noopFileWatcher,
|
|
127698
|
+
resolutions: isSymlink ? 0 : resolutions,
|
|
127699
|
+
files: isSymlink ? 0 : files,
|
|
127700
|
+
symlinks: void 0
|
|
127701
|
+
};
|
|
127702
|
+
fileWatchesOfAffectingLocations.set(locationToWatch, watcher);
|
|
127703
|
+
if (isSymlink) symlinkWatcher = watcher;
|
|
127704
|
+
}
|
|
127705
|
+
if (isSymlink) {
|
|
127706
|
+
Debug.assert(!!symlinkWatcher);
|
|
127707
|
+
const watcher = {
|
|
127708
|
+
watcher: {
|
|
127709
|
+
close: () => {
|
|
127710
|
+
var _a;
|
|
127711
|
+
const symlinkWatcher2 = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
127712
|
+
if (((_a = symlinkWatcher2 == null ? void 0 : symlinkWatcher2.symlinks) == null ? void 0 : _a.delete(affectingLocation)) && !symlinkWatcher2.symlinks.size && !symlinkWatcher2.resolutions && !symlinkWatcher2.files) {
|
|
127713
|
+
fileWatchesOfAffectingLocations.delete(locationToWatch);
|
|
127714
|
+
symlinkWatcher2.watcher.close();
|
|
127715
|
+
}
|
|
127716
|
+
}
|
|
127717
|
+
},
|
|
127718
|
+
resolutions,
|
|
127719
|
+
files,
|
|
127720
|
+
symlinks: void 0
|
|
127721
|
+
};
|
|
127722
|
+
fileWatchesOfAffectingLocations.set(affectingLocation, watcher);
|
|
127723
|
+
(symlinkWatcher.symlinks ?? (symlinkWatcher.symlinks = /* @__PURE__ */ new Set())).add(affectingLocation);
|
|
127724
|
+
}
|
|
127725
|
+
}
|
|
127726
|
+
function invalidateAffectingFileWatcher(path, packageJsonMap) {
|
|
127727
|
+
var _a;
|
|
127728
|
+
const watcher = fileWatchesOfAffectingLocations.get(path);
|
|
127729
|
+
if (watcher == null ? void 0 : watcher.resolutions) (affectingPathChecks ?? (affectingPathChecks = /* @__PURE__ */ new Set())).add(path);
|
|
127730
|
+
if (watcher == null ? void 0 : watcher.files) (affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path);
|
|
127731
|
+
(_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
|
|
127732
|
+
packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
|
|
127733
|
+
}
|
|
127734
|
+
function watchFailedLookupLocationOfNonRelativeModuleResolutions() {
|
|
127735
|
+
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfResolution);
|
|
127736
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
127737
|
+
}
|
|
127738
|
+
function createDirectoryWatcherForPackageDir(dir, dirPath, packageDir, packageDirPath, nonRecursive) {
|
|
127739
|
+
Debug.assert(!nonRecursive);
|
|
127740
|
+
let isSymlink = isSymlinkCache.get(packageDirPath);
|
|
127741
|
+
let packageDirWatcher = packageDirWatchers.get(packageDirPath);
|
|
127742
|
+
if (isSymlink === void 0) {
|
|
127743
|
+
const realPath2 = resolutionHost.realpath(packageDir);
|
|
127744
|
+
isSymlink = realPath2 !== packageDir && resolutionHost.toPath(realPath2) !== packageDirPath;
|
|
127745
|
+
isSymlinkCache.set(packageDirPath, isSymlink);
|
|
127746
|
+
if (!packageDirWatcher) {
|
|
127747
|
+
packageDirWatchers.set(
|
|
127748
|
+
packageDirPath,
|
|
127749
|
+
packageDirWatcher = {
|
|
127750
|
+
dirPathToWatcher: /* @__PURE__ */ new Map(),
|
|
127751
|
+
isSymlink
|
|
127752
|
+
}
|
|
127753
|
+
);
|
|
127754
|
+
} else if (packageDirWatcher.isSymlink !== isSymlink) {
|
|
127755
|
+
packageDirWatcher.dirPathToWatcher.forEach((watcher) => {
|
|
127756
|
+
removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath);
|
|
127757
|
+
watcher.watcher = createDirPathToWatcher();
|
|
127758
|
+
});
|
|
127759
|
+
packageDirWatcher.isSymlink = isSymlink;
|
|
127760
|
+
}
|
|
127761
|
+
} else {
|
|
127762
|
+
Debug.assertIsDefined(packageDirWatcher);
|
|
127763
|
+
Debug.assert(isSymlink === packageDirWatcher.isSymlink);
|
|
127764
|
+
}
|
|
127765
|
+
const forDirPath = packageDirWatcher.dirPathToWatcher.get(dirPath);
|
|
127766
|
+
if (forDirPath) {
|
|
127767
|
+
forDirPath.refCount++;
|
|
127768
|
+
} else {
|
|
127769
|
+
packageDirWatcher.dirPathToWatcher.set(dirPath, {
|
|
127770
|
+
watcher: createDirPathToWatcher(),
|
|
127771
|
+
refCount: 1
|
|
127772
|
+
});
|
|
127773
|
+
if (isSymlink) dirPathToSymlinkPackageRefCount.set(dirPath, (dirPathToSymlinkPackageRefCount.get(dirPath) ?? 0) + 1);
|
|
127774
|
+
}
|
|
127775
|
+
function createDirPathToWatcher() {
|
|
127776
|
+
return isSymlink ? createOrAddRefToDirectoryWatchOfFailedLookups(packageDir, packageDirPath, nonRecursive) : createOrAddRefToDirectoryWatchOfFailedLookups(dir, dirPath, nonRecursive);
|
|
127777
|
+
}
|
|
127778
|
+
}
|
|
127779
|
+
function setDirectoryWatcher(dir, dirPath, packageDir, packageDirPath, nonRecursive) {
|
|
127780
|
+
if (!packageDirPath || !resolutionHost.realpath) {
|
|
127781
|
+
createOrAddRefToDirectoryWatchOfFailedLookups(dir, dirPath, nonRecursive);
|
|
127782
|
+
} else {
|
|
127783
|
+
createDirectoryWatcherForPackageDir(dir, dirPath, packageDir, packageDirPath, nonRecursive);
|
|
127784
|
+
}
|
|
127785
|
+
}
|
|
127786
|
+
function createOrAddRefToDirectoryWatchOfFailedLookups(dir, dirPath, nonRecursive) {
|
|
127787
|
+
let dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
127788
|
+
if (dirWatcher) {
|
|
127789
|
+
Debug.assert(!!nonRecursive === !!dirWatcher.nonRecursive);
|
|
127790
|
+
dirWatcher.refCount++;
|
|
127791
|
+
} else {
|
|
127792
|
+
directoryWatchesOfFailedLookups.set(dirPath, dirWatcher = { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
|
|
127793
|
+
}
|
|
127794
|
+
return dirWatcher;
|
|
127795
|
+
}
|
|
127796
|
+
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) {
|
|
127797
|
+
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
127798
|
+
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
127799
|
+
failedLookupLocation,
|
|
127800
|
+
failedLookupLocationPath,
|
|
127801
|
+
rootDir,
|
|
127802
|
+
rootPath,
|
|
127803
|
+
rootPathComponents,
|
|
127804
|
+
isRootWatchable,
|
|
127805
|
+
getCurrentDirectory,
|
|
127806
|
+
resolutionHost.preferNonRecursiveWatch
|
|
127807
|
+
);
|
|
127808
|
+
if (toWatch) {
|
|
127809
|
+
const { dirPath, packageDirPath } = toWatch;
|
|
127810
|
+
if (dirPath === rootPath) {
|
|
127811
|
+
removeAtRoot = true;
|
|
127812
|
+
} else if (packageDirPath && resolutionHost.realpath) {
|
|
127813
|
+
const packageDirWatcher = packageDirWatchers.get(packageDirPath);
|
|
127814
|
+
const forDirPath = packageDirWatcher.dirPathToWatcher.get(dirPath);
|
|
127815
|
+
forDirPath.refCount--;
|
|
127816
|
+
if (forDirPath.refCount === 0) {
|
|
127817
|
+
removeDirectoryWatcher(packageDirWatcher.isSymlink ? packageDirPath : dirPath);
|
|
127818
|
+
packageDirWatcher.dirPathToWatcher.delete(dirPath);
|
|
127819
|
+
if (packageDirWatcher.isSymlink) {
|
|
127820
|
+
const refCount = dirPathToSymlinkPackageRefCount.get(dirPath) - 1;
|
|
127821
|
+
if (refCount === 0) {
|
|
127822
|
+
dirPathToSymlinkPackageRefCount.delete(dirPath);
|
|
127823
|
+
} else {
|
|
127824
|
+
dirPathToSymlinkPackageRefCount.set(dirPath, refCount);
|
|
127825
|
+
}
|
|
127826
|
+
}
|
|
127827
|
+
}
|
|
127828
|
+
} else {
|
|
127829
|
+
removeDirectoryWatcher(dirPath);
|
|
127830
|
+
}
|
|
127831
|
+
}
|
|
127832
|
+
return removeAtRoot;
|
|
128894
127833
|
}
|
|
128895
|
-
function
|
|
128896
|
-
|
|
127834
|
+
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
127835
|
+
Debug.checkDefined(resolution.files).delete(filePath);
|
|
127836
|
+
if (resolution.files.size) return;
|
|
127837
|
+
resolution.files = void 0;
|
|
127838
|
+
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
127839
|
+
if (resolved && resolved.resolvedFileName) {
|
|
127840
|
+
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
127841
|
+
const resolutions = resolvedFileToResolution.get(key);
|
|
127842
|
+
if ((resolutions == null ? void 0 : resolutions.delete(resolution)) && !resolutions.size) resolvedFileToResolution.delete(key);
|
|
127843
|
+
}
|
|
127844
|
+
const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
|
|
127845
|
+
if (resolutionsWithFailedLookups.delete(resolution)) {
|
|
127846
|
+
let removeAtRoot = false;
|
|
127847
|
+
if (failedLookupLocations) {
|
|
127848
|
+
for (const failedLookupLocation of failedLookupLocations) {
|
|
127849
|
+
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
|
|
127850
|
+
}
|
|
127851
|
+
}
|
|
127852
|
+
if (alternateResult) removeAtRoot = stopWatchFailedLookupLocation(alternateResult, removeAtRoot);
|
|
127853
|
+
if (removeAtRoot) removeDirectoryWatcher(rootPath);
|
|
127854
|
+
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
127855
|
+
resolutionsWithOnlyAffectingLocations.delete(resolution);
|
|
127856
|
+
}
|
|
127857
|
+
if (affectingLocations) {
|
|
127858
|
+
for (const affectingLocation of affectingLocations) {
|
|
127859
|
+
const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
127860
|
+
watcher.resolutions--;
|
|
127861
|
+
}
|
|
127862
|
+
}
|
|
127863
|
+
}
|
|
127864
|
+
function removeDirectoryWatcher(dirPath) {
|
|
127865
|
+
const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
127866
|
+
dirWatcher.refCount--;
|
|
127867
|
+
}
|
|
127868
|
+
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
127869
|
+
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, (fileOrDirectory) => {
|
|
127870
|
+
const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
|
|
127871
|
+
if (cachedDirectoryStructureHost) {
|
|
127872
|
+
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
127873
|
+
}
|
|
127874
|
+
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
127875
|
+
}, nonRecursive ? 0 /* None */ : 1 /* Recursive */);
|
|
127876
|
+
}
|
|
127877
|
+
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) {
|
|
127878
|
+
const resolutions = cache.get(filePath);
|
|
128897
127879
|
if (resolutions) {
|
|
128898
127880
|
resolutions.forEach(
|
|
128899
127881
|
(resolution) => stopWatchFailedLookupLocationOfResolution(
|
|
128900
127882
|
resolution,
|
|
128901
127883
|
filePath,
|
|
128902
|
-
|
|
127884
|
+
getResolutionWithResolvedFileName
|
|
128903
127885
|
)
|
|
128904
127886
|
);
|
|
128905
|
-
|
|
127887
|
+
cache.delete(filePath);
|
|
128906
127888
|
}
|
|
128907
127889
|
}
|
|
128908
127890
|
function removeResolutionsFromProjectReferenceRedirects(filePath) {
|
|
@@ -128914,62 +127896,149 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128914
127896
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
128915
127897
|
}
|
|
128916
127898
|
function removeResolutionsOfFile(filePath) {
|
|
128917
|
-
|
|
128918
|
-
|
|
128919
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, typeReferenceDirectiveResolutionCache);
|
|
128920
|
-
} else {
|
|
128921
|
-
(pendingRemoveResolutionsOfFile ?? (pendingRemoveResolutionsOfFile = /* @__PURE__ */ new Set())).add(filePath);
|
|
128922
|
-
}
|
|
127899
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleFromResolution);
|
|
127900
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveFromResolution);
|
|
128923
127901
|
}
|
|
128924
|
-
function
|
|
128925
|
-
|
|
128926
|
-
|
|
128927
|
-
|
|
128928
|
-
|
|
128929
|
-
|
|
127902
|
+
function invalidateResolutions(resolutions, canInvalidate) {
|
|
127903
|
+
if (!resolutions) return false;
|
|
127904
|
+
let invalidated = false;
|
|
127905
|
+
resolutions.forEach((resolution) => {
|
|
127906
|
+
if (resolution.isInvalidated || !canInvalidate(resolution)) return;
|
|
127907
|
+
resolution.isInvalidated = invalidated = true;
|
|
127908
|
+
for (const containingFilePath of Debug.checkDefined(resolution.files)) {
|
|
127909
|
+
(filesWithInvalidatedResolutions ?? (filesWithInvalidatedResolutions = /* @__PURE__ */ new Set())).add(containingFilePath);
|
|
127910
|
+
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || endsWith(containingFilePath, inferredTypesContainingFile);
|
|
127911
|
+
}
|
|
127912
|
+
});
|
|
127913
|
+
return invalidated;
|
|
128930
127914
|
}
|
|
128931
127915
|
function invalidateResolutionOfFile(filePath) {
|
|
128932
127916
|
removeResolutionsOfFile(filePath);
|
|
128933
127917
|
const prevHasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
128934
|
-
if (
|
|
127918
|
+
if (invalidateResolutions(resolvedFileToResolution.get(filePath), returnTrue) && hasChangedAutomaticTypeDirectiveNames && !prevHasChangedAutomaticTypeDirectiveNames) {
|
|
128935
127919
|
resolutionHost.onChangedAutomaticTypeDirectiveNames();
|
|
128936
127920
|
}
|
|
128937
127921
|
}
|
|
128938
|
-
function
|
|
128939
|
-
|
|
127922
|
+
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
|
|
127923
|
+
Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === void 0);
|
|
127924
|
+
filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
|
|
128940
127925
|
}
|
|
128941
|
-
function
|
|
128942
|
-
if (
|
|
127926
|
+
function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) {
|
|
127927
|
+
if (isCreatingWatchedDirectory) {
|
|
127928
|
+
(isInDirectoryChecks || (isInDirectoryChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
127929
|
+
} else {
|
|
127930
|
+
const updatedPath = removeIgnoredPath(fileOrDirectoryPath);
|
|
127931
|
+
if (!updatedPath) return false;
|
|
127932
|
+
fileOrDirectoryPath = updatedPath;
|
|
127933
|
+
if (resolutionHost.fileIsOpen(fileOrDirectoryPath)) {
|
|
127934
|
+
return false;
|
|
127935
|
+
}
|
|
127936
|
+
const dirOfFileOrDirectory = getDirectoryPath(fileOrDirectoryPath);
|
|
127937
|
+
if (isNodeModulesAtTypesDirectory(fileOrDirectoryPath) || isNodeModulesDirectory(fileOrDirectoryPath) || isNodeModulesAtTypesDirectory(dirOfFileOrDirectory) || isNodeModulesDirectory(dirOfFileOrDirectory)) {
|
|
127938
|
+
(failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
127939
|
+
(startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
127940
|
+
} else {
|
|
127941
|
+
if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
|
|
127942
|
+
return false;
|
|
127943
|
+
}
|
|
127944
|
+
if (fileExtensionIs(fileOrDirectoryPath, ".map")) {
|
|
127945
|
+
return false;
|
|
127946
|
+
}
|
|
127947
|
+
(failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
127948
|
+
(startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
127949
|
+
const packagePath = parseNodeModuleFromPath(
|
|
127950
|
+
fileOrDirectoryPath,
|
|
127951
|
+
/*isFolder*/
|
|
127952
|
+
true
|
|
127953
|
+
);
|
|
127954
|
+
if (packagePath) (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(packagePath);
|
|
127955
|
+
}
|
|
127956
|
+
}
|
|
127957
|
+
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
128943
127958
|
}
|
|
128944
|
-
function
|
|
128945
|
-
|
|
127959
|
+
function invalidatePackageJsonMap() {
|
|
127960
|
+
const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
127961
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
127962
|
+
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
127963
|
+
}
|
|
128946
127964
|
}
|
|
128947
127965
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
128948
127966
|
var _a;
|
|
128949
|
-
|
|
128950
|
-
|
|
127967
|
+
if (allModuleAndTypeResolutionsAreInvalidated) {
|
|
127968
|
+
affectingPathChecksForFile = void 0;
|
|
127969
|
+
invalidatePackageJsonMap();
|
|
127970
|
+
if (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks || affectingPathChecks) {
|
|
127971
|
+
invalidateResolutions(resolvedLibraries, canInvalidateFailedLookupResolution);
|
|
127972
|
+
}
|
|
127973
|
+
failedLookupChecks = void 0;
|
|
127974
|
+
startsWithPathChecks = void 0;
|
|
127975
|
+
isInDirectoryChecks = void 0;
|
|
127976
|
+
affectingPathChecks = void 0;
|
|
127977
|
+
return true;
|
|
127978
|
+
}
|
|
127979
|
+
let invalidated = false;
|
|
127980
|
+
if (affectingPathChecksForFile) {
|
|
128951
127981
|
(_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
|
|
128952
127982
|
if (some(f.packageJsonLocations, (location) => affectingPathChecksForFile.has(location))) {
|
|
128953
127983
|
(filesWithInvalidatedResolutions ?? (filesWithInvalidatedResolutions = /* @__PURE__ */ new Set())).add(f.path);
|
|
128954
127984
|
invalidated = true;
|
|
128955
127985
|
}
|
|
128956
127986
|
});
|
|
127987
|
+
affectingPathChecksForFile = void 0;
|
|
128957
127988
|
}
|
|
128958
|
-
|
|
128959
|
-
|
|
127989
|
+
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) {
|
|
127990
|
+
return invalidated;
|
|
127991
|
+
}
|
|
127992
|
+
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
127993
|
+
invalidatePackageJsonMap();
|
|
127994
|
+
failedLookupChecks = void 0;
|
|
127995
|
+
startsWithPathChecks = void 0;
|
|
127996
|
+
isInDirectoryChecks = void 0;
|
|
127997
|
+
invalidated = invalidateResolutions(resolutionsWithOnlyAffectingLocations, canInvalidatedFailedLookupResolutionWithAffectingLocation) || invalidated;
|
|
127998
|
+
affectingPathChecks = void 0;
|
|
127999
|
+
return invalidated;
|
|
128000
|
+
}
|
|
128001
|
+
function canInvalidateFailedLookupResolution(resolution) {
|
|
128002
|
+
var _a;
|
|
128003
|
+
if (canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution)) return true;
|
|
128004
|
+
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks) return false;
|
|
128005
|
+
return ((_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)))) || !!resolution.alternateResult && isInvalidatedFailedLookup(resolutionHost.toPath(resolution.alternateResult));
|
|
128006
|
+
}
|
|
128007
|
+
function isInvalidatedFailedLookup(locationPath) {
|
|
128008
|
+
return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (dirPath) => locationPath.length > dirPath.length && startsWith(locationPath, dirPath) && (isDiskPathRoot(dirPath) || locationPath[dirPath.length] === directorySeparator) ? true : void 0);
|
|
128009
|
+
}
|
|
128010
|
+
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
128011
|
+
var _a;
|
|
128012
|
+
return !!affectingPathChecks && ((_a = resolution.affectingLocations) == null ? void 0 : _a.some((location) => affectingPathChecks.has(location)));
|
|
128960
128013
|
}
|
|
128961
128014
|
function closeTypeRootsWatch() {
|
|
128962
128015
|
clearMap(typeRootsWatches, closeFileWatcher);
|
|
128963
128016
|
}
|
|
128964
128017
|
function createTypeRootsWatch(typeRoot) {
|
|
128965
|
-
return
|
|
128966
|
-
|
|
128967
|
-
|
|
128968
|
-
|
|
128969
|
-
|
|
128018
|
+
return canWatchTypeRootPath(typeRoot) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
128019
|
+
const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
|
|
128020
|
+
if (cachedDirectoryStructureHost) {
|
|
128021
|
+
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
128022
|
+
}
|
|
128023
|
+
hasChangedAutomaticTypeDirectiveNames = true;
|
|
128024
|
+
resolutionHost.onChangedAutomaticTypeDirectiveNames();
|
|
128025
|
+
const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(
|
|
128026
|
+
typeRoot,
|
|
128027
|
+
resolutionHost.toPath(typeRoot),
|
|
128028
|
+
rootPath,
|
|
128029
|
+
rootPathComponents,
|
|
128030
|
+
isRootWatchable,
|
|
128031
|
+
getCurrentDirectory,
|
|
128032
|
+
resolutionHost.preferNonRecursiveWatch,
|
|
128033
|
+
(dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2) || dirPathToSymlinkPackageRefCount.has(dirPath2)
|
|
128034
|
+
);
|
|
128035
|
+
if (dirPath) {
|
|
128036
|
+
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
128037
|
+
}
|
|
128038
|
+
}, 1 /* Recursive */) : noopFileWatcher;
|
|
128970
128039
|
}
|
|
128971
|
-
function updateTypeRootsWatch(
|
|
128972
|
-
|
|
128040
|
+
function updateTypeRootsWatch() {
|
|
128041
|
+
const options = resolutionHost.getCompilationSettings();
|
|
128973
128042
|
if (options.types) {
|
|
128974
128043
|
closeTypeRootsWatch();
|
|
128975
128044
|
return;
|
|
@@ -128988,6 +128057,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, sharedCache
|
|
|
128988
128057
|
closeTypeRootsWatch();
|
|
128989
128058
|
}
|
|
128990
128059
|
}
|
|
128060
|
+
function canWatchTypeRootPath(typeRoot) {
|
|
128061
|
+
if (resolutionHost.getCompilationSettings().typeRoots) return true;
|
|
128062
|
+
return canWatchAtTypes(resolutionHost.toPath(typeRoot));
|
|
128063
|
+
}
|
|
128991
128064
|
}
|
|
128992
128065
|
function resolutionIsSymlink(resolution) {
|
|
128993
128066
|
var _a, _b;
|
|
@@ -129755,23 +128828,22 @@ function createWatchProgram(host) {
|
|
|
129755
128828
|
compilerHost.getParsedCommandLine = getParsedCommandLine;
|
|
129756
128829
|
const resolutionCache = createResolutionCache(
|
|
129757
128830
|
compilerHost,
|
|
129758
|
-
configFileName ? getDirectoryPath(getNormalizedAbsolutePath(configFileName, currentDirectory)) : currentDirectory
|
|
128831
|
+
configFileName ? getDirectoryPath(getNormalizedAbsolutePath(configFileName, currentDirectory)) : currentDirectory,
|
|
128832
|
+
/*logChangesWhenResolvingModule*/
|
|
128833
|
+
false
|
|
129759
128834
|
);
|
|
129760
|
-
compilerHost.onSourceFileNotCreated = resolutionCache.onSourceFileNotCreated.bind(resolutionCache);
|
|
129761
128835
|
compilerHost.resolveModuleNameLiterals = maybeBind(host, host.resolveModuleNameLiterals);
|
|
129762
128836
|
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
129763
128837
|
if (!compilerHost.resolveModuleNameLiterals && !compilerHost.resolveModuleNames) {
|
|
129764
128838
|
compilerHost.resolveModuleNameLiterals = resolutionCache.resolveModuleNameLiterals.bind(resolutionCache);
|
|
129765
|
-
compilerHost.onReusedModuleResolutions = resolutionCache.onReusedModuleResolutions.bind(resolutionCache);
|
|
129766
128839
|
}
|
|
129767
128840
|
compilerHost.resolveTypeReferenceDirectiveReferences = maybeBind(host, host.resolveTypeReferenceDirectiveReferences);
|
|
129768
128841
|
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
129769
128842
|
if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) {
|
|
129770
128843
|
compilerHost.resolveTypeReferenceDirectiveReferences = resolutionCache.resolveTypeReferenceDirectiveReferences.bind(resolutionCache);
|
|
129771
|
-
compilerHost.onReusedTypeReferenceDirectiveResolutions = resolutionCache.onReusedTypeReferenceDirectiveResolutions.bind(resolutionCache);
|
|
129772
128844
|
}
|
|
129773
128845
|
compilerHost.resolveLibrary = !host.resolveLibrary ? resolutionCache.resolveLibrary.bind(resolutionCache) : host.resolveLibrary.bind(host);
|
|
129774
|
-
compilerHost.getModuleResolutionCache = host.resolveModuleNameLiterals || host.resolveModuleNames ? maybeBind(host, host.getModuleResolutionCache) : () => resolutionCache.
|
|
128846
|
+
compilerHost.getModuleResolutionCache = host.resolveModuleNameLiterals || host.resolveModuleNames ? maybeBind(host, host.getModuleResolutionCache) : () => resolutionCache.getModuleResolutionCache();
|
|
129775
128847
|
const userProvidedResolution = !!host.resolveModuleNameLiterals || !!host.resolveTypeReferenceDirectiveReferences || !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
129776
128848
|
const customHasInvalidatedResolutions = userProvidedResolution ? maybeBind(host, host.hasInvalidatedResolutions) || returnTrue : returnFalse;
|
|
129777
128849
|
const customHasInvalidLibResolutions = host.resolveLibrary ? maybeBind(host, host.hasInvalidatedLibResolutions) || returnTrue : returnFalse;
|