@typescript-deploys/pr-build 5.4.0-pr-56488-8 → 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
@@ -3661,7 +3661,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3661
3661
  TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
3662
3662
  TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
3663
3663
  TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
3664
- TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
3664
+ TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
3665
3665
  TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
3666
3666
  TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
3667
3667
  TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
@@ -15974,7 +15974,7 @@ function getClassLikeDeclarationOfSymbol(symbol) {
15974
15974
  return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike);
15975
15975
  }
15976
15976
  function getObjectFlags(type) {
15977
- return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
15977
+ return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
15978
15978
  }
15979
15979
  function isUMDExportSymbol(symbol) {
15980
15980
  return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
@@ -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);
@@ -54245,7 +54204,12 @@ function createTypeChecker(host) {
54245
54204
  const checkType = type.checkType;
54246
54205
  const constraint = getLowerBoundOfKeyType(checkType);
54247
54206
  if (constraint !== checkType) {
54248
- return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
54207
+ return getConditionalTypeInstantiation(
54208
+ type,
54209
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
54210
+ /*forConstraint*/
54211
+ false
54212
+ );
54249
54213
  }
54250
54214
  }
54251
54215
  return type;
@@ -54597,7 +54561,12 @@ function createTypeChecker(host) {
54597
54561
  );
54598
54562
  const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
54599
54563
  if (constraint && constraint !== type.checkType) {
54600
- const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
54564
+ const instantiated = getConditionalTypeInstantiation(
54565
+ type,
54566
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
54567
+ /*forConstraint*/
54568
+ true
54569
+ );
54601
54570
  if (!(instantiated.flags & 131072 /* Never */)) {
54602
54571
  type.resolvedConstraintOfDistributive = instantiated;
54603
54572
  return instantiated;
@@ -57031,7 +57000,7 @@ function createTypeChecker(host) {
57031
57000
  }
57032
57001
  }
57033
57002
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
57034
- const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
57003
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
57035
57004
  if (templates.length) {
57036
57005
  let i = types.length;
57037
57006
  while (i > 0) {
@@ -57431,19 +57400,14 @@ function createTypeChecker(host) {
57431
57400
  function getConstituentCountOfTypes(types) {
57432
57401
  return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
57433
57402
  }
57434
- function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
57435
- if (types.length !== 2) {
57436
- return false;
57437
- }
57438
- const [t1, t2] = types;
57439
- return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
57440
- }
57441
57403
  function getTypeFromIntersectionTypeNode(node) {
57442
57404
  const links = getNodeLinks(node);
57443
57405
  if (!links.resolvedType) {
57444
57406
  const aliasSymbol = getAliasSymbolForTypeNode(node);
57445
57407
  const types = map(node.types, getTypeFromTypeNode);
57446
- const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
57408
+ const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
57409
+ const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
57410
+ const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
57447
57411
  links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
57448
57412
  }
57449
57413
  return links.resolvedType;
@@ -57470,19 +57434,17 @@ function createTypeChecker(host) {
57470
57434
  return constraintType;
57471
57435
  }
57472
57436
  const keyTypes = [];
57473
- if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
57474
- if (!isGenericIndexType(constraintType)) {
57475
- const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
57476
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
57477
- } else {
57437
+ if (isGenericIndexType(constraintType)) {
57438
+ if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
57478
57439
  return getIndexTypeForGenericType(type, indexFlags);
57479
57440
  }
57441
+ forEachType(constraintType, addMemberForKeyType);
57442
+ } else if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
57443
+ const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
57444
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
57480
57445
  } else {
57481
57446
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
57482
57447
  }
57483
- if (isGenericIndexType(constraintType)) {
57484
- forEachType(constraintType, addMemberForKeyType);
57485
- }
57486
57448
  const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
57487
57449
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
57488
57450
  return constraintType;
@@ -57655,11 +57617,6 @@ function createTypeChecker(host) {
57655
57617
  }
57656
57618
  function createTemplateLiteralType(texts, types) {
57657
57619
  const type = createType(134217728 /* TemplateLiteral */);
57658
- type.objectFlags = getPropagatingFlagsOfTypes(
57659
- types,
57660
- /*excludeKinds*/
57661
- 98304 /* Nullable */
57662
- );
57663
57620
  type.texts = texts;
57664
57621
  type.types = types;
57665
57622
  return type;
@@ -57954,7 +57911,15 @@ function createTypeChecker(host) {
57954
57911
  }
57955
57912
  function isPatternLiteralPlaceholderType(type) {
57956
57913
  if (type.flags & 2097152 /* Intersection */) {
57957
- return !isGenericType(type) && some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 98304 /* Nullable */)) || isPatternLiteralPlaceholderType(t));
57914
+ let seenPlaceholder = false;
57915
+ for (const t of type.types) {
57916
+ if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
57917
+ seenPlaceholder = true;
57918
+ } else if (!(t.flags & 524288 /* Object */)) {
57919
+ return false;
57920
+ }
57921
+ }
57922
+ return seenPlaceholder;
57958
57923
  }
57959
57924
  return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
57960
57925
  }
