@typescript-deploys/pr-build 5.4.0-pr-56476-3 → 5.4.0-pr-56439-8

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 CHANGED
@@ -18120,6 +18120,7 @@ var nextAutoGenerateId = 0;
18120
18120
  var nodeFactoryPatchers = [];
18121
18121
  function createNodeFactory(flags, baseFactory2) {
18122
18122
  const update = flags & 8 /* NoOriginalNode */ ? updateWithoutOriginal : updateWithOriginal;
18123
+ const setOriginal = flags & 8 /* NoOriginalNode */ ? identity : setOriginalNode;
18123
18124
  const parenthesizerRules = memoize(() => flags & 1 /* NoParenthesizerRules */ ? nullParenthesizerRules : createParenthesizerRules(factory2));
18124
18125
  const converters = memoize(() => flags & 2 /* NoNodeConverters */ ? nullNodeConverters : createNodeConverters(factory2));
18125
18126
  const getBinaryCreateFunction = memoizeOne((operator) => (left, right) => createBinaryExpression(left, operator, right));
@@ -21617,7 +21618,7 @@ function createNodeFactory(flags, baseFactory2) {
21617
21618
  }
21618
21619
  function cloneSourceFile(source) {
21619
21620
  const node = source.redirectInfo ? cloneRedirectedSourceFile(source) : cloneSourceFileWorker(source);
21620
- setOriginalNode(node, source);
21621
+ setOriginal(node, source);
21621
21622
  return node;
21622
21623
  }
21623
21624
  function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
@@ -21750,7 +21751,7 @@ function createNodeFactory(flags, baseFactory2) {
21750
21751
  const clone2 = createBaseIdentifier(node.escapedText);
21751
21752
  clone2.flags |= node.flags & ~16 /* Synthesized */;
21752
21753
  clone2.transformFlags = node.transformFlags;
21753
- setOriginalNode(clone2, node);
21754
+ setOriginal(clone2, node);
21754
21755
  setIdentifierAutoGenerate(clone2, { ...node.emitNode.autoGenerate });
21755
21756
  return clone2;
21756
21757
  }
@@ -21761,7 +21762,7 @@ function createNodeFactory(flags, baseFactory2) {
21761
21762
  clone2.flowNode = node.flowNode;
21762
21763
  clone2.symbol = node.symbol;
21763
21764
  clone2.transformFlags = node.transformFlags;
21764
- setOriginalNode(clone2, node);
21765
+ setOriginal(clone2, node);
21765
21766
  const typeArguments = getIdentifierTypeArguments(node);
21766
21767
  if (typeArguments)
21767
21768
  setIdentifierTypeArguments(clone2, typeArguments);
@@ -21771,7 +21772,7 @@ function createNodeFactory(flags, baseFactory2) {
21771
21772
  const clone2 = createBasePrivateIdentifier(node.escapedText);
21772
21773
  clone2.flags |= node.flags & ~16 /* Synthesized */;
21773
21774
  clone2.transformFlags = node.transformFlags;
21774
- setOriginalNode(clone2, node);
21775
+ setOriginal(clone2, node);
21775
21776
  setIdentifierAutoGenerate(clone2, { ...node.emitNode.autoGenerate });
21776
21777
  return clone2;
21777
21778
  }
@@ -21779,7 +21780,7 @@ function createNodeFactory(flags, baseFactory2) {
21779
21780
  const clone2 = createBasePrivateIdentifier(node.escapedText);
21780
21781
  clone2.flags |= node.flags & ~16 /* Synthesized */;
21781
21782
  clone2.transformFlags = node.transformFlags;
21782
- setOriginalNode(clone2, node);
21783
+ setOriginal(clone2, node);
21783
21784
  return clone2;
21784
21785
  }
21785
21786
  function cloneNode(node) {
@@ -21804,7 +21805,7 @@ function createNodeFactory(flags, baseFactory2) {
21804
21805
  const clone2 = !isNodeKind(node.kind) ? baseFactory2.createBaseTokenNode(node.kind) : baseFactory2.createBaseNode(node.kind);
21805
21806
  clone2.flags |= node.flags & ~16 /* Synthesized */;
21806
21807
  clone2.transformFlags = node.transformFlags;
21807
- setOriginalNode(clone2, node);
21808
+ setOriginal(clone2, node);
21808
21809
  for (const key in node) {
21809
21810
  if (hasProperty(clone2, key) || !hasProperty(node, key)) {
21810
21811
  continue;
@@ -22329,7 +22330,7 @@ function createNodeFactory(flags, baseFactory2) {
22329
22330
  return typeof value === "number" ? createToken(value) : value;
22330
22331
  }
22331
22332
  function asEmbeddedStatement(statement) {
22332
- return statement && isNotEmittedStatement(statement) ? setTextRange(setOriginalNode(createEmptyStatement(), statement), statement) : statement;
22333
+ return statement && isNotEmittedStatement(statement) ? setTextRange(setOriginal(createEmptyStatement(), statement), statement) : statement;
22333
22334
  }
22334
22335
  function asVariableDeclaration(variableDeclaration) {
22335
22336
  if (typeof variableDeclaration === "string" || variableDeclaration && !isVariableDeclaration(variableDeclaration)) {
@@ -26897,8 +26898,10 @@ var Parser;
26897
26898
  setTextRangePosWidth(sourceFile, 0, sourceText.length);
26898
26899
  setFields(sourceFile);
26899
26900
  if (!isDeclarationFile && isExternalModule(sourceFile) && sourceFile.transformFlags & 67108864 /* ContainsPossibleTopLevelAwait */) {
26901
+ const oldSourceFile = sourceFile;
26900
26902
  sourceFile = reparseTopLevelAwait(sourceFile);
26901
- setFields(sourceFile);
26903
+ if (oldSourceFile !== sourceFile)
26904
+ setFields(sourceFile);
26902
26905
  }
26903
26906
  return sourceFile;
26904
26907
  function setFields(sourceFile2) {
@@ -36787,39 +36790,34 @@ function specToDiagnostic(spec, disallowTrailingRecursion) {
36787
36790
  return [Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
36788
36791
  }
36789
36792
  }
36790
- function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, basePath, useCaseSensitiveFileNames2) {
36791
- const rawExcludeRegex = getRegularExpressionForWildcard(exclude, basePath, "exclude");
36793
+ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, path, useCaseSensitiveFileNames2) {
36794
+ const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude");
36792
36795
  const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames2 ? "" : "i");
36793
36796
  const wildcardDirectories = {};
36794
- const wildCardKeyToPath = /* @__PURE__ */ new Map();
36795
36797
  if (include !== void 0) {
36796
36798
  const recursiveKeys = [];
36797
36799
  for (const file of include) {
36798
- const spec = normalizePath(combinePaths(basePath, file));
36800
+ const spec = normalizePath(combinePaths(path, file));
36799
36801
  if (excludeRegex && excludeRegex.test(spec)) {
36800
36802
  continue;
36801
36803
  }
36802
36804
  const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
36803
36805
  if (match) {
36804
- const { key, path, flags } = match;
36805
- const existingPath = wildCardKeyToPath.get(key);
36806
- const existingFlags = existingPath !== void 0 ? wildcardDirectories[existingPath] : void 0;
36806
+ const { key, flags } = match;
36807
+ const existingFlags = wildcardDirectories[key];
36807
36808
  if (existingFlags === void 0 || existingFlags < flags) {
36808
- wildcardDirectories[existingPath !== void 0 ? existingPath : path] = flags;
36809
- if (existingPath === void 0)
36810
- wildCardKeyToPath.set(key, path);
36809
+ wildcardDirectories[key] = flags;
36811
36810
  if (flags === 1 /* Recursive */) {
36812
36811
  recursiveKeys.push(key);
36813
36812
  }
36814
36813
  }
36815
36814
  }
36816
36815
  }
36817
- for (const path in wildcardDirectories) {
36818
- if (hasProperty(wildcardDirectories, path)) {
36816
+ for (const key in wildcardDirectories) {
36817
+ if (hasProperty(wildcardDirectories, key)) {
36819
36818
  for (const recursiveKey of recursiveKeys) {
36820
- const key = toCanonicalKey(path, useCaseSensitiveFileNames2);
36821
- if (key !== recursiveKey && containsPath(recursiveKey, key, basePath, !useCaseSensitiveFileNames2)) {
36822
- delete wildcardDirectories[path];
36819
+ if (key !== recursiveKey && containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames2)) {
36820
+ delete wildcardDirectories[key];
36823
36821
  }
36824
36822
  }
36825
36823
  }
@@ -36827,9 +36825,6 @@ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExclu
36827
36825
  }
36828
36826
  return wildcardDirectories;
36829
36827
  }
36830
- function toCanonicalKey(path, useCaseSensitiveFileNames2) {
36831
- return useCaseSensitiveFileNames2 ? path : toFileNameLowerCase(path);
36832
- }
36833
36828
  function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
36834
36829
  const match = wildcardDirectoryPattern.exec(spec);
36835
36830
  if (match) {
@@ -36837,16 +36832,13 @@ function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
36837
36832
  const starWildcardIndex = spec.indexOf("*");
36838
36833
  const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator);
36839
36834
  return {
36840
- key: toCanonicalKey(match[0], useCaseSensitiveFileNames2),
36841
- path: match[0],
36835
+ key: useCaseSensitiveFileNames2 ? match[0] : toFileNameLowerCase(match[0]),
36842
36836
  flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 /* Recursive */ : 0 /* None */
36843
36837
  };
36844
36838
  }
36845
36839
  if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) {
36846
- const path = removeTrailingDirectorySeparator(spec);
36847
36840
  return {
36848
- key: toCanonicalKey(path, useCaseSensitiveFileNames2),
36849
- path,
36841
+ key: removeTrailingDirectorySeparator(useCaseSensitiveFileNames2 ? spec : toFileNameLowerCase(spec)),
36850
36842
  flags: 1 /* Recursive */
36851
36843
  };
36852
36844
  }
@@ -37528,50 +37520,22 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
37528
37520
  }
37529
37521
  function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
37530
37522
  let cache;
37531
- let canonicalPathToCacheKey;
37532
- return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, deletePackageJsonInfo, clear: clear2, entries };
37523
+ return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2, entries, getInternalMap };
37533
37524
  function getPackageJsonInfo2(packageJsonPath) {
37534
- if (!cache)
37535
- return void 0;
37536
- const absolute = getNormalizedAbsolutePath(packageJsonPath, currentDirectory);
37537
- const result = cache.get(absolute);
37538
- if (result !== void 0)
37539
- return result;
37540
- if (!canonicalPathToCacheKey)
37541
- return void 0;
37542
- const path = getCanonicalFileName(absolute);
37543
- if (path === absolute)
37544
- return void 0;
37545
- const cacheKey = canonicalPathToCacheKey.get(path);
37546
- return cacheKey !== void 0 ? cache.get(cacheKey) : void 0;
37525
+ return cache == null ? void 0 : cache.get(toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
37547
37526
  }
37548
37527
  function setPackageJsonInfo(packageJsonPath, info) {
37549
- const absolute = getNormalizedAbsolutePath(packageJsonPath, currentDirectory);
37550
- (cache || (cache = /* @__PURE__ */ new Map())).set(absolute, info);
37551
- const path = getCanonicalFileName(absolute);
37552
- if (path !== absolute) {
37553
- (canonicalPathToCacheKey ?? (canonicalPathToCacheKey = /* @__PURE__ */ new Map())).set(path, absolute);
37554
- }
37555
- }
37556
- function deletePackageJsonInfo(packageJsonPath) {
37557
- if (!cache)
37558
- return;
37559
- const absolute = getNormalizedAbsolutePath(packageJsonPath, currentDirectory);
37560
- cache.delete(absolute);
37561
- if (canonicalPathToCacheKey) {
37562
- const path = getCanonicalFileName(absolute);
37563
- const cacheKey = canonicalPathToCacheKey.get(path);
37564
- if (cacheKey !== void 0) {
37565
- cache.delete(cacheKey);
37566
- canonicalPathToCacheKey.delete(path);
37567
- }
37568
- }
37528
+ (cache || (cache = /* @__PURE__ */ new Map())).set(toPath(packageJsonPath, currentDirectory, getCanonicalFileName), info);
37569
37529
  }
37570
37530
  function clear2() {
37571
37531
  cache = void 0;
37572
37532
  }
37573
37533
  function entries() {
37574
- return cache == null ? void 0 : cache.entries();
37534
+ const iter = cache == null ? void 0 : cache.entries();
37535
+ return iter ? arrayFrom(iter) : [];
37536
+ }
37537
+ function getInternalMap() {
37538
+ return cache;
37575
37539
  }
37576
37540
  }
37577
37541
  function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
@@ -42503,7 +42467,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
42503
42467
  if (!moduleSourceFile)
42504
42468
  return { moduleSpecifiers: emptyArray, computedWithoutCache };
42505
42469
  computedWithoutCache = true;
42506
- modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.fileName, moduleSourceFile.originalFileName, host));
42470
+ modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.path, moduleSourceFile.originalFileName, host));
42507
42471
  const result = computeModuleSpecifiers(
42508
42472
  modulePaths,
42509
42473
  compilerOptions,
@@ -42517,7 +42481,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
42517
42481
  return { moduleSpecifiers: result, computedWithoutCache };
42518
42482
  }
42519
42483
  function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
42520
- const info = getInfo(importingSourceFile.fileName, host);
42484
+ const info = getInfo(importingSourceFile.path, host);
42521
42485
  const preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
42522
42486
  const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
42523
42487
  host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
@@ -42581,7 +42545,6 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
42581
42545
  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);
