typescript 5.4.0-dev.20231127 → 5.4.0-dev.20231129
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 +224 -174
- package/lib/tsserver.js +415 -305
- package/lib/typescript.js +413 -304
- package/lib/typingsInstaller.js +32 -19
- package/package.json +3 -3
package/lib/tsserver.js
CHANGED
|
@@ -545,6 +545,7 @@ __export(server_exports, {
|
|
|
545
545
|
escapeNonAsciiString: () => escapeNonAsciiString,
|
|
546
546
|
escapeSnippetText: () => escapeSnippetText,
|
|
547
547
|
escapeString: () => escapeString,
|
|
548
|
+
escapeTemplateSubstitution: () => escapeTemplateSubstitution,
|
|
548
549
|
every: () => every,
|
|
549
550
|
expandPreOrPostfixIncrementOrDecrementExpression: () => expandPreOrPostfixIncrementOrDecrementExpression,
|
|
550
551
|
explainFiles: () => explainFiles,
|
|
@@ -1643,6 +1644,7 @@ __export(server_exports, {
|
|
|
1643
1644
|
isOuterExpression: () => isOuterExpression,
|
|
1644
1645
|
isOutermostOptionalChain: () => isOutermostOptionalChain,
|
|
1645
1646
|
isOverrideModifier: () => isOverrideModifier,
|
|
1647
|
+
isPackageJsonInfo: () => isPackageJsonInfo,
|
|
1646
1648
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
1647
1649
|
isParameter: () => isParameter,
|
|
1648
1650
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
@@ -2294,7 +2296,6 @@ __export(server_exports, {
|
|
|
2294
2296
|
updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
|
|
2295
2297
|
updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
|
|
2296
2298
|
updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
|
|
2297
|
-
updatePackageJsonWatch: () => updatePackageJsonWatch,
|
|
2298
2299
|
updateResolutionField: () => updateResolutionField,
|
|
2299
2300
|
updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher,
|
|
2300
2301
|
updateSourceFile: () => updateSourceFile,
|
|
@@ -2331,7 +2332,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2331
2332
|
|
|
2332
2333
|
// src/compiler/corePublic.ts
|
|
2333
2334
|
var versionMajorMinor = "5.4";
|
|
2334
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2335
|
+
var version = `${versionMajorMinor}.0-dev.20231129`;
|
|
2335
2336
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2336
2337
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2337
2338
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -20031,19 +20032,19 @@ function clearMap(map2, onDeleteValue) {
|
|
|
20031
20032
|
function mutateMapSkippingNewValues(map2, newMap, options) {
|
|
20032
20033
|
const { onDeleteValue, onExistingValue } = options;
|
|
20033
20034
|
map2.forEach((existingValue, key) => {
|
|
20034
|
-
|
|
20035
|
-
if (
|
|
20035
|
+
var _a;
|
|
20036
|
+
if (!(newMap == null ? void 0 : newMap.has(key))) {
|
|
20036
20037
|
map2.delete(key);
|
|
20037
20038
|
onDeleteValue(existingValue, key);
|
|
20038
20039
|
} else if (onExistingValue) {
|
|
20039
|
-
onExistingValue(existingValue,
|
|
20040
|
+
onExistingValue(existingValue, (_a = newMap.get) == null ? void 0 : _a.call(newMap, key), key);
|
|
20040
20041
|
}
|
|
20041
20042
|
});
|
|
20042
20043
|
}
|
|
20043
20044
|
function mutateMap(map2, newMap, options) {
|
|
20044
20045
|
mutateMapSkippingNewValues(map2, newMap, options);
|
|
20045
20046
|
const { createNewValue } = options;
|
|
20046
|
-
newMap.forEach((valueInNewMap, key) => {
|
|
20047
|
+
newMap == null ? void 0 : newMap.forEach((valueInNewMap, key) => {
|
|
20047
20048
|
if (!map2.has(key)) {
|
|
20048
20049
|
map2.set(key, createNewValue(key, valueInNewMap));
|
|
20049
20050
|
}
|
|
@@ -35640,8 +35641,9 @@ var Parser;
|
|
|
35640
35641
|
function nextTokenIsStringLiteral() {
|
|
35641
35642
|
return nextToken() === 11 /* StringLiteral */;
|
|
35642
35643
|
}
|
|
35643
|
-
function
|
|
35644
|
-
|
|
35644
|
+
function nextTokenIsFromKeywordOrEqualsToken() {
|
|
35645
|
+
nextToken();
|
|
35646
|
+
return token() === 161 /* FromKeyword */ || token() === 64 /* EqualsToken */;
|
|
35645
35647
|
}
|
|
35646
35648
|
function nextTokenIsIdentifierOrStringLiteralOnSameLine() {
|
|
35647
35649
|
nextToken();
|
|
@@ -36338,7 +36340,7 @@ var Parser;
|
|
|
36338
36340
|
identifier = parseIdentifier();
|
|
36339
36341
|
}
|
|
36340
36342
|
let isTypeOnly = false;
|
|
36341
|
-
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(
|
|
36343
|
+
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(nextTokenIsFromKeywordOrEqualsToken)) && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) {
|
|
36342
36344
|
isTypeOnly = true;
|
|
36343
36345
|
identifier = isIdentifier2() ? parseIdentifier() : void 0;
|
|
36344
36346
|
}
|
|
@@ -37121,18 +37123,7 @@ var Parser;
|
|
|
37121
37123
|
}
|
|
37122
37124
|
nextTokenJSDoc();
|
|
37123
37125
|
skipWhitespace();
|
|
37124
|
-
const
|
|
37125
|
-
let name = tokenIsIdentifierOrKeyword(token()) ? parseEntityName(
|
|
37126
|
-
/*allowReservedWords*/
|
|
37127
|
-
true
|
|
37128
|
-
) : void 0;
|
|
37129
|
-
if (name) {
|
|
37130
|
-
while (token() === 81 /* PrivateIdentifier */) {
|
|
37131
|
-
reScanHashToken();
|
|
37132
|
-
nextTokenJSDoc();
|
|
37133
|
-
name = finishNode(factory2.createJSDocMemberName(name, parseIdentifier()), p2);
|
|
37134
|
-
}
|
|
37135
|
-
}
|
|
37126
|
+
const name = parseJSDocLinkName();
|
|
37136
37127
|
const text = [];
|
|
37137
37128
|
while (token() !== 20 /* CloseBraceToken */ && token() !== 4 /* NewLineTrivia */ && token() !== 1 /* EndOfFileToken */) {
|
|
37138
37129
|
text.push(scanner2.getTokenText());
|
|
@@ -37141,6 +37132,26 @@ var Parser;
|
|
|
37141
37132
|
const create = linkType === "link" ? factory2.createJSDocLink : linkType === "linkcode" ? factory2.createJSDocLinkCode : factory2.createJSDocLinkPlain;
|
|
37142
37133
|
return finishNode(create(name, text.join("")), start3, scanner2.getTokenEnd());
|
|
37143
37134
|
}
|
|
37135
|
+
function parseJSDocLinkName() {
|
|
37136
|
+
if (tokenIsIdentifierOrKeyword(token())) {
|
|
37137
|
+
const pos = getNodePos();
|
|
37138
|
+
let name = parseIdentifierName();
|
|
37139
|
+
while (parseOptional(25 /* DotToken */)) {
|
|
37140
|
+
name = finishNode(factory2.createQualifiedName(name, token() === 81 /* PrivateIdentifier */ ? createMissingNode(
|
|
37141
|
+
80 /* Identifier */,
|
|
37142
|
+
/*reportAtCurrentPosition*/
|
|
37143
|
+
false
|
|
37144
|
+
) : parseIdentifier()), pos);
|
|
37145
|
+
}
|
|
37146
|
+
while (token() === 81 /* PrivateIdentifier */) {
|
|
37147
|
+
reScanHashToken();
|
|
37148
|
+
nextTokenJSDoc();
|
|
37149
|
+
name = finishNode(factory2.createJSDocMemberName(name, parseIdentifier()), pos);
|
|
37150
|
+
}
|
|
37151
|
+
return name;
|
|
37152
|
+
}
|
|
37153
|
+
return void 0;
|
|
37154
|
+
}
|
|
37144
37155
|
function parseJSDocLinkPrefix() {
|
|
37145
37156
|
skipWhitespaceOrAsterisk();
|
|
37146
37157
|
if (token() === 19 /* OpenBraceToken */ && nextTokenJSDoc() === 60 /* AtToken */ && tokenIsIdentifierOrKeyword(nextTokenJSDoc())) {
|
|
@@ -41244,34 +41255,39 @@ function specToDiagnostic(spec, disallowTrailingRecursion) {
|
|
|
41244
41255
|
return [Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
|
|
41245
41256
|
}
|
|
41246
41257
|
}
|
|
41247
|
-
function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude },
|
|
41248
|
-
const rawExcludeRegex = getRegularExpressionForWildcard(exclude,
|
|
41258
|
+
function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, basePath, useCaseSensitiveFileNames2) {
|
|
41259
|
+
const rawExcludeRegex = getRegularExpressionForWildcard(exclude, basePath, "exclude");
|
|
41249
41260
|
const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames2 ? "" : "i");
|
|
41250
41261
|
const wildcardDirectories = {};
|
|
41262
|
+
const wildCardKeyToPath = /* @__PURE__ */ new Map();
|
|
41251
41263
|
if (include !== void 0) {
|
|
41252
41264
|
const recursiveKeys = [];
|
|
41253
41265
|
for (const file of include) {
|
|
41254
|
-
const spec = normalizePath(combinePaths(
|
|
41266
|
+
const spec = normalizePath(combinePaths(basePath, file));
|
|
41255
41267
|
if (excludeRegex && excludeRegex.test(spec)) {
|
|
41256
41268
|
continue;
|
|
41257
41269
|
}
|
|
41258
41270
|
const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
|
|
41259
41271
|
if (match) {
|
|
41260
|
-
const { key, flags } = match;
|
|
41261
|
-
const
|
|
41272
|
+
const { key, path, flags } = match;
|
|
41273
|
+
const existingPath = wildCardKeyToPath.get(key);
|
|
41274
|
+
const existingFlags = existingPath !== void 0 ? wildcardDirectories[existingPath] : void 0;
|
|
41262
41275
|
if (existingFlags === void 0 || existingFlags < flags) {
|
|
41263
|
-
wildcardDirectories[
|
|
41276
|
+
wildcardDirectories[existingPath !== void 0 ? existingPath : path] = flags;
|
|
41277
|
+
if (existingPath === void 0)
|
|
41278
|
+
wildCardKeyToPath.set(key, path);
|
|
41264
41279
|
if (flags === 1 /* Recursive */) {
|
|
41265
41280
|
recursiveKeys.push(key);
|
|
41266
41281
|
}
|
|
41267
41282
|
}
|
|
41268
41283
|
}
|
|
41269
41284
|
}
|
|
41270
|
-
for (const
|
|
41271
|
-
if (hasProperty(wildcardDirectories,
|
|
41285
|
+
for (const path in wildcardDirectories) {
|
|
41286
|
+
if (hasProperty(wildcardDirectories, path)) {
|
|
41272
41287
|
for (const recursiveKey of recursiveKeys) {
|
|
41273
|
-
|
|
41274
|
-
|
|
41288
|
+
const key = toCanonicalKey(path, useCaseSensitiveFileNames2);
|
|
41289
|
+
if (key !== recursiveKey && containsPath(recursiveKey, key, basePath, !useCaseSensitiveFileNames2)) {
|
|
41290
|
+
delete wildcardDirectories[path];
|
|
41275
41291
|
}
|
|
41276
41292
|
}
|
|
41277
41293
|
}
|
|
@@ -41279,6 +41295,9 @@ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExclu
|
|
|
41279
41295
|
}
|
|
41280
41296
|
return wildcardDirectories;
|
|
41281
41297
|
}
|
|
41298
|
+
function toCanonicalKey(path, useCaseSensitiveFileNames2) {
|
|
41299
|
+
return useCaseSensitiveFileNames2 ? path : toFileNameLowerCase(path);
|
|
41300
|
+
}
|
|
41282
41301
|
function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
|
|
41283
41302
|
const match = wildcardDirectoryPattern.exec(spec);
|
|
41284
41303
|
if (match) {
|
|
@@ -41286,13 +41305,16 @@ function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
|
|
|
41286
41305
|
const starWildcardIndex = spec.indexOf("*");
|
|
41287
41306
|
const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator);
|
|
41288
41307
|
return {
|
|
41289
|
-
key:
|
|
41308
|
+
key: toCanonicalKey(match[0], useCaseSensitiveFileNames2),
|
|
41309
|
+
path: match[0],
|
|
41290
41310
|
flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 /* Recursive */ : 0 /* None */
|
|
41291
41311
|
};
|
|
41292
41312
|
}
|
|
41293
41313
|
if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) {
|
|
41314
|
+
const path = removeTrailingDirectorySeparator(spec);
|
|
41294
41315
|
return {
|
|
41295
|
-
key:
|
|
41316
|
+
key: toCanonicalKey(path, useCaseSensitiveFileNames2),
|
|
41317
|
+
path,
|
|
41296
41318
|
flags: 1 /* Recursive */
|
|
41297
41319
|
};
|
|
41298
41320
|
}
|
|
@@ -41935,6 +41957,9 @@ function getAutomaticTypeDirectiveNames(options, host) {
|
|
|
41935
41957
|
}
|
|
41936
41958
|
return result;
|
|
41937
41959
|
}
|
|
41960
|
+
function isPackageJsonInfo(entry) {
|
|
41961
|
+
return !!(entry == null ? void 0 : entry.contents);
|
|
41962
|
+
}
|
|
41938
41963
|
function compilerOptionValueToString(value) {
|
|
41939
41964
|
var _a;
|
|
41940
41965
|
if (value === null || typeof value !== "object") {
|
|
@@ -42039,7 +42064,7 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
|
|
|
42039
42064
|
}
|
|
42040
42065
|
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
42041
42066
|
let cache;
|
|
42042
|
-
return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2,
|
|
42067
|
+
return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2, getInternalMap };
|
|
42043
42068
|
function getPackageJsonInfo2(packageJsonPath) {
|
|
42044
42069
|
return cache == null ? void 0 : cache.get(toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
|
|
42045
42070
|
}
|
|
@@ -42049,10 +42074,6 @@ function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
|
42049
42074
|
function clear2() {
|
|
42050
42075
|
cache = void 0;
|
|
42051
42076
|
}
|
|
42052
|
-
function entries() {
|
|
42053
|
-
const iter = cache == null ? void 0 : cache.entries();
|
|
42054
|
-
return iter ? arrayFrom(iter) : [];
|
|
42055
|
-
}
|
|
42056
42077
|
function getInternalMap() {
|
|
42057
42078
|
return cache;
|
|
42058
42079
|
}
|
|
@@ -43069,13 +43090,13 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
43069
43090
|
}
|
|
43070
43091
|
const existing = (_b = state.packageJsonInfoCache) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
43071
43092
|
if (existing !== void 0) {
|
|
43072
|
-
if (
|
|
43093
|
+
if (isPackageJsonInfo(existing)) {
|
|
43073
43094
|
if (traceEnabled)
|
|
43074
43095
|
trace(host, Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
|
|
43075
43096
|
(_c = state.affectingLocations) == null ? void 0 : _c.push(packageJsonPath);
|
|
43076
43097
|
return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents };
|
|
43077
43098
|
} else {
|
|
43078
|
-
if (existing && traceEnabled)
|
|
43099
|
+
if (existing.directoryExists && traceEnabled)
|
|
43079
43100
|
trace(host, Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath);
|
|
43080
43101
|
(_d = state.failedLookupLocations) == null ? void 0 : _d.push(packageJsonPath);
|
|
43081
43102
|
return void 0;
|
|
@@ -43097,7 +43118,7 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
43097
43118
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
43098
43119
|
}
|
|
43099
43120
|
if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
|
|
43100
|
-
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, directoryExists);
|
|
43121
|
+
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, { packageDirectory, directoryExists });
|
|
43101
43122
|
(_f = state.failedLookupLocations) == null ? void 0 : _f.push(packageJsonPath);
|
|
43102
43123
|
}
|
|
43103
43124
|
}
|
|
@@ -47108,8 +47129,8 @@ function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourc
|
|
|
47108
47129
|
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getPreferences({}, compilerOptions, importingSourceFile), {}, options);
|
|
47109
47130
|
}
|
|
47110
47131
|
function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
|
|
47111
|
-
const info = getInfo(importingSourceFile.
|
|
47112
|
-
const modulePaths = getAllModulePaths(
|
|
47132
|
+
const info = getInfo(importingSourceFile.fileName, host);
|
|
47133
|
+
const modulePaths = getAllModulePaths(info, nodeModulesFileName, host, preferences, options);
|
|
47113
47134
|
return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
|
|
47114
47135
|
modulePath,
|
|
47115
47136
|
info,
|
|
@@ -47124,7 +47145,7 @@ function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeMod
|
|
|
47124
47145
|
}
|
|
47125
47146
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, preferences, userPreferences, options = {}) {
|
|
47126
47147
|
const info = getInfo(importingSourceFileName, host);
|
|
47127
|
-
const modulePaths = getAllModulePaths(
|
|
47148
|
+
const modulePaths = getAllModulePaths(info, toFileName2, host, userPreferences, options);
|
|
47128
47149
|
return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
|
|
47129
47150
|
modulePath,
|
|
47130
47151
|
info,
|
|
@@ -47186,7 +47207,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
47186
47207
|
if (!moduleSourceFile)
|
|
47187
47208
|
return { moduleSpecifiers: emptyArray, computedWithoutCache };
|
|
47188
47209
|
computedWithoutCache = true;
|
|
47189
|
-
modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.
|
|
47210
|
+
modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host));
|
|
47190
47211
|
const result = computeModuleSpecifiers(
|
|
47191
47212
|
modulePaths,
|
|
47192
47213
|
compilerOptions,
|
|
@@ -47200,7 +47221,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
47200
47221
|
return { moduleSpecifiers: result, computedWithoutCache };
|
|
47201
47222
|
}
|
|
47202
47223
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
47203
|
-
const info = getInfo(importingSourceFile.
|
|
47224
|
+
const info = getInfo(importingSourceFile.fileName, host);
|
|
47204
47225
|
const preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
47205
47226
|
const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
|
|
47206
47227
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
@@ -47264,16 +47285,22 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
47264
47285
|
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
47286
|
}
|
|
47266
47287
|
function getInfo(importingSourceFileName, host) {
|
|
47288
|
+
importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
|
|
47267
47289
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : true);
|
|
47268
47290
|
const sourceDirectory = getDirectoryPath(importingSourceFileName);
|
|
47269
|
-
return {
|
|
47291
|
+
return {
|
|
47292
|
+
getCanonicalFileName,
|
|
47293
|
+
importingSourceFileName,
|
|
47294
|
+
sourceDirectory,
|
|
47295
|
+
canonicalSourceDirectory: getCanonicalFileName(sourceDirectory)
|
|
47296
|
+
};
|
|
47270
47297
|
}
|
|
47271
47298
|
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference }, pathsOnly) {
|
|
47272
47299
|
const { baseUrl, paths, rootDirs } = compilerOptions;
|
|
47273
47300
|
if (pathsOnly && !paths) {
|
|
47274
47301
|
return void 0;
|
|
47275
47302
|
}
|
|
47276
|
-
const { sourceDirectory, getCanonicalFileName } = info;
|
|
47303
|
+
const { sourceDirectory, canonicalSourceDirectory, getCanonicalFileName } = info;
|
|
47277
47304
|
const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
|
|
47278
47305
|
const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
|
|
47279
47306
|
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
|
|
@@ -47298,7 +47325,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
47298
47325
|
if (relativePreference === 3 /* ExternalNonRelative */ && !pathIsRelative(maybeNonRelative)) {
|
|
47299
47326
|
const projectDirectory = compilerOptions.configFilePath ? toPath(getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory());
|
|
47300
47327
|
const modulePath = toPath(moduleFileName, projectDirectory, getCanonicalFileName);
|
|
47301
|
-
const sourceIsInternal = startsWith(
|
|
47328
|
+
const sourceIsInternal = startsWith(canonicalSourceDirectory, projectDirectory);
|
|
47302
47329
|
const targetIsInternal = startsWith(modulePath, projectDirectory);
|
|
47303
47330
|
if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
|
|
47304
47331
|
return maybeNonRelative;
|
|
@@ -47371,8 +47398,9 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
|
|
|
47371
47398
|
});
|
|
47372
47399
|
return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
|
|
47373
47400
|
}
|
|
47374
|
-
function getAllModulePaths(
|
|
47401
|
+
function getAllModulePaths(info, importedFileName, host, preferences, options = {}) {
|
|
47375
47402
|
var _a;
|
|
47403
|
+
const importingFilePath = toPath(info.importingSourceFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
47376
47404
|
const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
47377
47405
|
const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
|
|
47378
47406
|
if (cache) {
|
|
@@ -47380,30 +47408,29 @@ function getAllModulePaths(importingFilePath, importedFileName, host, preference
|
|
|
47380
47408
|
if (cached == null ? void 0 : cached.modulePaths)
|
|
47381
47409
|
return cached.modulePaths;
|
|
47382
47410
|
}
|
|
47383
|
-
const modulePaths = getAllModulePathsWorker(
|
|
47411
|
+
const modulePaths = getAllModulePathsWorker(info, importedFileName, host);
|
|
47384
47412
|
if (cache) {
|
|
47385
47413
|
cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
|
|
47386
47414
|
}
|
|
47387
47415
|
return modulePaths;
|
|
47388
47416
|
}
|
|
47389
|
-
function getAllModulePathsWorker(
|
|
47390
|
-
const getCanonicalFileName = hostGetCanonicalFileName(host);
|
|
47417
|
+
function getAllModulePathsWorker(info, importedFileName, host) {
|
|
47391
47418
|
const allFileNames = /* @__PURE__ */ new Map();
|
|
47392
47419
|
let importedFileFromNodeModules = false;
|
|
47393
47420
|
forEachFileNameOfModule(
|
|
47394
|
-
|
|
47421
|
+
info.importingSourceFileName,
|
|
47395
47422
|
importedFileName,
|
|
47396
47423
|
host,
|
|
47397
47424
|
/*preferSymlinks*/
|
|
47398
47425
|
true,
|
|
47399
47426
|
(path, isRedirect) => {
|
|
47400
47427
|
const isInNodeModules = pathContainsNodeModules(path);
|
|
47401
|
-
allFileNames.set(path, { path: getCanonicalFileName(path), isRedirect, isInNodeModules });
|
|
47428
|
+
allFileNames.set(path, { path: info.getCanonicalFileName(path), isRedirect, isInNodeModules });
|
|
47402
47429
|
importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules;
|
|
47403
47430
|
}
|
|
47404
47431
|
);
|
|
47405
47432
|
const sortedPaths = [];
|
|
47406
|
-
for (let directory =
|
|
47433
|
+
for (let directory = info.canonicalSourceDirectory; allFileNames.size !== 0; ) {
|
|
47407
47434
|
const directoryStart = ensureTrailingDirectorySeparator(directory);
|
|
47408
47435
|
let pathsInDirectory;
|
|
47409
47436
|
allFileNames.forEach(({ path, isRedirect, isInNodeModules }, fileName) => {
|
|
@@ -47424,7 +47451,10 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
|
|
|
47424
47451
|
directory = newDirectory;
|
|
47425
47452
|
}
|
|
47426
47453
|
if (allFileNames.size) {
|
|
47427
|
-
const remainingPaths = arrayFrom(
|
|
47454
|
+
const remainingPaths = arrayFrom(
|
|
47455
|
+
allFileNames.entries(),
|
|
47456
|
+
([fileName, { isRedirect, isInNodeModules }]) => ({ path: fileName, isRedirect, isInNodeModules })
|
|
47457
|
+
);
|
|
47428
47458
|
if (remainingPaths.length > 1)
|
|
47429
47459
|
remainingPaths.sort(comparePathsByRedirectAndNumberOfDirectorySeparators);
|
|
47430
47460
|
sortedPaths.push(...remainingPaths);
|
|
@@ -47584,7 +47614,7 @@ function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory,
|
|
|
47584
47614
|
}
|
|
47585
47615
|
return processEnding(shortest, allowedEndings, compilerOptions);
|
|
47586
47616
|
}
|
|
47587
|
-
function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileName,
|
|
47617
|
+
function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileName, canonicalSourceDirectory }, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
47588
47618
|
if (!host.fileExists || !host.readFile) {
|
|
47589
47619
|
return void 0;
|
|
47590
47620
|
}
|
|
@@ -47628,7 +47658,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
47628
47658
|
}
|
|
47629
47659
|
const globalTypingsCacheLocation = host.getGlobalTypingsCacheLocation && host.getGlobalTypingsCacheLocation();
|
|
47630
47660
|
const pathToTopLevelNodeModules = getCanonicalFileName(moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex));
|
|
47631
|
-
if (!(startsWith(
|
|
47661
|
+
if (!(startsWith(canonicalSourceDirectory, pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
|
|
47632
47662
|
return void 0;
|
|
47633
47663
|
}
|
|
47634
47664
|
const nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
|
|
@@ -47641,7 +47671,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
47641
47671
|
let moduleFileToTry = path;
|
|
47642
47672
|
let maybeBlockedByTypesVersions = false;
|
|
47643
47673
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
47644
|
-
if (
|
|
47674
|
+
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
47645
47675
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
47646
47676
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
47647
47677
|
if (getResolvePackageJsonExports(options)) {
|
|
@@ -59228,9 +59258,13 @@ function createTypeChecker(host) {
|
|
|
59228
59258
|
function getConstraintOfTypeParameter(typeParameter) {
|
|
59229
59259
|
return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0;
|
|
59230
59260
|
}
|
|
59261
|
+
function isConstMappedType(type, depth) {
|
|
59262
|
+
const typeVariable = getHomomorphicTypeVariable(type);
|
|
59263
|
+
return !!typeVariable && isConstTypeVariable(typeVariable, depth);
|
|
59264
|
+
}
|
|
59231
59265
|
function isConstTypeVariable(type, depth = 0) {
|
|
59232
59266
|
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));
|
|
59267
|
+
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
59268
|
}
|
|
59235
59269
|
function getConstraintOfIndexedAccess(type) {
|
|
59236
59270
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -71603,14 +71637,15 @@ function createTypeChecker(host) {
|
|
|
71603
71637
|
if (declaration) {
|
|
71604
71638
|
if (isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
71605
71639
|
const parent2 = declaration.parent.parent;
|
|
71606
|
-
|
|
71640
|
+
const rootDeclaration = getRootDeclaration(parent2);
|
|
71641
|
+
if (rootDeclaration.kind === 260 /* VariableDeclaration */ && getCombinedNodeFlagsCached(rootDeclaration) & 6 /* Constant */ || rootDeclaration.kind === 169 /* Parameter */) {
|
|
71607
71642
|
const links = getNodeLinks(parent2);
|
|
71608
71643
|
if (!(links.flags & 4194304 /* InCheckIdentifier */)) {
|
|
71609
71644
|
links.flags |= 4194304 /* InCheckIdentifier */;
|
|
71610
71645
|
const parentType = getTypeForBindingElementParent(parent2, 0 /* Normal */);
|
|
71611
71646
|
const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType);
|
|
71612
71647
|
links.flags &= ~4194304 /* InCheckIdentifier */;
|
|
71613
|
-
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(
|
|
71648
|
+
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(rootDeclaration.kind === 169 /* Parameter */ && isSymbolAssigned(symbol))) {
|
|
71614
71649
|
const pattern = declaration.parent;
|
|
71615
71650
|
const narrowedType = getFlowTypeOfReference(
|
|
71616
71651
|
pattern,
|
|
@@ -112868,8 +112903,8 @@ function transformDeclarations(context) {
|
|
|
112868
112903
|
const specifier = getModuleSpecifier(
|
|
112869
112904
|
options,
|
|
112870
112905
|
currentSourceFile,
|
|
112871
|
-
|
|
112872
|
-
|
|
112906
|
+
getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
|
|
112907
|
+
getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
|
|
112873
112908
|
host
|
|
112874
112909
|
);
|
|
112875
112910
|
if (!pathIsRelative(specifier)) {
|
|
@@ -120306,8 +120341,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
120306
120341
|
}
|
|
120307
120342
|
const baseName = getBaseNameOfFileName(fileOrDirectory);
|
|
120308
120343
|
const fsQueryResult = {
|
|
120309
|
-
fileExists: host.fileExists(
|
|
120310
|
-
directoryExists: host.directoryExists(
|
|
120344
|
+
fileExists: host.fileExists(fileOrDirectory),
|
|
120345
|
+
directoryExists: host.directoryExists(fileOrDirectory)
|
|
120311
120346
|
};
|
|
120312
120347
|
if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
|
|
120313
120348
|
clearCache();
|
|
@@ -120395,23 +120430,10 @@ function cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, t
|
|
|
120395
120430
|
}
|
|
120396
120431
|
});
|
|
120397
120432
|
}
|
|
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
120433
|
function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) {
|
|
120410
|
-
const missingFilePaths = program.getMissingFilePaths();
|
|
120411
|
-
const newMissingFilePathMap = arrayToMap(missingFilePaths, identity, returnTrue);
|
|
120412
120434
|
mutateMap(
|
|
120413
120435
|
missingFileWatches,
|
|
120414
|
-
|
|
120436
|
+
program.getMissingFilePaths(),
|
|
120415
120437
|
{
|
|
120416
120438
|
// Watch the missing files
|
|
120417
120439
|
createNewValue: createMissingFileWatch,
|
|
@@ -120422,18 +120444,22 @@ function updateMissingFilePathsWatch(program, missingFileWatches, createMissingF
|
|
|
120422
120444
|
);
|
|
120423
120445
|
}
|
|
120424
120446
|
function updateWatchingWildcardDirectories(existingWatchedForWildcards, wildcardDirectories, watchDirectory) {
|
|
120425
|
-
|
|
120426
|
-
|
|
120427
|
-
|
|
120428
|
-
|
|
120429
|
-
|
|
120430
|
-
|
|
120431
|
-
|
|
120432
|
-
|
|
120433
|
-
|
|
120434
|
-
|
|
120435
|
-
|
|
120436
|
-
|
|
120447
|
+
if (wildcardDirectories) {
|
|
120448
|
+
mutateMap(
|
|
120449
|
+
existingWatchedForWildcards,
|
|
120450
|
+
new Map(Object.entries(wildcardDirectories)),
|
|
120451
|
+
{
|
|
120452
|
+
// Create new watch and recursive info
|
|
120453
|
+
createNewValue: createWildcardDirectoryWatcher,
|
|
120454
|
+
// Close existing watch thats not needed any more
|
|
120455
|
+
onDeleteValue: closeFileWatcherOf,
|
|
120456
|
+
// Close existing watch that doesnt match in the flags
|
|
120457
|
+
onExistingValue: updateWildcardDirectoryWatcher
|
|
120458
|
+
}
|
|
120459
|
+
);
|
|
120460
|
+
} else {
|
|
120461
|
+
clearMap(existingWatchedForWildcards, closeFileWatcherOf);
|
|
120462
|
+
}
|
|
120437
120463
|
function createWildcardDirectoryWatcher(directory, flags) {
|
|
120438
120464
|
return {
|
|
120439
120465
|
watcher: watchDirectory(directory, flags),
|
|
@@ -121271,7 +121297,8 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
|
|
|
121271
121297
|
return false;
|
|
121272
121298
|
if (program.getSourceFiles().some(sourceFileNotUptoDate))
|
|
121273
121299
|
return false;
|
|
121274
|
-
|
|
121300
|
+
const missingPaths = program.getMissingFilePaths();
|
|
121301
|
+
if (missingPaths && forEachEntry(missingPaths, fileExists))
|
|
121275
121302
|
return false;
|
|
121276
121303
|
const currentOptions = program.getCompilerOptions();
|
|
121277
121304
|
if (!compareDataObjects(currentOptions, newOptions))
|
|
@@ -121575,7 +121602,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121575
121602
|
let redirectTargetsMap = createMultiMap();
|
|
121576
121603
|
let usesUriStyleNodeCoreModules = false;
|
|
121577
121604
|
const filesByName = /* @__PURE__ */ new Map();
|
|
121578
|
-
let
|
|
121605
|
+
let missingFileNames = /* @__PURE__ */ new Map();
|
|
121579
121606
|
const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
|
|
121580
121607
|
let resolvedProjectReferences;
|
|
121581
121608
|
let projectReferenceRedirects;
|
|
@@ -121694,12 +121721,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121694
121721
|
});
|
|
121695
121722
|
}
|
|
121696
121723
|
}
|
|
121697
|
-
missingFilePaths = arrayFrom(mapDefinedIterator(filesByName.entries(), ([path, file]) => file === void 0 ? path : void 0));
|
|
121698
121724
|
files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
|
|
121699
121725
|
processingDefaultLibFiles = void 0;
|
|
121700
121726
|
processingOtherFiles = void 0;
|
|
121701
121727
|
}
|
|
121702
|
-
Debug.assert(!!missingFilePaths);
|
|
121703
121728
|
if (oldProgram && host.onReleaseOldSourceFile) {
|
|
121704
121729
|
const oldSourceFiles = oldProgram.getSourceFiles();
|
|
121705
121730
|
for (const oldSourceFile of oldSourceFiles) {
|
|
@@ -121744,8 +121769,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121744
121769
|
getSourceFile,
|
|
121745
121770
|
getSourceFileByPath,
|
|
121746
121771
|
getSourceFiles: () => files,
|
|
121747
|
-
getMissingFilePaths: () =>
|
|
121748
|
-
// TODO: GH#18217
|
|
121772
|
+
getMissingFilePaths: () => missingFileNames,
|
|
121749
121773
|
getModuleResolutionCache: () => moduleResolutionCache,
|
|
121750
121774
|
getFilesByNameMap: () => filesByName,
|
|
121751
121775
|
getCompilerOptions: () => options,
|
|
@@ -122172,7 +122196,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122172
122196
|
const newSourceFiles = [];
|
|
122173
122197
|
const modifiedSourceFiles = [];
|
|
122174
122198
|
structureIsReused = 2 /* Completely */;
|
|
122175
|
-
if (oldProgram.getMissingFilePaths()
|
|
122199
|
+
if (forEachEntry(oldProgram.getMissingFilePaths(), (missingFileName) => host.fileExists(missingFileName))) {
|
|
122176
122200
|
return 0 /* Not */;
|
|
122177
122201
|
}
|
|
122178
122202
|
const oldSourceFiles = oldProgram.getSourceFiles();
|
|
@@ -122312,7 +122336,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122312
122336
|
if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
122313
122337
|
return 1 /* SafeModules */;
|
|
122314
122338
|
}
|
|
122315
|
-
|
|
122339
|
+
missingFileNames = oldProgram.getMissingFilePaths();
|
|
122316
122340
|
Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
122317
122341
|
for (const newSourceFile of newSourceFiles) {
|
|
122318
122342
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
@@ -122369,7 +122393,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122369
122393
|
const path = toPath3(f);
|
|
122370
122394
|
if (getSourceFileByPath(path))
|
|
122371
122395
|
return true;
|
|
122372
|
-
if (
|
|
122396
|
+
if (missingFileNames.has(path))
|
|
122373
122397
|
return false;
|
|
122374
122398
|
return host.fileExists(f);
|
|
122375
122399
|
},
|
|
@@ -123181,6 +123205,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123181
123205
|
addFileToFilesByName(
|
|
123182
123206
|
file2,
|
|
123183
123207
|
path,
|
|
123208
|
+
fileName,
|
|
123184
123209
|
/*redirectedPath*/
|
|
123185
123210
|
void 0
|
|
123186
123211
|
);
|
|
@@ -123253,7 +123278,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123253
123278
|
if (fileFromPackageId) {
|
|
123254
123279
|
const dupFile = createRedirectedSourceFile(fileFromPackageId, file, fileName, path, toPath3(fileName), originalFileName, sourceFileOptions);
|
|
123255
123280
|
redirectTargetsMap.add(fileFromPackageId.path, fileName);
|
|
123256
|
-
addFileToFilesByName(dupFile, path, redirectedPath);
|
|
123281
|
+
addFileToFilesByName(dupFile, path, fileName, redirectedPath);
|
|
123257
123282
|
addFileIncludeReason(dupFile, reason);
|
|
123258
123283
|
sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
|
|
123259
123284
|
processingOtherFiles.push(dupFile);
|
|
@@ -123263,7 +123288,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123263
123288
|
sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
|
|
123264
123289
|
}
|
|
123265
123290
|
}
|
|
123266
|
-
addFileToFilesByName(file, path, redirectedPath);
|
|
123291
|
+
addFileToFilesByName(file, path, fileName, redirectedPath);
|
|
123267
123292
|
if (file) {
|
|
123268
123293
|
sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
|
|
123269
123294
|
file.fileName = fileName;
|
|
@@ -123303,14 +123328,21 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123303
123328
|
if (file)
|
|
123304
123329
|
fileReasons.add(file.path, reason);
|
|
123305
123330
|
}
|
|
123306
|
-
function addFileToFilesByName(file, path, redirectedPath) {
|
|
123331
|
+
function addFileToFilesByName(file, path, fileName, redirectedPath) {
|
|
123307
123332
|
if (redirectedPath) {
|
|
123308
|
-
|
|
123309
|
-
|
|
123333
|
+
updateFilesByNameMap(fileName, redirectedPath, file);
|
|
123334
|
+
updateFilesByNameMap(fileName, path, file || false);
|
|
123310
123335
|
} else {
|
|
123311
|
-
|
|
123336
|
+
updateFilesByNameMap(fileName, path, file);
|
|
123312
123337
|
}
|
|
123313
123338
|
}
|
|
123339
|
+
function updateFilesByNameMap(fileName, path, file) {
|
|
123340
|
+
filesByName.set(path, file);
|
|
123341
|
+
if (file !== void 0)
|
|
123342
|
+
missingFileNames.delete(path);
|
|
123343
|
+
else
|
|
123344
|
+
missingFileNames.set(path, fileName);
|
|
123345
|
+
}
|
|
123314
123346
|
function getProjectReferenceRedirect(fileName) {
|
|
123315
123347
|
const referencedProject = getProjectReferenceRedirectProject(fileName);
|
|
123316
123348
|
return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
|
|
@@ -123631,6 +123663,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123631
123663
|
/*file*/
|
|
123632
123664
|
void 0,
|
|
123633
123665
|
sourceFilePath,
|
|
123666
|
+
refPath,
|
|
123634
123667
|
/*redirectedPath*/
|
|
123635
123668
|
void 0
|
|
123636
123669
|
);
|
|
@@ -123642,6 +123675,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123642
123675
|
addFileToFilesByName(
|
|
123643
123676
|
sourceFile,
|
|
123644
123677
|
sourceFilePath,
|
|
123678
|
+
refPath,
|
|
123645
123679
|
/*redirectedPath*/
|
|
123646
123680
|
void 0
|
|
123647
123681
|
);
|
|
@@ -123651,6 +123685,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123651
123685
|
addFileToFilesByName(
|
|
123652
123686
|
sourceFile,
|
|
123653
123687
|
sourceFilePath,
|
|
123688
|
+
refPath,
|
|
123654
123689
|
/*redirectedPath*/
|
|
123655
123690
|
void 0
|
|
123656
123691
|
);
|
|
@@ -127471,8 +127506,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127471
127506
|
function closeTypeRootsWatch() {
|
|
127472
127507
|
clearMap(typeRootsWatches, closeFileWatcher);
|
|
127473
127508
|
}
|
|
127474
|
-
function createTypeRootsWatch(
|
|
127475
|
-
return canWatchTypeRootPath(
|
|
127509
|
+
function createTypeRootsWatch(typeRoot) {
|
|
127510
|
+
return canWatchTypeRootPath(typeRoot) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
127476
127511
|
const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
|
|
127477
127512
|
if (cachedDirectoryStructureHost) {
|
|
127478
127513
|
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
@@ -127481,7 +127516,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127481
127516
|
resolutionHost.onChangedAutomaticTypeDirectiveNames();
|
|
127482
127517
|
const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(
|
|
127483
127518
|
typeRoot,
|
|
127484
|
-
|
|
127519
|
+
resolutionHost.toPath(typeRoot),
|
|
127485
127520
|
rootPath,
|
|
127486
127521
|
rootPathComponents,
|
|
127487
127522
|
getCurrentDirectory,
|
|
@@ -127502,7 +127537,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127502
127537
|
if (typeRoots) {
|
|
127503
127538
|
mutateMap(
|
|
127504
127539
|
typeRootsWatches,
|
|
127505
|
-
|
|
127540
|
+
new Set(typeRoots),
|
|
127506
127541
|
{
|
|
127507
127542
|
createNewValue: createTypeRootsWatch,
|
|
127508
127543
|
onDeleteValue: closeFileWatcher
|
|
@@ -128456,7 +128491,11 @@ function createWatchProgram(host) {
|
|
|
128456
128491
|
const oldProgram = getCurrentProgram();
|
|
128457
128492
|
builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
128458
128493
|
resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
|
|
128459
|
-
updateMissingFilePathsWatch(
|
|
128494
|
+
updateMissingFilePathsWatch(
|
|
128495
|
+
builderProgram.getProgram(),
|
|
128496
|
+
missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()),
|
|
128497
|
+
watchMissingFilePath
|
|
128498
|
+
);
|
|
128460
128499
|
if (needsUpdateInTypeRootWatch) {
|
|
128461
128500
|
resolutionCache.updateTypeRootsWatch();
|
|
128462
128501
|
}
|
|
@@ -128749,8 +128788,15 @@ function createWatchProgram(host) {
|
|
|
128749
128788
|
cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
|
|
128750
128789
|
}
|
|
128751
128790
|
}
|
|
128752
|
-
function watchMissingFilePath(missingFilePath) {
|
|
128753
|
-
return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
|
|
128791
|
+
function watchMissingFilePath(missingFilePath, missingFileName) {
|
|
128792
|
+
return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
|
|
128793
|
+
missingFilePath,
|
|
128794
|
+
missingFileName,
|
|
128795
|
+
onMissingFileChange,
|
|
128796
|
+
500 /* Medium */,
|
|
128797
|
+
watchOptions,
|
|
128798
|
+
WatchType.MissingFile
|
|
128799
|
+
);
|
|
128754
128800
|
}
|
|
128755
128801
|
function onMissingFileChange(fileName, eventKind, missingFilePath) {
|
|
128756
128802
|
updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
|
|
@@ -128762,15 +128808,11 @@ function createWatchProgram(host) {
|
|
|
128762
128808
|
}
|
|
128763
128809
|
}
|
|
128764
128810
|
function watchConfigFileWildCardDirectories() {
|
|
128765
|
-
|
|
128766
|
-
|
|
128767
|
-
|
|
128768
|
-
|
|
128769
|
-
|
|
128770
|
-
);
|
|
128771
|
-
} else if (watchedWildcardDirectories) {
|
|
128772
|
-
clearMap(watchedWildcardDirectories, closeFileWatcherOf);
|
|
128773
|
-
}
|
|
128811
|
+
updateWatchingWildcardDirectories(
|
|
128812
|
+
watchedWildcardDirectories || (watchedWildcardDirectories = /* @__PURE__ */ new Map()),
|
|
128813
|
+
wildcardDirectories,
|
|
128814
|
+
watchWildcardDirectory
|
|
128815
|
+
);
|
|
128774
128816
|
}
|
|
128775
128817
|
function watchWildcardDirectory(directory, flags) {
|
|
128776
128818
|
return watchDirectory(
|
|
@@ -128842,7 +128884,7 @@ function createWatchProgram(host) {
|
|
|
128842
128884
|
);
|
|
128843
128885
|
}
|
|
128844
128886
|
function watchReferencedProject(configFileName2, configPath, commandLine) {
|
|
128845
|
-
var _a, _b, _c, _d
|
|
128887
|
+
var _a, _b, _c, _d;
|
|
128846
128888
|
commandLine.watcher || (commandLine.watcher = watchFile2(
|
|
128847
128889
|
configFileName2,
|
|
128848
128890
|
(_fileName, eventKind) => {
|
|
@@ -128857,55 +128899,50 @@ function createWatchProgram(host) {
|
|
|
128857
128899
|
((_a = commandLine.parsedCommandLine) == null ? void 0 : _a.watchOptions) || watchOptions,
|
|
128858
128900
|
WatchType.ConfigFileOfReferencedProject
|
|
128859
128901
|
));
|
|
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
|
-
}
|
|
128902
|
+
updateWatchingWildcardDirectories(
|
|
128903
|
+
commandLine.watchedDirectories || (commandLine.watchedDirectories = /* @__PURE__ */ new Map()),
|
|
128904
|
+
(_b = commandLine.parsedCommandLine) == null ? void 0 : _b.wildcardDirectories,
|
|
128905
|
+
(directory, flags) => {
|
|
128906
|
+
var _a2;
|
|
128907
|
+
return watchDirectory(
|
|
128908
|
+
directory,
|
|
128909
|
+
(fileOrDirectory) => {
|
|
128910
|
+
const fileOrDirectoryPath = toPath3(fileOrDirectory);
|
|
128911
|
+
if (cachedDirectoryStructureHost) {
|
|
128912
|
+
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
128913
|
+
}
|
|
128914
|
+
nextSourceFileVersion(fileOrDirectoryPath);
|
|
128915
|
+
const config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
|
|
128916
|
+
if (!(config == null ? void 0 : config.parsedCommandLine))
|
|
128917
|
+
return;
|
|
128918
|
+
if (isIgnoredFileFromWildCardWatching({
|
|
128919
|
+
watchedDirPath: toPath3(directory),
|
|
128920
|
+
fileOrDirectory,
|
|
128921
|
+
fileOrDirectoryPath,
|
|
128922
|
+
configFileName: configFileName2,
|
|
128923
|
+
options: config.parsedCommandLine.options,
|
|
128924
|
+
program: config.parsedCommandLine.fileNames,
|
|
128925
|
+
currentDirectory,
|
|
128926
|
+
useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
|
|
128927
|
+
writeLog,
|
|
128928
|
+
toPath: toPath3
|
|
128929
|
+
}))
|
|
128930
|
+
return;
|
|
128931
|
+
if (config.updateLevel !== 2 /* Full */) {
|
|
128932
|
+
config.updateLevel = 1 /* RootNamesAndUpdate */;
|
|
128933
|
+
scheduleProgramUpdate();
|
|
128934
|
+
}
|
|
128935
|
+
},
|
|
128936
|
+
flags,
|
|
128937
|
+
((_a2 = commandLine.parsedCommandLine) == null ? void 0 : _a2.watchOptions) || watchOptions,
|
|
128938
|
+
WatchType.WildcardDirectoryOfReferencedProject
|
|
128939
|
+
);
|
|
128940
|
+
}
|
|
128941
|
+
);
|
|
128905
128942
|
updateExtendedConfigFilesWatches(
|
|
128906
128943
|
configPath,
|
|
128907
|
-
(
|
|
128908
|
-
((
|
|
128944
|
+
(_c = commandLine.parsedCommandLine) == null ? void 0 : _c.options,
|
|
128945
|
+
((_d = commandLine.parsedCommandLine) == null ? void 0 : _d.watchOptions) || watchOptions,
|
|
128909
128946
|
WatchType.ExtendedConfigOfReferencedProject
|
|
128910
128947
|
);
|
|
128911
128948
|
}
|
|
@@ -129232,9 +129269,9 @@ function getBuildOrder(state) {
|
|
|
129232
129269
|
function createStateBuildOrder(state) {
|
|
129233
129270
|
const buildOrder = createBuildOrder(state, state.rootNames.map((f) => resolveProjectName(state, f)));
|
|
129234
129271
|
state.resolvedConfigFilePaths.clear();
|
|
129235
|
-
const currentProjects = new
|
|
129272
|
+
const currentProjects = new Set(
|
|
129236
129273
|
getBuildOrderFromAnyBuildOrder(buildOrder).map(
|
|
129237
|
-
(resolved) =>
|
|
129274
|
+
(resolved) => toResolvedConfigFilePath(state, resolved)
|
|
129238
129275
|
)
|
|
129239
129276
|
);
|
|
129240
129277
|
const noopOnDelete = { onDeleteValue: noop };
|
|
@@ -129246,6 +129283,7 @@ function createStateBuildOrder(state) {
|
|
|
129246
129283
|
mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
|
|
129247
129284
|
mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
|
|
129248
129285
|
mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
|
|
129286
|
+
mutateMapSkippingNewValues(state.lastCachedPackageJsonLookups, currentProjects, noopOnDelete);
|
|
129249
129287
|
if (state.watch) {
|
|
129250
129288
|
mutateMapSkippingNewValues(
|
|
129251
129289
|
state.allWatchedConfigFiles,
|
|
@@ -129500,7 +129538,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
|
|
|
129500
129538
|
return withProgramOrUndefined(action) || emptyArray;
|
|
129501
129539
|
}
|
|
129502
129540
|
function createProgram2() {
|
|
129503
|
-
var _a, _b;
|
|
129541
|
+
var _a, _b, _c;
|
|
129504
129542
|
Debug.assert(program === void 0);
|
|
129505
129543
|
if (state.options.dry) {
|
|
129506
129544
|
reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
|
|
@@ -129529,12 +129567,13 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
|
|
|
129529
129567
|
config.projectReferences
|
|
129530
129568
|
);
|
|
129531
129569
|
if (state.watch) {
|
|
129570
|
+
const internalMap = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().getInternalMap();
|
|
129532
129571
|
state.lastCachedPackageJsonLookups.set(
|
|
129533
129572
|
projectPath,
|
|
129534
|
-
|
|
129535
|
-
|
|
129536
|
-
(
|
|
129537
|
-
)
|
|
129573
|
+
internalMap && new Set(arrayFrom(
|
|
129574
|
+
internalMap.values(),
|
|
129575
|
+
(data) => state.host.realpath && (isPackageJsonInfo(data) || data.directoryExists) ? state.host.realpath(combinePaths(data.packageDirectory, "package.json")) : combinePaths(data.packageDirectory, "package.json")
|
|
129576
|
+
))
|
|
129538
129577
|
);
|
|
129539
129578
|
state.builderPrograms.set(projectPath, program);
|
|
129540
129579
|
}
|
|
@@ -130267,9 +130306,10 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
130267
130306
|
const extendedConfigStatus = forEach(project.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName));
|
|
130268
130307
|
if (extendedConfigStatus)
|
|
130269
130308
|
return extendedConfigStatus;
|
|
130270
|
-
const
|
|
130271
|
-
|
|
130272
|
-
|
|
130309
|
+
const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath);
|
|
130310
|
+
const dependentPackageFileStatus = packageJsonLookups && forEachKey(
|
|
130311
|
+
packageJsonLookups,
|
|
130312
|
+
(path) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
|
|
130273
130313
|
);
|
|
130274
130314
|
if (dependentPackageFileStatus)
|
|
130275
130315
|
return dependentPackageFileStatus;
|
|
@@ -130626,7 +130666,7 @@ function watchWildCardDirectories(state, resolved, resolvedPath, parsed) {
|
|
|
130626
130666
|
return;
|
|
130627
130667
|
updateWatchingWildcardDirectories(
|
|
130628
130668
|
getOrCreateValueMapFromConfigFileMap(state.allWatchedWildcardDirectories, resolvedPath),
|
|
130629
|
-
|
|
130669
|
+
parsed.wildcardDirectories,
|
|
130630
130670
|
(dir, flags) => state.watchDirectory(
|
|
130631
130671
|
dir,
|
|
130632
130672
|
(fileOrDirectory) => {
|
|
@@ -130658,9 +130698,9 @@ function watchInputFiles(state, resolved, resolvedPath, parsed) {
|
|
|
130658
130698
|
return;
|
|
130659
130699
|
mutateMap(
|
|
130660
130700
|
getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath),
|
|
130661
|
-
|
|
130701
|
+
new Set(parsed.fileNames),
|
|
130662
130702
|
{
|
|
130663
|
-
createNewValue: (
|
|
130703
|
+
createNewValue: (input) => watchFile(
|
|
130664
130704
|
state,
|
|
130665
130705
|
input,
|
|
130666
130706
|
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
|
|
@@ -130678,11 +130718,11 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
|
|
|
130678
130718
|
return;
|
|
130679
130719
|
mutateMap(
|
|
130680
130720
|
getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath),
|
|
130681
|
-
|
|
130721
|
+
state.lastCachedPackageJsonLookups.get(resolvedPath),
|
|
130682
130722
|
{
|
|
130683
|
-
createNewValue: (
|
|
130723
|
+
createNewValue: (input) => watchFile(
|
|
130684
130724
|
state,
|
|
130685
|
-
|
|
130725
|
+
input,
|
|
130686
130726
|
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
|
|
130687
130727
|
2e3 /* High */,
|
|
130688
130728
|
parsed == null ? void 0 : parsed.watchOptions,
|
|
@@ -136465,7 +136505,7 @@ function updateImports(program, changeTracker, oldToNew, newToOld, host, getCano
|
|
|
136465
136505
|
if ((importedModuleSymbol == null ? void 0 : importedModuleSymbol.declarations) && importedModuleSymbol.declarations.some((d) => isAmbientModule(d)))
|
|
136466
136506
|
return void 0;
|
|
136467
136507
|
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,
|
|
136508
|
+
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
136509
|
});
|
|
136470
136510
|
}
|
|
136471
136511
|
}
|
|
@@ -137304,11 +137344,11 @@ function getSourceMapper(host) {
|
|
|
137304
137344
|
const fileFromCache = sourceFileLike.get(path);
|
|
137305
137345
|
if (fileFromCache !== void 0)
|
|
137306
137346
|
return fileFromCache ? fileFromCache : void 0;
|
|
137307
|
-
if (!host.readFile || host.fileExists && !host.fileExists(
|
|
137347
|
+
if (!host.readFile || host.fileExists && !host.fileExists(fileName)) {
|
|
137308
137348
|
sourceFileLike.set(path, false);
|
|
137309
137349
|
return void 0;
|
|
137310
137350
|
}
|
|
137311
|
-
const text = host.readFile(
|
|
137351
|
+
const text = host.readFile(fileName);
|
|
137312
137352
|
const file = text ? createSourceFileLike(text) : false;
|
|
137313
137353
|
sourceFileLike.set(path, file);
|
|
137314
137354
|
return file ? file : void 0;
|
|
@@ -139861,7 +139901,7 @@ function getTargetFileImportsAndAddExportInOldFile(oldFile, targetFile, importsT
|
|
|
139861
139901
|
const resolved = program.getResolvedModule(oldFile, moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
|
|
139862
139902
|
const fileName = (_a = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _a.resolvedFileName;
|
|
139863
139903
|
if (fileName && targetSourceFile) {
|
|
139864
|
-
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.
|
|
139904
|
+
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.fileName, fileName, createModuleSpecifierResolutionHost(program, host));
|
|
139865
139905
|
append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
139866
139906
|
} else {
|
|
139867
139907
|
append(copiedOldImports, filterImport(i, factory.createStringLiteral(moduleSpecifierFromImport(i).text), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
@@ -139939,7 +139979,7 @@ function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols
|
|
|
139939
139979
|
};
|
|
139940
139980
|
deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
|
|
139941
139981
|
const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(oldFile.path), targetFileName);
|
|
139942
|
-
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.
|
|
139982
|
+
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
|
|
139943
139983
|
const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove);
|
|
139944
139984
|
if (newImportDeclaration)
|
|
139945
139985
|
changes.insertNodeAfter(sourceFile, statement, newImportDeclaration);
|
|
@@ -140074,7 +140114,7 @@ function createOldFileImportsFromTargetFile(sourceFile, targetFileNeedExport, ta
|
|
|
140074
140114
|
}
|
|
140075
140115
|
function makeImportOrRequire(sourceFile, defaultImport, imports, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference) {
|
|
140076
140116
|
const pathToTargetFile = resolvePath(getDirectoryPath(sourceFile.path), targetFileNameWithExtension);
|
|
140077
|
-
const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.
|
|
140117
|
+
const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFile, createModuleSpecifierResolutionHost(program, host));
|
|
140078
140118
|
if (useEs6Imports) {
|
|
140079
140119
|
const specifiers = imports.map((i) => factory.createImportSpecifier(
|
|
140080
140120
|
/*isTypeOnly*/
|
|
@@ -165814,6 +165854,32 @@ function provideInlayHints(context) {
|
|
|
165814
165854
|
parts.push({ text: tokenToString(node.operator) });
|
|
165815
165855
|
visitForDisplayParts(node.operand);
|
|
165816
165856
|
break;
|
|
165857
|
+
case 203 /* TemplateLiteralType */:
|
|
165858
|
+
Debug.assertNode(node, isTemplateLiteralTypeNode);
|
|
165859
|
+
visitForDisplayParts(node.head);
|
|
165860
|
+
node.templateSpans.forEach(visitForDisplayParts);
|
|
165861
|
+
break;
|
|
165862
|
+
case 16 /* TemplateHead */:
|
|
165863
|
+
Debug.assertNode(node, isTemplateHead);
|
|
165864
|
+
parts.push({ text: getLiteralText2(node) });
|
|
165865
|
+
break;
|
|
165866
|
+
case 204 /* TemplateLiteralTypeSpan */:
|
|
165867
|
+
Debug.assertNode(node, isTemplateLiteralTypeSpan);
|
|
165868
|
+
visitForDisplayParts(node.type);
|
|
165869
|
+
visitForDisplayParts(node.literal);
|
|
165870
|
+
break;
|
|
165871
|
+
case 17 /* TemplateMiddle */:
|
|
165872
|
+
Debug.assertNode(node, isTemplateMiddle);
|
|
165873
|
+
parts.push({ text: getLiteralText2(node) });
|
|
165874
|
+
break;
|
|
165875
|
+
case 18 /* TemplateTail */:
|
|
165876
|
+
Debug.assertNode(node, isTemplateTail);
|
|
165877
|
+
parts.push({ text: getLiteralText2(node) });
|
|
165878
|
+
break;
|
|
165879
|
+
case 197 /* ThisType */:
|
|
165880
|
+
Debug.assertNode(node, isThisTypeNode);
|
|
165881
|
+
parts.push({ text: "this" });
|
|
165882
|
+
break;
|
|
165817
165883
|
default:
|
|
165818
165884
|
Debug.failBadSyntaxKind(node);
|
|
165819
165885
|
}
|
|
@@ -165837,8 +165903,22 @@ function provideInlayHints(context) {
|
|
|
165837
165903
|
});
|
|
165838
165904
|
}
|
|
165839
165905
|
function getLiteralText2(node) {
|
|
165840
|
-
|
|
165841
|
-
|
|
165906
|
+
switch (node.kind) {
|
|
165907
|
+
case 11 /* StringLiteral */:
|
|
165908
|
+
return quotePreference === 0 /* Single */ ? `'${escapeString(node.text, 39 /* singleQuote */)}'` : `"${escapeString(node.text, 34 /* doubleQuote */)}"`;
|
|
165909
|
+
case 16 /* TemplateHead */:
|
|
165910
|
+
case 17 /* TemplateMiddle */:
|
|
165911
|
+
case 18 /* TemplateTail */: {
|
|
165912
|
+
const rawText = node.rawText ?? escapeTemplateSubstitution(escapeString(node.text, 96 /* backtick */));
|
|
165913
|
+
switch (node.kind) {
|
|
165914
|
+
case 16 /* TemplateHead */:
|
|
165915
|
+
return "`" + rawText + "${";
|
|
165916
|
+
case 17 /* TemplateMiddle */:
|
|
165917
|
+
return "}" + rawText + "${";
|
|
165918
|
+
case 18 /* TemplateTail */:
|
|
165919
|
+
return "}" + rawText + "`";
|
|
165920
|
+
}
|
|
165921
|
+
}
|
|
165842
165922
|
}
|
|
165843
165923
|
return node.text;
|
|
165844
165924
|
}
|
|
@@ -173403,6 +173483,7 @@ __export(ts_exports2, {
|
|
|
173403
173483
|
escapeNonAsciiString: () => escapeNonAsciiString,
|
|
173404
173484
|
escapeSnippetText: () => escapeSnippetText,
|
|
173405
173485
|
escapeString: () => escapeString,
|
|
173486
|
+
escapeTemplateSubstitution: () => escapeTemplateSubstitution,
|
|
173406
173487
|
every: () => every,
|
|
173407
173488
|
expandPreOrPostfixIncrementOrDecrementExpression: () => expandPreOrPostfixIncrementOrDecrementExpression,
|
|
173408
173489
|
explainFiles: () => explainFiles,
|
|
@@ -174501,6 +174582,7 @@ __export(ts_exports2, {
|
|
|
174501
174582
|
isOuterExpression: () => isOuterExpression,
|
|
174502
174583
|
isOutermostOptionalChain: () => isOutermostOptionalChain,
|
|
174503
174584
|
isOverrideModifier: () => isOverrideModifier,
|
|
174585
|
+
isPackageJsonInfo: () => isPackageJsonInfo,
|
|
174504
174586
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
174505
174587
|
isParameter: () => isParameter,
|
|
174506
174588
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
@@ -175152,7 +175234,6 @@ __export(ts_exports2, {
|
|
|
175152
175234
|
updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
|
|
175153
175235
|
updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
|
|
175154
175236
|
updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
|
|
175155
|
-
updatePackageJsonWatch: () => updatePackageJsonWatch,
|
|
175156
175237
|
updateResolutionField: () => updateResolutionField,
|
|
175157
175238
|
updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher,
|
|
175158
175239
|
updateSourceFile: () => updateSourceFile,
|
|
@@ -177498,6 +177579,7 @@ var Project3 = class _Project {
|
|
|
177498
177579
|
return path === options.configFilePath ? options.configFile : this.getSourceFile(path);
|
|
177499
177580
|
}
|
|
177500
177581
|
close() {
|
|
177582
|
+
var _a;
|
|
177501
177583
|
this.projectService.typingsCache.onProjectClosed(this);
|
|
177502
177584
|
this.closeWatchingTypingLocations();
|
|
177503
177585
|
this.cleanupProgram();
|
|
@@ -177514,6 +177596,12 @@ var Project3 = class _Project {
|
|
|
177514
177596
|
this.resolutionCache.clear();
|
|
177515
177597
|
this.resolutionCache = void 0;
|
|
177516
177598
|
this.cachedUnresolvedImportsPerFile = void 0;
|
|
177599
|
+
(_a = this.packageJsonWatches) == null ? void 0 : _a.forEach((watcher) => {
|
|
177600
|
+
watcher.projects.delete(this);
|
|
177601
|
+
watcher.close();
|
|
177602
|
+
});
|
|
177603
|
+
this.packageJsonWatches = void 0;
|
|
177604
|
+
this.moduleSpecifierCache.clear();
|
|
177517
177605
|
this.moduleSpecifierCache = void 0;
|
|
177518
177606
|
this.directoryStructureHost = void 0;
|
|
177519
177607
|
this.exportMapCache = void 0;
|
|
@@ -177708,13 +177796,10 @@ var Project3 = class _Project {
|
|
|
177708
177796
|
}
|
|
177709
177797
|
}
|
|
177710
177798
|
/** @internal */
|
|
177711
|
-
onPackageJsonChange(
|
|
177712
|
-
|
|
177713
|
-
if (
|
|
177714
|
-
this.
|
|
177715
|
-
if (this.autoImportProviderHost) {
|
|
177716
|
-
this.autoImportProviderHost.markAsDirty();
|
|
177717
|
-
}
|
|
177799
|
+
onPackageJsonChange() {
|
|
177800
|
+
this.moduleSpecifierCache.clear();
|
|
177801
|
+
if (this.autoImportProviderHost) {
|
|
177802
|
+
this.autoImportProviderHost.markAsDirty();
|
|
177718
177803
|
}
|
|
177719
177804
|
}
|
|
177720
177805
|
/** @internal */
|
|
@@ -177929,7 +178014,7 @@ var Project3 = class _Project {
|
|
|
177929
178014
|
this.program,
|
|
177930
178015
|
this.missingFilesMap || (this.missingFilesMap = /* @__PURE__ */ new Map()),
|
|
177931
178016
|
// Watch the missing files
|
|
177932
|
-
(missingFilePath) => this.addMissingFileWatcher(missingFilePath)
|
|
178017
|
+
(missingFilePath, missingFileName) => this.addMissingFileWatcher(missingFilePath, missingFileName)
|
|
177933
178018
|
);
|
|
177934
178019
|
if (this.generatedFilesMap) {
|
|
177935
178020
|
const outPath = outFile(this.compilerOptions);
|
|
@@ -178043,7 +178128,7 @@ var Project3 = class _Project {
|
|
|
178043
178128
|
}
|
|
178044
178129
|
}
|
|
178045
178130
|
}
|
|
178046
|
-
addMissingFileWatcher(missingFilePath) {
|
|
178131
|
+
addMissingFileWatcher(missingFilePath, missingFileName) {
|
|
178047
178132
|
var _a;
|
|
178048
178133
|
if (isConfiguredProject(this)) {
|
|
178049
178134
|
const configFileExistenceInfo = this.projectService.configFileExistenceInfoCache.get(missingFilePath);
|
|
@@ -178051,7 +178136,7 @@ var Project3 = class _Project {
|
|
|
178051
178136
|
return noopFileWatcher;
|
|
178052
178137
|
}
|
|
178053
178138
|
const fileWatcher = this.projectService.watchFactory.watchFile(
|
|
178054
|
-
|
|
178139
|
+
getNormalizedAbsolutePath(missingFileName, this.currentDirectory),
|
|
178055
178140
|
(fileName, eventKind) => {
|
|
178056
178141
|
if (isConfiguredProject(this)) {
|
|
178057
178142
|
this.getCachedDirectoryStructureHost().addOrDeleteFile(fileName, missingFilePath, eventKind);
|
|
@@ -178388,7 +178473,7 @@ var Project3 = class _Project {
|
|
|
178388
178473
|
getPackageJsonsVisibleToFile(fileName, rootDir) {
|
|
178389
178474
|
if (this.projectService.serverMode !== 0 /* Semantic */)
|
|
178390
178475
|
return emptyArray2;
|
|
178391
|
-
return this.projectService.getPackageJsonsVisibleToFile(fileName, rootDir);
|
|
178476
|
+
return this.projectService.getPackageJsonsVisibleToFile(fileName, this, rootDir);
|
|
178392
178477
|
}
|
|
178393
178478
|
/** @internal */
|
|
178394
178479
|
getNearestAncestorDirectoryWithPackageJson(fileName) {
|
|
@@ -178396,9 +178481,7 @@ var Project3 = class _Project {
|
|
|
178396
178481
|
}
|
|
178397
178482
|
/** @internal */
|
|
178398
178483
|
getPackageJsonsForAutoImport(rootDir) {
|
|
178399
|
-
|
|
178400
|
-
this.packageJsonsForAutoImport = new Set(packageJsons.map((p) => p.fileName));
|
|
178401
|
-
return packageJsons;
|
|
178484
|
+
return this.getPackageJsonsVisibleToFile(combinePaths(this.currentDirectory, inferredTypesContainingFile), rootDir);
|
|
178402
178485
|
}
|
|
178403
178486
|
/** @internal */
|
|
178404
178487
|
getPackageJsonCache() {
|
|
@@ -178484,7 +178567,7 @@ var Project3 = class _Project {
|
|
|
178484
178567
|
}
|
|
178485
178568
|
/** @internal */
|
|
178486
178569
|
watchNodeModulesForPackageJsonChanges(directoryPath) {
|
|
178487
|
-
return this.projectService.watchPackageJsonsInNodeModules(
|
|
178570
|
+
return this.projectService.watchPackageJsonsInNodeModules(directoryPath, this);
|
|
178488
178571
|
}
|
|
178489
178572
|
/** @internal */
|
|
178490
178573
|
getIncompleteCompletionsCache() {
|
|
@@ -180060,18 +180143,20 @@ var _ProjectService = class _ProjectService {
|
|
|
180060
180143
|
* @internal
|
|
180061
180144
|
*/
|
|
180062
180145
|
watchWildcardDirectory(directory, flags, configFileName, config) {
|
|
180063
|
-
|
|
180146
|
+
let watcher = this.watchFactory.watchDirectory(
|
|
180064
180147
|
directory,
|
|
180065
180148
|
(fileOrDirectory) => {
|
|
180066
180149
|
const fileOrDirectoryPath = this.toPath(fileOrDirectory);
|
|
180067
180150
|
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.
|
|
180151
|
+
if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
|
|
180152
|
+
const file = this.getNormalizedAbsolutePath(fileOrDirectory);
|
|
180153
|
+
this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
|
|
180154
|
+
this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
|
|
180155
|
+
this.watchPackageJsonFile(file, fileOrDirectoryPath, result);
|
|
180071
180156
|
}
|
|
180072
180157
|
const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
|
|
180073
180158
|
if (isIgnoredFileFromWildCardWatching({
|
|
180074
|
-
watchedDirPath: directory,
|
|
180159
|
+
watchedDirPath: this.toPath(directory),
|
|
180075
180160
|
fileOrDirectory,
|
|
180076
180161
|
fileOrDirectoryPath,
|
|
180077
180162
|
configFileName,
|
|
@@ -180116,6 +180201,22 @@ var _ProjectService = class _ProjectService {
|
|
|
180116
180201
|
WatchType.WildcardDirectory,
|
|
180117
180202
|
configFileName
|
|
180118
180203
|
);
|
|
180204
|
+
const result = {
|
|
180205
|
+
packageJsonWatches: void 0,
|
|
180206
|
+
close() {
|
|
180207
|
+
var _a;
|
|
180208
|
+
if (watcher) {
|
|
180209
|
+
watcher.close();
|
|
180210
|
+
watcher = void 0;
|
|
180211
|
+
(_a = result.packageJsonWatches) == null ? void 0 : _a.forEach((watcher2) => {
|
|
180212
|
+
watcher2.projects.delete(result);
|
|
180213
|
+
watcher2.close();
|
|
180214
|
+
});
|
|
180215
|
+
result.packageJsonWatches = void 0;
|
|
180216
|
+
}
|
|
180217
|
+
}
|
|
180218
|
+
};
|
|
180219
|
+
return result;
|
|
180119
180220
|
}
|
|
180120
180221
|
/** @internal */
|
|
180121
180222
|
delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
|
|
@@ -180860,7 +180961,7 @@ var _ProjectService = class _ProjectService {
|
|
|
180860
180961
|
config.watchedDirectoriesStale = false;
|
|
180861
180962
|
updateWatchingWildcardDirectories(
|
|
180862
180963
|
config.watchedDirectories || (config.watchedDirectories = /* @__PURE__ */ new Map()),
|
|
180863
|
-
|
|
180964
|
+
config.parsedCommandLine.wildcardDirectories,
|
|
180864
180965
|
// Create new directory watcher
|
|
180865
180966
|
(directory, flags) => this.watchWildcardDirectory(directory, flags, configFileName, config)
|
|
180866
180967
|
);
|
|
@@ -180942,7 +181043,7 @@ var _ProjectService = class _ProjectService {
|
|
|
180942
181043
|
if (value.info) {
|
|
180943
181044
|
project.removeFile(
|
|
180944
181045
|
value.info,
|
|
180945
|
-
project.fileExists(
|
|
181046
|
+
project.fileExists(value.info.fileName),
|
|
180946
181047
|
/*detachFromProject*/
|
|
180947
181048
|
true
|
|
180948
181049
|
);
|
|
@@ -181174,7 +181275,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
181174
181275
|
watchClosedScriptInfo(info) {
|
|
181175
181276
|
Debug.assert(!info.fileWatcher);
|
|
181176
181277
|
if (!info.isDynamicOrHasMixedContent() && (!this.globalCacheLocationDirectoryPath || !startsWith(info.path, this.globalCacheLocationDirectoryPath))) {
|
|
181177
|
-
const indexOfNodeModules = info.
|
|
181278
|
+
const indexOfNodeModules = info.fileName.indexOf("/node_modules/");
|
|
181178
181279
|
if (!this.host.getModifiedTime || indexOfNodeModules === -1) {
|
|
181179
181280
|
info.fileWatcher = this.watchFactory.watchFile(
|
|
181180
181281
|
info.fileName,
|
|
@@ -181185,12 +181286,12 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
181185
181286
|
);
|
|
181186
181287
|
} else {
|
|
181187
181288
|
info.mTime = this.getModifiedTime(info);
|
|
181188
|
-
info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.
|
|
181289
|
+
info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.fileName.substring(0, indexOfNodeModules));
|
|
181189
181290
|
}
|
|
181190
181291
|
}
|
|
181191
181292
|
}
|
|
181192
|
-
createNodeModulesWatcher(dir) {
|
|
181193
|
-
|
|
181293
|
+
createNodeModulesWatcher(dir, dirPath) {
|
|
181294
|
+
let watcher = this.watchFactory.watchDirectory(
|
|
181194
181295
|
dir,
|
|
181195
181296
|
(fileOrDirectory) => {
|
|
181196
181297
|
var _a;
|
|
@@ -181199,14 +181300,14 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
181199
181300
|
return;
|
|
181200
181301
|
const basename = getBaseFileName(fileOrDirectoryPath);
|
|
181201
181302
|
if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (basename === "package.json" || basename === "node_modules")) {
|
|
181202
|
-
result.affectedModuleSpecifierCacheProjects.forEach((
|
|
181203
|
-
var _a2
|
|
181204
|
-
(
|
|
181303
|
+
result.affectedModuleSpecifierCacheProjects.forEach((project) => {
|
|
181304
|
+
var _a2;
|
|
181305
|
+
(_a2 = project.getModuleSpecifierCache()) == null ? void 0 : _a2.clear();
|
|
181205
181306
|
});
|
|
181206
181307
|
}
|
|
181207
181308
|
if (result.refreshScriptInfoRefCount) {
|
|
181208
|
-
if (
|
|
181209
|
-
this.refreshScriptInfosInDirectory(
|
|
181309
|
+
if (dirPath === fileOrDirectoryPath) {
|
|
181310
|
+
this.refreshScriptInfosInDirectory(dirPath);
|
|
181210
181311
|
} else {
|
|
181211
181312
|
const info = this.getScriptInfoForPath(fileOrDirectoryPath);
|
|
181212
181313
|
if (info) {
|
|
@@ -181228,30 +181329,35 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
181228
181329
|
affectedModuleSpecifierCacheProjects: void 0,
|
|
181229
181330
|
close: () => {
|
|
181230
181331
|
var _a;
|
|
181231
|
-
if (!result.refreshScriptInfoRefCount && !((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size)) {
|
|
181332
|
+
if (watcher && !result.refreshScriptInfoRefCount && !((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size)) {
|
|
181232
181333
|
watcher.close();
|
|
181233
|
-
|
|
181334
|
+
watcher = void 0;
|
|
181335
|
+
this.nodeModulesWatchers.delete(dirPath);
|
|
181234
181336
|
}
|
|
181235
181337
|
}
|
|
181236
181338
|
};
|
|
181237
|
-
this.nodeModulesWatchers.set(
|
|
181339
|
+
this.nodeModulesWatchers.set(dirPath, result);
|
|
181238
181340
|
return result;
|
|
181239
181341
|
}
|
|
181240
181342
|
/** @internal */
|
|
181241
181343
|
watchPackageJsonsInNodeModules(dir, project) {
|
|
181242
|
-
|
|
181243
|
-
|
|
181344
|
+
var _a;
|
|
181345
|
+
const dirPath = this.toPath(dir);
|
|
181346
|
+
const watcher = this.nodeModulesWatchers.get(dirPath) || this.createNodeModulesWatcher(dir, dirPath);
|
|
181347
|
+
Debug.assert(!((_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.has(project)));
|
|
181348
|
+
(watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project);
|
|
181244
181349
|
return {
|
|
181245
181350
|
close: () => {
|
|
181246
|
-
var
|
|
181247
|
-
(
|
|
181351
|
+
var _a2;
|
|
181352
|
+
(_a2 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a2.delete(project);
|
|
181248
181353
|
watcher.close();
|
|
181249
181354
|
}
|
|
181250
181355
|
};
|
|
181251
181356
|
}
|
|
181252
181357
|
watchClosedScriptInfoInNodeModules(dir) {
|
|
181253
181358
|
const watchDir = dir + "/node_modules";
|
|
181254
|
-
const
|
|
181359
|
+
const watchDirPath = this.toPath(watchDir);
|
|
181360
|
+
const watcher = this.nodeModulesWatchers.get(watchDirPath) || this.createNodeModulesWatcher(watchDir, watchDirPath);
|
|
181255
181361
|
watcher.refreshScriptInfoRefCount++;
|
|
181256
181362
|
return {
|
|
181257
181363
|
close: () => {
|
|
@@ -181261,7 +181367,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
181261
181367
|
};
|
|
181262
181368
|
}
|
|
181263
181369
|
getModifiedTime(info) {
|
|
181264
|
-
return (this.host.getModifiedTime(info.
|
|
181370
|
+
return (this.host.getModifiedTime(info.fileName) || missingFileModifiedTime).getTime();
|
|
181265
181371
|
}
|
|
181266
181372
|
refreshScriptInfo(info) {
|
|
181267
181373
|
const mTime = this.getModifiedTime(info);
|
|
@@ -181525,10 +181631,9 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181525
181631
|
});
|
|
181526
181632
|
}
|
|
181527
181633
|
if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports) {
|
|
181528
|
-
this.
|
|
181529
|
-
|
|
181530
|
-
|
|
181531
|
-
);
|
|
181634
|
+
this.forEachProject((project) => {
|
|
181635
|
+
project.onAutoImportProviderSettingsChanged();
|
|
181636
|
+
});
|
|
181532
181637
|
}
|
|
181533
181638
|
}
|
|
181534
181639
|
if (args.extraFileExtensions) {
|
|
@@ -182447,10 +182552,9 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182447
182552
|
this.currentPluginConfigOverrides.set(args.pluginName, args.configuration);
|
|
182448
182553
|
}
|
|
182449
182554
|
/** @internal */
|
|
182450
|
-
getPackageJsonsVisibleToFile(fileName, rootDir) {
|
|
182555
|
+
getPackageJsonsVisibleToFile(fileName, project, rootDir) {
|
|
182451
182556
|
const packageJsonCache = this.packageJsonCache;
|
|
182452
182557
|
const rootPath = rootDir && this.toPath(rootDir);
|
|
182453
|
-
const filePath = this.toPath(fileName);
|
|
182454
182558
|
const result = [];
|
|
182455
182559
|
const processDirectory = (directory) => {
|
|
182456
182560
|
switch (packageJsonCache.directoryHasPackageJson(directory)) {
|
|
@@ -182459,7 +182563,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182459
182563
|
return processDirectory(directory);
|
|
182460
182564
|
case -1 /* True */:
|
|
182461
182565
|
const packageJsonFileName = combinePaths(directory, "package.json");
|
|
182462
|
-
this.watchPackageJsonFile(packageJsonFileName);
|
|
182566
|
+
this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName), project);
|
|
182463
182567
|
const info = packageJsonCache.getInDirectory(directory);
|
|
182464
182568
|
if (info)
|
|
182465
182569
|
result.push(info);
|
|
@@ -182468,13 +182572,13 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182468
182572
|
return true;
|
|
182469
182573
|
}
|
|
182470
182574
|
};
|
|
182471
|
-
forEachAncestorDirectory(getDirectoryPath(
|
|
182575
|
+
forEachAncestorDirectory(getDirectoryPath(fileName), processDirectory);
|
|
182472
182576
|
return result;
|
|
182473
182577
|
}
|
|
182474
182578
|
/** @internal */
|
|
182475
182579
|
getNearestAncestorDirectoryWithPackageJson(fileName) {
|
|
182476
182580
|
return forEachAncestorDirectory(fileName, (directory) => {
|
|
182477
|
-
switch (this.packageJsonCache.directoryHasPackageJson(
|
|
182581
|
+
switch (this.packageJsonCache.directoryHasPackageJson(directory)) {
|
|
182478
182582
|
case -1 /* True */:
|
|
182479
182583
|
return directory;
|
|
182480
182584
|
case 0 /* False */:
|
|
@@ -182485,41 +182589,54 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182485
182589
|
});
|
|
182486
182590
|
}
|
|
182487
182591
|
/** @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
|
-
)
|
|
182592
|
+
watchPackageJsonFile(file, path, project) {
|
|
182593
|
+
Debug.assert(project !== void 0);
|
|
182594
|
+
let result = (this.packageJsonFilesMap ?? (this.packageJsonFilesMap = /* @__PURE__ */ new Map())).get(path);
|
|
182595
|
+
if (!result) {
|
|
182596
|
+
let watcher = this.watchFactory.watchFile(
|
|
182597
|
+
file,
|
|
182598
|
+
(fileName, eventKind) => {
|
|
182599
|
+
switch (eventKind) {
|
|
182600
|
+
case 0 /* Created */:
|
|
182601
|
+
return Debug.fail();
|
|
182602
|
+
case 1 /* Changed */:
|
|
182603
|
+
this.packageJsonCache.addOrUpdate(fileName, path);
|
|
182604
|
+
this.onPackageJsonChange(result);
|
|
182605
|
+
break;
|
|
182606
|
+
case 2 /* Deleted */:
|
|
182607
|
+
this.packageJsonCache.delete(path);
|
|
182608
|
+
this.onPackageJsonChange(result);
|
|
182609
|
+
result.projects.clear();
|
|
182610
|
+
result.close();
|
|
182611
|
+
}
|
|
182612
|
+
},
|
|
182613
|
+
250 /* Low */,
|
|
182614
|
+
this.hostConfiguration.watchOptions,
|
|
182615
|
+
WatchType.PackageJson
|
|
182516
182616
|
);
|
|
182617
|
+
result = {
|
|
182618
|
+
projects: /* @__PURE__ */ new Set(),
|
|
182619
|
+
close: () => {
|
|
182620
|
+
var _a;
|
|
182621
|
+
if (result.projects.size || !watcher)
|
|
182622
|
+
return;
|
|
182623
|
+
watcher.close();
|
|
182624
|
+
watcher = void 0;
|
|
182625
|
+
(_a = this.packageJsonFilesMap) == null ? void 0 : _a.delete(path);
|
|
182626
|
+
this.packageJsonCache.invalidate(path);
|
|
182627
|
+
}
|
|
182628
|
+
};
|
|
182629
|
+
this.packageJsonFilesMap.set(path, result);
|
|
182517
182630
|
}
|
|
182631
|
+
result.projects.add(project);
|
|
182632
|
+
(project.packageJsonWatches ?? (project.packageJsonWatches = /* @__PURE__ */ new Set())).add(result);
|
|
182518
182633
|
}
|
|
182519
182634
|
/** @internal */
|
|
182520
|
-
|
|
182521
|
-
|
|
182522
|
-
|
|
182635
|
+
onPackageJsonChange(result) {
|
|
182636
|
+
result.projects.forEach((project) => {
|
|
182637
|
+
var _a;
|
|
182638
|
+
return (_a = project.onPackageJsonChange) == null ? void 0 : _a.call(project);
|
|
182639
|
+
});
|
|
182523
182640
|
}
|
|
182524
182641
|
/** @internal */
|
|
182525
182642
|
includePackageJsonAutoImports() {
|
|
@@ -182533,19 +182650,6 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182533
182650
|
}
|
|
182534
182651
|
}
|
|
182535
182652
|
/** @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
182653
|
getIncompleteCompletionsCache() {
|
|
182550
182654
|
return this.incompleteCompletionsCache || (this.incompleteCompletionsCache = createIncompleteCompletionsCache());
|
|
182551
182655
|
}
|
|
@@ -182603,9 +182707,10 @@ function createModuleSpecifierCache(host) {
|
|
|
182603
182707
|
for (const p of modulePaths) {
|
|
182604
182708
|
if (p.isInNodeModules) {
|
|
182605
182709
|
const nodeModulesPath = p.path.substring(0, p.path.indexOf(nodeModulesPathPart) + nodeModulesPathPart.length - 1);
|
|
182606
|
-
|
|
182710
|
+
const key2 = host.toPath(nodeModulesPath);
|
|
182711
|
+
if (!(containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.has(key2))) {
|
|
182607
182712
|
(containedNodeModulesWatchers || (containedNodeModulesWatchers = /* @__PURE__ */ new Map())).set(
|
|
182608
|
-
|
|
182713
|
+
key2,
|
|
182609
182714
|
host.watchNodeModulesForPackageJsonChanges(nodeModulesPath)
|
|
182610
182715
|
);
|
|
182611
182716
|
}
|
|
@@ -182644,7 +182749,7 @@ function createModuleSpecifierCache(host) {
|
|
|
182644
182749
|
}
|
|
182645
182750
|
},
|
|
182646
182751
|
clear() {
|
|
182647
|
-
containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach(
|
|
182752
|
+
containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach(closeFileWatcher);
|
|
182648
182753
|
cache == null ? void 0 : cache.clear();
|
|
182649
182754
|
containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.clear();
|
|
182650
182755
|
currentKey = void 0;
|
|
@@ -182679,34 +182784,38 @@ function createPackageJsonCache(host) {
|
|
|
182679
182784
|
const directoriesWithoutPackageJson = /* @__PURE__ */ new Map();
|
|
182680
182785
|
return {
|
|
182681
182786
|
addOrUpdate,
|
|
182682
|
-
|
|
182683
|
-
get: packageJsons.get.bind(packageJsons),
|
|
182787
|
+
invalidate,
|
|
182684
182788
|
delete: (fileName) => {
|
|
182685
182789
|
packageJsons.delete(fileName);
|
|
182686
182790
|
directoriesWithoutPackageJson.set(getDirectoryPath(fileName), true);
|
|
182687
182791
|
},
|
|
182688
182792
|
getInDirectory: (directory) => {
|
|
182689
|
-
return packageJsons.get(combinePaths(directory, "package.json")) || void 0;
|
|
182793
|
+
return packageJsons.get(host.toPath(combinePaths(directory, "package.json"))) || void 0;
|
|
182690
182794
|
},
|
|
182691
|
-
directoryHasPackageJson,
|
|
182795
|
+
directoryHasPackageJson: (directory) => directoryHasPackageJson(host.toPath(directory)),
|
|
182692
182796
|
searchDirectoryAndAncestors: (directory) => {
|
|
182693
182797
|
forEachAncestorDirectory(directory, (ancestor) => {
|
|
182694
|
-
|
|
182798
|
+
const ancestorPath = host.toPath(ancestor);
|
|
182799
|
+
if (directoryHasPackageJson(ancestorPath) !== 3 /* Maybe */) {
|
|
182695
182800
|
return true;
|
|
182696
182801
|
}
|
|
182697
|
-
const packageJsonFileName =
|
|
182802
|
+
const packageJsonFileName = combinePaths(ancestor, "package.json");
|
|
182698
182803
|
if (tryFileExists(host, packageJsonFileName)) {
|
|
182699
|
-
addOrUpdate(packageJsonFileName);
|
|
182804
|
+
addOrUpdate(packageJsonFileName, combinePaths(ancestorPath, "package.json"));
|
|
182700
182805
|
} else {
|
|
182701
|
-
directoriesWithoutPackageJson.set(
|
|
182806
|
+
directoriesWithoutPackageJson.set(ancestorPath, true);
|
|
182702
182807
|
}
|
|
182703
182808
|
});
|
|
182704
182809
|
}
|
|
182705
182810
|
};
|
|
182706
|
-
function addOrUpdate(fileName) {
|
|
182811
|
+
function addOrUpdate(fileName, path) {
|
|
182707
182812
|
const packageJsonInfo = Debug.checkDefined(createPackageJsonInfo(fileName, host.host));
|
|
182708
|
-
packageJsons.set(
|
|
182709
|
-
directoriesWithoutPackageJson.delete(getDirectoryPath(
|
|
182813
|
+
packageJsons.set(path, packageJsonInfo);
|
|
182814
|
+
directoriesWithoutPackageJson.delete(getDirectoryPath(path));
|
|
182815
|
+
}
|
|
182816
|
+
function invalidate(path) {
|
|
182817
|
+
packageJsons.delete(path);
|
|
182818
|
+
directoriesWithoutPackageJson.delete(getDirectoryPath(path));
|
|
182710
182819
|
}
|
|
182711
182820
|
function directoryHasPackageJson(directory) {
|
|
182712
182821
|
return packageJsons.has(combinePaths(directory, "package.json")) ? -1 /* True */ : directoriesWithoutPackageJson.has(directory) ? 0 /* False */ : 3 /* Maybe */;
|
|
@@ -188166,6 +188275,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
188166
188275
|
escapeNonAsciiString,
|
|
188167
188276
|
escapeSnippetText,
|
|
188168
188277
|
escapeString,
|
|
188278
|
+
escapeTemplateSubstitution,
|
|
188169
188279
|
every,
|
|
188170
188280
|
expandPreOrPostfixIncrementOrDecrementExpression,
|
|
188171
188281
|
explainFiles,
|
|
@@ -189264,6 +189374,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189264
189374
|
isOuterExpression,
|
|
189265
189375
|
isOutermostOptionalChain,
|
|
189266
189376
|
isOverrideModifier,
|
|
189377
|
+
isPackageJsonInfo,
|
|
189267
189378
|
isPackedArrayLiteral,
|
|
189268
189379
|
isParameter,
|
|
189269
189380
|
isParameterDeclaration,
|
|
@@ -189915,7 +190026,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189915
190026
|
updateErrorForNoInputFiles,
|
|
189916
190027
|
updateLanguageServiceSourceFile,
|
|
189917
190028
|
updateMissingFilePathsWatch,
|
|
189918
|
-
updatePackageJsonWatch,
|
|
189919
190029
|
updateResolutionField,
|
|
189920
190030
|
updateSharedExtendedConfigFileWatcher,
|
|
189921
190031
|
updateSourceFile,
|