@@ -57971,7 +57936,7 @@ function createTypeChecker(host) {
57971
57936
  return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
57972
57937
  }
57973
57938
  function getGenericObjectFlags(type) {
57974
- if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
57939
+ if (type.flags & 3145728 /* UnionOrIntersection */) {
57975
57940
  if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
57976
57941
  type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
57977
57942
  }
@@ -57983,7 +57948,7 @@ function createTypeChecker(host) {
57983
57948
  }
57984
57949
  return type.objectFlags & 12582912 /* IsGenericType */;
57985
57950
  }
57986
- return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
57951
+ return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
57987
57952
  }
57988
57953
  function getSimplifiedType(type, writing) {
57989
57954
  return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -58164,7 +58129,7 @@ function createTypeChecker(host) {
58164
58129
  function isDeferredType(type, checkTuples) {
58165
58130
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
58166
58131
  }
58167
- function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
58132
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
58168
58133
  let result;
58169
58134
  let extraTypes;
58170
58135
  let tailCount = 0;
@@ -58210,7 +58175,7 @@ function createTypeChecker(host) {
58210
58175
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
58211
58176
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
58212
58177
  if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
58213
- if (checkType.flags & 1 /* Any */) {
58178
+ if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
58214
58179
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
58215
58180
  }
58216
58181
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -58320,7 +58285,9 @@ function createTypeChecker(host) {
58320
58285
  links.resolvedType = getConditionalType(
58321
58286
  root,
58322
58287
  /*mapper*/
58323
- void 0
58288
+ void 0,
58289
+ /*forConstraint*/
58290
+ false
58324
58291
  );
58325
58292
  if (outerTypeParameters) {
58326
58293
  root.instantiations = /* @__PURE__ */ new Map();
@@ -59009,7 +58976,7 @@ function createTypeChecker(host) {
59009
58976
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
59010
58977
  target.instantiations.set(id, result);
59011
58978
  const resultObjectFlags = getObjectFlags(result);
59012
- if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58979
+ if (result.flags & 3899393 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
59013
58980
  const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
59014
58981
  if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
59015
58982
  if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
@@ -59175,17 +59142,17 @@ function createTypeChecker(host) {
59175
59142
  result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
59176
59143
  return result;
59177
59144
  }
59178
- function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
59145
+ function getConditionalTypeInstantiation(type, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
59179
59146
  const root = type.root;
59180
59147
  if (root.outerTypeParameters) {
59181
59148
  const typeArguments = map(root.outerTypeParameters, (t) => getMappedType(t, mapper));
59182
- const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
59149
+ const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
59183
59150
  let result = root.instantiations.get(id);
59184
59151
  if (!result) {
59185
59152
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
59186
59153
  const checkType = root.checkType;
59187
59154
  const distributionType = root.isDistributive ? getMappedType(checkType, newMapper) : void 0;
59188
- result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper)), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, aliasSymbol, aliasTypeArguments);
59155
+ result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments);
59189
59156
  root.instantiations.set(id, result);
59190
59157
  }
59191
59158
  return result;
@@ -59273,7 +59240,14 @@ function createTypeChecker(host) {
59273
59240
  );
59274
59241
  }
59275
59242
  if (flags & 16777216 /* Conditional */) {
59276
- return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
59243
+ return getConditionalTypeInstantiation(
59244
+ type,
59245
+ combineTypeMappers(type.mapper, mapper),
59246
+ /*forConstraint*/
59247
+ false,
59248
+ aliasSymbol,
59249
+ aliasTypeArguments
59250
+ );
59277
59251
  }
59278
59252
  if (flags & 33554432 /* Substitution */) {
59279
59253
  const newBaseType = instantiateType(type.baseType, mapper);
@@ -60917,7 +60891,7 @@ function createTypeChecker(host) {
60917
60891
  return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState);
60918
60892
  }
60919
60893
  if (target2.flags & 1048576 /* Union */) {
60920
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */));
60894
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState);
60921
60895
  }
60922
60896
  if (target2.flags & 2097152 /* Intersection */) {
60923
60897
  return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
@@ -60962,7 +60936,8 @@ function createTypeChecker(host) {
60962
60936
  sourceType,
60963
60937
  target2,
60964
60938
  /*reportErrors*/
60965
- false
60939
+ false,
60940
+ 0 /* None */
60966
60941
  );
60967
60942
  if (!related) {
60968
60943
  return 0 /* False */;
@@ -60971,7 +60946,7 @@ function createTypeChecker(host) {
60971
60946
  }
60972
60947
  return result2;
60973
60948
  }
60974
- function typeRelatedToSomeType(source2, target2, reportErrors2) {
60949
+ function typeRelatedToSomeType(source2, target2, reportErrors2, intersectionState) {
60975
60950
  const targetTypes = target2.types;
60976
60951
  if (target2.flags & 1048576 /* Union */) {
60977
60952
  if (containsType(targetTypes, source2)) {
@@ -60989,7 +60964,10 @@ function createTypeChecker(host) {
60989
60964
  match,
60990
60965
  2 /* Target */,
60991
60966
  /*reportErrors*/
60992
- false
60967
+ false,
60968
+ /*headMessage*/
60969
+ void 0,
60970
+ intersectionState
60993
60971
  );
60994
60972
  if (related) {
60995
60973
  return related;
@@ -61002,7 +60980,10 @@ function createTypeChecker(host) {
61002
60980
  type,
61003
60981
  2 /* Target */,
61004
60982
  /*reportErrors*/
61005
- false
60983
+ false,
60984
+ /*headMessage*/
60985
+ void 0,
60986
+ intersectionState
61006
60987
  );
61007
60988
  if (related) {
61008
60989
  return related;
@@ -61016,7 +60997,10 @@ function createTypeChecker(host) {
61016
60997
  bestMatchingType,
61017
60998
  2 /* Target */,
61018
60999
  /*reportErrors*/
61019
- true
61000
+ true,
61001
+ /*headMessage*/
61002
+ void 0,
61003
+ intersectionState
61020
61004
  );
61021
61005
  }
61022
61006
  }
@@ -61814,13 +61798,6 @@ function createTypeChecker(host) {
61814
61798
  return result2;
61815
61799
  }
61816
61800
  }
61817
- } else {
61818
- const distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
61819
- if (distributiveConstraint) {
61820
- if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
61821
- return result2;
61822
- }
61823
- }
61824
61801
  }
61825
61802
  const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
61826
61803
  if (defaultConstraint) {
@@ -61828,6 +61805,13 @@ function createTypeChecker(host) {
61828
61805
  return result2;
61829
61806
  }
61830
61807
  }
61808
+ const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
61809
+ if (distributiveConstraint) {
61810
+ resetErrorInfo(saveErrorInfo);
61811
+ if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
61812
+ return result2;
61813
+ }
61814
+ }
61831
61815
  } else {
61832
61816
  if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) {
61833
61817
  return -1 /* True */;
@@ -63725,8 +63709,8 @@ function createTypeChecker(host) {
63725
63709
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
63726
63710
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
63727
63711
  }
63728
- const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
63729
- if (type.flags & 138117121 /* ObjectFlagsType */) {
63712
+ const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
63713
+ if (type.flags & 3899393 /* ObjectFlagsType */) {
63730
63714
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
63731
63715
  }
63732
63716
  return result;
@@ -107993,8 +107977,8 @@ function transformDeclarations(context) {
107993
107977
  const specifier = getModuleSpecifier(
107994
107978
  options,
107995
107979
  currentSourceFile,
107996
- getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
107997
- getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
107980
+ toPath(outputFilePath2, host.getCurrentDirectory(), host.getCanonicalFileName),
107981
+ toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName),
107998
107982
  host
107999
107983
  );
108000
107984
  if (!pathIsRelative(specifier)) {
@@ -115420,8 +115404,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
115420
115404
  }
115421
115405
  const baseName = getBaseNameOfFileName(fileOrDirectory);
115422
115406
  const fsQueryResult = {
115423
- fileExists: host.fileExists(fileOrDirectory),
115424
- directoryExists: host.directoryExists(fileOrDirectory)
115407
+ fileExists: host.fileExists(fileOrDirectoryPath),
115408
+ directoryExists: host.directoryExists(fileOrDirectoryPath)
115425
115409
  };
115426
115410
  if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
115427
115411
  clearCache();
@@ -115504,9 +115488,11 @@ function cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, t
115504
115488
  });
115505
115489
  }