42582
42546
  }
42583
42547
  function getInfo(importingSourceFileName, host) {
42584
- importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
42585
42548
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : true);
42586
42549
  const sourceDirectory = getDirectoryPath(importingSourceFileName);
42587
42550
  return { getCanonicalFileName, importingSourceFileName, sourceDirectory };
@@ -42616,7 +42579,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
42616
42579
  if (relativePreference === 3 /* ExternalNonRelative */ && !pathIsRelative(maybeNonRelative)) {
42617
42580
  const projectDirectory = compilerOptions.configFilePath ? toPath(getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory());
42618
42581
  const modulePath = toPath(moduleFileName, projectDirectory, getCanonicalFileName);
42619
- const sourceIsInternal = startsWith(info.getCanonicalFileName(sourceDirectory), projectDirectory);
42582
+ const sourceIsInternal = startsWith(sourceDirectory, projectDirectory);
42620
42583
  const targetIsInternal = startsWith(modulePath, projectDirectory);
42621
42584
  if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
42622
42585
  return maybeNonRelative;
@@ -42689,9 +42652,8 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
42689
42652
  });
42690
42653
  return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
42691
42654
  }
42692
- function getAllModulePaths(importingFileName, importedFileName, host, preferences, options = {}) {
42655
+ function getAllModulePaths(importingFilePath, importedFileName, host, preferences, options = {}) {
42693
42656
  var _a;
42694
- const importingFilePath = toPath(importingFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
42695
42657
  const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
42696
42658
  const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
42697
42659
  if (cache) {
@@ -42699,7 +42661,7 @@ function getAllModulePaths(importingFileName, importedFileName, host, preference
42699
42661
  if (cached == null ? void 0 : cached.modulePaths)
42700
42662
  return cached.modulePaths;
42701
42663
  }
42702
- const modulePaths = getAllModulePathsWorker(importingFileName, importedFileName, host);
42664
+ const modulePaths = getAllModulePathsWorker(importingFilePath, importedFileName, host);
42703
42665
  if (cache) {
42704
42666
  cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
42705
42667
  }
@@ -42722,7 +42684,7 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
42722
42684
  }
42723
42685
  );
42724
42686
  const sortedPaths = [];
42725
- for (let directory = getDirectoryPath(getCanonicalFileName(importingFileName)); allFileNames.size !== 0; ) {
42687
+ for (let directory = getDirectoryPath(importingFileName); allFileNames.size !== 0; ) {
42726
42688
  const directoryStart = ensureTrailingDirectorySeparator(directory);
42727
42689
  let pathsInDirectory;
42728
42690
  allFileNames.forEach(({ path, isRedirect, isInNodeModules }, fileName) => {
@@ -42743,10 +42705,7 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
42743
42705
  directory = newDirectory;
42744
42706
  }
42745
42707
  if (allFileNames.size) {
42746
- const remainingPaths = arrayFrom(
42747
- allFileNames.entries(),
42748
- ([fileName, { isRedirect, isInNodeModules }]) => ({ path: fileName, isRedirect, isInNodeModules })
42749
- );
42708
+ const remainingPaths = arrayFrom(allFileNames.values());
42750
42709
  if (remainingPaths.length > 1)
42751
42710
  remainingPaths.sort(comparePathsByRedirectAndNumberOfDirectorySeparators);
42752
42711
  sortedPaths.push(...remainingPaths);
@@ -42950,7 +42909,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
42950
42909
  }
42951
42910
  const globalTypingsCacheLocation = host.getGlobalTypingsCacheLocation && host.getGlobalTypingsCacheLocation();
42952
42911
  const pathToTopLevelNodeModules = getCanonicalFileName(moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex));
42953
- if (!(startsWith(getCanonicalFileName(sourceDirectory), pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
42912
+ if (!(startsWith(sourceDirectory, pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
42954
42913
  return void 0;
42955
42914
  }
42956
42915
  const nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
@@ -108018,8 +107977,8 @@ function transformDeclarations(context) {
108018
107977
  const specifier = getModuleSpecifier(
108019
107978
  options,
108020
107979
  currentSourceFile,
108021
- getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
108022
- getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
107980
+ toPath(outputFilePath2, host.getCurrentDirectory(), host.getCanonicalFileName),
107981
+ toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName),
108023
107982
  host
108024
107983
  );
108025
107984
  if (!pathIsRelative(specifier)) {
@@ -115445,8 +115404,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
115445
115404
  }
115446
115405
  const baseName = getBaseNameOfFileName(fileOrDirectory);
115447
115406
  const fsQueryResult = {
115448
- fileExists: host.fileExists(fileOrDirectory),
115449
- directoryExists: host.directoryExists(fileOrDirectory)
115407
+ fileExists: host.fileExists(fileOrDirectoryPath),
115408
+ directoryExists: host.directoryExists(fileOrDirectoryPath)
115450
115409
  };
115451
115410
  if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
115452
115411
  clearCache();
@@ -115529,9 +115488,11 @@ function cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, t
115529
115488
  });
115530
115489
  }
115531
115490
  function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) {
115491
+ const missingFilePaths = program.getMissingFilePaths();
115492
+ const newMissingFilePathMap = arrayToMap(missingFilePaths, identity, returnTrue);
115532
115493
  mutateMap(
115533
115494
  missingFileWatches,
115534
- program.getMissingFilePaths(),
115495
+ newMissingFilePathMap,
115535
115496
  {
115536
115497
  // Watch the missing files
115537
115498
  createNewValue: createMissingFileWatch,
@@ -116358,8 +116319,7 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
116358
116319
  return false;
116359
116320
  if (program.getSourceFiles().some(sourceFileNotUptoDate))
116360
116321
  return false;
116361
- const missingPaths = program.getMissingFilePaths();
116362
- if (missingPaths && forEachEntry(missingPaths, fileExists))
116322
+ if (program.getMissingFilePaths().some(fileExists))
116363
116323
  return false;
116364
116324
  const currentOptions = program.getCompilerOptions();
116365
116325
  if (!compareDataObjects(currentOptions, newOptions))
@@ -116659,7 +116619,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116659
116619
  let redirectTargetsMap = createMultiMap();
116660
116620
  let usesUriStyleNodeCoreModules = false;
116661
116621
  const filesByName = /* @__PURE__ */ new Map();
116662
- let missingFileNames = /* @__PURE__ */ new Map();
116622
+ let missingFilePaths;
116663
116623
  const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
116664
116624
  let resolvedProjectReferences;
116665
116625
  let projectReferenceRedirects;
@@ -116778,10 +116738,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116778
116738
  });
116779
116739
  }
116780
116740
  }
116741
+ missingFilePaths = arrayFrom(mapDefinedIterator(filesByName.entries(), ([path, file]) => file === void 0 ? path : void 0));
116781
116742
  files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
116782
116743
  processingDefaultLibFiles = void 0;
116783
116744
  processingOtherFiles = void 0;
116784
116745
  }
116746
+ Debug.assert(!!missingFilePaths);
116785
116747
  if (oldProgram && host.onReleaseOldSourceFile) {
116786
116748
  const oldSourceFiles = oldProgram.getSourceFiles();
116787
116749
  for (const oldSourceFile of oldSourceFiles) {
@@ -116826,7 +116788,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116826
116788
  getSourceFile,
116827
116789
  getSourceFileByPath,
116828
116790
  getSourceFiles: () => files,
116829
- getMissingFilePaths: () => missingFileNames,
116791
+ getMissingFilePaths: () => missingFilePaths,
116792
+ // TODO: GH#18217
116830
116793
  getModuleResolutionCache: () => moduleResolutionCache,
116831
116794
  getFilesByNameMap: () => filesByName,
116832
116795
  getCompilerOptions: () => options,
@@ -117253,7 +117216,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117253
117216
  const newSourceFiles = [];
117254
117217
  const modifiedSourceFiles = [];
117255
117218
  structureIsReused = 2 /* Completely */;
117256
- if (forEachEntry(oldProgram.getMissingFilePaths(), (missingFilePath) => host.fileExists(missingFilePath))) {
117219
+ if (oldProgram.getMissingFilePaths().some((missingFilePath) => host.fileExists(missingFilePath))) {
117257
117220
  return 0 /* Not */;
117258
117221
  }
117259
117222
  const oldSourceFiles = oldProgram.getSourceFiles();
@@ -117393,7 +117356,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117393
117356
  if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
117394
117357
  return 1 /* SafeModules */;
117395
117358
  }
117396
- missingFileNames = oldProgram.getMissingFilePaths();
117359
+ missingFilePaths = oldProgram.getMissingFilePaths();
117397
117360
  Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
117398
117361
  for (const newSourceFile of newSourceFiles) {
117399
117362
  filesByName.set(newSourceFile.path, newSourceFile);
@@ -117450,7 +117413,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117450
117413
  const path = toPath3(f);
117451
117414
  if (getSourceFileByPath(path))
117452
117415
  return true;
117453
- if (missingFileNames.has(path))
117416
+ if (contains(missingFilePaths, path))
117454
117417
  return false;
117455
117418
  return host.fileExists(f);
117456
117419
  },
@@ -118262,7 +118225,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118262
118225
  addFileToFilesByName(
118263
118226
  file2,
118264
118227
  path,
118265
- fileName,
118266
118228
  /*redirectedPath*/
118267
118229
  void 0
118268
118230
  );
@@ -118335,7 +118297,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118335
118297
  if (fileFromPackageId) {
118336
118298
  const dupFile = createRedirectedSourceFile(fileFromPackageId, file, fileName, path, toPath3(fileName), originalFileName, sourceFileOptions);
118337
118299
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
118338
- addFileToFilesByName(dupFile, path, fileName, redirectedPath);
118300
+ addFileToFilesByName(dupFile, path, redirectedPath);
118339
118301
  addFileIncludeReason(dupFile, reason);
118340
118302
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
118341
118303
  processingOtherFiles.push(dupFile);
@@ -118345,7 +118307,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118345
118307
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
118346
118308
  }
118347
118309
  }
118348
- addFileToFilesByName(file, path, fileName, redirectedPath);
118310
+ addFileToFilesByName(file, path, redirectedPath);
118349
118311
  if (file) {
118350
118312
  sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
118351
118313
  file.fileName = fileName;
@@ -118385,21 +118347,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118385
118347
  if (file)
118386
118348
  fileReasons.add(file.path, reason);
118387
118349
  }
118388
- function addFileToFilesByName(file, path, fileName, redirectedPath) {
118350
+ function addFileToFilesByName(file, path, redirectedPath) {
118389
118351
  if (redirectedPath) {
118390
- updateFilesByNameMap(fileName, redirectedPath, file);
118391
- updateFilesByNameMap(fileName, path, file || false);
118352
+ filesByName.set(redirectedPath, file);
118353
+ filesByName.set(path, file || false);
118392
118354
  } else {
118393
- updateFilesByNameMap(fileName, path, file);
118355
+ filesByName.set(path, file);
118394
118356
  }
118395
118357
  }
118396
- function updateFilesByNameMap(fileName, path, file) {
118397
- filesByName.set(path, file);
118398
- if (file !== void 0)
118399
- missingFileNames.delete(path);
118400
- else
118401
- missingFileNames.set(path, fileName);
118402
- }
118403
118358
  function getProjectReferenceRedirect(fileName) {
118404
118359
  const referencedProject = getProjectReferenceRedirectProject(fileName);
118405
118360
  return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
@@ -118720,7 +118675,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118720
118675
  /*file*/
118721
118676
  void 0,
118722
118677
  sourceFilePath,
118723
- refPath,
118724
118678
  /*redirectedPath*/
118725
118679
  void 0
118726
118680
  );
@@ -118732,7 +118686,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118732
118686
  addFileToFilesByName(
118733
118687
  sourceFile,
118734
118688
  sourceFilePath,
118735
- refPath,
118736
118689
  /*redirectedPath*/
118737
118690
  void 0
118738
118691
  );
@@ -118742,7 +118695,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118742
118695
  addFileToFilesByName(
118743
118696
  sourceFile,
118744
118697
  sourceFilePath,
118745
- refPath,
118746
118698
  /*redirectedPath*/
118747
118699
  void 0
118748
118700
  );
@@ -122244,7 +122196,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122244
122196
  const watcher = {
122245
122197
  watcher: canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
122246
122198
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
122247
- invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache());
122199
+ invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache().getInternalMap());
122248
122200
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
122249
122201
  }) : noopFileWatcher,
122250
122202
  resolutions: isSymlink ? 0 : resolutions,
@@ -122284,7 +122236,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122284
122236
  if (watcher == null ? void 0 : watcher.files)
122285
122237
  (affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path);
122286
122238
  (_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
122287
- packageJsonMap.deletePackageJsonInfo(path);
122239
+ packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
122288
122240
  }
122289
122241
  function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
122290
122242
  const program = resolutionHost.getCurrentProgram();
@@ -122469,14 +122421,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122469
122421
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
122470
122422
  }
122471
122423
  function invalidatePackageJsonMap() {
122472
- const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().entries();
122424
+ const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
122473
122425
  if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
122474
- for (const key of packageJsonMap) {
122475
- const path = resolutionHost.toPath(key[0]);
122476
- if (isInvalidatedFailedLookup(path)) {
122477
- moduleResolutionCache.getPackageJsonInfoCache().deletePackageJsonInfo(key[0]);
122478
- }
122479
- }
122426
+ packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
122480
122427
  }
122481
122428
  }
