typescript 5.4.0-dev.20231126 → 5.4.0-dev.20231128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +200 -160
- package/lib/tsserver.js +350 -289
- package/lib/typescript.js +349 -288
- package/lib/typingsInstaller.js +11 -7
- package/package.json +3 -3
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.4";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20231128`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -15951,19 +15951,19 @@ function clearMap(map2, onDeleteValue) {
|
|
|
15951
15951
|
function mutateMapSkippingNewValues(map2, newMap, options) {
|
|
15952
15952
|
const { onDeleteValue, onExistingValue } = options;
|
|
15953
15953
|
map2.forEach((existingValue, key) => {
|
|
15954
|
-
|
|
15955
|
-
if (
|
|
15954
|
+
var _a;
|
|
15955
|
+
if (!(newMap == null ? void 0 : newMap.has(key))) {
|
|
15956
15956
|
map2.delete(key);
|
|
15957
15957
|
onDeleteValue(existingValue, key);
|
|
15958
15958
|
} else if (onExistingValue) {
|
|
15959
|
-
onExistingValue(existingValue,
|
|
15959
|
+
onExistingValue(existingValue, (_a = newMap.get) == null ? void 0 : _a.call(newMap, key), key);
|
|
15960
15960
|
}
|
|
15961
15961
|
});
|
|
15962
15962
|
}
|
|
15963
15963
|
function mutateMap(map2, newMap, options) {
|
|
15964
15964
|
mutateMapSkippingNewValues(map2, newMap, options);
|
|
15965
15965
|
const { createNewValue } = options;
|
|
15966
|
-
newMap.forEach((valueInNewMap, key) => {
|
|
15966
|
+
newMap == null ? void 0 : newMap.forEach((valueInNewMap, key) => {
|
|
15967
15967
|
if (!map2.has(key)) {
|
|
15968
15968
|
map2.set(key, createNewValue(key, valueInNewMap));
|
|
15969
15969
|
}
|
|
@@ -31214,8 +31214,9 @@ var Parser;
|
|
|
31214
31214
|
function nextTokenIsStringLiteral() {
|
|
31215
31215
|
return nextToken() === 11 /* StringLiteral */;
|
|
31216
31216
|
}
|
|
31217
|
-
function
|
|
31218
|
-
|
|
31217
|
+
function nextTokenIsFromKeywordOrEqualsToken() {
|
|
31218
|
+
nextToken();
|
|
31219
|
+
return token() === 161 /* FromKeyword */ || token() === 64 /* EqualsToken */;
|
|
31219
31220
|
}
|
|
31220
31221
|
function nextTokenIsIdentifierOrStringLiteralOnSameLine() {
|
|
31221
31222
|
nextToken();
|
|
@@ -31912,7 +31913,7 @@ var Parser;
|
|
|
31912
31913
|
identifier = parseIdentifier();
|
|
31913
31914
|
}
|
|
31914
31915
|
let isTypeOnly = false;
|
|
31915
|
-
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(
|
|
31916
|
+
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(nextTokenIsFromKeywordOrEqualsToken)) && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) {
|
|
31916
31917
|
isTypeOnly = true;
|
|
31917
31918
|
identifier = isIdentifier2() ? parseIdentifier() : void 0;
|
|
31918
31919
|
}
|
|
@@ -36783,34 +36784,39 @@ function specToDiagnostic(spec, disallowTrailingRecursion) {
|
|
|
36783
36784
|
return [Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
|
|
36784
36785
|
}
|
|
36785
36786
|
}
|
|
36786
|
-
function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude },
|
|
36787
|
-
const rawExcludeRegex = getRegularExpressionForWildcard(exclude,
|
|
36787
|
+
function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, basePath, useCaseSensitiveFileNames2) {
|
|
36788
|
+
const rawExcludeRegex = getRegularExpressionForWildcard(exclude, basePath, "exclude");
|
|
36788
36789
|
const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames2 ? "" : "i");
|
|
36789
36790
|
const wildcardDirectories = {};
|
|
36791
|
+
const wildCardKeyToPath = /* @__PURE__ */ new Map();
|
|
36790
36792
|
if (include !== void 0) {
|
|
36791
36793
|
const recursiveKeys = [];
|
|
36792
36794
|
for (const file of include) {
|
|
36793
|
-
const spec = normalizePath(combinePaths(
|
|
36795
|
+
const spec = normalizePath(combinePaths(basePath, file));
|
|
36794
36796
|
if (excludeRegex && excludeRegex.test(spec)) {
|
|
36795
36797
|
continue;
|
|
36796
36798
|
}
|
|
36797
36799
|
const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
|
|
36798
36800
|
if (match) {
|
|
36799
|
-
const { key, flags } = match;
|
|
36800
|
-
const
|
|
36801
|
+
const { key, path, flags } = match;
|
|
36802
|
+
const existingPath = wildCardKeyToPath.get(key);
|
|
36803
|
+
const existingFlags = existingPath !== void 0 ? wildcardDirectories[existingPath] : void 0;
|
|
36801
36804
|
if (existingFlags === void 0 || existingFlags < flags) {
|
|
36802
|
-
wildcardDirectories[
|
|
36805
|
+
wildcardDirectories[existingPath !== void 0 ? existingPath : path] = flags;
|
|
36806
|
+
if (existingPath === void 0)
|
|
36807
|
+
wildCardKeyToPath.set(key, path);
|
|
36803
36808
|
if (flags === 1 /* Recursive */) {
|
|
36804
36809
|
recursiveKeys.push(key);
|
|
36805
36810
|
}
|
|
36806
36811
|
}
|
|
36807
36812
|
}
|
|
36808
36813
|
}
|
|
36809
|
-
for (const
|
|
36810
|
-
if (hasProperty(wildcardDirectories,
|
|
36814
|
+
for (const path in wildcardDirectories) {
|
|
36815
|
+
if (hasProperty(wildcardDirectories, path)) {
|
|
36811
36816
|
for (const recursiveKey of recursiveKeys) {
|
|
36812
|
-
|
|
36813
|
-
|
|
36817
|
+
const key = toCanonicalKey(path, useCaseSensitiveFileNames2);
|
|
36818
|
+
if (key !== recursiveKey && containsPath(recursiveKey, key, basePath, !useCaseSensitiveFileNames2)) {
|
|
36819
|
+
delete wildcardDirectories[path];
|
|
36814
36820
|
}
|
|
36815
36821
|
}
|
|
36816
36822
|
}
|
|
@@ -36818,6 +36824,9 @@ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExclu
|
|
|
36818
36824
|
}
|
|
36819
36825
|
return wildcardDirectories;
|
|
36820
36826
|
}
|
|
36827
|
+
function toCanonicalKey(path, useCaseSensitiveFileNames2) {
|
|
36828
|
+
return useCaseSensitiveFileNames2 ? path : toFileNameLowerCase(path);
|
|
36829
|
+
}
|
|
36821
36830
|
function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
|
|
36822
36831
|
const match = wildcardDirectoryPattern.exec(spec);
|
|
36823
36832
|
if (match) {
|
|
@@ -36825,13 +36834,16 @@ function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
|
|
|
36825
36834
|
const starWildcardIndex = spec.indexOf("*");
|
|
36826
36835
|
const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator);
|
|
36827
36836
|
return {
|
|
36828
|
-
key:
|
|
36837
|
+
key: toCanonicalKey(match[0], useCaseSensitiveFileNames2),
|
|
36838
|
+
path: match[0],
|
|
36829
36839
|
flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 /* Recursive */ : 0 /* None */
|
|
36830
36840
|
};
|
|
36831
36841
|
}
|
|
36832
36842
|
if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) {
|
|
36843
|
+
const path = removeTrailingDirectorySeparator(spec);
|
|
36833
36844
|
return {
|
|
36834
|
-
key:
|
|
36845
|
+
key: toCanonicalKey(path, useCaseSensitiveFileNames2),
|
|
36846
|
+
path,
|
|
36835
36847
|
flags: 1 /* Recursive */
|
|
36836
36848
|
};
|
|
36837
36849
|
}
|
|
@@ -37409,6 +37421,9 @@ function getAutomaticTypeDirectiveNames(options, host) {
|
|
|
37409
37421
|
}
|
|
37410
37422
|
return result;
|
|
37411
37423
|
}
|
|
37424
|
+
function isPackageJsonInfo(entry) {
|
|
37425
|
+
return !!(entry == null ? void 0 : entry.contents);
|
|
37426
|
+
}
|
|
37412
37427
|
function compilerOptionValueToString(value) {
|
|
37413
37428
|
var _a;
|
|
37414
37429
|
if (value === null || typeof value !== "object") {
|
|
@@ -37513,7 +37528,7 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
|
|
|
37513
37528
|
}
|
|
37514
37529
|
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
37515
37530
|
let cache;
|
|
37516
|
-
return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2,
|
|
37531
|
+
return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2, getInternalMap };
|
|
37517
37532
|
function getPackageJsonInfo2(packageJsonPath) {
|
|
37518
37533
|
return cache == null ? void 0 : cache.get(toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
|
|
37519
37534
|
}
|
|
@@ -37523,10 +37538,6 @@ function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
|
37523
37538
|
function clear2() {
|
|
37524
37539
|
cache = void 0;
|
|
37525
37540
|
}
|
|
37526
|
-
function entries() {
|
|
37527
|
-
const iter = cache == null ? void 0 : cache.entries();
|
|
37528
|
-
return iter ? arrayFrom(iter) : [];
|
|
37529
|
-
}
|
|
37530
37541
|
function getInternalMap() {
|
|
37531
37542
|
return cache;
|
|
37532
37543
|
}
|
|
@@ -38406,13 +38417,13 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
38406
38417
|
}
|
|
38407
38418
|
const existing = (_b = state.packageJsonInfoCache) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
38408
38419
|
if (existing !== void 0) {
|
|
38409
|
-
if (
|
|
38420
|
+
if (isPackageJsonInfo(existing)) {
|
|
38410
38421
|
if (traceEnabled)
|
|
38411
38422
|
trace(host, Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
|
|
38412
38423
|
(_c = state.affectingLocations) == null ? void 0 : _c.push(packageJsonPath);
|
|
38413
38424
|
return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents };
|
|
38414
38425
|
} else {
|
|
38415
|
-
if (existing && traceEnabled)
|
|
38426
|
+
if (existing.directoryExists && traceEnabled)
|
|
38416
38427
|
trace(host, Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath);
|
|
38417
38428
|
(_d = state.failedLookupLocations) == null ? void 0 : _d.push(packageJsonPath);
|
|
38418
38429
|
return void 0;
|
|
@@ -38434,7 +38445,7 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
38434
38445
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
38435
38446
|
}
|
|
38436
38447
|
if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
|
|
38437
|
-
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, directoryExists);
|
|
38448
|
+
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, { packageDirectory, directoryExists });
|
|
38438
38449
|
(_f = state.failedLookupLocations) == null ? void 0 : _f.push(packageJsonPath);
|
|
38439
38450
|
}
|
|
38440
38451
|
}
|
|
@@ -42407,7 +42418,7 @@ function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourc
|
|
|
42407
42418
|
}
|
|
42408
42419
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, preferences, userPreferences, options = {}) {
|
|
42409
42420
|
const info = getInfo(importingSourceFileName, host);
|
|
42410
|
-
const modulePaths = getAllModulePaths(
|
|
42421
|
+
const modulePaths = getAllModulePaths(info, toFileName2, host, userPreferences, options);
|
|
42411
42422
|
return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
|
|
42412
42423
|
modulePath,
|
|
42413
42424
|
info,
|
|
@@ -42460,7 +42471,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
42460
42471
|
if (!moduleSourceFile)
|
|
42461
42472
|
return { moduleSpecifiers: emptyArray, computedWithoutCache };
|
|
42462
42473
|
computedWithoutCache = true;
|
|
42463
|
-
modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.
|
|
42474
|
+
modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host));
|
|
42464
42475
|
const result = computeModuleSpecifiers(
|
|
42465
42476
|
modulePaths,
|
|
42466
42477
|
compilerOptions,
|
|
@@ -42474,7 +42485,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
42474
42485
|
return { moduleSpecifiers: result, computedWithoutCache };
|
|
42475
42486
|
}
|
|
42476
42487
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
42477
|
-
const info = getInfo(importingSourceFile.
|
|
42488
|
+
const info = getInfo(importingSourceFile.fileName, host);
|
|
42478
42489
|
const preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
42479
42490
|
const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
|
|
42480
42491
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
@@ -42538,16 +42549,22 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
42538
42549
|
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);
|
|
42539
42550
|
}
|
|
42540
42551
|
function getInfo(importingSourceFileName, host) {
|
|
42552
|
+
importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
|
|
42541
42553
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : true);
|
|
42542
42554
|
const sourceDirectory = getDirectoryPath(importingSourceFileName);
|
|
42543
|
-
return {
|
|
42555
|
+
return {
|
|
42556
|
+
getCanonicalFileName,
|
|
42557
|
+
importingSourceFileName,
|
|
42558
|
+
sourceDirectory,
|
|
42559
|
+
canonicalSourceDirectory: getCanonicalFileName(sourceDirectory)
|
|
42560
|
+
};
|
|
42544
42561
|
}
|
|
42545
42562
|
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference }, pathsOnly) {
|
|
42546
42563
|
const { baseUrl, paths, rootDirs } = compilerOptions;
|
|
42547
42564
|
if (pathsOnly && !paths) {
|
|
42548
42565
|
return void 0;
|
|
42549
42566
|
}
|
|
42550
|
-
const { sourceDirectory, getCanonicalFileName } = info;
|
|
42567
|
+
const { sourceDirectory, canonicalSourceDirectory, getCanonicalFileName } = info;
|
|
42551
42568
|
const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
|
|
42552
42569
|
const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
|
|
42553
42570
|
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
|
|
@@ -42572,7 +42589,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
42572
42589
|
if (relativePreference === 3 /* ExternalNonRelative */ && !pathIsRelative(maybeNonRelative)) {
|
|
42573
42590
|
const projectDirectory = compilerOptions.configFilePath ? toPath(getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory());
|
|
42574
42591
|
const modulePath = toPath(moduleFileName, projectDirectory, getCanonicalFileName);
|
|
42575
|
-
const sourceIsInternal = startsWith(
|
|
42592
|
+
const sourceIsInternal = startsWith(canonicalSourceDirectory, projectDirectory);
|
|
42576
42593
|
const targetIsInternal = startsWith(modulePath, projectDirectory);
|
|
42577
42594
|
if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
|
|
42578
42595
|
return maybeNonRelative;
|
|
@@ -42645,8 +42662,9 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
|
|
|
42645
42662
|
});
|
|
42646
42663
|
return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
|
|
42647
42664
|
}
|
|
42648
|
-
function getAllModulePaths(
|
|
42665
|
+
function getAllModulePaths(info, importedFileName, host, preferences, options = {}) {
|
|
42649
42666
|
var _a;
|
|
42667
|
+
const importingFilePath = toPath(info.importingSourceFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
42650
42668
|
const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
42651
42669
|
const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
|
|
42652
42670
|
if (cache) {
|
|
@@ -42654,30 +42672,29 @@ function getAllModulePaths(importingFilePath, importedFileName, host, preference
|
|
|
42654
42672
|
if (cached == null ? void 0 : cached.modulePaths)
|
|
42655
42673
|
return cached.modulePaths;
|
|
42656
42674
|
}
|
|
42657
|
-
const modulePaths = getAllModulePathsWorker(
|
|
42675
|
+
const modulePaths = getAllModulePathsWorker(info, importedFileName, host);
|
|
42658
42676
|
if (cache) {
|
|
42659
42677
|
cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
|
|
42660
42678
|
}
|
|
42661
42679
|
return modulePaths;
|
|
42662
42680
|
}
|
|
42663
|
-
function getAllModulePathsWorker(
|
|
42664
|
-
const getCanonicalFileName = hostGetCanonicalFileName(host);
|
|
42681
|
+
function getAllModulePathsWorker(info, importedFileName, host) {
|
|
42665
42682
|
const allFileNames = /* @__PURE__ */ new Map();
|
|
42666
42683
|
let importedFileFromNodeModules = false;
|
|
42667
42684
|
forEachFileNameOfModule(
|
|
42668
|
-
|
|
42685
|
+
info.importingSourceFileName,
|
|
42669
42686
|
importedFileName,
|
|
42670
42687
|
host,
|
|
42671
42688
|
/*preferSymlinks*/
|
|
42672
42689
|
true,
|
|
42673
42690
|
(path, isRedirect) => {
|
|
42674
42691
|
const isInNodeModules = pathContainsNodeModules(path);
|
|
42675
|
-
allFileNames.set(path, { path: getCanonicalFileName(path), isRedirect, isInNodeModules });
|
|
42692
|
+
allFileNames.set(path, { path: info.getCanonicalFileName(path), isRedirect, isInNodeModules });
|
|
42676
42693
|
importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules;
|
|
42677
42694
|
}
|
|
42678
42695
|
);
|
|
42679
42696
|
const sortedPaths = [];
|
|
42680
|
-
for (let directory =
|
|
42697
|
+
for (let directory = info.canonicalSourceDirectory; allFileNames.size !== 0; ) {
|
|
42681
42698
|
const directoryStart = ensureTrailingDirectorySeparator(directory);
|
|
42682
42699
|
let pathsInDirectory;
|
|
42683
42700
|
allFileNames.forEach(({ path, isRedirect, isInNodeModules }, fileName) => {
|
|
@@ -42698,7 +42715,10 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
|
|
|
42698
42715
|
directory = newDirectory;
|
|
42699
42716
|
}
|
|
42700
42717
|
if (allFileNames.size) {
|
|
42701
|
-
const remainingPaths = arrayFrom(
|
|
42718
|
+
const remainingPaths = arrayFrom(
|
|
42719
|
+
allFileNames.entries(),
|
|
42720
|
+
([fileName, { isRedirect, isInNodeModules }]) => ({ path: fileName, isRedirect, isInNodeModules })
|
|
42721
|
+
);
|
|
42702
42722
|
if (remainingPaths.length > 1)
|
|
42703
42723
|
remainingPaths.sort(comparePathsByRedirectAndNumberOfDirectorySeparators);
|
|
42704
42724
|
sortedPaths.push(...remainingPaths);
|
|
@@ -42858,7 +42878,7 @@ function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory,
|
|
|
42858
42878
|
}
|
|
42859
42879
|
return processEnding(shortest, allowedEndings, compilerOptions);
|
|
42860
42880
|
}
|
|
42861
|
-
function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileName,
|
|
42881
|
+
function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileName, canonicalSourceDirectory }, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
42862
42882
|
if (!host.fileExists || !host.readFile) {
|
|
42863
42883
|
return void 0;
|
|
42864
42884
|
}
|
|
@@ -42902,7 +42922,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
42902
42922
|
}
|
|
42903
42923
|
const globalTypingsCacheLocation = host.getGlobalTypingsCacheLocation && host.getGlobalTypingsCacheLocation();
|
|
42904
42924
|
const pathToTopLevelNodeModules = getCanonicalFileName(moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex));
|
|
42905
|
-
if (!(startsWith(
|
|
42925
|
+
if (!(startsWith(canonicalSourceDirectory, pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
|
|
42906
42926
|
return void 0;
|
|
42907
42927
|
}
|
|
42908
42928
|
const nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
|
|
@@ -42915,7 +42935,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
42915
42935
|
let moduleFileToTry = path;
|
|
42916
42936
|
let maybeBlockedByTypesVersions = false;
|
|
42917
42937
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
42918
|
-
if (
|
|
42938
|
+
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
42919
42939
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
42920
42940
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
42921
42941
|
if (getResolvePackageJsonExports(options)) {
|
|
@@ -54502,9 +54522,13 @@ function createTypeChecker(host) {
|
|
|
54502
54522
|
function getConstraintOfTypeParameter(typeParameter) {
|
|
54503
54523
|
return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0;
|
|
54504
54524
|
}
|
|
54525
|
+
function isConstMappedType(type, depth) {
|
|
54526
|
+
const typeVariable = getHomomorphicTypeVariable(type);
|
|
54527
|
+
return !!typeVariable && isConstTypeVariable(typeVariable, depth);
|
|
54528
|
+
}
|
|
54505
54529
|
function isConstTypeVariable(type, depth = 0) {
|
|
54506
54530
|
var _a;
|
|
54507
|
-
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));
|
|
54531
|
+
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));
|
|
54508
54532
|
}
|
|
54509
54533
|
function getConstraintOfIndexedAccess(type) {
|
|
54510
54534
|
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
|
|
@@ -107971,8 +107995,8 @@ function transformDeclarations(context) {
|
|
|
107971
107995
|
const specifier = getModuleSpecifier(
|
|
107972
107996
|
options,
|
|
107973
107997
|
currentSourceFile,
|
|
107974
|
-
|
|
107975
|
-
|
|
107998
|
+
getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
|
|
107999
|
+
getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
|
|
107976
108000
|
host
|
|
107977
108001
|
);
|
|
107978
108002
|
if (!pathIsRelative(specifier)) {
|
|
@@ -115398,8 +115422,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
115398
115422
|
}
|
|
115399
115423
|
const baseName = getBaseNameOfFileName(fileOrDirectory);
|
|
115400
115424
|
const fsQueryResult = {
|
|
115401
|
-
fileExists: host.fileExists(
|
|
115402
|
-
directoryExists: host.directoryExists(
|
|
115425
|
+
fileExists: host.fileExists(fileOrDirectory),
|
|
115426
|
+
directoryExists: host.directoryExists(fileOrDirectory)
|
|
115403
115427
|
};
|
|
115404
115428
|
if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
|
|
115405
115429
|
clearCache();
|
|
@@ -115482,11 +115506,9 @@ function cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, t
|
|
|
115482
115506
|
});
|
|
115483
115507
|
}
|
|
115484
115508
|
function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) {
|
|
115485
|
-
const missingFilePaths = program.getMissingFilePaths();
|
|
115486
|
-
const newMissingFilePathMap = arrayToMap(missingFilePaths, identity, returnTrue);
|
|
115487
115509
|
mutateMap(
|
|
115488
115510
|
missingFileWatches,
|
|
115489
|
-
|
|
115511
|
+
program.getMissingFilePaths(),
|
|
115490
115512
|
{
|
|
115491
115513
|
// Watch the missing files
|
|
115492
115514
|
createNewValue: createMissingFileWatch,
|
|
@@ -115497,18 +115519,22 @@ function updateMissingFilePathsWatch(program, missingFileWatches, createMissingF
|
|
|
115497
115519
|
);
|
|
115498
115520
|
}
|
|
115499
115521
|
function updateWatchingWildcardDirectories(existingWatchedForWildcards, wildcardDirectories, watchDirectory) {
|
|
115500
|
-
|
|
115501
|
-
|
|
115502
|
-
|
|
115503
|
-
|
|
115504
|
-
|
|
115505
|
-
|
|
115506
|
-
|
|
115507
|
-
|
|
115508
|
-
|
|
115509
|
-
|
|
115510
|
-
|
|
115511
|
-
|
|
115522
|
+
if (wildcardDirectories) {
|
|
115523
|
+
mutateMap(
|
|
115524
|
+
existingWatchedForWildcards,
|
|
115525
|
+
new Map(Object.entries(wildcardDirectories)),
|
|
115526
|
+
{
|
|
115527
|
+
// Create new watch and recursive info
|
|
115528
|
+
createNewValue: createWildcardDirectoryWatcher,
|
|
115529
|
+
// Close existing watch thats not needed any more
|
|
115530
|
+
onDeleteValue: closeFileWatcherOf,
|
|
115531
|
+
// Close existing watch that doesnt match in the flags
|
|
115532
|
+
onExistingValue: updateWildcardDirectoryWatcher
|
|
115533
|
+
}
|
|
115534
|
+
);
|
|
115535
|
+
} else {
|
|
115536
|
+
clearMap(existingWatchedForWildcards, closeFileWatcherOf);
|
|
115537
|
+
}
|
|
115512
115538
|
function createWildcardDirectoryWatcher(directory, flags) {
|
|
115513
115539
|
return {
|
|
115514
115540
|
watcher: watchDirectory(directory, flags),
|
|
@@ -116313,7 +116339,8 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
|
|
|
116313
116339
|
return false;
|
|
116314
116340
|
if (program.getSourceFiles().some(sourceFileNotUptoDate))
|
|
116315
116341
|
return false;
|
|
116316
|
-
|
|
116342
|
+
const missingPaths = program.getMissingFilePaths();
|
|
116343
|
+
if (missingPaths && forEachEntry(missingPaths, fileExists))
|
|
116317
116344
|
return false;
|
|
116318
116345
|
const currentOptions = program.getCompilerOptions();
|
|
116319
116346
|
if (!compareDataObjects(currentOptions, newOptions))
|
|
@@ -116613,7 +116640,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116613
116640
|
let redirectTargetsMap = createMultiMap();
|
|
116614
116641
|
let usesUriStyleNodeCoreModules = false;
|
|
116615
116642
|
const filesByName = /* @__PURE__ */ new Map();
|
|
116616
|
-
let
|
|
116643
|
+
let missingFileNames = /* @__PURE__ */ new Map();
|
|
116617
116644
|
const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
|
|
116618
116645
|
let resolvedProjectReferences;
|
|
116619
116646
|
let projectReferenceRedirects;
|
|
@@ -116732,12 +116759,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116732
116759
|
});
|
|
116733
116760
|
}
|
|
116734
116761
|
}
|
|
116735
|
-
missingFilePaths = arrayFrom(mapDefinedIterator(filesByName.entries(), ([path, file]) => file === void 0 ? path : void 0));
|
|
116736
116762
|
files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
|
|
116737
116763
|
processingDefaultLibFiles = void 0;
|
|
116738
116764
|
processingOtherFiles = void 0;
|
|
116739
116765
|
}
|
|
116740
|
-
Debug.assert(!!missingFilePaths);
|
|
116741
116766
|
if (oldProgram && host.onReleaseOldSourceFile) {
|
|
116742
116767
|
const oldSourceFiles = oldProgram.getSourceFiles();
|
|
116743
116768
|
for (const oldSourceFile of oldSourceFiles) {
|
|
@@ -116782,8 +116807,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
116782
116807
|
getSourceFile,
|
|
116783
116808
|
getSourceFileByPath,
|
|
116784
116809
|
getSourceFiles: () => files,
|
|
116785
|
-
getMissingFilePaths: () =>
|
|
116786
|
-
// TODO: GH#18217
|
|
116810
|
+
getMissingFilePaths: () => missingFileNames,
|
|
116787
116811
|
getModuleResolutionCache: () => moduleResolutionCache,
|
|
116788
116812
|
getFilesByNameMap: () => filesByName,
|
|
116789
116813
|
getCompilerOptions: () => options,
|
|
@@ -117210,7 +117234,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117210
117234
|
const newSourceFiles = [];
|
|
117211
117235
|
const modifiedSourceFiles = [];
|
|
117212
117236
|
structureIsReused = 2 /* Completely */;
|
|
117213
|
-
if (oldProgram.getMissingFilePaths()
|
|
117237
|
+
if (forEachEntry(oldProgram.getMissingFilePaths(), (missingFileName) => host.fileExists(missingFileName))) {
|
|
117214
117238
|
return 0 /* Not */;
|
|
117215
117239
|
}
|
|
117216
117240
|
const oldSourceFiles = oldProgram.getSourceFiles();
|
|
@@ -117350,7 +117374,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117350
117374
|
if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
117351
117375
|
return 1 /* SafeModules */;
|
|
117352
117376
|
}
|
|
117353
|
-
|
|
117377
|
+
missingFileNames = oldProgram.getMissingFilePaths();
|
|
117354
117378
|
Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
117355
117379
|
for (const newSourceFile of newSourceFiles) {
|
|
117356
117380
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
@@ -117407,7 +117431,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117407
117431
|
const path = toPath3(f);
|
|
117408
117432
|
if (getSourceFileByPath(path))
|
|
117409
117433
|
return true;
|
|
117410
|
-
if (
|
|
117434
|
+
if (missingFileNames.has(path))
|
|
117411
117435
|
return false;
|
|
117412
117436
|
return host.fileExists(f);
|
|
117413
117437
|
},
|
|
@@ -118219,6 +118243,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118219
118243
|
addFileToFilesByName(
|
|
118220
118244
|
file2,
|
|
118221
118245
|
path,
|
|
118246
|
+
fileName,
|
|
118222
118247
|
/*redirectedPath*/
|
|
118223
118248
|
void 0
|
|
118224
118249
|
);
|
|
@@ -118291,7 +118316,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118291
118316
|
if (fileFromPackageId) {
|
|
118292
118317
|
const dupFile = createRedirectedSourceFile(fileFromPackageId, file, fileName, path, toPath3(fileName), originalFileName, sourceFileOptions);
|
|
118293
118318
|
redirectTargetsMap.add(fileFromPackageId.path, fileName);
|
|
118294
|
-
addFileToFilesByName(dupFile, path, redirectedPath);
|
|
118319
|
+
addFileToFilesByName(dupFile, path, fileName, redirectedPath);
|
|
118295
118320
|
addFileIncludeReason(dupFile, reason);
|
|
118296
118321
|
sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
|
|
118297
118322
|
processingOtherFiles.push(dupFile);
|
|
@@ -118301,7 +118326,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118301
118326
|
sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
|
|
118302
118327
|
}
|
|
118303
118328
|
}
|
|
118304
|
-
addFileToFilesByName(file, path, redirectedPath);
|
|
118329
|
+
addFileToFilesByName(file, path, fileName, redirectedPath);
|
|
118305
118330
|
if (file) {
|
|
118306
118331
|
sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
|
|
118307
118332
|
file.fileName = fileName;
|
|
@@ -118341,14 +118366,21 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118341
118366
|
if (file)
|
|
118342
118367
|
fileReasons.add(file.path, reason);
|
|
118343
118368
|
}
|
|
118344
|
-
function addFileToFilesByName(file, path, redirectedPath) {
|
|
118369
|
+
function addFileToFilesByName(file, path, fileName, redirectedPath) {
|
|
118345
118370
|
if (redirectedPath) {
|
|
118346
|
-
|
|
118347
|
-
|
|
118371
|
+
updateFilesByNameMap(fileName, redirectedPath, file);
|
|
118372
|
+
updateFilesByNameMap(fileName, path, file || false);
|
|
118348
118373
|
} else {
|
|
118349
|
-
|
|
118374
|
+
updateFilesByNameMap(fileName, path, file);
|
|
118350
118375
|
}
|
|
118351
118376
|
}
|
|
118377
|
+
function updateFilesByNameMap(fileName, path, file) {
|
|
118378
|
+
filesByName.set(path, file);
|
|
118379
|
+
if (file !== void 0)
|
|
118380
|
+
missingFileNames.delete(path);
|
|
118381
|
+
else
|
|
118382
|
+
missingFileNames.set(path, fileName);
|
|
118383
|
+
}
|
|
118352
118384
|
function getProjectReferenceRedirect(fileName) {
|
|
118353
118385
|
const referencedProject = getProjectReferenceRedirectProject(fileName);
|
|
118354
118386
|
return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
|
|
@@ -118669,6 +118701,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118669
118701
|
/*file*/
|
|
118670
118702
|
void 0,
|
|
118671
118703
|
sourceFilePath,
|
|
118704
|
+
refPath,
|
|
118672
118705
|
/*redirectedPath*/
|
|
118673
118706
|
void 0
|
|
118674
118707
|
);
|
|
@@ -118680,6 +118713,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118680
118713
|
addFileToFilesByName(
|
|
118681
118714
|
sourceFile,
|
|
118682
118715
|
sourceFilePath,
|
|
118716
|
+
refPath,
|
|
118683
118717
|
/*redirectedPath*/
|
|
118684
118718
|
void 0
|
|
118685
118719
|
);
|
|
@@ -118689,6 +118723,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118689
118723
|
addFileToFilesByName(
|
|
118690
118724
|
sourceFile,
|
|
118691
118725
|
sourceFilePath,
|
|
118726
|
+
refPath,
|
|
118692
118727
|
/*redirectedPath*/
|
|
118693
118728
|
void 0
|
|
118694
118729
|
);
|
|
@@ -122474,8 +122509,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122474
122509
|
function closeTypeRootsWatch() {
|
|
122475
122510
|
clearMap(typeRootsWatches, closeFileWatcher);
|
|
122476
122511
|
}
|
|
122477
|
-
function createTypeRootsWatch(
|
|
122478
|
-
return canWatchTypeRootPath(
|
|
122512
|
+
function createTypeRootsWatch(typeRoot) {
|
|
122513
|
+
return canWatchTypeRootPath(typeRoot) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
122479
122514
|
const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
|
|
122480
122515
|
if (cachedDirectoryStructureHost) {
|
|
122481
122516
|
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
@@ -122484,7 +122519,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122484
122519
|
resolutionHost.onChangedAutomaticTypeDirectiveNames();
|
|
122485
122520
|
const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(
|
|
122486
122521
|
typeRoot,
|
|
122487
|
-
|
|
122522
|
+
resolutionHost.toPath(typeRoot),
|
|
122488
122523
|
rootPath,
|
|
122489
122524
|
rootPathComponents,
|
|
122490
122525
|
getCurrentDirectory,
|
|
@@ -122505,7 +122540,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122505
122540
|
if (typeRoots) {
|
|
122506
122541
|
mutateMap(
|
|
122507
122542
|
typeRootsWatches,
|
|
122508
|
-
|
|
122543
|
+
new Set(typeRoots),
|
|
122509
122544
|
{
|
|
122510
122545
|
createNewValue: createTypeRootsWatch,
|
|
122511
122546
|
onDeleteValue: closeFileWatcher
|
|
@@ -123434,7 +123469,11 @@ function createWatchProgram(host) {
|
|
|
123434
123469
|
const oldProgram = getCurrentProgram();
|
|
123435
123470
|
builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
123436
123471
|
resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
|
|
123437
|
-
updateMissingFilePathsWatch(
|
|
123472
|
+
updateMissingFilePathsWatch(
|
|
123473
|
+
builderProgram.getProgram(),
|
|
123474
|
+
missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()),
|
|
123475
|
+
watchMissingFilePath
|
|
123476
|
+
);
|
|
123438
123477
|
if (needsUpdateInTypeRootWatch) {
|
|
123439
123478
|
resolutionCache.updateTypeRootsWatch();
|
|
123440
123479
|
}
|
|
@@ -123727,8 +123766,15 @@ function createWatchProgram(host) {
|
|
|
123727
123766
|
cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
|
|
123728
123767
|
}
|
|
123729
123768
|
}
|
|
123730
|
-
function watchMissingFilePath(missingFilePath) {
|
|
123731
|
-
return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
|
|
123769
|
+
function watchMissingFilePath(missingFilePath, missingFileName) {
|
|
123770
|
+
return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
|
|
123771
|
+
missingFilePath,
|
|
123772
|
+
missingFileName,
|
|
123773
|
+
onMissingFileChange,
|
|
123774
|
+
500 /* Medium */,
|
|
123775
|
+
watchOptions,
|
|
123776
|
+
WatchType.MissingFile
|
|
123777
|
+
);
|
|
123732
123778
|
}
|
|
123733
123779
|
function onMissingFileChange(fileName, eventKind, missingFilePath) {
|
|
123734
123780
|
updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
|
|
@@ -123740,15 +123786,11 @@ function createWatchProgram(host) {
|
|
|
123740
123786
|
}
|
|
123741
123787
|
}
|
|
123742
123788
|
function watchConfigFileWildCardDirectories() {
|
|
123743
|
-
|
|
123744
|
-
|
|
123745
|
-
|
|
123746
|
-
|
|
123747
|
-
|
|
123748
|
-
);
|
|
123749
|
-
} else if (watchedWildcardDirectories) {
|
|
123750
|
-
clearMap(watchedWildcardDirectories, closeFileWatcherOf);
|
|
123751
|
-
}
|
|
123789
|
+
updateWatchingWildcardDirectories(
|
|
123790
|
+
watchedWildcardDirectories || (watchedWildcardDirectories = /* @__PURE__ */ new Map()),
|
|
123791
|
+
wildcardDirectories,
|
|
123792
|
+
watchWildcardDirectory
|
|
123793
|
+
);
|
|
123752
123794
|
}
|
|
123753
123795
|
function watchWildcardDirectory(directory, flags) {
|
|
123754
123796
|
return watchDirectory(
|
|
@@ -123820,7 +123862,7 @@ function createWatchProgram(host) {
|
|
|
123820
123862
|
);
|
|
123821
123863
|
}
|
|
123822
123864
|
function watchReferencedProject(configFileName2, configPath, commandLine) {
|
|
123823
|
-
var _a, _b, _c, _d
|
|
123865
|
+
var _a, _b, _c, _d;
|
|
123824
123866
|
commandLine.watcher || (commandLine.watcher = watchFile2(
|
|
123825
123867
|
configFileName2,
|
|
123826
123868
|
(_fileName, eventKind) => {
|
|
@@ -123835,55 +123877,50 @@ function createWatchProgram(host) {
|
|
|
123835
123877
|
((_a = commandLine.parsedCommandLine) == null ? void 0 : _a.watchOptions) || watchOptions,
|
|
123836
123878
|
WatchType.ConfigFileOfReferencedProject
|
|
123837
123879
|
));
|
|
123838
|
-
|
|
123839
|
-
|
|
123840
|
-
|
|
123841
|
-
|
|
123842
|
-
|
|
123843
|
-
|
|
123844
|
-
|
|
123845
|
-
|
|
123846
|
-
(fileOrDirectory)
|
|
123847
|
-
|
|
123848
|
-
|
|
123849
|
-
|
|
123850
|
-
|
|
123851
|
-
|
|
123852
|
-
|
|
123853
|
-
|
|
123854
|
-
|
|
123855
|
-
|
|
123856
|
-
|
|
123857
|
-
|
|
123858
|
-
|
|
123859
|
-
|
|
123860
|
-
|
|
123861
|
-
|
|
123862
|
-
|
|
123863
|
-
|
|
123864
|
-
|
|
123865
|
-
|
|
123866
|
-
|
|
123867
|
-
|
|
123868
|
-
|
|
123869
|
-
|
|
123870
|
-
|
|
123871
|
-
|
|
123872
|
-
|
|
123873
|
-
|
|
123874
|
-
|
|
123875
|
-
|
|
123876
|
-
|
|
123877
|
-
|
|
123878
|
-
);
|
|
123879
|
-
} else if (commandLine.watchedDirectories) {
|
|
123880
|
-
clearMap(commandLine.watchedDirectories, closeFileWatcherOf);
|
|
123881
|
-
commandLine.watchedDirectories = void 0;
|
|
123882
|
-
}
|
|
123880
|
+
updateWatchingWildcardDirectories(
|
|
123881
|
+
commandLine.watchedDirectories || (commandLine.watchedDirectories = /* @__PURE__ */ new Map()),
|
|
123882
|
+
(_b = commandLine.parsedCommandLine) == null ? void 0 : _b.wildcardDirectories,
|
|
123883
|
+
(directory, flags) => {
|
|
123884
|
+
var _a2;
|
|
123885
|
+
return watchDirectory(
|
|
123886
|
+
directory,
|
|
123887
|
+
(fileOrDirectory) => {
|
|
123888
|
+
const fileOrDirectoryPath = toPath3(fileOrDirectory);
|
|
123889
|
+
if (cachedDirectoryStructureHost) {
|
|
123890
|
+
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
123891
|
+
}
|
|
123892
|
+
nextSourceFileVersion(fileOrDirectoryPath);
|
|
123893
|
+
const config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
|
|
123894
|
+
if (!(config == null ? void 0 : config.parsedCommandLine))
|
|
123895
|
+
return;
|
|
123896
|
+
if (isIgnoredFileFromWildCardWatching({
|
|
123897
|
+
watchedDirPath: toPath3(directory),
|
|
123898
|
+
fileOrDirectory,
|
|
123899
|
+
fileOrDirectoryPath,
|
|
123900
|
+
configFileName: configFileName2,
|
|
123901
|
+
options: config.parsedCommandLine.options,
|
|
123902
|
+
program: config.parsedCommandLine.fileNames,
|
|
123903
|
+
currentDirectory,
|
|
123904
|
+
useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
|
|
123905
|
+
writeLog,
|
|
123906
|
+
toPath: toPath3
|
|
123907
|
+
}))
|
|
123908
|
+
return;
|
|
123909
|
+
if (config.updateLevel !== 2 /* Full */) {
|
|
123910
|
+
config.updateLevel = 1 /* RootNamesAndUpdate */;
|
|
123911
|
+
scheduleProgramUpdate();
|
|
123912
|
+
}
|
|
123913
|
+
},
|
|
123914
|
+
flags,
|
|
123915
|
+
((_a2 = commandLine.parsedCommandLine) == null ? void 0 : _a2.watchOptions) || watchOptions,
|
|
123916
|
+
WatchType.WildcardDirectoryOfReferencedProject
|
|
123917
|
+
);
|
|
123918
|
+
}
|
|
123919
|
+
);
|
|
123883
123920
|
updateExtendedConfigFilesWatches(
|
|
123884
123921
|
configPath,
|
|
123885
|
-
(
|
|
123886
|
-
((
|
|
123922
|
+
(_c = commandLine.parsedCommandLine) == null ? void 0 : _c.options,
|
|
123923
|
+
((_d = commandLine.parsedCommandLine) == null ? void 0 : _d.watchOptions) || watchOptions,
|
|
123887
123924
|
WatchType.ExtendedConfigOfReferencedProject
|
|
123888
123925
|
);
|
|
123889
123926
|
}
|
|
@@ -124189,9 +124226,9 @@ function getBuildOrder(state) {
|
|
|
124189
124226
|
function createStateBuildOrder(state) {
|
|
124190
124227
|
const buildOrder = createBuildOrder(state, state.rootNames.map((f) => resolveProjectName(state, f)));
|
|
124191
124228
|
state.resolvedConfigFilePaths.clear();
|
|
124192
|
-
const currentProjects = new
|
|
124229
|
+
const currentProjects = new Set(
|
|
124193
124230
|
getBuildOrderFromAnyBuildOrder(buildOrder).map(
|
|
124194
|
-
(resolved) =>
|
|
124231
|
+
(resolved) => toResolvedConfigFilePath(state, resolved)
|
|
124195
124232
|
)
|
|
124196
124233
|
);
|
|
124197
124234
|
const noopOnDelete = { onDeleteValue: noop };
|
|
@@ -124203,6 +124240,7 @@ function createStateBuildOrder(state) {
|
|
|
124203
124240
|
mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
|
|
124204
124241
|
mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
|
|
124205
124242
|
mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
|
|
124243
|
+
mutateMapSkippingNewValues(state.lastCachedPackageJsonLookups, currentProjects, noopOnDelete);
|
|
124206
124244
|
if (state.watch) {
|
|
124207
124245
|
mutateMapSkippingNewValues(
|
|
124208
124246
|
state.allWatchedConfigFiles,
|
|
@@ -124451,7 +124489,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
|
|
|
124451
124489
|
return withProgramOrUndefined(action) || emptyArray;
|
|
124452
124490
|
}
|
|
124453
124491
|
function createProgram2() {
|
|
124454
|
-
var _a, _b;
|
|
124492
|
+
var _a, _b, _c;
|
|
124455
124493
|
Debug.assert(program === void 0);
|
|
124456
124494
|
if (state.options.dry) {
|
|
124457
124495
|
reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
|
|
@@ -124480,12 +124518,13 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
|
|
|
124480
124518
|
config.projectReferences
|
|
124481
124519
|
);
|
|
124482
124520
|
if (state.watch) {
|
|
124521
|
+
const internalMap = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().getInternalMap();
|
|
124483
124522
|
state.lastCachedPackageJsonLookups.set(
|
|
124484
124523
|
projectPath,
|
|
124485
|
-
|
|
124486
|
-
|
|
124487
|
-
(
|
|
124488
|
-
)
|
|
124524
|
+
internalMap && new Set(arrayFrom(
|
|
124525
|
+
internalMap.values(),
|
|
124526
|
+
(data) => state.host.realpath && (isPackageJsonInfo(data) || data.directoryExists) ? state.host.realpath(combinePaths(data.packageDirectory, "package.json")) : combinePaths(data.packageDirectory, "package.json")
|
|
124527
|
+
))
|
|
124489
124528
|
);
|
|
124490
124529
|
state.builderPrograms.set(projectPath, program);
|
|
124491
124530
|
}
|
|
@@ -125218,9 +125257,10 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
125218
125257
|
const extendedConfigStatus = forEach(project.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName));
|
|
125219
125258
|
if (extendedConfigStatus)
|
|
125220
125259
|
return extendedConfigStatus;
|
|
125221
|
-
const
|
|
125222
|
-
|
|
125223
|
-
|
|
125260
|
+
const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath);
|
|
125261
|
+
const dependentPackageFileStatus = packageJsonLookups && forEachKey(
|
|
125262
|
+
packageJsonLookups,
|
|
125263
|
+
(path) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
|
|
125224
125264
|
);
|
|
125225
125265
|
if (dependentPackageFileStatus)
|
|
125226
125266
|
return dependentPackageFileStatus;
|
|
@@ -125577,7 +125617,7 @@ function watchWildCardDirectories(state, resolved, resolvedPath, parsed) {
|
|
|
125577
125617
|
return;
|
|
125578
125618
|
updateWatchingWildcardDirectories(
|
|
125579
125619
|
getOrCreateValueMapFromConfigFileMap(state.allWatchedWildcardDirectories, resolvedPath),
|
|
125580
|
-
|
|
125620
|
+
parsed.wildcardDirectories,
|
|
125581
125621
|
(dir, flags) => state.watchDirectory(
|
|
125582
125622
|
dir,
|
|
125583
125623
|
(fileOrDirectory) => {
|
|
@@ -125609,9 +125649,9 @@ function watchInputFiles(state, resolved, resolvedPath, parsed) {
|
|
|
125609
125649
|
return;
|
|
125610
125650
|
mutateMap(
|
|
125611
125651
|
getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath),
|
|
125612
|
-
|
|
125652
|
+
new Set(parsed.fileNames),
|
|
125613
125653
|
{
|
|
125614
|
-
createNewValue: (
|
|
125654
|
+
createNewValue: (input) => watchFile(
|
|
125615
125655
|
state,
|
|
125616
125656
|
input,
|
|
125617
125657
|
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
|
|
@@ -125629,11 +125669,11 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
|
|
|
125629
125669
|
return;
|
|
125630
125670
|
mutateMap(
|
|
125631
125671
|
getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath),
|
|
125632
|
-
|
|
125672
|
+
state.lastCachedPackageJsonLookups.get(resolvedPath),
|
|
125633
125673
|
{
|
|
125634
|
-
createNewValue: (
|
|
125674
|
+
createNewValue: (input) => watchFile(
|
|
125635
125675
|
state,
|
|
125636
|
-
|
|
125676
|
+
input,
|
|
125637
125677
|
() => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
|
|
125638
125678
|
2e3 /* High */,
|
|
125639
125679
|
parsed == null ? void 0 : parsed.watchOptions,
|