115506
115490
  function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) {
115491
+ const missingFilePaths = program.getMissingFilePaths();
115492
+ const newMissingFilePathMap = arrayToMap(missingFilePaths, identity, returnTrue);
115507
115493
  mutateMap(
115508
115494
  missingFileWatches,
115509
- program.getMissingFilePaths(),
115495
+ newMissingFilePathMap,
115510
115496
  {
115511
115497
  // Watch the missing files
115512
115498
  createNewValue: createMissingFileWatch,
@@ -116333,8 +116319,7 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
116333
116319
  return false;
116334
116320
  if (program.getSourceFiles().some(sourceFileNotUptoDate))
116335
116321
  return false;
116336
- const missingPaths = program.getMissingFilePaths();
116337
- if (missingPaths && forEachEntry(missingPaths, fileExists))
116322
+ if (program.getMissingFilePaths().some(fileExists))
116338
116323
  return false;
116339
116324
  const currentOptions = program.getCompilerOptions();
116340
116325
  if (!compareDataObjects(currentOptions, newOptions))
@@ -116634,7 +116619,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116634
116619
  let redirectTargetsMap = createMultiMap();
116635
116620
  let usesUriStyleNodeCoreModules = false;
116636
116621
  const filesByName = /* @__PURE__ */ new Map();
116637
- let missingFileNames = /* @__PURE__ */ new Map();
116622
+ let missingFilePaths;
116638
116623
  const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
116639
116624
  let resolvedProjectReferences;
116640
116625
  let projectReferenceRedirects;
@@ -116753,10 +116738,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116753
116738
  });
116754
116739
  }