122482
122429
  function invalidateResolutionsOfFailedLookupLocations() {
@@ -123493,11 +123440,7 @@ function createWatchProgram(host) {
123493
123440
  const oldProgram = getCurrentProgram();
123494
123441
  builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
123495
123442
  resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
123496
- updateMissingFilePathsWatch(
123497
- builderProgram.getProgram(),
123498
- missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()),
123499
- watchMissingFilePath
123500
- );
123443
+ updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()), watchMissingFilePath);
123501
123444
  if (needsUpdateInTypeRootWatch) {
123502
123445
  resolutionCache.updateTypeRootsWatch();
123503
123446
  }
@@ -123790,15 +123733,8 @@ function createWatchProgram(host) {
123790
123733
  cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
123791
123734
  }
123792
123735
  }
123793
- function watchMissingFilePath(missingFilePath, missingFileName) {
123794
- return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
123795
- missingFilePath,
123796
- missingFileName,
123797
- onMissingFileChange,
123798
- 500 /* Medium */,
123799
- watchOptions,
123800
- WatchType.MissingFile
123801
- );
123736
+ function watchMissingFilePath(missingFilePath) {
123737
+ return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(missingFilePath, missingFilePath, onMissingFileChange, 500 /* Medium */, watchOptions, WatchType.MissingFile);
123802
123738
  }
