typescript 5.4.0-dev.20231126 → 5.4.0-dev.20231128
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 +200 -160
- package/lib/tsserver.js +350 -289
- package/lib/typescript.js +349 -288
- package/lib/typingsInstaller.js +11 -7
- package/package.json +3 -3
package/lib/tsserver.js
CHANGED
|
@@ -1643,6 +1643,7 @@ __export(server_exports, {
|
|
|
1643
1643
|
isOuterExpression: () => isOuterExpression,
|
|
1644
1644
|
isOutermostOptionalChain: () => isOutermostOptionalChain,
|
|
1645
1645
|
isOverrideModifier: () => isOverrideModifier,
|
|
1646
|
+
isPackageJsonInfo: () => isPackageJsonInfo,
|
|
1646
1647
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
1647
1648
|
isParameter: () => isParameter,
|
|
1648
1649
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
@@ -2294,7 +2295,6 @@ __export(server_exports, {
|
|
|
2294
2295
|
updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
|
|
2295
2296
|
updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
|
|
2296
2297
|
updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
|
|
2297
|
-
updatePackageJsonWatch: () => updatePackageJsonWatch,
|
|
2298
2298
|
updateResolutionField: () => updateResolutionField,
|
|
2299
2299
|
updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher,
|
|
2300
2300
|
updateSourceFile: () => updateSourceFile,
|
|
@@ -2331,7 +2331,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2331
2331
|
|
|
2332
2332
|
// src/compiler/corePublic.ts
|
|
2333
2333
|
var versionMajorMinor = "5.4";
|
|
2334
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2334
|
+
var version = `${versionMajorMinor}.0-dev.20231128`;
|
|
2335
2335
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2336
2336
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2337
2337
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -20031,19 +20031,19 @@ function clearMap(map2, onDeleteValue) {
|
|
|
20031
20031
|
function mutateMapSkippingNewValues(map2, newMap, options) {
|
|
20032
20032
|
const { onDeleteValue, onExistingValue } = options;
|
|
20033
20033
|
map2.forEach((existingValue, key) => {
|
|
20034
|
-
|
|
20035
|
-
if (
|
|
20034
|
+
var _a;
|
|
20035
|
+
if (!(newMap == null ? void 0 : newMap.has(key))) {
|
|
20036
20036
|
map2.delete(key);
|
|
20037
20037
|
onDeleteValue(existingValue, key);
|
|
20038
20038
|
} else if (onExistingValue) {
|
|
20039
|
-
onExistingValue(existingValue,
|
|
20039
|
+
onExistingValue(existingValue, (_a = newMap.get) == null ? void 0 : _a.call(newMap, key), key);
|
|
20040
20040
|
}
|
|
20041
20041
|
});
|
|
20042
20042
|
}
|
|
20043
20043
|
function mutateMap(map2, newMap, options) {
|
|
20044
20044
|
mutateMapSkippingNewValues(map2, newMap, options);
|
|
20045
20045
|
const { createNewValue } = options;
|
|
20046
|
-
newMap.forEach((valueInNewMap, key) => {
|
|
20046
|
+
newMap == null ? void 0 : newMap.forEach((valueInNewMap, key) => {
|
|
20047
20047
|
if (!map2.has(key)) {
|
|
20048
20048
|
map2.set(key, createNewValue(key, valueInNewMap));
|
|
20049
20049
|
}
|
|
@@ -35640,8 +35640,9 @@ var Parser;
|
|
|
35640
35640
|
function nextTokenIsStringLiteral() {
|
|
35641
35641
|
return nextToken() === 11 /* StringLiteral */;
|
|
35642
35642
|
}
|
|
35643
|
-
function
|
|
35644
|
-
|
|
35643
|
+
function nextTokenIsFromKeywordOrEqualsToken() {
|
|
35644
|
+
nextToken();
|
|
35645
|
+
return token() === 161 /* FromKeyword */ || token() === 64 /* EqualsToken */;
|
|
35645
35646
|
}
|
|
35646
35647
|
function nextTokenIsIdentifierOrStringLiteralOnSameLine() {
|
|
35647
35648
|
nextToken();
|
|
@@ -36338,7 +36339,7 @@ var Parser;
|
|
|
36338
36339
|
identifier = parseIdentifier();
|
|
36339
36340
|
}
|
|
36340
36341
|
let isTypeOnly = false;
|
|
36341
|
-
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(
|
|
36342
|
+
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(nextTokenIsFromKeywordOrEqualsToken)) && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) {
|
|
36342
36343
|
isTypeOnly = true;
|
|
36343
36344
|
identifier = isIdentifier2() ? parseIdentifier() : void 0;
|
|
36344
36345
|
}
|
|
@@ -41244,34 +41245,39 @@ function specToDiagnostic(spec, disallowTrailingRecursion) {
|
|
|
41244
41245
|
return [Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
|
|
41245
41246
|
}
|
|
41246
41247
|
}
|
|
41247
|
-
function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude },
|
|
41248
|
-
const rawExcludeRegex = getRegularExpressionForWildcard(exclude,
|
|
41248
|
+
function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, basePath, useCaseSensitiveFileNames2) {
|
|
41249
|
+
const rawExcludeRegex = getRegularExpressionForWildcard(exclude, basePath, "exclude");
|
|
41249
41250
|
const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames2 ? "" : "i");
|
|
41250
41251
|
const wildcardDirectories = {};
|
|
41252
|
+
const wildCardKeyToPath = /* @__PURE__ */ new Map();
|
|
41251
41253
|
if (include !== void 0) {
|
|
41252
41254
|
const recursiveKeys = [];
|
|
41253
41255
|
for (const file of include) {
|
|
41254
|
-
const spec = normalizePath(combinePaths(
|
|
41256
|
+
const spec = normalizePath(combinePaths(basePath, file));
|
|
41255
41257
|
if (excludeRegex && excludeRegex.test(spec)) {
|
|
41256
41258
|
continue;
|
|
41257
41259
|
}
|
|
41258
41260
|
const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
|
|
41259
41261
|
if (match) {
|
|
41260
|
-
const { key, flags } = match;
|
|
41261
|
-
const
|
|
41262
|
+
const { key, path, flags } = match;
|
|
41263
|
+
const existingPath = wildCardKeyToPath.get(key);
|
|
41264
|
+
const existingFlags = existingPath !== void 0 ? wildcardDirectories[existingPath] : void 0;
|
|
41262
41265
|
if (existingFlags === void 0 || existingFlags < flags) {
|
|
41263
|
-
wildcardDirectories[
|
|
41266
|
+
wildcardDirectories[existingPath !== void 0 ? existingPath : path] = flags;
|
|
41267
|
+
if (existingPath === void 0)
|
|
41268
|
+
wildCardKeyToPath.set(key, path);
|
|
41264
41269
|
if (flags === 1 /* Recursive */) {
|
|
41265
41270
|
recursiveKeys.push(key);
|
|
41266
41271
|
}
|
|
41267
41272
|
}
|
|
41268
41273
|
}
|
|
41269
41274
|
}
|
|
41270
|
-
for (const
|
|
41271
|
-
if (hasProperty(wildcardDirectories,
|
|
41275
|
+
for (const path in wildcardDirectories) {
|
|
41276
|
+
if (hasProperty(wildcardDirectories, path)) {
|
|
41272
41277
|
for (const recursiveKey of recursiveKeys) {
|
|
41273
|
-
|
|
41274
|
-
|
|
41278
|
+
const key = toCanonicalKey(path, useCaseSensitiveFileNames2);
|
|
41279
|
+
if (key !== recursiveKey && containsPath(recursiveKey, key, basePath, !useCaseSensitiveFileNames2)) {
|
|
41280
|
+
delete wildcardDirectories[path];
|
|
41275
41281
|
}
|
|
41276
41282
|
}
|
|
41277
41283
|
}
|
|
@@ -41279,6 +41285,9 @@ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExclu
|
|
|
41279
41285
|
}
|
|
41280
41286
|
return wildcardDirectories;
|
|
41281
41287
|
}
|
|
41288
|
+
function toCanonicalKey(path, useCaseSensitiveFileNames2) {
|
|
41289
|
+
return useCaseSensitiveFileNames2 ? path : toFileNameLowerCase(path);
|
|
41290
|
+
}
|
|
41282
41291
|
function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
|
|
41283
41292
|
const match = wildcardDirectoryPattern.exec(spec);
|
|
41284
41293
|
if (match) {
|
|
@@ -41286,13 +41295,16 @@ function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
|
|
|
41286
41295
|
const starWildcardIndex = spec.indexOf("*");
|
|
41287
41296
|
const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator);
|
|
41288
41297
|
return {
|
|
41289
|
-
key:
|
|
41298
|
+
key: toCanonicalKey(match[0], useCaseSensitiveFileNames2),
|
|
41299
|
+
path: match[0],
|
|
41290
41300
|
flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 /* Recursive */ : 0 /* None */
|
|
41291
41301
|
};
|
|
41292
41302
|
}
|
|
41293
41303
|
if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) {
|
|
41304
|
+
const path = removeTrailingDirectorySeparator(spec);
|
|
41294
41305
|
return {
|
|
41295
|
-
key:
|
|
41306
|
+
key: toCanonicalKey(path, useCaseSensitiveFileNames2),
|
|
41307
|
+
path,
|
|
41296
41308
|
flags: 1 /* Recursive */
|
|
41297
41309
|
};
|
|
41298
41310
|
}
|
|
@@ -41935,6 +41947,9 @@ function getAutomaticTypeDirectiveNames(options, host) {
|
|
|
41935
41947
|
}
|
|
41936
41948
|
return result;
|
|
41937
41949
|
}
|
|
41950
|
+
function isPackageJsonInfo(entry) {
|
|
41951
|
+
return !!(entry == null ? void 0 : entry.contents);
|
|
41952
|
+
}
|
|
41938
41953
|
function compilerOptionValueToString(value) {
|
|
41939
41954
|
var _a;
|
|
41940
41955
|
if (value === null || typeof value !== "object") {
|
|
@@ -42039,7 +42054,7 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
|
|
|
42039
42054
|
}
|
|
42040
42055
|
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
42041
42056
|
let cache;
|
|
42042
|
-
return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2,
|
|
42057
|
+
return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2, getInternalMap };
|
|
42043
42058
|
function getPackageJsonInfo2(packageJsonPath) {
|
|
42044
42059
|
return cache == null ? void 0 : cache.get(toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
|
|
42045
42060
|
}
|
|
@@ -42049,10 +42064,6 @@ function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
|
42049
42064
|
function clear2() {
|
|
42050
42065
|
cache = void 0;
|
|
42051
42066
|
}
|
|
42052
|
-
function entries() {
|
|
42053
|
-
const iter = cache == null ? void 0 : cache.entries();
|
|
42054
|
-
return iter ? arrayFrom(iter) : [];
|
|
42055
|
-
}
|
|
42056
42067
|
function getInternalMap() {
|
|
42057
42068
|
return cache;
|
|
42058
42069
|
}
|
|
@@ -43069,13 +43080,13 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
43069
43080
|
}
|
|
43070
43081
|
const existing = (_b = state.packageJsonInfoCache) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
43071
43082
|
if (existing !== void 0) {
|
|
43072
|
-
if (
|
|
43083
|
+
if (isPackageJsonInfo(existing)) {
|
|
43073
43084
|
if (traceEnabled)
|
|
43074
43085
|
trace(host, Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
|
|
43075
43086
|
(_c = state.affectingLocations) == null ? void 0 : _c.push(packageJsonPath);
|
|
43076
43087
|
return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents };
|
|
43077
43088
|
} else {
|
|
43078
|
-
if (existing && traceEnabled)
|
|
43089
|
+
if (existing.directoryExists && traceEnabled)
|
|
43079
43090
|
trace(host, Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath);
|
|
43080
43091
|
(_d = state.failedLookupLocations) == null ? void 0 : _d.push(packageJsonPath);
|
|
43081
43092
|
return void 0;
|
|
@@ -43097,7 +43108,7 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
43097
43108
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
43098
43109
|
}
|
|
43099
43110
|
if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
|
|
43100
|
-
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, directoryExists);
|
|
43111
|
+
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, { packageDirectory, directoryExists });
|
|
43101
43112
|
(_f = state.failedLookupLocations) == null ? void 0 : _f.push(packageJsonPath);
|
|
43102
43113
|
}
|
|
43103
43114
|
}
|
|
@@ -47108,8 +47119,8 @@ function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourc
|
|
|
47108
47119
|
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getPreferences({}, compilerOptions, importingSourceFile), {}, options);
|
|
47109
47120
|
}
|
|
47110
47121
|
function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
|
|
47111
|
-
const info = getInfo(importingSourceFile.
|
|
47112
|
-
const modulePaths = getAllModulePaths(
|
|
47122
|
+
const info = getInfo(importingSourceFile.fileName, host);
|
|
47123
|
+
const modulePaths = getAllModulePaths(info, nodeModulesFileName, host, preferences, options);
|
|
47113
47124
|
return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
|
|
47114
47125
|
modulePath,
|
|
47115
47126
|
info,
|
|
@@ -47124,7 +47135,7 @@ function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeMod
|
|
|
47124
47135
|
}
|
|
47125
47136
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, preferences, userPreferences, options = {}) {
|
|
47126
47137
|
const info = getInfo(importingSourceFileName, host);
|
|
47127
|
-
const modulePaths = getAllModulePaths(
|
|
47138
|
+
const modulePaths = getAllModulePaths(info, toFileName2, host, userPreferences, options);
|
|
47128
47139
|
return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
|
|
47129
47140
|
modulePath,
|
|
47130
47141
|
info,
|
|
@@ -47186,7 +47197,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
47186
47197
|
if (!moduleSourceFile)
|
|
47187
47198
|
return { moduleSpecifiers: emptyArray, computedWithoutCache };
|
|
47188
47199
|
computedWithoutCache = true;
|
|
47189
|
-
modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.
|
|
47200
|
+
modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host));
|
|
47190
47201
|
const result = computeModuleSpecifiers(
|
|
47191
47202
|
modulePaths,
|
|
47192
47203
|
compilerOptions,
|
|
@@ -47200,7 +47211,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
47200
47211
|
return { moduleSpecifiers: result, computedWithoutCache };
|
|
47201
47212
|
}
|
|
47202
47213
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
47203
|
-
const info = getInfo(importingSourceFile.
|
|
47214
|
+
const info = getInfo(importingSourceFile.fileName, host);
|
|
47204
47215
|
const preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
47205
47216
|
const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
|
|
47206
47217
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
@@ -47264,16 +47275,22 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
47264
47275
|
return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? pathsSpecifiers : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? redirectPathsSpecifiers : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? nodeModulesSpecifiers : Debug.checkDefined(relativeSpecifiers);
|
|
47265
47276
|
}
|
|
47266
47277
|
function getInfo(importingSourceFileName, host) {
|
|
47278
|
+
importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
|
|
47267
47279
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : true);
|
|
47268
47280
|
const sourceDirectory = getDirectoryPath(importingSourceFileName);
|
|
47269
|
-
return {
|
|
47281
|
+
return {
|
|
47282
|
+
getCanonicalFileName,
|
|
47283
|
+
importingSourceFileName,
|
|
47284
|
+
sourceDirectory,
|
|
47285
|
+
canonicalSourceDirectory: getCanonicalFileName(sourceDirectory)
|
|
47286
|
+
};
|
|
47270
47287
|
}
|
|
47271
47288
|
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference }, pathsOnly) {
|
|
47272
47289
|
const { baseUrl, paths, rootDirs } = compilerOptions;
|
|
47273
47290
|
if (pathsOnly && !paths) {
|
|
47274
47291
|
return void 0;
|
|
47275
47292
|
}
|
|
47276
|
-
const { sourceDirectory, getCanonicalFileName } = info;
|
|
47293
|
+
const { sourceDirectory, canonicalSourceDirectory, getCanonicalFileName } = info;
|
|
47277
47294
|
const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
|
|
47278
47295
|
const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
|
|
47279
47296
|
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
|
|
@@ -47298,7 +47315,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
47298
47315
|
if (relativePreference === 3 /* ExternalNonRelative */ && !pathIsRelative(maybeNonRelative)) {
|
|
47299
47316
|
const projectDirectory = compilerOptions.configFilePath ? toPath(getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory());
|
|
47300
47317
|
const modulePath = toPath(moduleFileName, projectDirectory, getCanonicalFileName);
|
|
47301
|
-
const sourceIsInternal = startsWith(
|
|
47318
|
+
const sourceIsInternal = startsWith(canonicalSourceDirectory, projectDirectory);
|
|
47302
47319
|
const targetIsInternal = startsWith(modulePath, projectDirectory);
|
|
47303
47320
|
if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
|
|
47304
47321
|
return maybeNonRelative;
|
|
@@ -47371,8 +47388,9 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
|
|
|
47371
47388
|
});
|
|
47372
47389
|
return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
|
|
47373
47390
|
}
|
|
47374
|
-
function getAllModulePaths(
|
|
47391
|
+
function getAllModulePaths(info, importedFileName, host, preferences, options = {}) {
|
|
47375
47392
|
var _a;
|
|
47393
|
+
const importingFilePath = toPath(info.importingSourceFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
47376
47394
|
const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
47377
47395
|
const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
|
|
47378
47396
|
if (cache) {
|
|
@@ -47380,30 +47398,29 @@ function getAllModulePaths(importingFilePath, importedFileName, host, preference
|
|
|
47380
47398
|
if (cached == null ? void 0 : cached.modulePaths)
|
|
47381
47399
|
return cached.modulePaths;
|
|
47382
47400
|
}
|
|
47383
|
-
const modulePaths = getAllModulePathsWorker(
|
|
47401
|
+
const modulePaths = getAllModulePathsWorker(info, importedFileName, host);
|
|
47384
47402
|
if (cache) {
|
|
47385
47403
|
cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
|
|
47386
47404
|
}
|
|
47387
47405
|
return modulePaths;
|
|
47388
47406
|
}
|
|
47389
|
-
function getAllModulePathsWorker(
|
|
47390
|
-
const getCanonicalFileName = hostGetCanonicalFileName(host);
|
|
47407
|
+
function getAllModulePathsWorker(info, importedFileName, host) {
|
|
47391
47408
|
const allFileNames = /* @__PURE__ */ new Map();
|
|
47392
47409
|
let importedFileFromNodeModules = false;
|
|
47393
47410
|
forEachFileNameOfModule(
|
|
47394
|
-
|
|
47411
|
+
info.importingSourceFileName,
|
|
47395
47412
|
importedFileName,
|
|
47396
47413
|
host,
|
|
47397
47414
|
/*preferSymlinks*/
|
|
47398
47415
|
true,
|
|
47399
47416
|
(path, isRedirect) => {
|
|
47400
47417
|
const isInNodeModules = pathContainsNodeModules(path);
|
|
47401
|
-
allFileNames.set(path, { path: getCanonicalFileName(path), isRedirect, isInNodeModules });
|
|
47418
|
+
allFileNames.set(path, { path: info.getCanonicalFileName(path), isRedirect, isInNodeModules });
|
|
47402
47419
|
importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules;
|
|
47403
47420
|
}
|
|
47404
47421
|
);
|
|
47405
47422
|
const sortedPaths = [];
|
|
47406
|
-
for (let directory =
|
|
47423
|
+
for (let directory = info.canonicalSourceDirectory; allFileNames.size !== 0; ) {
|
|
47407
47424
|
const directoryStart = ensureTrailingDirectorySeparator(directory);
|
|
47408
47425
|
let pathsInDirectory;
|
|
47409
47426
|
allFileNames.forEach(({ path, isRedirect, isInNodeModules }, fileName) => {
|
|
@@ -47424,7 +47441,10 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
|
|
|
47424
47441
|
directory = newDirectory;
|
|
47425
47442
|
}
|
|
47426
47443
|
if (allFileNames.size) {
|
|
47427
|
-
const remainingPaths = arrayFrom(
|
|
47444
|
+
const remainingPaths = arrayFrom(
|
|
47445
|
+
allFileNames.entries(),
|
|
47446
|
+
([fileName, { isRedirect, isInNodeModules }]) => ({ path: fileName, isRedirect, isInNodeModules })
|
|
47447
|
+
);
|
|
47428
47448
|
if (remainingPaths.length > 1)
|
|
47429
47449
|
remainingPaths.sort(comparePathsByRedirectAndNumberOfDirectorySeparators);
|
|
47430
47450
|
sortedPaths.push(...remainingPaths);
|
|
@@ -47584,7 +47604,7 @@ function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory,
|
|
|
47584
47604
|
}
|
|
47585
47605
|
return processEnding(shortest, allowedEndings, compilerOptions);
|
|
47586
47606
|
}
|
|
47587
|
-
function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileName,
|
|
47607
|
+
function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileName, canonicalSourceDirectory }, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
47588
47608
|
if (!host.fileExists || !host.readFile) {
|
|
47589
47609
|
return void 0;
|
|
47590
47610
|
}
|
|
@@ -47628,7 +47648,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
47628
47648
|
}
|
|
47629
47649
|
const globalTypingsCacheLocation = host.getGlobalTypingsCacheLocation && host.getGlobalTypingsCacheLocation();
|
|
47630
47650
|
const pathToTopLevelNodeModules = getCanonicalFileName(moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex));
|
|
47631
|
-
if (!(startsWith(
|
|
47651
|
+
if (!(startsWith(canonicalSourceDirectory, pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
|
|
47632
47652
|
return void 0;
|
|
47633
47653
|
}
|
|
47634
47654
|
const nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
|
|
@@ -47641,7 +47661,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
47641
47661
|
let moduleFileToTry = path;
|
|
47642
47662
|
let maybeBlockedByTypesVersions = false;
|
|
47643
47663
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
47644
|
-
if (
|
|
47664
|
+
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
47645
47665
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
47646
47666
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
47647
47667
|
if (getResolvePackageJsonExports(options)) {
|
|
@@ -59228,9 +59248,13 @@ function createTypeChecker(host) {
|
|
|
59228
59248
|
function getConstraintOfTypeParameter(typeParameter) {
|
|
59229
59249
|
return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0;
|
|
59230
59250
|
}
|
|
59251
|
+
function isConstMappedType(type, depth) {
|
|
59252
|
+
const typeVariable = getHomomorphicTypeVariable(type);
|
|
59253
|
+
return !!typeVariable && isConstTypeVariable(typeVariable, depth);
|
|
59254
|
+
}
|
|
59231
59255
|
function isConstTypeVariable(type, depth = 0) {
|
|
59232
59256
|
var _a;
|
|
59233
|
-
return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 4096 /* Const */)) || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0));
|
|
59257
|
+
return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 4096 /* Const */)) || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || getObjectFlags(type) & 32 /* Mapped */ && isConstMappedType(type, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0));
|
|
59234
59258
|
}
|
|
59235
59259
|
function getConstraintOfIndexedAccess(type) {
|
|
59236
59260
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -112868,8 +112892,8 @@ function transformDeclarations(context) {
|
|
|
112868
112892
|
const specifier = getModuleSpecifier(
|
|
112869
112893
|
options,
|
|
112870
112894
|
currentSourceFile,
|
|
112871
|
-
|
|
112872
|
-
|
|
112895
|
+
getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
|
|
112896
|
+
getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
|
|
112873
112897
|
host
|
|
112874
112898
|
);
|
|
112875
112899
|
if (!pathIsRelative(specifier)) {
|
|
@@ -120306,8 +120330,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
120306
120330
|
}
|
|
120307
120331
|
const baseName = getBaseNameOfFileName(fileOrDirectory);
|
|
120308
120332
|
const fsQueryResult = {
|
|
120309
|
-
fileExists: host.fileExists(
|
|
120310
|
-
directoryExists: host.directoryExists(
|
|
120333
|
+
fileExists: host.fileExists(fileOrDirectory),
|
|
120334
|
+
directoryExists: host.directoryExists(fileOrDirectory)
|
|
120311
120335
|
};
|
|
120312
120336
|
if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
|
|
120313
120337
|
clearCache();
|
|
@@ -120395,23 +120419,10 @@ function cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, t
|
|
|
120395
120419
|
}
|
|
120396
120420
|
});
|
|
120397
120421
|
}
|
|
120398
|
-
function updatePackageJsonWatch(lookups, packageJsonWatches, createPackageJsonWatch) {
|
|
120399
|
-
const newMap = new Map(lookups);
|
|
120400
|
-
mutateMap(
|
|
120401
|
-
packageJsonWatches,
|
|
120402
|
-
newMap,
|
|
120403
|
-
{
|
|
120404
|
-
createNewValue: createPackageJsonWatch,
|
|
120405
|
-
onDeleteValue: closeFileWatcher
|
|
120406
|
-
}
|
|
120407
|
-
);
|
|
120408
|
-
}
|
|
120409
120422
|
function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) {
|
|
120410
|
-
const missingFilePaths = program.getMissingFilePaths();
|
|
120411
|
-
const newMissingFilePathMap = arrayToMap(missingFilePaths, identity, returnTrue);
|
|
120412
120423
|
mutateMap(
|
|
120413
120424
|
missingFileWatches,
|
|
120414
|
-
|
|
120425
|
+
program.getMissingFilePaths(),
|
|
120415
120426
|
{
|
|
120416
120427
|
// Watch the missing files
|
|
120417
120428
|
createNewValue: createMissingFileWatch,
|
|
@@ -120422,18 +120433,22 @@ function updateMissingFilePathsWatch(program, missingFileWatches, createMissingF
|
|
|
120422
120433
|
);
|
|
120423
120434
|
}
|
|
120424
120435
|
function updateWatchingWildcardDirectories(existingWatchedForWildcards, wildcardDirectories, watchDirectory) {
|
|
120425
|
-
|
|
120426
|
-
|
|
120427
|
-
|
|
120428
|
-
|
|
120429
|
-
|
|
120430
|
-
|
|
120431
|
-
|
|
120432
|
-
|
|
120433
|
-
|
|
120434
|
-
|
|
120435
|
-
|
|
120436
|
-
|
|
120436
|
+
if (wildcardDirectories) {
|
|
120437
|
+
mutateMap(
|
|
120438
|
+
existingWatchedForWildcards,
|
|
120439
|
+
new Map(Object.entries(wildcardDirectories)),
|
|
120440
|
+
{
|
|
120441
|
+
// Create new watch and recursive info
|
|
120442
|
+
createNewValue: createWildcardDirectoryWatcher,
|
|
120443
|
+
// Close existing watch thats not needed any more
|
|
120444
|
+
onDeleteValue: closeFileWatcherOf,
|
|
120445
|
+
// Close existing watch that doesnt match in the flags
|
|
120446
|
+
onExistingValue: updateWildcardDirectoryWatcher
|
|
120447
|
+
}
|
|
120448
|
+
);
|
|
120449
|
+
} else {
|
|
120450
|
+
clearMap(existingWatchedForWildcards, closeFileWatcherOf);
|
|
120451
|
+
}
|
|
120437
120452
|
function createWildcardDirectoryWatcher(directory, flags) {
|
|
120438
120453
|
return {
|
|
120439
120454
|
watcher: watchDirectory(directory, flags),
|
|
@@ -121271,7 +121286,8 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
|
|
|
121271
121286
|
return false;
|
|
121272
121287
|
if (program.getSourceFiles().some(sourceFileNotUptoDate))
|
|
121273
121288
|
return false;
|
|
121274
|
-
|
|
121289
|
+
const missingPaths = program.getMissingFilePaths();
|
|
121290
|
+
if (missingPaths && forEachEntry(missingPaths, fileExists))
|
|
121275
121291
|
return false;
|
|
121276
121292
|
const currentOptions = program.getCompilerOptions();
|
|
121277
121293
|
if (!compareDataObjects(currentOptions, newOptions))
|
|
@@ -121575,7 +121591,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121575
121591
|
let redirectTargetsMap = createMultiMap();
|
|
121576
121592
|
let usesUriStyleNodeCoreModules = false;
|
|
121577
121593
|
const filesByName = /* @__PURE__ */ new Map();
|
|
121578
|
-
let
|
|
121594
|
+
let missingFileNames = /* @__PURE__ */ new Map();
|
|
121579
121595
|
const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
|
|
121580
121596
|
let resolvedProjectReferences;
|
|
121581
121597
|
let projectReferenceRedirects;
|
|
@@ -121694,12 +121710,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121694
121710
|
});
|
|
121695
121711
|
}
|
|
121696
121712
|
}
|
|
121697
|
-
missingFilePaths = arrayFrom(mapDefinedIterator(filesByName.entries(), ([path, file]) => file === void 0 ? path : void 0));
|
|
121698
121713
|
files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
|
|
121699
121714
|
processingDefaultLibFiles = void 0;
|
|
121700
121715
|
processingOtherFiles = void 0;
|
|
121701
121716
|
}
|
|
121702
|
-
Debug.assert(!!missingFilePaths);
|
|
121703
121717
|
if (oldProgram && host.onReleaseOldSourceFile) {
|
|
121704
121718
|
const oldSourceFiles = oldProgram.getSourceFiles();
|
|
121705
121719
|
for (const oldSourceFile of oldSourceFiles) {
|
|
@@ -121744,8 +121758,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121744
121758
|
getSourceFile,
|
|
121745
121759
|
getSourceFileByPath,
|
|
121746
121760
|
getSourceFiles: () => files,
|
|
121747
|
-
getMissingFilePaths: () =>
|
|
121748
|
-
// TODO: GH#18217
|
|
121761
|
+
getMissingFilePaths: () => missingFileNames,
|
|
121749
121762
|
getModuleResolutionCache: () => moduleResolutionCache,
|
|
121750
121763
|
getFilesByNameMap: () => filesByName,
|
|
121751
121764
|
getCompilerOptions: () => options,
|
|
@@ -122172,7 +122185,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122172
122185
|
const newSourceFiles = [];
|
|
122173
122186
|
const modifiedSourceFiles = [];
|
|
122174
122187
|
structureIsReused = 2 /* Completely */;
|
|
122175
|
-
if (oldProgram.getMissingFilePaths()
|
|
122188
|
+
if (forEachEntry(oldProgram.getMissingFilePaths(), (missingFileName) => host.fileExists(missingFileName))) {
|
|
122176
122189
|
return 0 /* Not */;
|
|
122177
122190
|
}
|
|
122178
122191
|
const oldSourceFiles = oldProgram.getSourceFiles();
|
|
@@ -122312,7 +122325,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122312
122325
|
if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
122313
122326
|
return 1 /* SafeModules */;
|
|
122314
122327
|
}
|
|
122315
|
-
|
|
122328
|
+
missingFileNames = oldProgram.getMissingFilePaths();
|
|
122316
122329
|
Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
122317
122330
|
for (const newSourceFile of newSourceFiles) {
|
|
122318
122331
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
@@ -122369,7 +122382,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122369
122382
|
const path = toPath3(f);
|
|
122370
122383
|
if (getSourceFileByPath(path))
|
|
122371
122384
|
return true;
|
|
122372
|
-
if (
|
|
122385
|
+
if (missingFileNames.has(path))
|
|
122373
122386
|
return false;
|
|
122374
122387
|
return host.fileExists(f);
|
|
122375
122388
|
},
|
|
@@ -123181,6 +123194,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123181
123194
|
addFileToFilesByName(
|
|
123182
123195
|
file2,
|
|
123183
123196
|
path,
|
|
123197
|
+
fileName,
|
|
123184
123198
|
/*redirectedPath*/
|
|
123185
123199
|
void 0
|
|
123186
123200
|
);
|
|
@@ -123253,7 +123267,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123253
123267
|
if (fileFromPackageId) {
|
|
123254
123268
|
const dupFile = createRedirectedSourceFile(fileFromPackageId, file, fileName, path, toPath3(fileName), originalFileName, sourceFileOptions);
|
|
123255
123269
|
redirectTargetsMap.add(fileFromPackageId.path, fileName);
|
|
123256
|
-
addFileToFilesByName(dupFile, path, redirectedPath);
|
|
123270
|
+
addFileToFilesByName(dupFile, path, fileName, redirectedPath);
|
|
123257
123271
|
addFileIncludeReason(dupFile, reason);
|
|
123258
123272
|
sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
|
|
123259
123273
|
processingOtherFiles.push(dupFile);
|
|
@@ -123263,7 +123277,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123263
123277
|
sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
|
|
123264
123278
|
}
|
|
123265
123279
|
}
|
|
123266
|
-
addFileToFilesByName(file, path, redirectedPath);
|
|
123280
|
+
addFileToFilesByName(file, path, fileName, redirectedPath);
|
|
123267
123281
|
if (file) {
|
|
123268
123282
|
sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
|
|
123269
123283
|
file.fileName = fileName;
|
|
@@ -123303,14 +123317,21 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123303
123317
|
if (file)
|
|
123304
123318
|
fileReasons.add(file.path, reason);
|
|
123305
123319
|
}
|
|
123306
|
-
function addFileToFilesByName(file, path, redirectedPath) {
|
|
123320
|
+
function addFileToFilesByName(file, path, fileName, redirectedPath) {
|
|
123307
123321
|
if (redirectedPath) {
|
|
123308
|
-
|
|
123309
|
-
|
|
123322
|
+
updateFilesByNameMap(fileName, redirectedPath, file);
|
|
123323
|
+
updateFilesByNameMap(fileName, path, file || false);
|
|
123310
123324
|
} else {
|
|
123311
|
-
|
|
123325
|
+
updateFilesByNameMap(fileName, path, file);
|
|
123312
123326
|
}
|
|
123313
123327
|
}
|
|
123328
|
+
function updateFilesByNameMap(fileName, path, file) {
|
|
123329
|
+
filesByName.set(path, file);
|
|
123330
|
+
if (file !== void 0)
|
|
123331
|
+
missingFileNames.delete(path);
|
|
123332
|
+
else
|
|
123333
|
+
missingFileNames.set(path, fileName);
|
|
123334
|
+
}
|
|
123314
123335
|
function getProjectReferenceRedirect(fileName) {
|
|
123315
123336
|
const referencedProject = getProjectReferenceRedirectProject(fileName);
|
|
123316
123337
|
return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
|
|
@@ -123631,6 +123652,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123631
123652
|
/*file*/
|
|
123632
123653
|
void 0,
|
|
123633
123654
|
sourceFilePath,
|
|
123655
|
+
refPath,
|
|
123634
123656
|
/*redirectedPath*/
|
|
123635
123657
|
void 0
|
|
123636
123658
|
);
|
|
@@ -123642,6 +123664,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123642
123664
|
addFileToFilesByName(
|
|
123643
123665
|
sourceFile,
|
|
123644
123666
|
sourceFilePath,
|
|
123667
|
+
refPath,
|
|
123645
123668
|
/*redirectedPath*/
|
|
123646
123669
|
void 0
|
|
123647
123670
|
);
|
|
@@ -123651,6 +123674,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123651
123674
|
addFileToFilesByName(
|
|
123652
123675
|
sourceFile,
|
|
123653
123676
|
sourceFilePath,
|
|
123677
|
+
refPath,
|
|
123654
123678
|
/*redirectedPath*/
|
|
123655
123679
|
void 0
|
|
123656
123680
|
);
|
|
@@ -127471,8 +127495,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127471
127495
|
function closeTypeRootsWatch() {
|
|
127472
127496
|
clearMap(typeRootsWatches, closeFileWatcher);
|
|
127473
127497
|
}
|
|
127474
|
-
function createTypeRootsWatch(
|
|
127475
|
-
return canWatchTypeRootPath(
|
|
127498
|
+
function createTypeRootsWatch(typeRoot) {
|
|
127499
|
+
return canWatchTypeRootPath(typeRoot) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
127476
127500
|
const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
|
|
127477
127501
|
if (cachedDirectoryStructureHost) {
|
|
127478
127502
|
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
@@ -127481,7 +127505,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127481
127505
|
resolutionHost.onChangedAutomaticTypeDirectiveNames();
|
|
127482
127506
|
const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(
|
|
127483
127507
|
typeRoot,
|
|
127484
|
-
|
|
127508
|
+
resolutionHost.toPath(typeRoot),
|
|
127485
127509
|
rootPath,
|
|
127486
127510
|
rootPathComponents,
|
|
127487
127511
|
getCurrentDirectory,
|
|
@@ -127502,7 +127526,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127502
127526
|
if (typeRoots) {
|
|
127503
127527
|
mutateMap(
|
|
127504
127528
|
typeRootsWatches,
|
|
127505
|
-
|
|
127529
|
+
new Set(typeRoots),
|
|
127506
127530
|
{
|
|
127507
127531
|
createNewValue: createTypeRootsWatch,
|
|
127508
127532
|
onDeleteValue: closeFileWatcher
|
|
@@ -128456,7 +128480,11 @@ function createWatchProgram(host) {
|
|
|
128456
128480
|
const oldProgram = getCurrentProgram();
|
|
128457
128481
|
builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
128458
128482
|
resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
|
|
128459
|
-
updateMissingFilePathsWatch(
|
|
128483
|
+
updateMissingFilePathsWatch(
|
|
128484
|
+
builderProgram.getProgram(),
|
|
128485
|
+
missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()),
|
|
128486
|
+
watchMissingFilePath
|
|
128487
|
+
);
|
|
128460
128488
|
if (needsUpdateInTypeRootWatch) {
|
|
128461
128489
|
resolutionCache.updateTypeRootsWatch();
|
|
128462
128490
|
}
|
|
@@ -128749,8 +128777,15 @@ function createWatchProgram(host) {
|
|
|
128749
128777
|
cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
|
|
128750
128778
|
}
|
|
128751
128779
|
}
|
|
128752
|
-
function watchMissingFilePath(missingFilePath) {
|
|
128753
|
-
return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
|
|
128780
|
+
function watchMissingFilePath(missingFilePath, missingFileName) {
|
|
128781
|
+
return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
|
|
128782
|
+
missingFilePath,
|
|
128783
|
+
missingFileName,
|
|
128784
|
+
onMissingFileChange,
|
|
128785
|
+
500 /* Medium */,
|
|
128786
|
+
watchOptions,
|
|
128787
|
+
WatchType.MissingFile
|
|
128788
|
+
);
|
|
128754
128789
|
}
|
|
128755
128790
|
function onMissingFileChange(fileName, eventKind, missingFilePath) {
|
|
128756
128791
|
updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
|
|
@@ -128762,15 +128797,11 @@ function createWatchProgram(host) {
|
|
|
128762
128797
|
}
|
|
128763
128798
|
}
|
|
128764
128799
|
function watchConfigFileWildCardDirectories() {
|
|
128765
|
-
|
|
128766
|
-
|
|
128767
|
-
|
|
128768
|
-
|
|
128769
|
-
|
|
128770
|
-
);
|
|
128771
|
-
} else if (watchedWildcardDirectories) {
|
|
128772
|
-
clearMap(watchedWildcardDirectories, closeFileWatcherOf);
|
|
128773
|
-
}
|
|
128800
|
+
updateWatchingWildcardDirectories(
|
|
128801
|
+
watchedWildcardDirectories || (watchedWildcardDirectories = /* @__PURE__ */ new Map()),
|
|
128802
|
+
wildcardDirectories,
|
|
128803
|
+
watchWildcardDirectory
|
|
128804
|
+
);
|
|
128774
128805
|
}
|
|
128775
128806
|
function watchWildcardDirectory(directory, flags) {
|
|
128776
128807
|
return watchDirectory(
|
|
@@ -128842,7 +128873,7 @@ function createWatchProgram(host) {
|
|
|
128842
128873
|
);
|
|
128843
128874
|
}
|
|
128844
128875
|
function watchReferencedProject(configFileName2, configPath, commandLine) {
|
|
128845
|
-
var _a, _b, _c, _d
|
|
128876
|
+
var _a, _b, _c, _d;
|
|
128846
128877
|
commandLine.watcher || (commandLine.watcher = watchFile2(
|
|
128847
128878
|
configFileName2,
|
|
128848
128879
|
(_fileName, eventKind) => {
|
|
@@ -128857,55 +128888,50 @@ function createWatchProgram(host) {
|
|
|
128857
128888
|
((_a = commandLine.parsedCommandLine) == null ? void 0 : _a.watchOptions) || watchOptions,
|
|
128858
128889
|
WatchType.ConfigFileOfReferencedProject
|
|
128859
128890
|
));
|
|
128860
|
-
|
|
128861
|
-
|
|
128862
|
-
|
|
128863
|
-
|
|
128864
|
-
|
|
128865
|
-
|
|
128866
|
-
|
|
128867
|
-
|
|
128868
|
-
(fileOrDirectory)
|
|
128869
|
-
|
|
128870
|
-
|
|
128871
|
-
|
|
128872
|
-
|
|
128873
|
-
|
|
128874
|
-
|
|
128875
|
-
|
|
128876
|
-
|
|
128877
|
-
|
|
128878
|
-
|
|
128879
|
-
|
|
128880
|
-
|
|
128881
|
-
|
|
128882
|
-
|
|
128883
|
-
|
|
128884
|
-
|
|
128885
|
-
|
|
128886
|
-
|
|
128887
|
-
|
|
128888
|
-
|
|
128889
|
-
|
|
128890
|
-
|
|
128891
|
-
|
|
128892
|
-
|
|
128893
|
-
|
|
128894
|
-
|
|
128895
|
-
|
|
128896
|
-
|
|
128897
|
-
|
|
128898
|
-
|
|
128899
|
-
|
|
128900
|
-
);
|
|
128901
|
-
} else if (commandLine.watchedDirectories) {
|
|
128902
|
-
clearMap(commandLine.watchedDirectories, closeFileWatcherOf);
|
|
128903
|
-
commandLine.watchedDirectories = void 0;
|
|
128904
|
-
}
|
|
128891
|
+
updateWatchingWildcardDirectories(
|
|
128892
|
+
commandLine.watchedDirectories || (commandLine.watchedDirectories = /* @__PURE__ */ new Map()),
|
|
128893
|
+
(_b = commandLine.parsedCommandLine) == null ? void 0 : _b.wildcardDirectories,
|
|
128894
|
+
(directory, flags) => {
|
|
128895
|
+
var _a2;
|
|
128896
|
+
return watchDirectory(
|
|
128897
|
+
directory,
|
|
128898
|
+
(fileOrDirectory) => {
|
|
128899
|
+
const fileOrDirectoryPath = toPath3(fileOrDirectory);
|
|
128900
|
+
if (cachedDirectoryStructureHost) {
|
|
128901
|
+
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
128902
|
+
}
|
|
128903
|
+
nextSourceFileVersion(fileOrDirectoryPath);
|
|
128904
|
+
const config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
|
|
128905
|
+
if (!(config == null ? void 0 : config.parsedCommandLine))
|
|
128906
|
+
return;
|
|
128907
|
+
if (isIgnoredFileFromWildCardWatching({
|
|
128908
|
+
watchedDirPath: toPath3(directory),
|
|
128909
|
+
fileOrDirectory,
|
|
128910
|
+
fileOrDirectoryPath,
|
|
128911
|
+
configFileName: configFileName2,
|
|
128912
|
+
options: config.parsedCommandLine.options,
|
|
128913
|
+
program: config.parsedCommandLine.fileNames,
|
|
128914
|
+
currentDirectory,
|
|
128915
|
+
useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
|
|
128916
|
+
writeLog,
|
|
128917
|
+
toPath: toPath3
|
|
128918
|
+
}))
|
|
128919
|
+
return;
|
|
128920
|
+
if (config.updateLevel !== 2 /* Full */) {
|
|
128921
|
+
config.updateLevel = 1 /* RootNamesAndUpdate */;
|
|
128922
|
+
scheduleProgramUpdate();
|
|
128923
|
+
}
|
|
128924
|
+
},
|
|
128925
|
+
flags,
|
|
128926
|
+
((_a2 = commandLine.parsedCommandLine) == null ? void 0 : _a2.watchOptions) || watchOptions,
|
|
128927
|
+
WatchType.WildcardDirectoryOfReferencedProject
|
|
128928
|
+
);
|
|
128929
|
+
}
|
|
128930
|
+
);
|
|
128905
128931
|
updateExtendedConfigFilesWatches(
|
|
128906
128932
|
configPath,
|
|
128907
|
-
(
|
|
128908
|
-
((
|
|
128933
|
+
(_c = commandLine.parsedCommandLine) == null ? void 0 : _c.options,
|
|
128934
|
+
((_d = commandLine.parsedCommandLine) == null ? void 0 : _d.watchOptions) || watchOptions,
|
|
128909
128935
|
WatchType.ExtendedConfigOfReferencedProject
|
|
128910
128936
|
);
|
|
128911
128937
|
}
|
|
@@ -129232,9 +129258,9 @@ function getBuildOrder(state) {
|
|
|
129232
129258
|
function createStateBuildOrder(state) {
|
|
129233
129259
|
const buildOrder = createBuildOrder(state, state.rootNames.map((f) => resolveProjectName(state, f)));
|
|
129234
129260
|
state.resolvedConfigFilePaths.clear();
|
|
129235
|
-
const currentProjects = new
|
|
129261
|
+
const currentProjects = new Set(
|
|
129236
129262
|
getBuildOrderFromAnyBuildOrder(buildOrder).map(
|
|
129237
|
-
(resolved) =>
|
|
129263
|
+
(resolved) => toResolvedConfigFilePath(state, resolved)
|
|
129238
129264
|
)
|
|
129239
129265
|
);
|
|
129240
129266
|
const noopOnDelete = { onDeleteValue: noop };
|
|
@@ -129246,6 +129272,7 @@ function createStateBuildOrder(state) {
|
|
|
129246
129272
|
mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
|
|
129247
129273
|
mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
|
|
129248
129274
|
mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
|
|
129275
|
+
mutateMapSkippingNewValues(state.lastCachedPackageJsonLookups, currentProjects, noopOnDelete);
|
|
129249
129276
|
if (state.watch) {
|
|
129250
129277
|
mutateMapSkippingNewValues(
|
|
129251
129278
|
state.allWatchedConfigFiles,
|
|
@@ -129500,7 +129527,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
|
|
|
129500
129527
|
return withProgramOrUndefined(action) || emptyArray;
|
|
129501
129528
|
}
|
|
129502
129529
|
function createProgram2() {
|
|
129503
|
-
var _a, _b;
|
|
129530
|
+
var _a, _b, _c;
|
|
129504
129531
|
Debug.assert(program === void 0);
|
|
129505
129532
|
if (state.options.dry) {
|
|
129506
129533
|
reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
|
|
@@ -129529,12 +129556,13 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
|
|
|
129529
129556
|
config.projectReferences
|
|
129530
129557
|
);
|
|
129531
129558
|
if (state.watch) {
|
|
129559
|
+
const internalMap = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().getInternalMap();
|
|
129532
129560
|
state.lastCachedPackageJsonLookups.set(
|
|
129533
129561
|
projectPath,
|
|
129534
|
-
|
|
129535
|
-
|
|
129536
|
-
(
|
|
129537
|
-
)
|
|
129562
|
+
internalMap && new Set(arrayFrom(
|
|
129563
|
+
internalMap.values(),
|
|
129564
|
+
(data) => state.host.realpath && (isPackageJsonInfo(data) || data.directoryExists) ? state.host.realpath(combinePaths(data.packageDirectory, "package.json")) : combinePaths(data.packageDirectory, "package.json")
|
|
129565
|
+
))
|
|
129538
129566
|
);
|
|
129539
129567
|
state.builderPrograms.set(projectPath, program);
|
|
129540
129568
|
}
|
|
@@ -130267,9 +130295,10 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
130267
130295
|
const extendedConfigStatus = forEach(project.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName));
|
|
130268
130296
|
if (extendedConfigStatus)
|
|
130269
130297
|
return extendedConfigStatus;
|
|
130270
|
-
const
|
|
130271
|
-
|
|
130272
|
-
|
|
130298
|
+
const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath);
|
|
130299
|
+
const dependentPackageFileStatus = packageJsonLookups && forEachKey(
|
|
130300
|
+
packageJsonLookups,
|
|
130301
|
+
(path) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
|
|
130273
130302
|
);
|
|
130274
130303
|
if (dependentPackageFileStatus)
|
|
130275
130304
|
return dependentPackageFileStatus;
|
|
@@ -130626,7 +130655,7 @@ function watchWildCardDirectories(state, resolved, resolvedPath, parsed) {
|
|
|
130626
130655
|
return;
|
|
130627
130656
|
updateWatchingWildcardDirectories(
|
|
130628
130657
|
getOrCreateValueMapFromConfigFileMap(state.allWatchedWildcardDirectories, resolvedPath),
|
|
130629
|
-
|
|
130658
|
+
parsed.wildcardDirectories,
|
|
130630
130659
|
(dir, flags) => state.watchDirectory(
|
|
130631
130660
|
dir,
|
|
130632
130661
|
(fileOrDirectory) => {
|
|
@@ -130658,9 +130687,9 @@ function watchInputFiles(state, resolved, resolvedPath, parsed) {
|
|
|
130658
130687
|
return;
|
|
130659
130688
|
mutateMap(
|
|
130660
130689
|
getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath),
|
|
130661
|
-
|
|
130690
|
+
new Set(parsed.fileNames),
|
|
130662
130691
|
{
|
|
130663
|
-
createNewValue: (
|
|
130692
|
+
createNewValue: (input) => watchFile(
|
|
130664
130693
|
state,
|
|
130665
130694
|
input,
|
|
130666
130695
|
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
|
|
@@ -130678,11 +130707,11 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
|
|
|
130678
130707
|
return;
|
|
130679
130708
|
mutateMap(
|
|
130680
130709
|
getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath),
|
|
130681
|
-
|
|
130710
|
+
state.lastCachedPackageJsonLookups.get(resolvedPath),
|
|
130682
130711
|
{
|
|
130683
|
-
createNewValue: (
|
|
130712
|
+
createNewValue: (input) => watchFile(
|
|
130684
130713
|
state,
|
|
130685
|
-
|
|
130714
|
+
input,
|
|
130686
130715
|
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
|
|
130687
130716
|
2e3 /* High */,
|
|
130688
130717
|
parsed == null ? void 0 : parsed.watchOptions,
|
|
@@ -136465,7 +136494,7 @@ function updateImports(program, changeTracker, oldToNew, newToOld, host, getCano
|
|
|
136465
136494
|
if ((importedModuleSymbol == null ? void 0 : importedModuleSymbol.declarations) && importedModuleSymbol.declarations.some((d) => isAmbientModule(d)))
|
|
136466
136495
|
return void 0;
|
|
136467
136496
|
const toImport = oldFromNew !== void 0 ? getSourceFileToImportFromResolved(importLiteral, resolveModuleName(importLiteral.text, oldImportFromPath, program.getCompilerOptions(), host), oldToNew, allFiles) : getSourceFileToImport(importedModuleSymbol, importLiteral, sourceFile, program, host, oldToNew);
|
|
136468
|
-
return toImport !== void 0 && (toImport.updated || importingSourceFileMoved && pathIsRelative(importLiteral.text)) ? ts_moduleSpecifiers_exports.updateModuleSpecifier(program.getCompilerOptions(), sourceFile,
|
|
136497
|
+
return toImport !== void 0 && (toImport.updated || importingSourceFileMoved && pathIsRelative(importLiteral.text)) ? ts_moduleSpecifiers_exports.updateModuleSpecifier(program.getCompilerOptions(), sourceFile, newImportFromPath, toImport.newFileName, createModuleSpecifierResolutionHost(program, host), importLiteral.text) : void 0;
|
|
136469
136498
|
});
|
|
136470
136499
|
}
|
|
136471
136500
|
}
|
|
@@ -137304,11 +137333,11 @@ function getSourceMapper(host) {
|
|
|
137304
137333
|
const fileFromCache = sourceFileLike.get(path);
|
|
137305
137334
|
if (fileFromCache !== void 0)
|
|
137306
137335
|
return fileFromCache ? fileFromCache : void 0;
|
|
137307
|
-
if (!host.readFile || host.fileExists && !host.fileExists(
|
|
137336
|
+
if (!host.readFile || host.fileExists && !host.fileExists(fileName)) {
|
|
137308
137337
|
sourceFileLike.set(path, false);
|
|
137309
137338
|
return void 0;
|
|
137310
137339
|
}
|
|
137311
|
-
const text = host.readFile(
|
|
137340
|
+
const text = host.readFile(fileName);
|
|
137312
137341
|
const file = text ? createSourceFileLike(text) : false;
|
|
137313
137342
|
sourceFileLike.set(path, file);
|
|
137314
137343
|
return file ? file : void 0;
|
|
@@ -139861,7 +139890,7 @@ function getTargetFileImportsAndAddExportInOldFile(oldFile, targetFile, importsT
|
|
|
139861
139890
|
const resolved = program.getResolvedModule(oldFile, moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
|
|
139862
139891
|
const fileName = (_a = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _a.resolvedFileName;
|
|
139863
139892
|
if (fileName && targetSourceFile) {
|
|
139864
|
-
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.
|
|
139893
|
+
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.fileName, fileName, createModuleSpecifierResolutionHost(program, host));
|
|
139865
139894
|
append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
139866
139895
|
} else {
|
|
139867
139896
|
append(copiedOldImports, filterImport(i, factory.createStringLiteral(moduleSpecifierFromImport(i).text), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
@@ -139939,7 +139968,7 @@ function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols
|
|
|
139939
139968
|
};
|
|
139940
139969
|
deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
|
|
139941
139970
|
const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(oldFile.path), targetFileName);
|
|
139942
|
-
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.
|
|
139971
|
+
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
|
|
139943
139972
|
const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove);
|
|
139944
139973
|
if (newImportDeclaration)
|
|
139945
139974
|
changes.insertNodeAfter(sourceFile, statement, newImportDeclaration);
|
|
@@ -140074,7 +140103,7 @@ function createOldFileImportsFromTargetFile(sourceFile, targetFileNeedExport, ta
|
|
|
140074
140103
|
}
|
|
140075
140104
|
function makeImportOrRequire(sourceFile, defaultImport, imports, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference) {
|
|
140076
140105
|
const pathToTargetFile = resolvePath(getDirectoryPath(sourceFile.path), targetFileNameWithExtension);
|
|
140077
|
-
const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.
|
|
140106
|
+
const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFile, createModuleSpecifierResolutionHost(program, host));
|
|
140078
140107
|
if (useEs6Imports) {
|
|
140079
140108
|
const specifiers = imports.map((i) => factory.createImportSpecifier(
|
|
140080
140109
|
/*isTypeOnly*/
|
|
@@ -165814,6 +165843,10 @@ function provideInlayHints(context) {
|
|
|
165814
165843
|
parts.push({ text: tokenToString(node.operator) });
|
|
165815
165844
|
visitForDisplayParts(node.operand);
|
|
165816
165845
|
break;
|
|
165846
|
+
case 197 /* ThisType */:
|
|
165847
|
+
Debug.assertNode(node, isThisTypeNode);
|
|
165848
|
+
parts.push({ text: "this" });
|
|
165849
|
+
break;
|
|
165817
165850
|
default:
|
|
165818
165851
|
Debug.failBadSyntaxKind(node);
|
|
165819
165852
|
}
|
|
@@ -174501,6 +174534,7 @@ __export(ts_exports2, {
|
|
|
174501
174534
|
isOuterExpression: () => isOuterExpression,
|
|
174502
174535
|
isOutermostOptionalChain: () => isOutermostOptionalChain,
|
|
174503
174536
|
isOverrideModifier: () => isOverrideModifier,
|
|
174537
|
+
isPackageJsonInfo: () => isPackageJsonInfo,
|
|
174504
174538
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
174505
174539
|
isParameter: () => isParameter,
|
|
174506
174540
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
@@ -175152,7 +175186,6 @@ __export(ts_exports2, {
|
|
|
175152
175186
|
updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
|
|
175153
175187
|
updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
|
|
175154
175188
|
updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
|
|
175155
|
-
updatePackageJsonWatch: () => updatePackageJsonWatch,
|
|
175156
175189
|
updateResolutionField: () => updateResolutionField,
|
|
175157
175190
|
updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher,
|
|
175158
175191
|
updateSourceFile: () => updateSourceFile,
|
|
@@ -177498,6 +177531,7 @@ var Project3 = class _Project {
|
|
|
177498
177531
|
return path === options.configFilePath ? options.configFile : this.getSourceFile(path);
|
|
177499
177532
|
}
|
|
177500
177533
|
close() {
|
|
177534
|
+
var _a;
|
|
177501
177535
|
this.projectService.typingsCache.onProjectClosed(this);
|
|
177502
177536
|
this.closeWatchingTypingLocations();
|
|
177503
177537
|
this.cleanupProgram();
|
|
@@ -177514,6 +177548,12 @@ var Project3 = class _Project {
|
|
|
177514
177548
|
this.resolutionCache.clear();
|
|
177515
177549
|
this.resolutionCache = void 0;
|
|
177516
177550
|
this.cachedUnresolvedImportsPerFile = void 0;
|
|
177551
|
+
(_a = this.packageJsonWatches) == null ? void 0 : _a.forEach((watcher) => {
|
|
177552
|
+
watcher.projects.delete(this);
|
|
177553
|
+
watcher.close();
|
|
177554
|
+
});
|
|
177555
|
+
this.packageJsonWatches = void 0;
|
|
177556
|
+
this.moduleSpecifierCache.clear();
|
|
177517
177557
|
this.moduleSpecifierCache = void 0;
|
|
177518
177558
|
this.directoryStructureHost = void 0;
|
|
177519
177559
|
this.exportMapCache = void 0;
|
|
@@ -177708,13 +177748,10 @@ var Project3 = class _Project {
|
|
|
177708
177748
|
}
|
|
177709
177749
|
}
|
|
177710
177750
|
/** @internal */
|
|
177711
|
-
onPackageJsonChange(
|
|
177712
|
-
|
|
177713
|
-
if (
|
|
177714
|
-
this.
|
|
177715
|
-
if (this.autoImportProviderHost) {
|
|
177716
|
-
this.autoImportProviderHost.markAsDirty();
|
|
177717
|
-
}
|
|
177751
|
+
onPackageJsonChange() {
|
|
177752
|
+
this.moduleSpecifierCache.clear();
|
|
177753
|
+
if (this.autoImportProviderHost) {
|
|
177754
|
+
this.autoImportProviderHost.markAsDirty();
|
|
177718
177755
|
}
|
|
177719
177756
|
}
|
|
177720
177757
|
/** @internal */
|
|
@@ -177929,7 +177966,7 @@ var Project3 = class _Project {
|
|
|
177929
177966
|
this.program,
|
|
177930
177967
|
this.missingFilesMap || (this.missingFilesMap = /* @__PURE__ */ new Map()),
|
|
177931
177968
|
// Watch the missing files
|
|
177932
|
-
(missingFilePath) => this.addMissingFileWatcher(missingFilePath)
|
|
177969
|
+
(missingFilePath, missingFileName) => this.addMissingFileWatcher(missingFilePath, missingFileName)
|
|
177933
177970
|
);
|
|
177934
177971
|
if (this.generatedFilesMap) {
|
|
177935
177972
|
const outPath = outFile(this.compilerOptions);
|
|
@@ -178043,7 +178080,7 @@ var Project3 = class _Project {
|
|
|
178043
178080
|
}
|
|
178044
178081
|
}
|
|
178045
178082
|
}
|
|
178046
|
-
addMissingFileWatcher(missingFilePath) {
|
|
178083
|
+
addMissingFileWatcher(missingFilePath, missingFileName) {
|
|
178047
178084
|
var _a;
|
|
178048
178085
|
if (isConfiguredProject(this)) {
|
|
178049
178086
|
const configFileExistenceInfo = this.projectService.configFileExistenceInfoCache.get(missingFilePath);
|
|
@@ -178051,7 +178088,7 @@ var Project3 = class _Project {
|
|
|
178051
178088
|
return noopFileWatcher;
|
|
178052
178089
|
}
|
|
178053
178090
|
const fileWatcher = this.projectService.watchFactory.watchFile(
|
|
178054
|
-
|
|
178091
|
+
getNormalizedAbsolutePath(missingFileName, this.currentDirectory),
|
|
178055
178092
|
(fileName, eventKind) => {
|
|
178056
178093
|
if (isConfiguredProject(this)) {
|
|
178057
178094
|
this.getCachedDirectoryStructureHost().addOrDeleteFile(fileName, missingFilePath, eventKind);
|
|
@@ -178388,7 +178425,7 @@ var Project3 = class _Project {
|
|
|
178388
178425
|
getPackageJsonsVisibleToFile(fileName, rootDir) {
|
|
178389
178426
|
if (this.projectService.serverMode !== 0 /* Semantic */)
|
|
178390
178427
|
return emptyArray2;
|
|
178391
|
-
return this.projectService.getPackageJsonsVisibleToFile(fileName, rootDir);
|
|
178428
|
+
return this.projectService.getPackageJsonsVisibleToFile(fileName, this, rootDir);
|
|
178392
178429
|
}
|
|
178393
178430
|
/** @internal */
|
|
178394
178431
|
getNearestAncestorDirectoryWithPackageJson(fileName) {
|
|
@@ -178396,9 +178433,7 @@ var Project3 = class _Project {
|
|
|
178396
178433
|
}
|
|
178397
178434
|
/** @internal */
|
|
178398
178435
|
getPackageJsonsForAutoImport(rootDir) {
|
|
178399
|
-
|
|
178400
|
-
this.packageJsonsForAutoImport = new Set(packageJsons.map((p) => p.fileName));
|
|
178401
|
-
return packageJsons;
|
|
178436
|
+
return this.getPackageJsonsVisibleToFile(combinePaths(this.currentDirectory, inferredTypesContainingFile), rootDir);
|
|
178402
178437
|
}
|
|
178403
178438
|
/** @internal */
|
|
178404
178439
|
getPackageJsonCache() {
|
|
@@ -178484,7 +178519,7 @@ var Project3 = class _Project {
|
|
|
178484
178519
|
}
|
|
178485
178520
|
/** @internal */
|
|
178486
178521
|
watchNodeModulesForPackageJsonChanges(directoryPath) {
|
|
178487
|
-
return this.projectService.watchPackageJsonsInNodeModules(
|
|
178522
|
+
return this.projectService.watchPackageJsonsInNodeModules(directoryPath, this);
|
|
178488
178523
|
}
|
|
178489
178524
|
/** @internal */
|
|
178490
178525
|
getIncompleteCompletionsCache() {
|
|
@@ -180060,18 +180095,20 @@ var _ProjectService = class _ProjectService {
|
|
|
180060
180095
|
* @internal
|
|
180061
180096
|
*/
|
|
180062
180097
|
watchWildcardDirectory(directory, flags, configFileName, config) {
|
|
180063
|
-
|
|
180098
|
+
let watcher = this.watchFactory.watchDirectory(
|
|
180064
180099
|
directory,
|
|
180065
180100
|
(fileOrDirectory) => {
|
|
180066
180101
|
const fileOrDirectoryPath = this.toPath(fileOrDirectory);
|
|
180067
180102
|
const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
180068
|
-
if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(
|
|
180069
|
-
|
|
180070
|
-
this.
|
|
180103
|
+
if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
|
|
180104
|
+
const file = this.getNormalizedAbsolutePath(fileOrDirectory);
|
|
180105
|
+
this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
|
|
180106
|
+
this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
|
|
180107
|
+
this.watchPackageJsonFile(file, fileOrDirectoryPath, result);
|
|
180071
180108
|
}
|
|
180072
180109
|
const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
|
|
180073
180110
|
if (isIgnoredFileFromWildCardWatching({
|
|
180074
|
-
watchedDirPath: directory,
|
|
180111
|
+
watchedDirPath: this.toPath(directory),
|
|
180075
180112
|
fileOrDirectory,
|
|
180076
180113
|
fileOrDirectoryPath,
|
|
180077
180114
|
configFileName,
|
|
@@ -180116,6 +180153,22 @@ var _ProjectService = class _ProjectService {
|
|
|
180116
180153
|
WatchType.WildcardDirectory,
|
|
180117
180154
|
configFileName
|
|
180118
180155
|
);
|
|
180156
|
+
const result = {
|
|
180157
|
+
packageJsonWatches: void 0,
|
|
180158
|
+
close() {
|
|
180159
|
+
var _a;
|
|
180160
|
+
if (watcher) {
|
|
180161
|
+
watcher.close();
|
|
180162
|
+
watcher = void 0;
|
|
180163
|
+
(_a = result.packageJsonWatches) == null ? void 0 : _a.forEach((watcher2) => {
|
|
180164
|
+
watcher2.projects.delete(result);
|
|
180165
|
+
watcher2.close();
|
|
180166
|
+
});
|
|
180167
|
+
result.packageJsonWatches = void 0;
|
|
180168
|
+
}
|
|
180169
|
+
}
|
|
180170
|
+
};
|
|
180171
|
+
return result;
|
|
180119
180172
|
}
|
|
180120
180173
|
/** @internal */
|
|
180121
180174
|
delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
|
|
@@ -180860,7 +180913,7 @@ var _ProjectService = class _ProjectService {
|
|
|
180860
180913
|
config.watchedDirectoriesStale = false;
|
|
180861
180914
|
updateWatchingWildcardDirectories(
|
|
180862
180915
|
config.watchedDirectories || (config.watchedDirectories = /* @__PURE__ */ new Map()),
|
|
180863
|
-
|
|
180916
|
+
config.parsedCommandLine.wildcardDirectories,
|
|
180864
180917
|
// Create new directory watcher
|
|
180865
180918
|
(directory, flags) => this.watchWildcardDirectory(directory, flags, configFileName, config)
|
|
180866
180919
|
);
|
|
@@ -180942,7 +180995,7 @@ var _ProjectService = class _ProjectService {
|
|
|
180942
180995
|
if (value.info) {
|
|
180943
180996
|
project.removeFile(
|
|
180944
180997
|
value.info,
|
|
180945
|
-
project.fileExists(
|
|
180998
|
+
project.fileExists(value.info.fileName),
|
|
180946
180999
|
/*detachFromProject*/
|
|
180947
181000
|
true
|
|
180948
181001
|
);
|
|
@@ -181174,7 +181227,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
181174
181227
|
watchClosedScriptInfo(info) {
|
|
181175
181228
|
Debug.assert(!info.fileWatcher);
|
|
181176
181229
|
if (!info.isDynamicOrHasMixedContent() && (!this.globalCacheLocationDirectoryPath || !startsWith(info.path, this.globalCacheLocationDirectoryPath))) {
|
|
181177
|
-
const indexOfNodeModules = info.
|
|
181230
|
+
const indexOfNodeModules = info.fileName.indexOf("/node_modules/");
|
|
181178
181231
|
if (!this.host.getModifiedTime || indexOfNodeModules === -1) {
|
|
181179
181232
|
info.fileWatcher = this.watchFactory.watchFile(
|
|
181180
181233
|
info.fileName,
|
|
@@ -181185,12 +181238,12 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
181185
181238
|
);
|
|
181186
181239
|
} else {
|
|
181187
181240
|
info.mTime = this.getModifiedTime(info);
|
|
181188
|
-
info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.
|
|
181241
|
+
info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.fileName.substring(0, indexOfNodeModules));
|
|
181189
181242
|
}
|
|
181190
181243
|
}
|
|
181191
181244
|
}
|
|
181192
|
-
createNodeModulesWatcher(dir) {
|
|
181193
|
-
|
|
181245
|
+
createNodeModulesWatcher(dir, dirPath) {
|
|
181246
|
+
let watcher = this.watchFactory.watchDirectory(
|
|
181194
181247
|
dir,
|
|
181195
181248
|
(fileOrDirectory) => {
|
|
181196
181249
|
var _a;
|
|
@@ -181199,14 +181252,14 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
181199
181252
|
return;
|
|
181200
181253
|
const basename = getBaseFileName(fileOrDirectoryPath);
|
|
181201
181254
|
if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (basename === "package.json" || basename === "node_modules")) {
|
|
181202
|
-
result.affectedModuleSpecifierCacheProjects.forEach((
|
|
181203
|
-
var _a2
|
|
181204
|
-
(
|
|
181255
|
+
result.affectedModuleSpecifierCacheProjects.forEach((project) => {
|
|
181256
|
+
var _a2;
|
|
181257
|
+
(_a2 = project.getModuleSpecifierCache()) == null ? void 0 : _a2.clear();
|
|
181205
181258
|
});
|
|
181206
181259
|
}
|
|
181207
181260
|
if (result.refreshScriptInfoRefCount) {
|
|
181208
|
-
if (
|
|
181209
|
-
this.refreshScriptInfosInDirectory(
|
|
181261
|
+
if (dirPath === fileOrDirectoryPath) {
|
|
181262
|
+
this.refreshScriptInfosInDirectory(dirPath);
|
|
181210
181263
|
} else {
|
|
181211
181264
|
const info = this.getScriptInfoForPath(fileOrDirectoryPath);
|
|
181212
181265
|
if (info) {
|
|
@@ -181228,30 +181281,35 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
181228
181281
|
affectedModuleSpecifierCacheProjects: void 0,
|
|
181229
181282
|
close: () => {
|
|
181230
181283
|
var _a;
|
|
181231
|
-
if (!result.refreshScriptInfoRefCount && !((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size)) {
|
|
181284
|
+
if (watcher && !result.refreshScriptInfoRefCount && !((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size)) {
|
|
181232
181285
|
watcher.close();
|
|
181233
|
-
|
|
181286
|
+
watcher = void 0;
|
|
181287
|
+
this.nodeModulesWatchers.delete(dirPath);
|
|
181234
181288
|
}
|
|
181235
181289
|
}
|
|
181236
181290
|
};
|
|
181237
|
-
this.nodeModulesWatchers.set(
|
|
181291
|
+
this.nodeModulesWatchers.set(dirPath, result);
|
|
181238
181292
|
return result;
|
|
181239
181293
|
}
|
|
181240
181294
|
/** @internal */
|
|
181241
181295
|
watchPackageJsonsInNodeModules(dir, project) {
|
|
181242
|
-
|
|
181243
|
-
|
|
181296
|
+
var _a;
|
|
181297
|
+
const dirPath = this.toPath(dir);
|
|
181298
|
+
const watcher = this.nodeModulesWatchers.get(dirPath) || this.createNodeModulesWatcher(dir, dirPath);
|
|
181299
|
+
Debug.assert(!((_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.has(project)));
|
|
181300
|
+
(watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project);
|
|
181244
181301
|
return {
|
|
181245
181302
|
close: () => {
|
|
181246
|
-
var
|
|
181247
|
-
(
|
|
181303
|
+
var _a2;
|
|
181304
|
+
(_a2 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a2.delete(project);
|
|
181248
181305
|
watcher.close();
|
|
181249
181306
|
}
|
|
181250
181307
|
};
|
|
181251
181308
|
}
|
|
181252
181309
|
watchClosedScriptInfoInNodeModules(dir) {
|
|
181253
181310
|
const watchDir = dir + "/node_modules";
|
|
181254
|
-
const
|
|
181311
|
+
const watchDirPath = this.toPath(watchDir);
|
|
181312
|
+
const watcher = this.nodeModulesWatchers.get(watchDirPath) || this.createNodeModulesWatcher(watchDir, watchDirPath);
|
|
181255
181313
|
watcher.refreshScriptInfoRefCount++;
|
|
181256
181314
|
return {
|
|
181257
181315
|
close: () => {
|
|
@@ -181261,7 +181319,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
181261
181319
|
};
|
|
181262
181320
|
}
|
|
181263
181321
|
getModifiedTime(info) {
|
|
181264
|
-
return (this.host.getModifiedTime(info.
|
|
181322
|
+
return (this.host.getModifiedTime(info.fileName) || missingFileModifiedTime).getTime();
|
|
181265
181323
|
}
|
|
181266
181324
|
refreshScriptInfo(info) {
|
|
181267
181325
|
const mTime = this.getModifiedTime(info);
|
|
@@ -181525,10 +181583,9 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181525
181583
|
});
|
|
181526
181584
|
}
|
|
181527
181585
|
if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports) {
|
|
181528
|
-
this.
|
|
181529
|
-
|
|
181530
|
-
|
|
181531
|
-
);
|
|
181586
|
+
this.forEachProject((project) => {
|
|
181587
|
+
project.onAutoImportProviderSettingsChanged();
|
|
181588
|
+
});
|
|
181532
181589
|
}
|
|
181533
181590
|
}
|
|
181534
181591
|
if (args.extraFileExtensions) {
|
|
@@ -182447,10 +182504,9 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182447
182504
|
this.currentPluginConfigOverrides.set(args.pluginName, args.configuration);
|
|
182448
182505
|
}
|
|
182449
182506
|
/** @internal */
|
|
182450
|
-
getPackageJsonsVisibleToFile(fileName, rootDir) {
|
|
182507
|
+
getPackageJsonsVisibleToFile(fileName, project, rootDir) {
|
|
182451
182508
|
const packageJsonCache = this.packageJsonCache;
|
|
182452
182509
|
const rootPath = rootDir && this.toPath(rootDir);
|
|
182453
|
-
const filePath = this.toPath(fileName);
|
|
182454
182510
|
const result = [];
|
|
182455
182511
|
const processDirectory = (directory) => {
|
|
182456
182512
|
switch (packageJsonCache.directoryHasPackageJson(directory)) {
|
|
@@ -182459,7 +182515,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182459
182515
|
return processDirectory(directory);
|
|
182460
182516
|
case -1 /* True */:
|
|
182461
182517
|
const packageJsonFileName = combinePaths(directory, "package.json");
|
|
182462
|
-
this.watchPackageJsonFile(packageJsonFileName);
|
|
182518
|
+
this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName), project);
|
|
182463
182519
|
const info = packageJsonCache.getInDirectory(directory);
|
|
182464
182520
|
if (info)
|
|
182465
182521
|
result.push(info);
|
|
@@ -182468,13 +182524,13 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182468
182524
|
return true;
|
|
182469
182525
|
}
|
|
182470
182526
|
};
|
|
182471
|
-
forEachAncestorDirectory(getDirectoryPath(
|
|
182527
|
+
forEachAncestorDirectory(getDirectoryPath(fileName), processDirectory);
|
|
182472
182528
|
return result;
|
|
182473
182529
|
}
|
|
182474
182530
|
/** @internal */
|
|
182475
182531
|
getNearestAncestorDirectoryWithPackageJson(fileName) {
|
|
182476
182532
|
return forEachAncestorDirectory(fileName, (directory) => {
|
|
182477
|
-
switch (this.packageJsonCache.directoryHasPackageJson(
|
|
182533
|
+
switch (this.packageJsonCache.directoryHasPackageJson(directory)) {
|
|
182478
182534
|
case -1 /* True */:
|
|
182479
182535
|
return directory;
|
|
182480
182536
|
case 0 /* False */:
|
|
@@ -182485,41 +182541,54 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182485
182541
|
});
|
|
182486
182542
|
}
|
|
182487
182543
|
/** @internal */
|
|
182488
|
-
watchPackageJsonFile(path) {
|
|
182489
|
-
|
|
182490
|
-
|
|
182491
|
-
|
|
182492
|
-
|
|
182493
|
-
|
|
182494
|
-
|
|
182495
|
-
|
|
182496
|
-
|
|
182497
|
-
|
|
182498
|
-
|
|
182499
|
-
|
|
182500
|
-
|
|
182501
|
-
|
|
182502
|
-
|
|
182503
|
-
|
|
182504
|
-
|
|
182505
|
-
|
|
182506
|
-
|
|
182507
|
-
|
|
182508
|
-
|
|
182509
|
-
|
|
182510
|
-
|
|
182511
|
-
|
|
182512
|
-
250 /* Low */,
|
|
182513
|
-
this.hostConfiguration.watchOptions,
|
|
182514
|
-
WatchType.PackageJson
|
|
182515
|
-
)
|
|
182544
|
+
watchPackageJsonFile(file, path, project) {
|
|
182545
|
+
Debug.assert(project !== void 0);
|
|
182546
|
+
let result = (this.packageJsonFilesMap ?? (this.packageJsonFilesMap = /* @__PURE__ */ new Map())).get(path);
|
|
182547
|
+
if (!result) {
|
|
182548
|
+
let watcher = this.watchFactory.watchFile(
|
|
182549
|
+
file,
|
|
182550
|
+
(fileName, eventKind) => {
|
|
182551
|
+
switch (eventKind) {
|
|
182552
|
+
case 0 /* Created */:
|
|
182553
|
+
return Debug.fail();
|
|
182554
|
+
case 1 /* Changed */:
|
|
182555
|
+
this.packageJsonCache.addOrUpdate(fileName, path);
|
|
182556
|
+
this.onPackageJsonChange(result);
|
|
182557
|
+
break;
|
|
182558
|
+
case 2 /* Deleted */:
|
|
182559
|
+
this.packageJsonCache.delete(path);
|
|
182560
|
+
this.onPackageJsonChange(result);
|
|
182561
|
+
result.projects.clear();
|
|
182562
|
+
result.close();
|
|
182563
|
+
}
|
|
182564
|
+
},
|
|
182565
|
+
250 /* Low */,
|
|
182566
|
+
this.hostConfiguration.watchOptions,
|
|
182567
|
+
WatchType.PackageJson
|
|
182516
182568
|
);
|
|
182569
|
+
result = {
|
|
182570
|
+
projects: /* @__PURE__ */ new Set(),
|
|
182571
|
+
close: () => {
|
|
182572
|
+
var _a;
|
|
182573
|
+
if (result.projects.size || !watcher)
|
|
182574
|
+
return;
|
|
182575
|
+
watcher.close();
|
|
182576
|
+
watcher = void 0;
|
|
182577
|
+
(_a = this.packageJsonFilesMap) == null ? void 0 : _a.delete(path);
|
|
182578
|
+
this.packageJsonCache.invalidate(path);
|
|
182579
|
+
}
|
|
182580
|
+
};
|
|
182581
|
+
this.packageJsonFilesMap.set(path, result);
|
|
182517
182582
|
}
|
|
182583
|
+
result.projects.add(project);
|
|
182584
|
+
(project.packageJsonWatches ?? (project.packageJsonWatches = /* @__PURE__ */ new Set())).add(result);
|
|
182518
182585
|
}
|
|
182519
182586
|
/** @internal */
|
|
182520
|
-
|
|
182521
|
-
|
|
182522
|
-
|
|
182587
|
+
onPackageJsonChange(result) {
|
|
182588
|
+
result.projects.forEach((project) => {
|
|
182589
|
+
var _a;
|
|
182590
|
+
return (_a = project.onPackageJsonChange) == null ? void 0 : _a.call(project);
|
|
182591
|
+
});
|
|
182523
182592
|
}
|
|
182524
182593
|
/** @internal */
|
|
182525
182594
|
includePackageJsonAutoImports() {
|
|
@@ -182533,19 +182602,6 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182533
182602
|
}
|
|
182534
182603
|
}
|
|
182535
182604
|
/** @internal */
|
|
182536
|
-
invalidateProjectPackageJson(packageJsonPath) {
|
|
182537
|
-
this.configuredProjects.forEach(invalidate);
|
|
182538
|
-
this.inferredProjects.forEach(invalidate);
|
|
182539
|
-
this.externalProjects.forEach(invalidate);
|
|
182540
|
-
function invalidate(project) {
|
|
182541
|
-
if (packageJsonPath) {
|
|
182542
|
-
project.onPackageJsonChange(packageJsonPath);
|
|
182543
|
-
} else {
|
|
182544
|
-
project.onAutoImportProviderSettingsChanged();
|
|
182545
|
-
}
|
|
182546
|
-
}
|
|
182547
|
-
}
|
|
182548
|
-
/** @internal */
|
|
182549
182605
|
getIncompleteCompletionsCache() {
|
|
182550
182606
|
return this.incompleteCompletionsCache || (this.incompleteCompletionsCache = createIncompleteCompletionsCache());
|
|
182551
182607
|
}
|
|
@@ -182603,9 +182659,10 @@ function createModuleSpecifierCache(host) {
|
|
|
182603
182659
|
for (const p of modulePaths) {
|
|
182604
182660
|
if (p.isInNodeModules) {
|
|
182605
182661
|
const nodeModulesPath = p.path.substring(0, p.path.indexOf(nodeModulesPathPart) + nodeModulesPathPart.length - 1);
|
|
182606
|
-
|
|
182662
|
+
const key2 = host.toPath(nodeModulesPath);
|
|
182663
|
+
if (!(containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.has(key2))) {
|
|
182607
182664
|
(containedNodeModulesWatchers || (containedNodeModulesWatchers = /* @__PURE__ */ new Map())).set(
|
|
182608
|
-
|
|
182665
|
+
key2,
|
|
182609
182666
|
host.watchNodeModulesForPackageJsonChanges(nodeModulesPath)
|
|
182610
182667
|
);
|
|
182611
182668
|
}
|
|
@@ -182644,7 +182701,7 @@ function createModuleSpecifierCache(host) {
|
|
|
182644
182701
|
}
|
|
182645
182702
|
},
|
|
182646
182703
|
clear() {
|
|
182647
|
-
containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach(
|
|
182704
|
+
containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach(closeFileWatcher);
|
|
182648
182705
|
cache == null ? void 0 : cache.clear();
|
|
182649
182706
|
containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.clear();
|
|
182650
182707
|
currentKey = void 0;
|
|
@@ -182679,34 +182736,38 @@ function createPackageJsonCache(host) {
|
|
|
182679
182736
|
const directoriesWithoutPackageJson = /* @__PURE__ */ new Map();
|
|
182680
182737
|
return {
|
|
182681
182738
|
addOrUpdate,
|
|
182682
|
-
|
|
182683
|
-
get: packageJsons.get.bind(packageJsons),
|
|
182739
|
+
invalidate,
|
|
182684
182740
|
delete: (fileName) => {
|
|
182685
182741
|
packageJsons.delete(fileName);
|
|
182686
182742
|
directoriesWithoutPackageJson.set(getDirectoryPath(fileName), true);
|
|
182687
182743
|
},
|
|
182688
182744
|
getInDirectory: (directory) => {
|
|
182689
|
-
return packageJsons.get(combinePaths(directory, "package.json")) || void 0;
|
|
182745
|
+
return packageJsons.get(host.toPath(combinePaths(directory, "package.json"))) || void 0;
|
|
182690
182746
|
},
|
|
182691
|
-
directoryHasPackageJson,
|
|
182747
|
+
directoryHasPackageJson: (directory) => directoryHasPackageJson(host.toPath(directory)),
|
|
182692
182748
|
searchDirectoryAndAncestors: (directory) => {
|
|
182693
182749
|
forEachAncestorDirectory(directory, (ancestor) => {
|
|
182694
|
-
|
|
182750
|
+
const ancestorPath = host.toPath(ancestor);
|
|
182751
|
+
if (directoryHasPackageJson(ancestorPath) !== 3 /* Maybe */) {
|
|
182695
182752
|
return true;
|
|
182696
182753
|
}
|
|
182697
|
-
const packageJsonFileName =
|
|
182754
|
+
const packageJsonFileName = combinePaths(ancestor, "package.json");
|
|
182698
182755
|
if (tryFileExists(host, packageJsonFileName)) {
|
|
182699
|
-
addOrUpdate(packageJsonFileName);
|
|
182756
|
+
addOrUpdate(packageJsonFileName, combinePaths(ancestorPath, "package.json"));
|
|
182700
182757
|
} else {
|
|
182701
|
-
directoriesWithoutPackageJson.set(
|
|
182758
|
+
directoriesWithoutPackageJson.set(ancestorPath, true);
|
|
182702
182759
|
}
|
|
182703
182760
|
});
|
|
182704
182761
|
}
|
|
182705
182762
|
};
|
|
182706
|
-
function addOrUpdate(fileName) {
|
|
182763
|
+
function addOrUpdate(fileName, path) {
|
|
182707
182764
|
const packageJsonInfo = Debug.checkDefined(createPackageJsonInfo(fileName, host.host));
|
|
182708
|
-
packageJsons.set(
|
|
182709
|
-
directoriesWithoutPackageJson.delete(getDirectoryPath(
|
|
182765
|
+
packageJsons.set(path, packageJsonInfo);
|
|
182766
|
+
directoriesWithoutPackageJson.delete(getDirectoryPath(path));
|
|
182767
|
+
}
|
|
182768
|
+
function invalidate(path) {
|
|
182769
|
+
packageJsons.delete(path);
|
|
182770
|
+
directoriesWithoutPackageJson.delete(getDirectoryPath(path));
|
|
182710
182771
|
}
|
|
182711
182772
|
function directoryHasPackageJson(directory) {
|
|
182712
182773
|
return packageJsons.has(combinePaths(directory, "package.json")) ? -1 /* True */ : directoriesWithoutPackageJson.has(directory) ? 0 /* False */ : 3 /* Maybe */;
|
|
@@ -189264,6 +189325,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189264
189325
|
isOuterExpression,
|
|
189265
189326
|
isOutermostOptionalChain,
|
|
189266
189327
|
isOverrideModifier,
|
|
189328
|
+
isPackageJsonInfo,
|
|
189267
189329
|
isPackedArrayLiteral,
|
|
189268
189330
|
isParameter,
|
|
189269
189331
|
isParameterDeclaration,
|
|
@@ -189915,7 +189977,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189915
189977
|
updateErrorForNoInputFiles,
|
|
189916
189978
|
updateLanguageServiceSourceFile,
|
|
189917
189979
|
updateMissingFilePathsWatch,
|
|
189918
|
-
updatePackageJsonWatch,
|
|
189919
189980
|
updateResolutionField,
|
|
189920
189981
|
updateSharedExtendedConfigFileWatcher,
|
|
189921
189982
|
updateSourceFile,
|