116755
116740
  }
116741
+ missingFilePaths = arrayFrom(mapDefinedIterator(filesByName.entries(), ([path, file]) => file === void 0 ? path : void 0));
116756
116742
  files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
116757
116743
  processingDefaultLibFiles = void 0;
116758
116744
  processingOtherFiles = void 0;
116759
116745
  }
116746
+ Debug.assert(!!missingFilePaths);
116760
116747
  if (oldProgram && host.onReleaseOldSourceFile) {
116761
116748
  const oldSourceFiles = oldProgram.getSourceFiles();
116762
116749
  for (const oldSourceFile of oldSourceFiles) {
@@ -116801,7 +116788,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116801
116788
  getSourceFile,
116802
116789
  getSourceFileByPath,
116803
116790
  getSourceFiles: () => files,
116804
- getMissingFilePaths: () => missingFileNames,
116791
+ getMissingFilePaths: () => missingFilePaths,
116792
+ // TODO: GH#18217
116805
116793
  getModuleResolutionCache: () => moduleResolutionCache,
116806
116794
  getFilesByNameMap: () => filesByName,
116807
116795
  getCompilerOptions: () => options,
@@ -117228,7 +117216,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117228
117216
  const newSourceFiles = [];
117229
117217
  const modifiedSourceFiles = [];
117230
117218
  structureIsReused = 2 /* Completely */;
117231
- if (forEachEntry(oldProgram.getMissingFilePaths(), (missingFilePath) => host.fileExists(missingFilePath))) {
117219
+ if (oldProgram.getMissingFilePaths().some((missingFilePath) => host.fileExists(missingFilePath))) {
117232
117220
  return 0 /* Not */;
117233
117221
  }
117234
117222
  const oldSourceFiles = oldProgram.getSourceFiles();
@@ -117368,7 +117356,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117368
117356
  if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
117369
117357
  return 1 /* SafeModules */;
117370
117358
  }
117371
- missingFileNames = oldProgram.getMissingFilePaths();
117359
+ missingFilePaths = oldProgram.getMissingFilePaths();
117372
117360
  Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
117373
117361
  for (const newSourceFile of newSourceFiles) {
117374
117362
  filesByName.set(newSourceFile.path, newSourceFile);
@@ -117425,7 +117413,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117425
117413
  const path = toPath3(f);
117426
117414
  if (getSourceFileByPath(path))
117427
117415
  return true;
117428
- if (missingFileNames.has(path))
117416
+ if (contains(missingFilePaths, path))
117429
117417
  return false;
117430
117418
  return host.fileExists(f);
117431
117419
  },
@@ -118237,7 +118225,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118237
118225
  addFileToFilesByName(
118238
118226
  file2,
118239
118227
  path,
118240
- fileName,
118241
118228
  /*redirectedPath*/
118242
118229
  void 0
118243
118230
  );
@@ -118310,7 +118297,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118310
118297
  if (fileFromPackageId) {
118311
118298
  const dupFile = createRedirectedSourceFile(fileFromPackageId, file, fileName, path, toPath3(fileName), originalFileName, sourceFileOptions);
118312
118299
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
118313
- addFileToFilesByName(dupFile, path, fileName, redirectedPath);
118300
+ addFileToFilesByName(dupFile, path, redirectedPath);
118314
118301
  addFileIncludeReason(dupFile, reason);
118315
118302
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
118316
118303
  processingOtherFiles.push(dupFile);
@@ -118320,7 +118307,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118320
118307
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
118321
118308
  }
118322
118309
  }
118323
- addFileToFilesByName(file, path, fileName, redirectedPath);
118310
+ addFileToFilesByName(file, path, redirectedPath);
118324
118311
  if (file) {
118325
118312
  sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
118326
118313
  file.fileName = fileName;
@@ -118360,21 +118347,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118360
118347
  if (file)
118361
118348
  fileReasons.add(file.path, reason);
118362
118349
  }
118363
- function addFileToFilesByName(file, path, fileName, redirectedPath) {
118350
+ function addFileToFilesByName(file, path, redirectedPath) {
118364
118351
  if (redirectedPath) {
118365
- updateFilesByNameMap(fileName, redirectedPath, file);
118366
- updateFilesByNameMap(fileName, path, file || false);
118352
+ filesByName.set(redirectedPath, file);
118353
+ filesByName.set(path, file || false);
118367
118354
  } else {
118368
- updateFilesByNameMap(fileName, path, file);
118355
+ filesByName.set(path, file);
118369
118356
  }
118370
118357
  }
118371
- function updateFilesByNameMap(fileName, path, file) {
118372
- filesByName.set(path, file);
118373
- if (file !== void 0)
118374
- missingFileNames.delete(path);
118375
- else
118376
- missingFileNames.set(path, fileName);
118377
- }
118378
118358
  function getProjectReferenceRedirect(fileName) {
118379
118359
  const referencedProject = getProjectReferenceRedirectProject(fileName);
118380
118360
  return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
@@ -118695,7 +118675,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118695
118675
  /*file*/
118696
118676
  void 0,
118697
118677
  sourceFilePath,
118698
- refPath,
118699
118678
  /*redirectedPath*/
118700
118679
  void 0
118701
118680
  );
@@ -118707,7 +118686,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118707
118686
  addFileToFilesByName(
118708
118687
  sourceFile,
118709
118688
  sourceFilePath,
118710
- refPath,
118711
118689
  /*redirectedPath*/
118712
118690
  void 0
118713
118691
  );
@@ -118717,7 +118695,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118717
118695
  addFileToFilesByName(
118718
118696
  sourceFile,
118719
118697
  sourceFilePath,
118720
- refPath,
118721
118698
  /*redirectedPath*/
118722
118699
  void 0
118723
118700
  );
@@ -122219,7 +122196,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122219
122196
  const watcher = {
122220
122197
  watcher: canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
122221
122198
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
122222
- invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache());
122199
+ invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache().getInternalMap());
122223
122200
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
122224
122201
  }) : noopFileWatcher,
