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/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.4";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20231129`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -17329,19 +17329,19 @@ ${lanes.join("\n")}
|
|
|
17329
17329
|
function mutateMapSkippingNewValues(map2, newMap, options) {
|
|
17330
17330
|
const { onDeleteValue, onExistingValue } = options;
|
|
17331
17331
|
map2.forEach((existingValue, key) => {
|
|
17332
|
-
|
|
17333
|
-
if (
|
|
17332
|
+
var _a;
|
|
17333
|
+
if (!(newMap == null ? void 0 : newMap.has(key))) {
|
|
17334
17334
|
map2.delete(key);
|
|
17335
17335
|
onDeleteValue(existingValue, key);
|
|
17336
17336
|
} else if (onExistingValue) {
|
|
17337
|
-
onExistingValue(existingValue,
|
|
17337
|
+
onExistingValue(existingValue, (_a = newMap.get) == null ? void 0 : _a.call(newMap, key), key);
|
|
17338
17338
|
}
|
|
17339
17339
|
});
|
|
17340
17340
|
}
|
|
17341
17341
|
function mutateMap(map2, newMap, options) {
|
|
17342
17342
|
mutateMapSkippingNewValues(map2, newMap, options);
|
|
17343
17343
|
const { createNewValue } = options;
|
|
17344
|
-
newMap.forEach((valueInNewMap, key) => {
|
|
17344
|
+
newMap == null ? void 0 : newMap.forEach((valueInNewMap, key) => {
|
|
17345
17345
|
if (!map2.has(key)) {
|
|
17346
17346
|
map2.set(key, createNewValue(key, valueInNewMap));
|
|
17347
17347
|
}
|
|
@@ -33709,8 +33709,9 @@ ${lanes.join("\n")}
|
|
|
33709
33709
|
function nextTokenIsStringLiteral() {
|
|
33710
33710
|
return nextToken() === 11 /* StringLiteral */;
|
|
33711
33711
|
}
|
|
33712
|
-
function
|
|
33713
|
-
|
|
33712
|
+
function nextTokenIsFromKeywordOrEqualsToken() {
|
|
33713
|
+
nextToken();
|
|
33714
|
+
return token() === 161 /* FromKeyword */ || token() === 64 /* EqualsToken */;
|
|
33714
33715
|
}
|
|
33715
33716
|
function nextTokenIsIdentifierOrStringLiteralOnSameLine() {
|
|
33716
33717
|
nextToken();
|
|
@@ -34407,7 +34408,7 @@ ${lanes.join("\n")}
|
|
|
34407
34408
|
identifier = parseIdentifier();
|
|
34408
34409
|
}
|
|
34409
34410
|
let isTypeOnly = false;
|
|
34410
|
-
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(
|
|
34411
|
+
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(nextTokenIsFromKeywordOrEqualsToken)) && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) {
|
|
34411
34412
|
isTypeOnly = true;
|
|
34412
34413
|
identifier = isIdentifier2() ? parseIdentifier() : void 0;
|
|
34413
34414
|
}
|
|
@@ -35190,18 +35191,7 @@ ${lanes.join("\n")}
|
|
|
35190
35191
|
}
|
|
35191
35192
|
nextTokenJSDoc();
|
|
35192
35193
|
skipWhitespace();
|
|
35193
|
-
const
|
|
35194
|
-
let name = tokenIsIdentifierOrKeyword(token()) ? parseEntityName(
|
|
35195
|
-
/*allowReservedWords*/
|
|
35196
|
-
true
|
|
35197
|
-
) : void 0;
|
|
35198
|
-
if (name) {
|
|
35199
|
-
while (token() === 81 /* PrivateIdentifier */) {
|
|
35200
|
-
reScanHashToken();
|
|
35201
|
-
nextTokenJSDoc();
|
|
35202
|
-
name = finishNode(factory2.createJSDocMemberName(name, parseIdentifier()), p2);
|
|
35203
|
-
}
|
|
35204
|
-
}
|
|
35194
|
+
const name = parseJSDocLinkName();
|
|
35205
35195
|
const text = [];
|
|
35206
35196
|
while (token() !== 20 /* CloseBraceToken */ && token() !== 4 /* NewLineTrivia */ && token() !== 1 /* EndOfFileToken */) {
|
|
35207
35197
|
text.push(scanner2.getTokenText());
|
|
@@ -35210,6 +35200,26 @@ ${lanes.join("\n")}
|
|
|
35210
35200
|
const create = linkType === "link" ? factory2.createJSDocLink : linkType === "linkcode" ? factory2.createJSDocLinkCode : factory2.createJSDocLinkPlain;
|
|
35211
35201
|
return finishNode(create(name, text.join("")), start2, scanner2.getTokenEnd());
|
|
35212
35202
|
}
|
|
35203
|
+
function parseJSDocLinkName() {
|
|
35204
|
+
if (tokenIsIdentifierOrKeyword(token())) {
|
|
35205
|
+
const pos = getNodePos();
|
|
35206
|
+
let name = parseIdentifierName();
|
|
35207
|
+
while (parseOptional(25 /* DotToken */)) {
|
|
35208
|
+
name = finishNode(factory2.createQualifiedName(name, token() === 81 /* PrivateIdentifier */ ? createMissingNode(
|
|
35209
|
+
80 /* Identifier */,
|
|
35210
|
+
/*reportAtCurrentPosition*/
|
|
35211
|
+
false
|
|
35212
|
+
) : parseIdentifier()), pos);
|
|
35213
|
+
}
|
|
35214
|
+
while (token() === 81 /* PrivateIdentifier */) {
|
|
35215
|
+
reScanHashToken();
|
|
35216
|
+
nextTokenJSDoc();
|
|
35217
|
+
name = finishNode(factory2.createJSDocMemberName(name, parseIdentifier()), pos);
|
|
35218
|
+
}
|
|
35219
|
+
return name;
|
|
35220
|
+
}
|
|
35221
|
+
return void 0;
|
|
35222
|
+
}
|
|
35213
35223
|
function parseJSDocLinkPrefix() {
|
|
35214
35224
|
skipWhitespaceOrAsterisk();
|
|
35215
35225
|
if (token() === 19 /* OpenBraceToken */ && nextTokenJSDoc() === 60 /* AtToken */ && tokenIsIdentifierOrKeyword(nextTokenJSDoc())) {
|
|
@@ -37549,34 +37559,39 @@ ${lanes.join("\n")}
|
|
|
37549
37559
|
return [Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
|
|
37550
37560
|
}
|
|
37551
37561
|
}
|
|
37552
|
-
function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude },
|
|
37553
|
-
const rawExcludeRegex = getRegularExpressionForWildcard(exclude,
|
|
37562
|
+
function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, basePath, useCaseSensitiveFileNames2) {
|
|
37563
|
+
const rawExcludeRegex = getRegularExpressionForWildcard(exclude, basePath, "exclude");
|
|
37554
37564
|
const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames2 ? "" : "i");
|
|
37555
37565
|
const wildcardDirectories = {};
|
|
37566
|
+
const wildCardKeyToPath = /* @__PURE__ */ new Map();
|
|
37556
37567
|
if (include !== void 0) {
|
|
37557
37568
|
const recursiveKeys = [];
|
|
37558
37569
|
for (const file of include) {
|
|
37559
|
-
const spec = normalizePath(combinePaths(
|
|
37570
|
+
const spec = normalizePath(combinePaths(basePath, file));
|
|
37560
37571
|
if (excludeRegex && excludeRegex.test(spec)) {
|
|
37561
37572
|
continue;
|
|
37562
37573
|
}
|
|
37563
37574
|
const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
|
|
37564
37575
|
if (match) {
|
|
37565
|
-
const { key, flags } = match;
|
|
37566
|
-
const
|
|
37576
|
+
const { key, path, flags } = match;
|
|
37577
|
+
const existingPath = wildCardKeyToPath.get(key);
|
|
37578
|
+
const existingFlags = existingPath !== void 0 ? wildcardDirectories[existingPath] : void 0;
|
|
37567
37579
|
if (existingFlags === void 0 || existingFlags < flags) {
|
|
37568
|
-
wildcardDirectories[
|
|
37580
|
+
wildcardDirectories[existingPath !== void 0 ? existingPath : path] = flags;
|
|
37581
|
+
if (existingPath === void 0)
|
|
37582
|
+
wildCardKeyToPath.set(key, path);
|
|
37569
37583
|
if (flags === 1 /* Recursive */) {
|
|
37570
37584
|
recursiveKeys.push(key);
|
|
37571
37585
|
}
|
|
37572
37586
|
}
|
|
37573
37587
|
}
|
|
37574
37588
|
}
|
|
37575
|
-
for (const
|
|
37576
|
-
if (hasProperty(wildcardDirectories,
|
|
37589
|
+
for (const path in wildcardDirectories) {
|
|
37590
|
+
if (hasProperty(wildcardDirectories, path)) {
|
|
37577
37591
|
for (const recursiveKey of recursiveKeys) {
|
|
37578
|
-
|
|
37579
|
-
|
|
37592
|
+
const key = toCanonicalKey(path, useCaseSensitiveFileNames2);
|
|
37593
|
+
if (key !== recursiveKey && containsPath(recursiveKey, key, basePath, !useCaseSensitiveFileNames2)) {
|
|
37594
|
+
delete wildcardDirectories[path];
|
|
37580
37595
|
}
|
|
37581
37596
|
}
|
|
37582
37597
|
}
|
|
@@ -37584,6 +37599,9 @@ ${lanes.join("\n")}
|
|
|
37584
37599
|
}
|
|
37585
37600
|
return wildcardDirectories;
|
|
37586
37601
|
}
|
|
37602
|
+
function toCanonicalKey(path, useCaseSensitiveFileNames2) {
|
|
37603
|
+
return useCaseSensitiveFileNames2 ? path : toFileNameLowerCase(path);
|
|
37604
|
+
}
|
|
37587
37605
|
function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
|
|
37588
37606
|
const match = wildcardDirectoryPattern.exec(spec);
|
|
37589
37607
|
if (match) {
|
|
@@ -37591,13 +37609,16 @@ ${lanes.join("\n")}
|
|
|
37591
37609
|
const starWildcardIndex = spec.indexOf("*");
|
|
37592
37610
|
const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator);
|
|
37593
37611
|
return {
|
|
37594
|
-
key:
|
|
37612
|
+
key: toCanonicalKey(match[0], useCaseSensitiveFileNames2),
|
|
37613
|
+
path: match[0],
|
|
37595
37614
|
flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 /* Recursive */ : 0 /* None */
|
|
37596
37615
|
};
|
|
37597
37616
|
}
|
|
37598
37617
|
if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) {
|
|
37618
|
+
const path = removeTrailingDirectorySeparator(spec);
|
|
37599
37619
|
return {
|
|
37600
|
-
key:
|
|
37620
|
+
key: toCanonicalKey(path, useCaseSensitiveFileNames2),
|
|
37621
|
+
path,
|
|
37601
37622
|
flags: 1 /* Recursive */
|
|
37602
37623
|
};
|
|
37603
37624
|
}
|
|
@@ -39790,6 +39811,9 @@ ${lanes.join("\n")}
|
|
|
39790
39811
|
}
|
|
39791
39812
|
return result;
|
|
39792
39813
|
}
|
|
39814
|
+
function isPackageJsonInfo(entry) {
|
|
39815
|
+
return !!(entry == null ? void 0 : entry.contents);
|
|
39816
|
+
}
|
|
39793
39817
|
function compilerOptionValueToString(value) {
|
|
39794
39818
|
var _a;
|
|
39795
39819
|
if (value === null || typeof value !== "object") {
|
|
@@ -39894,7 +39918,7 @@ ${lanes.join("\n")}
|
|
|
39894
39918
|
}
|
|
39895
39919
|
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
39896
39920
|
let cache;
|
|
39897
|
-
return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2,
|
|
39921
|
+
return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2, getInternalMap };
|
|
39898
39922
|
function getPackageJsonInfo2(packageJsonPath) {
|
|
39899
39923
|
return cache == null ? void 0 : cache.get(toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
|
|
39900
39924
|
}
|
|
@@ -39904,10 +39928,6 @@ ${lanes.join("\n")}
|
|
|
39904
39928
|
function clear2() {
|
|
39905
39929
|
cache = void 0;
|
|
39906
39930
|
}
|
|
39907
|
-
function entries() {
|
|
39908
|
-
const iter = cache == null ? void 0 : cache.entries();
|
|
39909
|
-
return iter ? arrayFrom(iter) : [];
|
|
39910
|
-
}
|
|
39911
39931
|
function getInternalMap() {
|
|
39912
39932
|
return cache;
|
|
39913
39933
|
}
|
|
@@ -40910,13 +40930,13 @@ ${lanes.join("\n")}
|
|
|
40910
40930
|
}
|
|
40911
40931
|
const existing = (_b = state.packageJsonInfoCache) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
40912
40932
|
if (existing !== void 0) {
|
|
40913
|
-
if (
|
|
40933
|
+
if (isPackageJsonInfo(existing)) {
|
|
40914
40934
|
if (traceEnabled)
|
|
40915
40935
|
trace(host, Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
|
|
40916
40936
|
(_c = state.affectingLocations) == null ? void 0 : _c.push(packageJsonPath);
|
|
40917
40937
|
return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents };
|
|
40918
40938
|
} else {
|
|
40919
|
-
if (existing && traceEnabled)
|
|
40939
|
+
if (existing.directoryExists && traceEnabled)
|
|
40920
40940
|
trace(host, Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath);
|
|
40921
40941
|
(_d = state.failedLookupLocations) == null ? void 0 : _d.push(packageJsonPath);
|
|
40922
40942
|
return void 0;
|
|
@@ -40938,7 +40958,7 @@ ${lanes.join("\n")}
|
|
|
40938
40958
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
40939
40959
|
}
|
|
40940
40960
|
if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
|
|
40941
|
-
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, directoryExists);
|
|
40961
|
+
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, { packageDirectory, directoryExists });
|
|
40942
40962
|
(_f = state.failedLookupLocations) == null ? void 0 : _f.push(packageJsonPath);
|
|
40943
40963
|
}
|
|
40944
40964
|
}
|
|
@@ -44970,8 +44990,8 @@ ${lanes.join("\n")}
|
|
|
44970
44990
|
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getPreferences({}, compilerOptions, importingSourceFile), {}, options);
|
|
44971
44991
|
}
|
|
44972
44992
|
function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
|
|
44973
|
-
const info = getInfo(importingSourceFile.
|
|
44974
|
-
const modulePaths = getAllModulePaths(
|
|
44993
|
+
const info = getInfo(importingSourceFile.fileName, host);
|
|
44994
|
+
const modulePaths = getAllModulePaths(info, nodeModulesFileName, host, preferences, options);
|
|
44975
44995
|
return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
|
|
44976
44996
|
modulePath,
|
|
44977
44997
|
info,
|
|
@@ -44986,7 +45006,7 @@ ${lanes.join("\n")}
|
|
|
44986
45006
|
}
|
|
44987
45007
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, preferences, userPreferences, options = {}) {
|
|
44988
45008
|
const info = getInfo(importingSourceFileName, host);
|
|
44989
|
-
const modulePaths = getAllModulePaths(
|
|
45009
|
+
const modulePaths = getAllModulePaths(info, toFileName2, host, userPreferences, options);
|
|
44990
45010
|
return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
|
|
44991
45011
|
modulePath,
|
|
44992
45012
|
info,
|
|
@@ -45048,7 +45068,7 @@ ${lanes.join("\n")}
|
|
|
45048
45068
|
if (!moduleSourceFile)
|
|
45049
45069
|
return { moduleSpecifiers: emptyArray, computedWithoutCache };
|
|
45050
45070
|
computedWithoutCache = true;
|
|
45051
|
-
modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.
|
|
45071
|
+
modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host));
|
|
45052
45072
|
const result = computeModuleSpecifiers(
|
|
45053
45073
|
modulePaths,
|
|
45054
45074
|
compilerOptions,
|
|
@@ -45062,7 +45082,7 @@ ${lanes.join("\n")}
|
|
|
45062
45082
|
return { moduleSpecifiers: result, computedWithoutCache };
|
|
45063
45083
|
}
|
|
45064
45084
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
45065
|
-
const info = getInfo(importingSourceFile.
|
|
45085
|
+
const info = getInfo(importingSourceFile.fileName, host);
|
|
45066
45086
|
const preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
45067
45087
|
const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
|
|
45068
45088
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
@@ -45126,16 +45146,22 @@ ${lanes.join("\n")}
|
|
|
45126
45146
|
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);
|
|
45127
45147
|
}
|
|
45128
45148
|
function getInfo(importingSourceFileName, host) {
|
|
45149
|
+
importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
|
|
45129
45150
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : true);
|
|
45130
45151
|
const sourceDirectory = getDirectoryPath(importingSourceFileName);
|
|
45131
|
-
return {
|
|
45152
|
+
return {
|
|
45153
|
+
getCanonicalFileName,
|
|
45154
|
+
importingSourceFileName,
|
|
45155
|
+
sourceDirectory,
|
|
45156
|
+
canonicalSourceDirectory: getCanonicalFileName(sourceDirectory)
|
|
45157
|
+
};
|
|
45132
45158
|
}
|
|
45133
45159
|
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference }, pathsOnly) {
|
|
45134
45160
|
const { baseUrl, paths, rootDirs } = compilerOptions;
|
|
45135
45161
|
if (pathsOnly && !paths) {
|
|
45136
45162
|
return void 0;
|
|
45137
45163
|
}
|
|
45138
|
-
const { sourceDirectory, getCanonicalFileName } = info;
|
|
45164
|
+
const { sourceDirectory, canonicalSourceDirectory, getCanonicalFileName } = info;
|
|
45139
45165
|
const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
|
|
45140
45166
|
const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
|
|
45141
45167
|
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
|
|
@@ -45160,7 +45186,7 @@ ${lanes.join("\n")}
|
|
|
45160
45186
|
if (relativePreference === 3 /* ExternalNonRelative */ && !pathIsRelative(maybeNonRelative)) {
|
|
45161
45187
|
const projectDirectory = compilerOptions.configFilePath ? toPath(getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory());
|
|
45162
45188
|
const modulePath = toPath(moduleFileName, projectDirectory, getCanonicalFileName);
|
|
45163
|
-
const sourceIsInternal = startsWith(
|
|
45189
|
+
const sourceIsInternal = startsWith(canonicalSourceDirectory, projectDirectory);
|
|
45164
45190
|
const targetIsInternal = startsWith(modulePath, projectDirectory);
|
|
45165
45191
|
if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
|
|
45166
45192
|
return maybeNonRelative;
|
|
@@ -45233,8 +45259,9 @@ ${lanes.join("\n")}
|
|
|
45233
45259
|
});
|
|
45234
45260
|
return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
|
|
45235
45261
|
}
|
|
45236
|
-
function getAllModulePaths(
|
|
45262
|
+
function getAllModulePaths(info, importedFileName, host, preferences, options = {}) {
|
|
45237
45263
|
var _a;
|
|
45264
|
+
const importingFilePath = toPath(info.importingSourceFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
45238
45265
|
const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
45239
45266
|
const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
|
|
45240
45267
|
if (cache) {
|
|
@@ -45242,30 +45269,29 @@ ${lanes.join("\n")}
|
|
|
45242
45269
|
if (cached == null ? void 0 : cached.modulePaths)
|
|
45243
45270
|
return cached.modulePaths;
|
|
45244
45271
|
}
|
|
45245
|
-
const modulePaths = getAllModulePathsWorker(
|
|
45272
|
+
const modulePaths = getAllModulePathsWorker(info, importedFileName, host);
|
|
45246
45273
|
if (cache) {
|
|
45247
45274
|
cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
|
|
45248
45275
|
}
|
|
45249
45276
|
return modulePaths;
|
|
45250
45277
|
}
|
|
45251
|
-
function getAllModulePathsWorker(
|
|
45252
|
-
const getCanonicalFileName = hostGetCanonicalFileName(host);
|
|
45278
|
+
function getAllModulePathsWorker(info, importedFileName, host) {
|
|
45253
45279
|
const allFileNames = /* @__PURE__ */ new Map();
|
|
45254
45280
|
let importedFileFromNodeModules = false;
|
|
45255
45281
|
forEachFileNameOfModule(
|
|
45256
|
-
|
|
45282
|
+
info.importingSourceFileName,
|
|
45257
45283
|
importedFileName,
|
|
45258
45284
|
host,
|
|
45259
45285
|
/*preferSymlinks*/
|
|
45260
45286
|
true,
|
|
45261
45287
|
(path, isRedirect) => {
|
|
45262
45288
|
const isInNodeModules = pathContainsNodeModules(path);
|
|
45263
|
-
allFileNames.set(path, { path: getCanonicalFileName(path), isRedirect, isInNodeModules });
|
|
45289
|
+
allFileNames.set(path, { path: info.getCanonicalFileName(path), isRedirect, isInNodeModules });
|
|
45264
45290
|
importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules;
|
|
45265
45291
|
}
|
|
45266
45292
|
);
|
|
45267
45293
|
const sortedPaths = [];
|
|
45268
|
-
for (let directory =
|
|
45294
|
+
for (let directory = info.canonicalSourceDirectory; allFileNames.size !== 0; ) {
|
|
45269
45295
|
const directoryStart = ensureTrailingDirectorySeparator(directory);
|
|
45270
45296
|
let pathsInDirectory;
|
|
45271
45297
|
allFileNames.forEach(({ path, isRedirect, isInNodeModules }, fileName) => {
|
|
@@ -45286,7 +45312,10 @@ ${lanes.join("\n")}
|
|
|
45286
45312
|
directory = newDirectory;
|
|
45287
45313
|
}
|
|
45288
45314
|
if (allFileNames.size) {
|
|
45289
|
-
const remainingPaths = arrayFrom(
|
|
45315
|
+
const remainingPaths = arrayFrom(
|
|
45316
|
+
allFileNames.entries(),
|
|
45317
|
+
([fileName, { isRedirect, isInNodeModules }]) => ({ path: fileName, isRedirect, isInNodeModules })
|
|
45318
|
+
);
|
|
45290
45319
|
if (remainingPaths.length > 1)
|
|
45291
45320
|
remainingPaths.sort(comparePathsByRedirectAndNumberOfDirectorySeparators);
|
|
45292
45321
|
sortedPaths.push(...remainingPaths);
|
|
@@ -45446,7 +45475,7 @@ ${lanes.join("\n")}
|
|
|
45446
45475
|
}
|
|
45447
45476
|
return processEnding(shortest, allowedEndings, compilerOptions);
|
|
45448
45477
|
}
|
|
45449
|
-
function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileName,
|
|
45478
|
+
function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileName, canonicalSourceDirectory }, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
45450
45479
|
if (!host.fileExists || !host.readFile) {
|
|
45451
45480
|
return void 0;
|
|
45452
45481
|
}
|
|
@@ -45490,7 +45519,7 @@ ${lanes.join("\n")}
|
|
|
45490
45519
|
}
|
|
45491
45520
|
const globalTypingsCacheLocation = host.getGlobalTypingsCacheLocation && host.getGlobalTypingsCacheLocation();
|
|
45492
45521
|
const pathToTopLevelNodeModules = getCanonicalFileName(moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex));
|
|
45493
|
-
if (!(startsWith(
|
|
45522
|
+
if (!(startsWith(canonicalSourceDirectory, pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
|
|
45494
45523
|
return void 0;
|
|
45495
45524
|
}
|
|
45496
45525
|
const nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
|
|
@@ -45503,7 +45532,7 @@ ${lanes.join("\n")}
|
|
|
45503
45532
|
let moduleFileToTry = path;
|
|
45504
45533
|
let maybeBlockedByTypesVersions = false;
|
|
45505
45534
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
45506
|
-
if (
|
|
45535
|
+
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
45507
45536
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
45508
45537
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
45509
45538
|
if (getResolvePackageJsonExports(options)) {
|
|
@@ -56992,9 +57021,13 @@ ${lanes.join("\n")}
|
|
|
56992
57021
|
function getConstraintOfTypeParameter(typeParameter) {
|
|
56993
57022
|
return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0;
|
|
56994
57023
|
}
|
|
57024
|
+
function isConstMappedType(type, depth) {
|
|
57025
|
+
const typeVariable = getHomomorphicTypeVariable(type);
|
|
57026
|
+
return !!typeVariable && isConstTypeVariable(typeVariable, depth);
|
|
57027
|
+
}
|
|
56995
57028
|
function isConstTypeVariable(type, depth = 0) {
|
|
56996
57029
|
var _a;
|
|
56997
|
-
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));
|
|
57030
|
+
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));
|
|
56998
57031
|
}
|
|
56999
57032
|
function getConstraintOfIndexedAccess(type) {
|
|
57000
57033
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -69367,14 +69400,15 @@ ${lanes.join("\n")}
|
|
|
69367
69400
|
if (declaration) {
|
|
69368
69401
|
if (isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
69369
69402
|
const parent2 = declaration.parent.parent;
|
|
69370
|
-
|
|
69403
|
+
const rootDeclaration = getRootDeclaration(parent2);
|
|
69404
|
+
if (rootDeclaration.kind === 260 /* VariableDeclaration */ && getCombinedNodeFlagsCached(rootDeclaration) & 6 /* Constant */ || rootDeclaration.kind === 169 /* Parameter */) {
|
|
69371
69405
|
const links = getNodeLinks(parent2);
|
|
69372
69406
|
if (!(links.flags & 4194304 /* InCheckIdentifier */)) {
|
|
69373
69407
|
links.flags |= 4194304 /* InCheckIdentifier */;
|
|
69374
69408
|
const parentType = getTypeForBindingElementParent(parent2, 0 /* Normal */);
|
|
69375
69409
|
const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType);
|
|
69376
69410
|
links.flags &= ~4194304 /* InCheckIdentifier */;
|
|
69377
|
-
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(
|
|
69411
|
+
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(rootDeclaration.kind === 169 /* Parameter */ && isSymbolAssigned(symbol))) {
|
|
69378
69412
|
const pattern = declaration.parent;
|
|
69379
69413
|
const narrowedType = getFlowTypeOfReference(
|
|
69380
69414
|
pattern,
|
|
@@ -110941,8 +110975,8 @@ ${lanes.join("\n")}
|
|
|
110941
110975
|
const specifier = getModuleSpecifier(
|
|
110942
110976
|
options,
|
|
110943
110977
|
currentSourceFile,
|
|
110944
|
-
|
|
110945
|
-
|
|
110978
|
+
getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
|
|
110979
|
+
getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
|
|
110946
110980
|
host
|
|
110947
110981
|
);
|
|
110948
110982
|
if (!pathIsRelative(specifier)) {
|
|
@@ -118405,8 +118439,8 @@ ${lanes.join("\n")}
|
|
|
118405
118439
|
}
|
|
118406
118440
|
const baseName = getBaseNameOfFileName(fileOrDirectory);
|
|
118407
118441
|
const fsQueryResult = {
|
|
118408
|
-
fileExists: host.fileExists(
|
|
118409
|
-
directoryExists: host.directoryExists(
|
|
118442
|
+
fileExists: host.fileExists(fileOrDirectory),
|
|
118443
|
+
directoryExists: host.directoryExists(fileOrDirectory)
|
|
118410
118444
|
};
|
|
118411
118445
|
if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
|
|
118412
118446
|
clearCache();
|
|
@@ -118488,23 +118522,10 @@ ${lanes.join("\n")}
|
|
|
118488
118522
|
}
|
|
118489
118523
|
});
|
|
118490
118524
|
}
|
|
118491
|
-
function updatePackageJsonWatch(lookups, packageJsonWatches, createPackageJsonWatch) {
|
|
118492
|
-
const newMap = new Map(lookups);
|
|
118493
|
-
mutateMap(
|
|
118494
|
-
packageJsonWatches,
|
|
118495
|
-
newMap,
|
|
118496
|
-
{
|
|
118497
|
-
createNewValue: createPackageJsonWatch,
|
|
118498
|
-
onDeleteValue: closeFileWatcher
|
|
118499
|
-
}
|
|
118500
|
-
);
|
|
118501
|
-
}
|
|
118502
118525
|
function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) {
|
|
118503
|
-
const missingFilePaths = program.getMissingFilePaths();
|
|
118504
|
-
const newMissingFilePathMap = arrayToMap(missingFilePaths, identity, returnTrue);
|
|
118505
118526
|
mutateMap(
|
|
118506
118527
|
missingFileWatches,
|
|
118507
|
-
|
|
118528
|
+
program.getMissingFilePaths(),
|
|
118508
118529
|
{
|
|
118509
118530
|
// Watch the missing files
|
|
118510
118531
|
createNewValue: createMissingFileWatch,
|
|
@@ -118515,18 +118536,22 @@ ${lanes.join("\n")}
|
|
|
118515
118536
|
);
|
|
118516
118537
|
}
|
|
118517
118538
|
function updateWatchingWildcardDirectories(existingWatchedForWildcards, wildcardDirectories, watchDirectory) {
|
|
118518
|
-
|
|
118519
|
-
|
|
118520
|
-
|
|
118521
|
-
|
|
118522
|
-
|
|
118523
|
-
|
|
118524
|
-
|
|
118525
|
-
|
|
118526
|
-
|
|
118527
|
-
|
|
118528
|
-
|
|
118529
|
-
|
|
118539
|
+
if (wildcardDirectories) {
|
|
118540
|
+
mutateMap(
|
|
118541
|
+
existingWatchedForWildcards,
|
|
118542
|
+
new Map(Object.entries(wildcardDirectories)),
|
|
118543
|
+
{
|
|
118544
|
+
// Create new watch and recursive info
|
|
118545
|
+
createNewValue: createWildcardDirectoryWatcher,
|
|
118546
|
+
// Close existing watch thats not needed any more
|
|
118547
|
+
onDeleteValue: closeFileWatcherOf,
|
|
118548
|
+
// Close existing watch that doesnt match in the flags
|
|
118549
|
+
onExistingValue: updateWildcardDirectoryWatcher
|
|
118550
|
+
}
|
|
118551
|
+
);
|
|
118552
|
+
} else {
|
|
118553
|
+
clearMap(existingWatchedForWildcards, closeFileWatcherOf);
|
|
118554
|
+
}
|
|
118530
118555
|
function createWildcardDirectoryWatcher(directory, flags) {
|
|
118531
118556
|
return {
|
|
118532
118557
|
watcher: watchDirectory(directory, flags),
|
|
@@ -119350,7 +119375,8 @@ ${lanes.join("\n")}
|
|
|
119350
119375
|
return false;
|
|
119351
119376
|
if (program.getSourceFiles().some(sourceFileNotUptoDate))
|
|
119352
119377
|
return false;
|
|
119353
|
-
|
|
119378
|
+
const missingPaths = program.getMissingFilePaths();
|
|
119379
|
+
if (missingPaths && forEachEntry(missingPaths, fileExists))
|
|
119354
119380
|
return false;
|
|
119355
119381
|
const currentOptions = program.getCompilerOptions();
|
|
119356
119382
|
if (!compareDataObjects(currentOptions, newOptions))
|
|
@@ -119557,7 +119583,7 @@ ${lanes.join("\n")}
|
|
|
119557
119583
|
let redirectTargetsMap = createMultiMap();
|
|
119558
119584
|
let usesUriStyleNodeCoreModules = false;
|
|
119559
119585
|
const filesByName = /* @__PURE__ */ new Map();
|
|
119560
|
-
let
|
|
119586
|
+
let missingFileNames = /* @__PURE__ */ new Map();
|
|
119561
119587
|
const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
|
|
119562
119588
|
let resolvedProjectReferences;
|
|
119563
119589
|
let projectReferenceRedirects;
|
|
@@ -119676,12 +119702,10 @@ ${lanes.join("\n")}
|
|
|
119676
119702
|
});
|
|
119677
119703
|
}
|
|
119678
119704
|
}
|
|
119679
|
-
missingFilePaths = arrayFrom(mapDefinedIterator(filesByName.entries(), ([path, file]) => file === void 0 ? path : void 0));
|
|
119680
119705
|
files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
|
|
119681
119706
|
processingDefaultLibFiles = void 0;
|
|
119682
119707
|
processingOtherFiles = void 0;
|
|
119683
119708
|
}
|
|
119684
|
-
Debug.assert(!!missingFilePaths);
|
|
119685
119709
|
if (oldProgram && host.onReleaseOldSourceFile) {
|
|
119686
119710
|
const oldSourceFiles = oldProgram.getSourceFiles();
|
|
119687
119711
|
for (const oldSourceFile of oldSourceFiles) {
|
|
@@ -119726,8 +119750,7 @@ ${lanes.join("\n")}
|
|
|
119726
119750
|
getSourceFile,
|
|
119727
119751
|
getSourceFileByPath,
|
|
119728
119752
|
getSourceFiles: () => files,
|
|
119729
|
-
getMissingFilePaths: () =>
|
|
119730
|
-
// TODO: GH#18217
|
|
119753
|
+
getMissingFilePaths: () => missingFileNames,
|
|
119731
119754
|
getModuleResolutionCache: () => moduleResolutionCache,
|
|
119732
119755
|
getFilesByNameMap: () => filesByName,
|
|
119733
119756
|
getCompilerOptions: () => options,
|
|
@@ -120154,7 +120177,7 @@ ${lanes.join("\n")}
|
|
|
120154
120177
|
const newSourceFiles = [];
|
|
120155
120178
|
const modifiedSourceFiles = [];
|
|
120156
120179
|
structureIsReused = 2 /* Completely */;
|
|
120157
|
-
if (oldProgram.getMissingFilePaths()
|
|
120180
|
+
if (forEachEntry(oldProgram.getMissingFilePaths(), (missingFileName) => host.fileExists(missingFileName))) {
|
|
120158
120181
|
return 0 /* Not */;
|
|
120159
120182
|
}
|
|
120160
120183
|
const oldSourceFiles = oldProgram.getSourceFiles();
|
|
@@ -120294,7 +120317,7 @@ ${lanes.join("\n")}
|
|
|
120294
120317
|
if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
120295
120318
|
return 1 /* SafeModules */;
|
|
120296
120319
|
}
|
|
120297
|
-
|
|
120320
|
+
missingFileNames = oldProgram.getMissingFilePaths();
|
|
120298
120321
|
Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
120299
120322
|
for (const newSourceFile of newSourceFiles) {
|
|
120300
120323
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
@@ -120351,7 +120374,7 @@ ${lanes.join("\n")}
|
|
|
120351
120374
|
const path = toPath3(f);
|
|
120352
120375
|
if (getSourceFileByPath(path))
|
|
120353
120376
|
return true;
|
|
120354
|
-
if (
|
|
120377
|
+
if (missingFileNames.has(path))
|
|
120355
120378
|
return false;
|
|
120356
120379
|
return host.fileExists(f);
|
|
120357
120380
|
},
|
|
@@ -121163,6 +121186,7 @@ ${lanes.join("\n")}
|
|
|
121163
121186
|
addFileToFilesByName(
|
|
121164
121187
|
file2,
|
|
121165
121188
|
path,
|
|
121189
|
+
fileName,
|
|
121166
121190
|
/*redirectedPath*/
|
|
121167
121191
|
void 0
|
|
121168
121192
|
);
|
|
@@ -121235,7 +121259,7 @@ ${lanes.join("\n")}
|
|
|
121235
121259
|
if (fileFromPackageId) {
|
|
121236
121260
|
const dupFile = createRedirectedSourceFile(fileFromPackageId, file, fileName, path, toPath3(fileName), originalFileName, sourceFileOptions);
|
|
121237
121261
|
redirectTargetsMap.add(fileFromPackageId.path, fileName);
|
|
121238
|
-
addFileToFilesByName(dupFile, path, redirectedPath);
|
|
121262
|
+
addFileToFilesByName(dupFile, path, fileName, redirectedPath);
|
|
121239
121263
|
addFileIncludeReason(dupFile, reason);
|
|
121240
121264
|
sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
|
|
121241
121265
|
processingOtherFiles.push(dupFile);
|
|
@@ -121245,7 +121269,7 @@ ${lanes.join("\n")}
|
|
|
121245
121269
|
sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
|
|
121246
121270
|
}
|
|
121247
121271
|
}
|
|
121248
|
-
addFileToFilesByName(file, path, redirectedPath);
|
|
121272
|
+
addFileToFilesByName(file, path, fileName, redirectedPath);
|
|
121249
121273
|
if (file) {
|
|
121250
121274
|
sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
|
|
121251
121275
|
file.fileName = fileName;
|
|
@@ -121285,14 +121309,21 @@ ${lanes.join("\n")}
|
|
|
121285
121309
|
if (file)
|
|
121286
121310
|
fileReasons.add(file.path, reason);
|
|
121287
121311
|
}
|
|
121288
|
-
function addFileToFilesByName(file, path, redirectedPath) {
|
|
121312
|
+
function addFileToFilesByName(file, path, fileName, redirectedPath) {
|
|
121289
121313
|
if (redirectedPath) {
|
|
121290
|
-
|
|
121291
|
-
|
|
121314
|
+
updateFilesByNameMap(fileName, redirectedPath, file);
|
|
121315
|
+
updateFilesByNameMap(fileName, path, file || false);
|
|
121292
121316
|
} else {
|
|
121293
|
-
|
|
121317
|
+
updateFilesByNameMap(fileName, path, file);
|
|
121294
121318
|
}
|
|
121295
121319
|
}
|
|
121320
|
+
function updateFilesByNameMap(fileName, path, file) {
|
|
121321
|
+
filesByName.set(path, file);
|
|
121322
|
+
if (file !== void 0)
|
|
121323
|
+
missingFileNames.delete(path);
|
|
121324
|
+
else
|
|
121325
|
+
missingFileNames.set(path, fileName);
|
|
121326
|
+
}
|
|
121296
121327
|
function getProjectReferenceRedirect(fileName) {
|
|
121297
121328
|
const referencedProject = getProjectReferenceRedirectProject(fileName);
|
|
121298
121329
|
return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
|
|
@@ -121613,6 +121644,7 @@ ${lanes.join("\n")}
|
|
|
121613
121644
|
/*file*/
|
|
121614
121645
|
void 0,
|
|
121615
121646
|
sourceFilePath,
|
|
121647
|
+
refPath,
|
|
121616
121648
|
/*redirectedPath*/
|
|
121617
121649
|
void 0
|
|
121618
121650
|
);
|
|
@@ -121624,6 +121656,7 @@ ${lanes.join("\n")}
|
|
|
121624
121656
|
addFileToFilesByName(
|
|
121625
121657
|
sourceFile,
|
|
121626
121658
|
sourceFilePath,
|
|
121659
|
+
refPath,
|
|
121627
121660
|
/*redirectedPath*/
|
|
121628
121661
|
void 0
|
|
121629
121662
|
);
|
|
@@ -121633,6 +121666,7 @@ ${lanes.join("\n")}
|
|
|
121633
121666
|
addFileToFilesByName(
|
|
121634
121667
|
sourceFile,
|
|
121635
121668
|
sourceFilePath,
|
|
121669
|
+
refPath,
|
|
121636
121670
|
/*redirectedPath*/
|
|
121637
121671
|
void 0
|
|
121638
121672
|
);
|
|
@@ -125611,8 +125645,8 @@ ${lanes.join("\n")}
|
|
|
125611
125645
|
function closeTypeRootsWatch() {
|
|
125612
125646
|
clearMap(typeRootsWatches, closeFileWatcher);
|
|
125613
125647
|
}
|
|
125614
|
-
function createTypeRootsWatch(
|
|
125615
|
-
return canWatchTypeRootPath(
|
|
125648
|
+
function createTypeRootsWatch(typeRoot) {
|
|
125649
|
+
return canWatchTypeRootPath(typeRoot) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
125616
125650
|
const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
|
|
125617
125651
|
if (cachedDirectoryStructureHost) {
|
|
125618
125652
|
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
@@ -125621,7 +125655,7 @@ ${lanes.join("\n")}
|
|
|
125621
125655
|
resolutionHost.onChangedAutomaticTypeDirectiveNames();
|
|
125622
125656
|
const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(
|
|
125623
125657
|
typeRoot,
|
|
125624
|
-
|
|
125658
|
+
resolutionHost.toPath(typeRoot),
|
|
125625
125659
|
rootPath,
|
|
125626
125660
|
rootPathComponents,
|
|
125627
125661
|
getCurrentDirectory,
|
|
@@ -125642,7 +125676,7 @@ ${lanes.join("\n")}
|
|
|
125642
125676
|
if (typeRoots) {
|
|
125643
125677
|
mutateMap(
|
|
125644
125678
|
typeRootsWatches,
|
|
125645
|
-
|
|
125679
|
+
new Set(typeRoots),
|
|
125646
125680
|
{
|
|
125647
125681
|
createNewValue: createTypeRootsWatch,
|
|
125648
125682
|
onDeleteValue: closeFileWatcher
|
|
@@ -126609,7 +126643,11 @@ ${lanes.join("\n")}
|
|
|
126609
126643
|
const oldProgram = getCurrentProgram();
|
|
126610
126644
|
builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
126611
126645
|
resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
|
|
126612
|
-
updateMissingFilePathsWatch(
|
|
126646
|
+
updateMissingFilePathsWatch(
|
|
126647
|
+
builderProgram.getProgram(),
|
|
126648
|
+
missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()),
|
|
126649
|
+
watchMissingFilePath
|
|
126650
|
+
);
|
|
126613
126651
|
if (needsUpdateInTypeRootWatch) {
|
|
126614
126652
|
resolutionCache.updateTypeRootsWatch();
|
|
126615
126653
|
}
|
|
@@ -126902,8 +126940,15 @@ ${lanes.join("\n")}
|
|
|
126902
126940
|
cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
|
|
126903
126941
|
}
|
|
126904
126942
|
}
|
|
126905
|
-
function watchMissingFilePath(missingFilePath) {
|
|
126906
|
-
return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
|
|
126943
|
+
function watchMissingFilePath(missingFilePath, missingFileName) {
|
|
126944
|
+
return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
|
|
126945
|
+
missingFilePath,
|
|
126946
|
+
missingFileName,
|
|
126947
|
+
onMissingFileChange,
|
|
126948
|
+
500 /* Medium */,
|
|
126949
|
+
watchOptions,
|
|
126950
|
+
WatchType.MissingFile
|
|
126951
|
+
);
|
|
126907
126952
|
}
|
|
126908
126953
|
function onMissingFileChange(fileName, eventKind, missingFilePath) {
|
|
126909
126954
|
updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
|
|
@@ -126915,15 +126960,11 @@ ${lanes.join("\n")}
|
|
|
126915
126960
|
}
|
|
126916
126961
|
}
|
|
126917
126962
|
function watchConfigFileWildCardDirectories() {
|
|
126918
|
-
|
|
126919
|
-
|
|
126920
|
-
|
|
126921
|
-
|
|
126922
|
-
|
|
126923
|
-
);
|
|
126924
|
-
} else if (watchedWildcardDirectories) {
|
|
126925
|
-
clearMap(watchedWildcardDirectories, closeFileWatcherOf);
|
|
126926
|
-
}
|
|
126963
|
+
updateWatchingWildcardDirectories(
|
|
126964
|
+
watchedWildcardDirectories || (watchedWildcardDirectories = /* @__PURE__ */ new Map()),
|
|
126965
|
+
wildcardDirectories,
|
|
126966
|
+
watchWildcardDirectory
|
|
126967
|
+
);
|
|
126927
126968
|
}
|
|
126928
126969
|
function watchWildcardDirectory(directory, flags) {
|
|
126929
126970
|
return watchDirectory(
|
|
@@ -126995,7 +127036,7 @@ ${lanes.join("\n")}
|
|
|
126995
127036
|
);
|
|
126996
127037
|
}
|
|
126997
127038
|
function watchReferencedProject(configFileName2, configPath, commandLine) {
|
|
126998
|
-
var _a, _b, _c, _d
|
|
127039
|
+
var _a, _b, _c, _d;
|
|
126999
127040
|
commandLine.watcher || (commandLine.watcher = watchFile2(
|
|
127000
127041
|
configFileName2,
|
|
127001
127042
|
(_fileName, eventKind) => {
|
|
@@ -127010,55 +127051,50 @@ ${lanes.join("\n")}
|
|
|
127010
127051
|
((_a = commandLine.parsedCommandLine) == null ? void 0 : _a.watchOptions) || watchOptions,
|
|
127011
127052
|
WatchType.ConfigFileOfReferencedProject
|
|
127012
127053
|
));
|
|
127013
|
-
|
|
127014
|
-
|
|
127015
|
-
|
|
127016
|
-
|
|
127017
|
-
|
|
127018
|
-
|
|
127019
|
-
|
|
127020
|
-
|
|
127021
|
-
(fileOrDirectory)
|
|
127022
|
-
|
|
127023
|
-
|
|
127024
|
-
|
|
127025
|
-
|
|
127026
|
-
|
|
127027
|
-
|
|
127028
|
-
|
|
127029
|
-
|
|
127030
|
-
|
|
127031
|
-
|
|
127032
|
-
|
|
127033
|
-
|
|
127034
|
-
|
|
127035
|
-
|
|
127036
|
-
|
|
127037
|
-
|
|
127038
|
-
|
|
127039
|
-
|
|
127040
|
-
|
|
127041
|
-
|
|
127042
|
-
|
|
127043
|
-
|
|
127044
|
-
|
|
127045
|
-
|
|
127046
|
-
|
|
127047
|
-
|
|
127048
|
-
|
|
127049
|
-
|
|
127050
|
-
|
|
127051
|
-
|
|
127052
|
-
|
|
127053
|
-
);
|
|
127054
|
-
} else if (commandLine.watchedDirectories) {
|
|
127055
|
-
clearMap(commandLine.watchedDirectories, closeFileWatcherOf);
|
|
127056
|
-
commandLine.watchedDirectories = void 0;
|
|
127057
|
-
}
|
|
127054
|
+
updateWatchingWildcardDirectories(
|
|
127055
|
+
commandLine.watchedDirectories || (commandLine.watchedDirectories = /* @__PURE__ */ new Map()),
|
|
127056
|
+
(_b = commandLine.parsedCommandLine) == null ? void 0 : _b.wildcardDirectories,
|
|
127057
|
+
(directory, flags) => {
|
|
127058
|
+
var _a2;
|
|
127059
|
+
return watchDirectory(
|
|
127060
|
+
directory,
|
|
127061
|
+
(fileOrDirectory) => {
|
|
127062
|
+
const fileOrDirectoryPath = toPath3(fileOrDirectory);
|
|
127063
|
+
if (cachedDirectoryStructureHost) {
|
|
127064
|
+
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
127065
|
+
}
|
|
127066
|
+
nextSourceFileVersion(fileOrDirectoryPath);
|
|
127067
|
+
const config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
|
|
127068
|
+
if (!(config == null ? void 0 : config.parsedCommandLine))
|
|
127069
|
+
return;
|
|
127070
|
+
if (isIgnoredFileFromWildCardWatching({
|
|
127071
|
+
watchedDirPath: toPath3(directory),
|
|
127072
|
+
fileOrDirectory,
|
|
127073
|
+
fileOrDirectoryPath,
|
|
127074
|
+
configFileName: configFileName2,
|
|
127075
|
+
options: config.parsedCommandLine.options,
|
|
127076
|
+
program: config.parsedCommandLine.fileNames,
|
|
127077
|
+
currentDirectory,
|
|
127078
|
+
useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
|
|
127079
|
+
writeLog,
|
|
127080
|
+
toPath: toPath3
|
|
127081
|
+
}))
|
|
127082
|
+
return;
|
|
127083
|
+
if (config.updateLevel !== 2 /* Full */) {
|
|
127084
|
+
config.updateLevel = 1 /* RootNamesAndUpdate */;
|
|
127085
|
+
scheduleProgramUpdate();
|
|
127086
|
+
}
|
|
127087
|
+
},
|
|
127088
|
+
flags,
|
|
127089
|
+
((_a2 = commandLine.parsedCommandLine) == null ? void 0 : _a2.watchOptions) || watchOptions,
|
|
127090
|
+
WatchType.WildcardDirectoryOfReferencedProject
|
|
127091
|
+
);
|
|
127092
|
+
}
|
|
127093
|
+
);
|
|
127058
127094
|
updateExtendedConfigFilesWatches(
|
|
127059
127095
|
configPath,
|
|
127060
|
-
(
|
|
127061
|
-
((
|
|
127096
|
+
(_c = commandLine.parsedCommandLine) == null ? void 0 : _c.options,
|
|
127097
|
+
((_d = commandLine.parsedCommandLine) == null ? void 0 : _d.watchOptions) || watchOptions,
|
|
127062
127098
|
WatchType.ExtendedConfigOfReferencedProject
|
|
127063
127099
|
);
|
|
127064
127100
|
}
|
|
@@ -127396,9 +127432,9 @@ ${lanes.join("\n")}
|
|
|
127396
127432
|
function createStateBuildOrder(state) {
|
|
127397
127433
|
const buildOrder = createBuildOrder(state, state.rootNames.map((f) => resolveProjectName(state, f)));
|
|
127398
127434
|
state.resolvedConfigFilePaths.clear();
|
|
127399
|
-
const currentProjects = new
|
|
127435
|
+
const currentProjects = new Set(
|
|
127400
127436
|
getBuildOrderFromAnyBuildOrder(buildOrder).map(
|
|
127401
|
-
(resolved) =>
|
|
127437
|
+
(resolved) => toResolvedConfigFilePath(state, resolved)
|
|
127402
127438
|
)
|
|
127403
127439
|
);
|
|
127404
127440
|
const noopOnDelete = { onDeleteValue: noop };
|
|
@@ -127410,6 +127446,7 @@ ${lanes.join("\n")}
|
|
|
127410
127446
|
mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
|
|
127411
127447
|
mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
|
|
127412
127448
|
mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
|
|
127449
|
+
mutateMapSkippingNewValues(state.lastCachedPackageJsonLookups, currentProjects, noopOnDelete);
|
|
127413
127450
|
if (state.watch) {
|
|
127414
127451
|
mutateMapSkippingNewValues(
|
|
127415
127452
|
state.allWatchedConfigFiles,
|
|
@@ -127658,7 +127695,7 @@ ${lanes.join("\n")}
|
|
|
127658
127695
|
return withProgramOrUndefined(action) || emptyArray;
|
|
127659
127696
|
}
|
|
127660
127697
|
function createProgram2() {
|
|
127661
|
-
var _a, _b;
|
|
127698
|
+
var _a, _b, _c;
|
|
127662
127699
|
Debug.assert(program === void 0);
|
|
127663
127700
|
if (state.options.dry) {
|
|
127664
127701
|
reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
|
|
@@ -127687,12 +127724,13 @@ ${lanes.join("\n")}
|
|
|
127687
127724
|
config.projectReferences
|
|
127688
127725
|
);
|
|
127689
127726
|
if (state.watch) {
|
|
127727
|
+
const internalMap = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().getInternalMap();
|
|
127690
127728
|
state.lastCachedPackageJsonLookups.set(
|
|
127691
127729
|
projectPath,
|
|
127692
|
-
|
|
127693
|
-
|
|
127694
|
-
(
|
|
127695
|
-
)
|
|
127730
|
+
internalMap && new Set(arrayFrom(
|
|
127731
|
+
internalMap.values(),
|
|
127732
|
+
(data) => state.host.realpath && (isPackageJsonInfo(data) || data.directoryExists) ? state.host.realpath(combinePaths(data.packageDirectory, "package.json")) : combinePaths(data.packageDirectory, "package.json")
|
|
127733
|
+
))
|
|
127696
127734
|
);
|
|
127697
127735
|
state.builderPrograms.set(projectPath, program);
|
|
127698
127736
|
}
|
|
@@ -128425,9 +128463,10 @@ ${lanes.join("\n")}
|
|
|
128425
128463
|
const extendedConfigStatus = forEach(project.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName));
|
|
128426
128464
|
if (extendedConfigStatus)
|
|
128427
128465
|
return extendedConfigStatus;
|
|
128428
|
-
const
|
|
128429
|
-
|
|
128430
|
-
|
|
128466
|
+
const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath);
|
|
128467
|
+
const dependentPackageFileStatus = packageJsonLookups && forEachKey(
|
|
128468
|
+
packageJsonLookups,
|
|
128469
|
+
(path) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
|
|
128431
128470
|
);
|
|
128432
128471
|
if (dependentPackageFileStatus)
|
|
128433
128472
|
return dependentPackageFileStatus;
|
|
@@ -128784,7 +128823,7 @@ ${lanes.join("\n")}
|
|
|
128784
128823
|
return;
|
|
128785
128824
|
updateWatchingWildcardDirectories(
|
|
128786
128825
|
getOrCreateValueMapFromConfigFileMap(state.allWatchedWildcardDirectories, resolvedPath),
|
|
128787
|
-
|
|
128826
|
+
parsed.wildcardDirectories,
|
|
128788
128827
|
(dir, flags) => state.watchDirectory(
|
|
128789
128828
|
dir,
|
|
128790
128829
|
(fileOrDirectory) => {
|
|
@@ -128816,9 +128855,9 @@ ${lanes.join("\n")}
|
|
|
128816
128855
|
return;
|
|
128817
128856
|
mutateMap(
|
|
128818
128857
|
getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath),
|
|
128819
|
-
|
|
128858
|
+
new Set(parsed.fileNames),
|
|
128820
128859
|
{
|
|
128821
|
-
createNewValue: (
|
|
128860
|
+
createNewValue: (input) => watchFile(
|
|
128822
128861
|
state,
|
|
128823
128862
|
input,
|
|
128824
128863
|
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
|
|
@@ -128836,11 +128875,11 @@ ${lanes.join("\n")}
|
|
|
128836
128875
|
return;
|
|
128837
128876
|
mutateMap(
|
|
128838
128877
|
getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath),
|
|
128839
|
-
|
|
128878
|
+
state.lastCachedPackageJsonLookups.get(resolvedPath),
|
|
128840
128879
|
{
|
|
128841
|
-
createNewValue: (
|
|
128880
|
+
createNewValue: (input) => watchFile(
|
|
128842
128881
|
state,
|
|
128843
|
-
|
|
128882
|
+
input,
|
|
128844
128883
|
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
|
|
128845
128884
|
2e3 /* High */,
|
|
128846
128885
|
parsed == null ? void 0 : parsed.watchOptions,
|
|
@@ -134803,7 +134842,7 @@ ${lanes.join("\n")}
|
|
|
134803
134842
|
if ((importedModuleSymbol == null ? void 0 : importedModuleSymbol.declarations) && importedModuleSymbol.declarations.some((d) => isAmbientModule(d)))
|
|
134804
134843
|
return void 0;
|
|
134805
134844
|
const toImport = oldFromNew !== void 0 ? getSourceFileToImportFromResolved(importLiteral, resolveModuleName(importLiteral.text, oldImportFromPath, program.getCompilerOptions(), host), oldToNew, allFiles) : getSourceFileToImport(importedModuleSymbol, importLiteral, sourceFile, program, host, oldToNew);
|
|
134806
|
-
return toImport !== void 0 && (toImport.updated || importingSourceFileMoved && pathIsRelative(importLiteral.text)) ? ts_moduleSpecifiers_exports.updateModuleSpecifier(program.getCompilerOptions(), sourceFile,
|
|
134845
|
+
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;
|
|
134807
134846
|
});
|
|
134808
134847
|
}
|
|
134809
134848
|
}
|
|
@@ -135660,11 +135699,11 @@ ${lanes.join("\n")}
|
|
|
135660
135699
|
const fileFromCache = sourceFileLike.get(path);
|
|
135661
135700
|
if (fileFromCache !== void 0)
|
|
135662
135701
|
return fileFromCache ? fileFromCache : void 0;
|
|
135663
|
-
if (!host.readFile || host.fileExists && !host.fileExists(
|
|
135702
|
+
if (!host.readFile || host.fileExists && !host.fileExists(fileName)) {
|
|
135664
135703
|
sourceFileLike.set(path, false);
|
|
135665
135704
|
return void 0;
|
|
135666
135705
|
}
|
|
135667
|
-
const text = host.readFile(
|
|
135706
|
+
const text = host.readFile(fileName);
|
|
135668
135707
|
const file = text ? createSourceFileLike(text) : false;
|
|
135669
135708
|
sourceFileLike.set(path, file);
|
|
135670
135709
|
return file ? file : void 0;
|
|
@@ -138237,7 +138276,7 @@ ${lanes.join("\n")}
|
|
|
138237
138276
|
const resolved = program.getResolvedModule(oldFile, moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
|
|
138238
138277
|
const fileName = (_a = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _a.resolvedFileName;
|
|
138239
138278
|
if (fileName && targetSourceFile) {
|
|
138240
|
-
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.
|
|
138279
|
+
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.fileName, fileName, createModuleSpecifierResolutionHost(program, host));
|
|
138241
138280
|
append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
138242
138281
|
} else {
|
|
138243
138282
|
append(copiedOldImports, filterImport(i, factory.createStringLiteral(moduleSpecifierFromImport(i).text), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
@@ -138315,7 +138354,7 @@ ${lanes.join("\n")}
|
|
|
138315
138354
|
};
|
|
138316
138355
|
deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
|
|
138317
138356
|
const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(oldFile.path), targetFileName);
|
|
138318
|
-
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.
|
|
138357
|
+
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
|
|
138319
138358
|
const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove);
|
|
138320
138359
|
if (newImportDeclaration)
|
|
138321
138360
|
changes.insertNodeAfter(sourceFile, statement, newImportDeclaration);
|
|
@@ -138450,7 +138489,7 @@ ${lanes.join("\n")}
|
|
|
138450
138489
|
}
|
|
138451
138490
|
function makeImportOrRequire(sourceFile, defaultImport, imports, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference) {
|
|
138452
138491
|
const pathToTargetFile = resolvePath(getDirectoryPath(sourceFile.path), targetFileNameWithExtension);
|
|
138453
|
-
const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.
|
|
138492
|
+
const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFile, createModuleSpecifierResolutionHost(program, host));
|
|
138454
138493
|
if (useEs6Imports) {
|
|
138455
138494
|
const specifiers = imports.map((i) => factory.createImportSpecifier(
|
|
138456
138495
|
/*isTypeOnly*/
|
|
@@ -165157,6 +165196,32 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
165157
165196
|
parts.push({ text: tokenToString(node.operator) });
|
|
165158
165197
|
visitForDisplayParts(node.operand);
|
|
165159
165198
|
break;
|
|
165199
|
+
case 203 /* TemplateLiteralType */:
|
|
165200
|
+
Debug.assertNode(node, isTemplateLiteralTypeNode);
|
|
165201
|
+
visitForDisplayParts(node.head);
|
|
165202
|
+
node.templateSpans.forEach(visitForDisplayParts);
|
|
165203
|
+
break;
|
|
165204
|
+
case 16 /* TemplateHead */:
|
|
165205
|
+
Debug.assertNode(node, isTemplateHead);
|
|
165206
|
+
parts.push({ text: getLiteralText2(node) });
|
|
165207
|
+
break;
|
|
165208
|
+
case 204 /* TemplateLiteralTypeSpan */:
|
|
165209
|
+
Debug.assertNode(node, isTemplateLiteralTypeSpan);
|
|
165210
|
+
visitForDisplayParts(node.type);
|
|
165211
|
+
visitForDisplayParts(node.literal);
|
|
165212
|
+
break;
|
|
165213
|
+
case 17 /* TemplateMiddle */:
|
|
165214
|
+
Debug.assertNode(node, isTemplateMiddle);
|
|
165215
|
+
parts.push({ text: getLiteralText2(node) });
|
|
165216
|
+
break;
|
|
165217
|
+
case 18 /* TemplateTail */:
|
|
165218
|
+
Debug.assertNode(node, isTemplateTail);
|
|
165219
|
+
parts.push({ text: getLiteralText2(node) });
|
|
165220
|
+
break;
|
|
165221
|
+
case 197 /* ThisType */:
|
|
165222
|
+
Debug.assertNode(node, isThisTypeNode);
|
|
165223
|
+
parts.push({ text: "this" });
|
|
165224
|
+
break;
|
|
165160
165225
|
default:
|
|
165161
165226
|
Debug.failBadSyntaxKind(node);
|
|
165162
165227
|
}
|
|
@@ -165180,8 +165245,22 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
165180
165245
|
});
|
|
165181
165246
|
}
|
|
165182
165247
|
function getLiteralText2(node) {
|
|
165183
|
-
|
|
165184
|
-
|
|
165248
|
+
switch (node.kind) {
|
|
165249
|
+
case 11 /* StringLiteral */:
|
|
165250
|
+
return quotePreference === 0 /* Single */ ? `'${escapeString(node.text, 39 /* singleQuote */)}'` : `"${escapeString(node.text, 34 /* doubleQuote */)}"`;
|
|
165251
|
+
case 16 /* TemplateHead */:
|
|
165252
|
+
case 17 /* TemplateMiddle */:
|
|
165253
|
+
case 18 /* TemplateTail */: {
|
|
165254
|
+
const rawText = node.rawText ?? escapeTemplateSubstitution(escapeString(node.text, 96 /* backtick */));
|
|
165255
|
+
switch (node.kind) {
|
|
165256
|
+
case 16 /* TemplateHead */:
|
|
165257
|
+
return "`" + rawText + "${";
|
|
165258
|
+
case 17 /* TemplateMiddle */:
|
|
165259
|
+
return "}" + rawText + "${";
|
|
165260
|
+
case 18 /* TemplateTail */:
|
|
165261
|
+
return "}" + rawText + "`";
|
|
165262
|
+
}
|
|
165263
|
+
}
|
|
165185
165264
|
}
|
|
165186
165265
|
return node.text;
|
|
165187
165266
|
}
|
|
@@ -174826,6 +174905,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
174826
174905
|
return path === options.configFilePath ? options.configFile : this.getSourceFile(path);
|
|
174827
174906
|
}
|
|
174828
174907
|
close() {
|
|
174908
|
+
var _a;
|
|
174829
174909
|
this.projectService.typingsCache.onProjectClosed(this);
|
|
174830
174910
|
this.closeWatchingTypingLocations();
|
|
174831
174911
|
this.cleanupProgram();
|
|
@@ -174842,6 +174922,12 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
174842
174922
|
this.resolutionCache.clear();
|
|
174843
174923
|
this.resolutionCache = void 0;
|
|
174844
174924
|
this.cachedUnresolvedImportsPerFile = void 0;
|
|
174925
|
+
(_a = this.packageJsonWatches) == null ? void 0 : _a.forEach((watcher) => {
|
|
174926
|
+
watcher.projects.delete(this);
|
|
174927
|
+
watcher.close();
|
|
174928
|
+
});
|
|
174929
|
+
this.packageJsonWatches = void 0;
|
|
174930
|
+
this.moduleSpecifierCache.clear();
|
|
174845
174931
|
this.moduleSpecifierCache = void 0;
|
|
174846
174932
|
this.directoryStructureHost = void 0;
|
|
174847
174933
|
this.exportMapCache = void 0;
|
|
@@ -175036,13 +175122,10 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175036
175122
|
}
|
|
175037
175123
|
}
|
|
175038
175124
|
/** @internal */
|
|
175039
|
-
onPackageJsonChange(
|
|
175040
|
-
|
|
175041
|
-
if (
|
|
175042
|
-
this.
|
|
175043
|
-
if (this.autoImportProviderHost) {
|
|
175044
|
-
this.autoImportProviderHost.markAsDirty();
|
|
175045
|
-
}
|
|
175125
|
+
onPackageJsonChange() {
|
|
175126
|
+
this.moduleSpecifierCache.clear();
|
|
175127
|
+
if (this.autoImportProviderHost) {
|
|
175128
|
+
this.autoImportProviderHost.markAsDirty();
|
|
175046
175129
|
}
|
|
175047
175130
|
}
|
|
175048
175131
|
/** @internal */
|
|
@@ -175257,7 +175340,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175257
175340
|
this.program,
|
|
175258
175341
|
this.missingFilesMap || (this.missingFilesMap = /* @__PURE__ */ new Map()),
|
|
175259
175342
|
// Watch the missing files
|
|
175260
|
-
(missingFilePath) => this.addMissingFileWatcher(missingFilePath)
|
|
175343
|
+
(missingFilePath, missingFileName) => this.addMissingFileWatcher(missingFilePath, missingFileName)
|
|
175261
175344
|
);
|
|
175262
175345
|
if (this.generatedFilesMap) {
|
|
175263
175346
|
const outPath = outFile(this.compilerOptions);
|
|
@@ -175371,7 +175454,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175371
175454
|
}
|
|
175372
175455
|
}
|
|
175373
175456
|
}
|
|
175374
|
-
addMissingFileWatcher(missingFilePath) {
|
|
175457
|
+
addMissingFileWatcher(missingFilePath, missingFileName) {
|
|
175375
175458
|
var _a;
|
|
175376
175459
|
if (isConfiguredProject(this)) {
|
|
175377
175460
|
const configFileExistenceInfo = this.projectService.configFileExistenceInfoCache.get(missingFilePath);
|
|
@@ -175379,7 +175462,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175379
175462
|
return noopFileWatcher;
|
|
175380
175463
|
}
|
|
175381
175464
|
const fileWatcher = this.projectService.watchFactory.watchFile(
|
|
175382
|
-
|
|
175465
|
+
getNormalizedAbsolutePath(missingFileName, this.currentDirectory),
|
|
175383
175466
|
(fileName, eventKind) => {
|
|
175384
175467
|
if (isConfiguredProject(this)) {
|
|
175385
175468
|
this.getCachedDirectoryStructureHost().addOrDeleteFile(fileName, missingFilePath, eventKind);
|
|
@@ -175716,7 +175799,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175716
175799
|
getPackageJsonsVisibleToFile(fileName, rootDir) {
|
|
175717
175800
|
if (this.projectService.serverMode !== 0 /* Semantic */)
|
|
175718
175801
|
return emptyArray2;
|
|
175719
|
-
return this.projectService.getPackageJsonsVisibleToFile(fileName, rootDir);
|
|
175802
|
+
return this.projectService.getPackageJsonsVisibleToFile(fileName, this, rootDir);
|
|
175720
175803
|
}
|
|
175721
175804
|
/** @internal */
|
|
175722
175805
|
getNearestAncestorDirectoryWithPackageJson(fileName) {
|
|
@@ -175724,9 +175807,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175724
175807
|
}
|
|
175725
175808
|
/** @internal */
|
|
175726
175809
|
getPackageJsonsForAutoImport(rootDir) {
|
|
175727
|
-
|
|
175728
|
-
this.packageJsonsForAutoImport = new Set(packageJsons.map((p) => p.fileName));
|
|
175729
|
-
return packageJsons;
|
|
175810
|
+
return this.getPackageJsonsVisibleToFile(combinePaths(this.currentDirectory, inferredTypesContainingFile), rootDir);
|
|
175730
175811
|
}
|
|
175731
175812
|
/** @internal */
|
|
175732
175813
|
getPackageJsonCache() {
|
|
@@ -175812,7 +175893,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175812
175893
|
}
|
|
175813
175894
|
/** @internal */
|
|
175814
175895
|
watchNodeModulesForPackageJsonChanges(directoryPath) {
|
|
175815
|
-
return this.projectService.watchPackageJsonsInNodeModules(
|
|
175896
|
+
return this.projectService.watchPackageJsonsInNodeModules(directoryPath, this);
|
|
175816
175897
|
}
|
|
175817
175898
|
/** @internal */
|
|
175818
175899
|
getIncompleteCompletionsCache() {
|
|
@@ -177387,18 +177468,20 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
177387
177468
|
* @internal
|
|
177388
177469
|
*/
|
|
177389
177470
|
watchWildcardDirectory(directory, flags, configFileName, config) {
|
|
177390
|
-
|
|
177471
|
+
let watcher = this.watchFactory.watchDirectory(
|
|
177391
177472
|
directory,
|
|
177392
177473
|
(fileOrDirectory) => {
|
|
177393
177474
|
const fileOrDirectoryPath = this.toPath(fileOrDirectory);
|
|
177394
177475
|
const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
177395
|
-
if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(
|
|
177396
|
-
|
|
177397
|
-
this.
|
|
177476
|
+
if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
|
|
177477
|
+
const file = this.getNormalizedAbsolutePath(fileOrDirectory);
|
|
177478
|
+
this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
|
|
177479
|
+
this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
|
|
177480
|
+
this.watchPackageJsonFile(file, fileOrDirectoryPath, result);
|
|
177398
177481
|
}
|
|
177399
177482
|
const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
|
|
177400
177483
|
if (isIgnoredFileFromWildCardWatching({
|
|
177401
|
-
watchedDirPath: directory,
|
|
177484
|
+
watchedDirPath: this.toPath(directory),
|
|
177402
177485
|
fileOrDirectory,
|
|
177403
177486
|
fileOrDirectoryPath,
|
|
177404
177487
|
configFileName,
|
|
@@ -177443,6 +177526,22 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
177443
177526
|
WatchType.WildcardDirectory,
|
|
177444
177527
|
configFileName
|
|
177445
177528
|
);
|
|
177529
|
+
const result = {
|
|
177530
|
+
packageJsonWatches: void 0,
|
|
177531
|
+
close() {
|
|
177532
|
+
var _a;
|
|
177533
|
+
if (watcher) {
|
|
177534
|
+
watcher.close();
|
|
177535
|
+
watcher = void 0;
|
|
177536
|
+
(_a = result.packageJsonWatches) == null ? void 0 : _a.forEach((watcher2) => {
|
|
177537
|
+
watcher2.projects.delete(result);
|
|
177538
|
+
watcher2.close();
|
|
177539
|
+
});
|
|
177540
|
+
result.packageJsonWatches = void 0;
|
|
177541
|
+
}
|
|
177542
|
+
}
|
|
177543
|
+
};
|
|
177544
|
+
return result;
|
|
177446
177545
|
}
|
|
177447
177546
|
/** @internal */
|
|
177448
177547
|
delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
|
|
@@ -178187,7 +178286,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
178187
178286
|
config.watchedDirectoriesStale = false;
|
|
178188
178287
|
updateWatchingWildcardDirectories(
|
|
178189
178288
|
config.watchedDirectories || (config.watchedDirectories = /* @__PURE__ */ new Map()),
|
|
178190
|
-
|
|
178289
|
+
config.parsedCommandLine.wildcardDirectories,
|
|
178191
178290
|
// Create new directory watcher
|
|
178192
178291
|
(directory, flags) => this.watchWildcardDirectory(directory, flags, configFileName, config)
|
|
178193
178292
|
);
|
|
@@ -178269,7 +178368,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
178269
178368
|
if (value.info) {
|
|
178270
178369
|
project.removeFile(
|
|
178271
178370
|
value.info,
|
|
178272
|
-
project.fileExists(
|
|
178371
|
+
project.fileExists(value.info.fileName),
|
|
178273
178372
|
/*detachFromProject*/
|
|
178274
178373
|
true
|
|
178275
178374
|
);
|
|
@@ -178501,7 +178600,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
178501
178600
|
watchClosedScriptInfo(info) {
|
|
178502
178601
|
Debug.assert(!info.fileWatcher);
|
|
178503
178602
|
if (!info.isDynamicOrHasMixedContent() && (!this.globalCacheLocationDirectoryPath || !startsWith(info.path, this.globalCacheLocationDirectoryPath))) {
|
|
178504
|
-
const indexOfNodeModules = info.
|
|
178603
|
+
const indexOfNodeModules = info.fileName.indexOf("/node_modules/");
|
|
178505
178604
|
if (!this.host.getModifiedTime || indexOfNodeModules === -1) {
|
|
178506
178605
|
info.fileWatcher = this.watchFactory.watchFile(
|
|
178507
178606
|
info.fileName,
|
|
@@ -178512,12 +178611,12 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
178512
178611
|
);
|
|
178513
178612
|
} else {
|
|
178514
178613
|
info.mTime = this.getModifiedTime(info);
|
|
178515
|
-
info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.
|
|
178614
|
+
info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.fileName.substring(0, indexOfNodeModules));
|
|
178516
178615
|
}
|
|
178517
178616
|
}
|
|
178518
178617
|
}
|
|
178519
|
-
createNodeModulesWatcher(dir) {
|
|
178520
|
-
|
|
178618
|
+
createNodeModulesWatcher(dir, dirPath) {
|
|
178619
|
+
let watcher = this.watchFactory.watchDirectory(
|
|
178521
178620
|
dir,
|
|
178522
178621
|
(fileOrDirectory) => {
|
|
178523
178622
|
var _a;
|
|
@@ -178526,14 +178625,14 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
178526
178625
|
return;
|
|
178527
178626
|
const basename = getBaseFileName(fileOrDirectoryPath);
|
|
178528
178627
|
if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (basename === "package.json" || basename === "node_modules")) {
|
|
178529
|
-
result.affectedModuleSpecifierCacheProjects.forEach((
|
|
178530
|
-
var _a2
|
|
178531
|
-
(
|
|
178628
|
+
result.affectedModuleSpecifierCacheProjects.forEach((project) => {
|
|
178629
|
+
var _a2;
|
|
178630
|
+
(_a2 = project.getModuleSpecifierCache()) == null ? void 0 : _a2.clear();
|
|
178532
178631
|
});
|
|
178533
178632
|
}
|
|
178534
178633
|
if (result.refreshScriptInfoRefCount) {
|
|
178535
|
-
if (
|
|
178536
|
-
this.refreshScriptInfosInDirectory(
|
|
178634
|
+
if (dirPath === fileOrDirectoryPath) {
|
|
178635
|
+
this.refreshScriptInfosInDirectory(dirPath);
|
|
178537
178636
|
} else {
|
|
178538
178637
|
const info = this.getScriptInfoForPath(fileOrDirectoryPath);
|
|
178539
178638
|
if (info) {
|
|
@@ -178555,30 +178654,35 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
178555
178654
|
affectedModuleSpecifierCacheProjects: void 0,
|
|
178556
178655
|
close: () => {
|
|
178557
178656
|
var _a;
|
|
178558
|
-
if (!result.refreshScriptInfoRefCount && !((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size)) {
|
|
178657
|
+
if (watcher && !result.refreshScriptInfoRefCount && !((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size)) {
|
|
178559
178658
|
watcher.close();
|
|
178560
|
-
|
|
178659
|
+
watcher = void 0;
|
|
178660
|
+
this.nodeModulesWatchers.delete(dirPath);
|
|
178561
178661
|
}
|
|
178562
178662
|
}
|
|
178563
178663
|
};
|
|
178564
|
-
this.nodeModulesWatchers.set(
|
|
178664
|
+
this.nodeModulesWatchers.set(dirPath, result);
|
|
178565
178665
|
return result;
|
|
178566
178666
|
}
|
|
178567
178667
|
/** @internal */
|
|
178568
178668
|
watchPackageJsonsInNodeModules(dir, project) {
|
|
178569
|
-
|
|
178570
|
-
|
|
178669
|
+
var _a;
|
|
178670
|
+
const dirPath = this.toPath(dir);
|
|
178671
|
+
const watcher = this.nodeModulesWatchers.get(dirPath) || this.createNodeModulesWatcher(dir, dirPath);
|
|
178672
|
+
Debug.assert(!((_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.has(project)));
|
|
178673
|
+
(watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project);
|
|
178571
178674
|
return {
|
|
178572
178675
|
close: () => {
|
|
178573
|
-
var
|
|
178574
|
-
(
|
|
178676
|
+
var _a2;
|
|
178677
|
+
(_a2 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a2.delete(project);
|
|
178575
178678
|
watcher.close();
|
|
178576
178679
|
}
|
|
178577
178680
|
};
|
|
178578
178681
|
}
|
|
178579
178682
|
watchClosedScriptInfoInNodeModules(dir) {
|
|
178580
178683
|
const watchDir = dir + "/node_modules";
|
|
178581
|
-
const
|
|
178684
|
+
const watchDirPath = this.toPath(watchDir);
|
|
178685
|
+
const watcher = this.nodeModulesWatchers.get(watchDirPath) || this.createNodeModulesWatcher(watchDir, watchDirPath);
|
|
178582
178686
|
watcher.refreshScriptInfoRefCount++;
|
|
178583
178687
|
return {
|
|
178584
178688
|
close: () => {
|
|
@@ -178588,7 +178692,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
178588
178692
|
};
|
|
178589
178693
|
}
|
|
178590
178694
|
getModifiedTime(info) {
|
|
178591
|
-
return (this.host.getModifiedTime(info.
|
|
178695
|
+
return (this.host.getModifiedTime(info.fileName) || missingFileModifiedTime).getTime();
|
|
178592
178696
|
}
|
|
178593
178697
|
refreshScriptInfo(info) {
|
|
178594
178698
|
const mTime = this.getModifiedTime(info);
|
|
@@ -178852,10 +178956,9 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
178852
178956
|
});
|
|
178853
178957
|
}
|
|
178854
178958
|
if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports) {
|
|
178855
|
-
this.
|
|
178856
|
-
|
|
178857
|
-
|
|
178858
|
-
);
|
|
178959
|
+
this.forEachProject((project) => {
|
|
178960
|
+
project.onAutoImportProviderSettingsChanged();
|
|
178961
|
+
});
|
|
178859
178962
|
}
|
|
178860
178963
|
}
|
|
178861
178964
|
if (args.extraFileExtensions) {
|
|
@@ -179774,10 +179877,9 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
179774
179877
|
this.currentPluginConfigOverrides.set(args.pluginName, args.configuration);
|
|
179775
179878
|
}
|
|
179776
179879
|
/** @internal */
|
|
179777
|
-
getPackageJsonsVisibleToFile(fileName, rootDir) {
|
|
179880
|
+
getPackageJsonsVisibleToFile(fileName, project, rootDir) {
|
|
179778
179881
|
const packageJsonCache = this.packageJsonCache;
|
|
179779
179882
|
const rootPath = rootDir && this.toPath(rootDir);
|
|
179780
|
-
const filePath = this.toPath(fileName);
|
|
179781
179883
|
const result = [];
|
|
179782
179884
|
const processDirectory = (directory) => {
|
|
179783
179885
|
switch (packageJsonCache.directoryHasPackageJson(directory)) {
|
|
@@ -179786,7 +179888,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
179786
179888
|
return processDirectory(directory);
|
|
179787
179889
|
case -1 /* True */:
|
|
179788
179890
|
const packageJsonFileName = combinePaths(directory, "package.json");
|
|
179789
|
-
this.watchPackageJsonFile(packageJsonFileName);
|
|
179891
|
+
this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName), project);
|
|
179790
179892
|
const info = packageJsonCache.getInDirectory(directory);
|
|
179791
179893
|
if (info)
|
|
179792
179894
|
result.push(info);
|
|
@@ -179795,13 +179897,13 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
179795
179897
|
return true;
|
|
179796
179898
|
}
|
|
179797
179899
|
};
|
|
179798
|
-
forEachAncestorDirectory(getDirectoryPath(
|
|
179900
|
+
forEachAncestorDirectory(getDirectoryPath(fileName), processDirectory);
|
|
179799
179901
|
return result;
|
|
179800
179902
|
}
|
|
179801
179903
|
/** @internal */
|
|
179802
179904
|
getNearestAncestorDirectoryWithPackageJson(fileName) {
|
|
179803
179905
|
return forEachAncestorDirectory(fileName, (directory) => {
|
|
179804
|
-
switch (this.packageJsonCache.directoryHasPackageJson(
|
|
179906
|
+
switch (this.packageJsonCache.directoryHasPackageJson(directory)) {
|
|
179805
179907
|
case -1 /* True */:
|
|
179806
179908
|
return directory;
|
|
179807
179909
|
case 0 /* False */:
|
|
@@ -179812,41 +179914,54 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
179812
179914
|
});
|
|
179813
179915
|
}
|
|
179814
179916
|
/** @internal */
|
|
179815
|
-
watchPackageJsonFile(path) {
|
|
179816
|
-
|
|
179817
|
-
|
|
179818
|
-
|
|
179819
|
-
|
|
179820
|
-
|
|
179821
|
-
|
|
179822
|
-
|
|
179823
|
-
|
|
179824
|
-
|
|
179825
|
-
|
|
179826
|
-
|
|
179827
|
-
|
|
179828
|
-
|
|
179829
|
-
|
|
179830
|
-
|
|
179831
|
-
|
|
179832
|
-
|
|
179833
|
-
|
|
179834
|
-
|
|
179835
|
-
|
|
179836
|
-
|
|
179837
|
-
|
|
179838
|
-
|
|
179839
|
-
250 /* Low */,
|
|
179840
|
-
this.hostConfiguration.watchOptions,
|
|
179841
|
-
WatchType.PackageJson
|
|
179842
|
-
)
|
|
179917
|
+
watchPackageJsonFile(file, path, project) {
|
|
179918
|
+
Debug.assert(project !== void 0);
|
|
179919
|
+
let result = (this.packageJsonFilesMap ?? (this.packageJsonFilesMap = /* @__PURE__ */ new Map())).get(path);
|
|
179920
|
+
if (!result) {
|
|
179921
|
+
let watcher = this.watchFactory.watchFile(
|
|
179922
|
+
file,
|
|
179923
|
+
(fileName, eventKind) => {
|
|
179924
|
+
switch (eventKind) {
|
|
179925
|
+
case 0 /* Created */:
|
|
179926
|
+
return Debug.fail();
|
|
179927
|
+
case 1 /* Changed */:
|
|
179928
|
+
this.packageJsonCache.addOrUpdate(fileName, path);
|
|
179929
|
+
this.onPackageJsonChange(result);
|
|
179930
|
+
break;
|
|
179931
|
+
case 2 /* Deleted */:
|
|
179932
|
+
this.packageJsonCache.delete(path);
|
|
179933
|
+
this.onPackageJsonChange(result);
|
|
179934
|
+
result.projects.clear();
|
|
179935
|
+
result.close();
|
|
179936
|
+
}
|
|
179937
|
+
},
|
|
179938
|
+
250 /* Low */,
|
|
179939
|
+
this.hostConfiguration.watchOptions,
|
|
179940
|
+
WatchType.PackageJson
|
|
179843
179941
|
);
|
|
179942
|
+
result = {
|
|
179943
|
+
projects: /* @__PURE__ */ new Set(),
|
|
179944
|
+
close: () => {
|
|
179945
|
+
var _a;
|
|
179946
|
+
if (result.projects.size || !watcher)
|
|
179947
|
+
return;
|
|
179948
|
+
watcher.close();
|
|
179949
|
+
watcher = void 0;
|
|
179950
|
+
(_a = this.packageJsonFilesMap) == null ? void 0 : _a.delete(path);
|
|
179951
|
+
this.packageJsonCache.invalidate(path);
|
|
179952
|
+
}
|
|
179953
|
+
};
|
|
179954
|
+
this.packageJsonFilesMap.set(path, result);
|
|
179844
179955
|
}
|
|
179956
|
+
result.projects.add(project);
|
|
179957
|
+
(project.packageJsonWatches ?? (project.packageJsonWatches = /* @__PURE__ */ new Set())).add(result);
|
|
179845
179958
|
}
|
|
179846
179959
|
/** @internal */
|
|
179847
|
-
|
|
179848
|
-
|
|
179849
|
-
|
|
179960
|
+
onPackageJsonChange(result) {
|
|
179961
|
+
result.projects.forEach((project) => {
|
|
179962
|
+
var _a;
|
|
179963
|
+
return (_a = project.onPackageJsonChange) == null ? void 0 : _a.call(project);
|
|
179964
|
+
});
|
|
179850
179965
|
}
|
|
179851
179966
|
/** @internal */
|
|
179852
179967
|
includePackageJsonAutoImports() {
|
|
@@ -179860,19 +179975,6 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
179860
179975
|
}
|
|
179861
179976
|
}
|
|
179862
179977
|
/** @internal */
|
|
179863
|
-
invalidateProjectPackageJson(packageJsonPath) {
|
|
179864
|
-
this.configuredProjects.forEach(invalidate);
|
|
179865
|
-
this.inferredProjects.forEach(invalidate);
|
|
179866
|
-
this.externalProjects.forEach(invalidate);
|
|
179867
|
-
function invalidate(project) {
|
|
179868
|
-
if (packageJsonPath) {
|
|
179869
|
-
project.onPackageJsonChange(packageJsonPath);
|
|
179870
|
-
} else {
|
|
179871
|
-
project.onAutoImportProviderSettingsChanged();
|
|
179872
|
-
}
|
|
179873
|
-
}
|
|
179874
|
-
}
|
|
179875
|
-
/** @internal */
|
|
179876
179978
|
getIncompleteCompletionsCache() {
|
|
179877
179979
|
return this.incompleteCompletionsCache || (this.incompleteCompletionsCache = createIncompleteCompletionsCache());
|
|
179878
179980
|
}
|
|
@@ -179905,9 +180007,10 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
179905
180007
|
for (const p of modulePaths) {
|
|
179906
180008
|
if (p.isInNodeModules) {
|
|
179907
180009
|
const nodeModulesPath = p.path.substring(0, p.path.indexOf(nodeModulesPathPart) + nodeModulesPathPart.length - 1);
|
|
179908
|
-
|
|
180010
|
+
const key2 = host.toPath(nodeModulesPath);
|
|
180011
|
+
if (!(containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.has(key2))) {
|
|
179909
180012
|
(containedNodeModulesWatchers || (containedNodeModulesWatchers = /* @__PURE__ */ new Map())).set(
|
|
179910
|
-
|
|
180013
|
+
key2,
|
|
179911
180014
|
host.watchNodeModulesForPackageJsonChanges(nodeModulesPath)
|
|
179912
180015
|
);
|
|
179913
180016
|
}
|
|
@@ -179946,7 +180049,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
179946
180049
|
}
|
|
179947
180050
|
},
|
|
179948
180051
|
clear() {
|
|
179949
|
-
containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach(
|
|
180052
|
+
containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach(closeFileWatcher);
|
|
179950
180053
|
cache == null ? void 0 : cache.clear();
|
|
179951
180054
|
containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.clear();
|
|
179952
180055
|
currentKey = void 0;
|
|
@@ -179987,34 +180090,38 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
179987
180090
|
const directoriesWithoutPackageJson = /* @__PURE__ */ new Map();
|
|
179988
180091
|
return {
|
|
179989
180092
|
addOrUpdate,
|
|
179990
|
-
|
|
179991
|
-
get: packageJsons.get.bind(packageJsons),
|
|
180093
|
+
invalidate,
|
|
179992
180094
|
delete: (fileName) => {
|
|
179993
180095
|
packageJsons.delete(fileName);
|
|
179994
180096
|
directoriesWithoutPackageJson.set(getDirectoryPath(fileName), true);
|
|
179995
180097
|
},
|
|
179996
180098
|
getInDirectory: (directory) => {
|
|
179997
|
-
return packageJsons.get(combinePaths(directory, "package.json")) || void 0;
|
|
180099
|
+
return packageJsons.get(host.toPath(combinePaths(directory, "package.json"))) || void 0;
|
|
179998
180100
|
},
|
|
179999
|
-
directoryHasPackageJson,
|
|
180101
|
+
directoryHasPackageJson: (directory) => directoryHasPackageJson(host.toPath(directory)),
|
|
180000
180102
|
searchDirectoryAndAncestors: (directory) => {
|
|
180001
180103
|
forEachAncestorDirectory(directory, (ancestor) => {
|
|
180002
|
-
|
|
180104
|
+
const ancestorPath = host.toPath(ancestor);
|
|
180105
|
+
if (directoryHasPackageJson(ancestorPath) !== 3 /* Maybe */) {
|
|
180003
180106
|
return true;
|
|
180004
180107
|
}
|
|
180005
|
-
const packageJsonFileName =
|
|
180108
|
+
const packageJsonFileName = combinePaths(ancestor, "package.json");
|
|
180006
180109
|
if (tryFileExists(host, packageJsonFileName)) {
|
|
180007
|
-
addOrUpdate(packageJsonFileName);
|
|
180110
|
+
addOrUpdate(packageJsonFileName, combinePaths(ancestorPath, "package.json"));
|
|
180008
180111
|
} else {
|
|
180009
|
-
directoriesWithoutPackageJson.set(
|
|
180112
|
+
directoriesWithoutPackageJson.set(ancestorPath, true);
|
|
180010
180113
|
}
|
|
180011
180114
|
});
|
|
180012
180115
|
}
|
|
180013
180116
|
};
|
|
180014
|
-
function addOrUpdate(fileName) {
|
|
180117
|
+
function addOrUpdate(fileName, path) {
|
|
180015
180118
|
const packageJsonInfo = Debug.checkDefined(createPackageJsonInfo(fileName, host.host));
|
|
180016
|
-
packageJsons.set(
|
|
180017
|
-
directoriesWithoutPackageJson.delete(getDirectoryPath(
|
|
180119
|
+
packageJsons.set(path, packageJsonInfo);
|
|
180120
|
+
directoriesWithoutPackageJson.delete(getDirectoryPath(path));
|
|
180121
|
+
}
|
|
180122
|
+
function invalidate(path) {
|
|
180123
|
+
packageJsons.delete(path);
|
|
180124
|
+
directoriesWithoutPackageJson.delete(getDirectoryPath(path));
|
|
180018
180125
|
}
|
|
180019
180126
|
function directoryHasPackageJson(directory) {
|
|
180020
180127
|
return packageJsons.has(combinePaths(directory, "package.json")) ? -1 /* True */ : directoriesWithoutPackageJson.has(directory) ? 0 /* False */ : 3 /* Maybe */;
|
|
@@ -184934,6 +185041,7 @@ ${e.message}`;
|
|
|
184934
185041
|
escapeNonAsciiString: () => escapeNonAsciiString,
|
|
184935
185042
|
escapeSnippetText: () => escapeSnippetText,
|
|
184936
185043
|
escapeString: () => escapeString,
|
|
185044
|
+
escapeTemplateSubstitution: () => escapeTemplateSubstitution,
|
|
184937
185045
|
every: () => every,
|
|
184938
185046
|
expandPreOrPostfixIncrementOrDecrementExpression: () => expandPreOrPostfixIncrementOrDecrementExpression,
|
|
184939
185047
|
explainFiles: () => explainFiles,
|
|
@@ -186032,6 +186140,7 @@ ${e.message}`;
|
|
|
186032
186140
|
isOuterExpression: () => isOuterExpression,
|
|
186033
186141
|
isOutermostOptionalChain: () => isOutermostOptionalChain,
|
|
186034
186142
|
isOverrideModifier: () => isOverrideModifier,
|
|
186143
|
+
isPackageJsonInfo: () => isPackageJsonInfo,
|
|
186035
186144
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
186036
186145
|
isParameter: () => isParameter,
|
|
186037
186146
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
@@ -186683,7 +186792,6 @@ ${e.message}`;
|
|
|
186683
186792
|
updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
|
|
186684
186793
|
updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
|
|
186685
186794
|
updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
|
|
186686
|
-
updatePackageJsonWatch: () => updatePackageJsonWatch,
|
|
186687
186795
|
updateResolutionField: () => updateResolutionField,
|
|
186688
186796
|
updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher,
|
|
186689
186797
|
updateSourceFile: () => updateSourceFile,
|
|
@@ -187346,6 +187454,7 @@ ${e.message}`;
|
|
|
187346
187454
|
escapeNonAsciiString: () => escapeNonAsciiString,
|
|
187347
187455
|
escapeSnippetText: () => escapeSnippetText,
|
|
187348
187456
|
escapeString: () => escapeString,
|
|
187457
|
+
escapeTemplateSubstitution: () => escapeTemplateSubstitution,
|
|
187349
187458
|
every: () => every,
|
|
187350
187459
|
expandPreOrPostfixIncrementOrDecrementExpression: () => expandPreOrPostfixIncrementOrDecrementExpression,
|
|
187351
187460
|
explainFiles: () => explainFiles,
|
|
@@ -188444,6 +188553,7 @@ ${e.message}`;
|
|
|
188444
188553
|
isOuterExpression: () => isOuterExpression,
|
|
188445
188554
|
isOutermostOptionalChain: () => isOutermostOptionalChain,
|
|
188446
188555
|
isOverrideModifier: () => isOverrideModifier,
|
|
188556
|
+
isPackageJsonInfo: () => isPackageJsonInfo,
|
|
188447
188557
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
188448
188558
|
isParameter: () => isParameter,
|
|
188449
188559
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
@@ -189095,7 +189205,6 @@ ${e.message}`;
|
|
|
189095
189205
|
updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
|
|
189096
189206
|
updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
|
|
189097
189207
|
updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
|
|
189098
|
-
updatePackageJsonWatch: () => updatePackageJsonWatch,
|
|
189099
189208
|
updateResolutionField: () => updateResolutionField,
|
|
189100
189209
|
updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher,
|
|
189101
189210
|
updateSourceFile: () => updateSourceFile,
|