123803
123739
  function onMissingFileChange(fileName, eventKind, missingFilePath) {
123804
123740
  updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
@@ -124273,7 +124209,6 @@ function createStateBuildOrder(state) {
124273
124209
  mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124274
124210
  mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124275
124211
  mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124276
- mutateMapSkippingNewValues(state.lastCachedPackageJsonLookups, currentProjects, noopOnDelete);
124277
124212
  if (state.watch) {
124278
124213
  mutateMapSkippingNewValues(
124279
124214
  state.allWatchedConfigFiles,
@@ -124522,7 +124457,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
124522
124457
  return withProgramOrUndefined(action) || emptyArray;
124523
124458
  }
124524
124459
  function createProgram2() {
124525
- var _a, _b, _c;
124460
+ var _a, _b;
124526
124461
  Debug.assert(program === void 0);
124527
124462
  if (state.options.dry) {
124528
124463
  reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
@@ -124551,16 +124486,12 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
124551
124486
  config.projectReferences
124552
124487
  );
124553
124488
  if (state.watch) {
124554
- const entries = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().entries();
124555
124489
  state.lastCachedPackageJsonLookups.set(
124556
124490
  projectPath,
124557
- entries && new Map(arrayFrom(
124558
- entries,
124559
- ([path, data]) => {
124560
- path = state.host.realpath && data ? state.host.realpath(path) : path;
124561
- return [toPath2(state, path), path];
124562
- }
124563
- ))
124491
+ state.moduleResolutionCache && map(
124492
+ state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
124493
+ ([path, data]) => [state.host.realpath && data ? toPath2(state, state.host.realpath(path)) : path, data]
124494
+ )
124564
124495
  );
124565
124496
  state.builderPrograms.set(projectPath, program);
124566
124497
  }
@@ -125293,10 +125224,9 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
125293
125224
  const extendedConfigStatus = forEach(project.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName));
125294
125225
  if (extendedConfigStatus)
125295
125226
  return extendedConfigStatus;
125296
- const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath);
125297
- const dependentPackageFileStatus = packageJsonLookups && forEachEntry(
125298
- packageJsonLookups,
125299
- (path) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
125227
+ const dependentPackageFileStatus = forEach(
125228
+ state.lastCachedPackageJsonLookups.get(resolvedPath) || emptyArray,
125229
+ ([path]) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
125300
125230
  );
125301
125231
  if (dependentPackageFileStatus)
125302
125232
  return dependentPackageFileStatus;
@@ -125707,9 +125637,9 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
125707
125637
  getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath),
125708
125638
  new Map(state.lastCachedPackageJsonLookups.get(resolvedPath)),
125709
125639
  {
125710
- createNewValue: (_path, input) => watchFile(
125640
+ createNewValue: (path, _input) => watchFile(
125711
125641
  state,
125712
- input,
125642
+ path,
125713
125643
  () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
125714
125644
  2e3 /* High */,
125715
125645
  parsed == null ? void 0 : parsed.watchOptions,