122225
122202
  resolutions: isSymlink ? 0 : resolutions,
@@ -122259,7 +122236,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122259
122236
  if (watcher == null ? void 0 : watcher.files)
122260
122237
  (affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path);
122261
122238
  (_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
122262
- packageJsonMap.deletePackageJsonInfo(path);
122239
+ packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
122263
122240
  }
122264
122241
  function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
122265
122242
  const program = resolutionHost.getCurrentProgram();
@@ -122444,14 +122421,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122444
122421
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
122445
122422
  }
122446
122423
  function invalidatePackageJsonMap() {
122447
- const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().entries();
122424
+ const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
122448
122425
  if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
122449
- for (const key of packageJsonMap) {
122450
- const path = resolutionHost.toPath(key[0]);
122451
- if (isInvalidatedFailedLookup(path)) {
122452
- moduleResolutionCache.getPackageJsonInfoCache().deletePackageJsonInfo(key[0]);
122453
- }
122454
- }
122426
+ packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
122455
122427
  }
122456
122428
  }
122457
122429
  function invalidateResolutionsOfFailedLookupLocations() {
@@ -123468,11 +123440,7 @@ function createWatchProgram(host) {
123468
123440
  const oldProgram = getCurrentProgram();
123469
123441
  builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
123470
123442
  resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
123471
- updateMissingFilePathsWatch(
123472
- builderProgram.getProgram(),
123473
- missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()),
123474
- watchMissingFilePath
123475
- );
123443
+ updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()), watchMissingFilePath);
123476
123444
  if (needsUpdateInTypeRootWatch) {
123477
123445
  resolutionCache.updateTypeRootsWatch();
123478
123446
  }
@@ -123765,15 +123733,8 @@ function createWatchProgram(host) {
123765
123733
  cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
123766
123734
  }
123767
123735
  }
123768
- function watchMissingFilePath(missingFilePath, missingFileName) {
123769
- return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
123770
- missingFilePath,
123771
- missingFileName,
123772
- onMissingFileChange,
123773
- 500 /* Medium */,
123774
- watchOptions,
123775
- WatchType.MissingFile
123776
- );
123736
+ function watchMissingFilePath(missingFilePath) {
123737
+ return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(missingFilePath, missingFilePath, onMissingFileChange, 500 /* Medium */, watchOptions, WatchType.MissingFile);
123777
123738
  }
123778
123739
  function onMissingFileChange(fileName, eventKind, missingFilePath) {
123779
123740
  updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
@@ -124248,7 +124209,6 @@ function createStateBuildOrder(state) {
124248
124209
  mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124249
124210
  mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124250
124211
  mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124251
- mutateMapSkippingNewValues(state.lastCachedPackageJsonLookups, currentProjects, noopOnDelete);
124252
124212
  if (state.watch) {
124253
124213
  mutateMapSkippingNewValues(
124254
124214
  state.allWatchedConfigFiles,
@@ -124497,7 +124457,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
124497
124457
  return withProgramOrUndefined(action) || emptyArray;
124498
124458
  }
124499
124459
  function createProgram2() {
124500
- var _a, _b, _c;
124460
+ var _a, _b;
124501
124461
  Debug.assert(program === void 0);
124502
124462
  if (state.options.dry) {
124503
124463
  reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
@@ -124526,16 +124486,12 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
124526
124486
  config.projectReferences
124527
124487
  );
124528
124488
  if (state.watch) {
124529
- const entries = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().entries();
124530
124489
  state.lastCachedPackageJsonLookups.set(
124531
124490
  projectPath,
124532
- entries && new Map(arrayFrom(
124533
- entries,
124534
- ([path, data]) => {
124535
- path = state.host.realpath && data ? state.host.realpath(path) : path;
124536
- return [toPath2(state, path), path];
124537
- }
124538
- ))
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
+ )
124539
124495
  );
124540
124496
  state.builderPrograms.set(projectPath, program);
124541
124497
  }
@@ -125268,10 +125224,9 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
125268
125224
  const extendedConfigStatus = forEach(project.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName));
125269
125225
  if (extendedConfigStatus)
125270
125226
  return extendedConfigStatus;
125271
- const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath);
125272
- const dependentPackageFileStatus = packageJsonLookups && forEachEntry(
125273
- packageJsonLookups,
125274
- (path) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
125227
+ const dependentPackageFileStatus = forEach(
125228
+ state.lastCachedPackageJsonLookups.get(resolvedPath) || emptyArray,
125229
+ ([path]) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
125275
125230
  );
125276
125231
  if (dependentPackageFileStatus)
125277
125232
  return dependentPackageFileStatus;
@@ -125682,9 +125637,9 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
125682
125637
  getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath),
125683
125638
  new Map(state.lastCachedPackageJsonLookups.get(resolvedPath)),
125684
125639
  {
125685
- createNewValue: (_path, input) => watchFile(
125640
+ createNewValue: (path, _input) => watchFile(
125686
125641
  state,
125687
- input,
125642
+ path,
125688
125643
  () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
125689
125644
  2e3 /* High */,
125690
125645
  parsed == null ? void 0 : parsed.watchOptions,