@typescript-deploys/pr-build 5.4.0-pr-56458-11 → 5.4.0-pr-56476-3

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
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.4";
21
- var version = `${versionMajorMinor}.0-insiders.20231120`;
21
+ var version = `${versionMajorMinor}.0-insiders.20231121`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -36787,34 +36787,39 @@ function specToDiagnostic(spec, disallowTrailingRecursion) {
36787
36787
  return [Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
36788
36788
  }
36789
36789
  }
36790
- function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, path, useCaseSensitiveFileNames2) {
36791
- const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude");
36790
+ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, basePath, useCaseSensitiveFileNames2) {
36791
+ const rawExcludeRegex = getRegularExpressionForWildcard(exclude, basePath, "exclude");
36792
36792
  const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames2 ? "" : "i");
36793
36793
  const wildcardDirectories = {};
36794
+ const wildCardKeyToPath = /* @__PURE__ */ new Map();
36794
36795
  if (include !== void 0) {
36795
36796
  const recursiveKeys = [];
36796
36797
  for (const file of include) {
36797
- const spec = normalizePath(combinePaths(path, file));
36798
+ const spec = normalizePath(combinePaths(basePath, file));
36798
36799
  if (excludeRegex && excludeRegex.test(spec)) {
36799
36800
  continue;
36800
36801
  }
36801
36802
  const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
36802
36803
  if (match) {
36803
- const { key, flags } = match;
36804
- const existingFlags = wildcardDirectories[key];
36804
+ const { key, path, flags } = match;
36805
+ const existingPath = wildCardKeyToPath.get(key);
36806
+ const existingFlags = existingPath !== void 0 ? wildcardDirectories[existingPath] : void 0;
36805
36807
  if (existingFlags === void 0 || existingFlags < flags) {
36806
- wildcardDirectories[key] = flags;
36808
+ wildcardDirectories[existingPath !== void 0 ? existingPath : path] = flags;
36809
+ if (existingPath === void 0)
36810
+ wildCardKeyToPath.set(key, path);
36807
36811
  if (flags === 1 /* Recursive */) {
36808
36812
  recursiveKeys.push(key);
36809
36813
  }
36810
36814
  }
36811
36815
  }
36812
36816
  }
36813
- for (const key in wildcardDirectories) {
36814
- if (hasProperty(wildcardDirectories, key)) {
36817
+ for (const path in wildcardDirectories) {
36818
+ if (hasProperty(wildcardDirectories, path)) {
36815
36819
  for (const recursiveKey of recursiveKeys) {
36816
- if (key !== recursiveKey && containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames2)) {
36817
- delete wildcardDirectories[key];
36820
+ const key = toCanonicalKey(path, useCaseSensitiveFileNames2);
36821
+ if (key !== recursiveKey && containsPath(recursiveKey, key, basePath, !useCaseSensitiveFileNames2)) {
36822
+ delete wildcardDirectories[path];
36818
36823
  }
36819
36824
  }
36820
36825
  }
@@ -36822,6 +36827,9 @@ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExclu
36822
36827
  }
36823
36828
  return wildcardDirectories;
36824
36829
  }
36830
+ function toCanonicalKey(path, useCaseSensitiveFileNames2) {
36831
+ return useCaseSensitiveFileNames2 ? path : toFileNameLowerCase(path);
36832
+ }
36825
36833
  function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
36826
36834
  const match = wildcardDirectoryPattern.exec(spec);
36827
36835
  if (match) {
@@ -36829,13 +36837,16 @@ function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
36829
36837
  const starWildcardIndex = spec.indexOf("*");
36830
36838
  const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator);
36831
36839
  return {
36832
- key: useCaseSensitiveFileNames2 ? match[0] : toFileNameLowerCase(match[0]),
36840
+ key: toCanonicalKey(match[0], useCaseSensitiveFileNames2),
36841
+ path: match[0],
36833
36842
  flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 /* Recursive */ : 0 /* None */
36834
36843
  };
36835
36844
  }
36836
36845
  if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) {
36846
+ const path = removeTrailingDirectorySeparator(spec);
36837
36847
  return {
36838
- key: removeTrailingDirectorySeparator(useCaseSensitiveFileNames2 ? spec : toFileNameLowerCase(spec)),
36848
+ key: toCanonicalKey(path, useCaseSensitiveFileNames2),
36849
+ path,
36839
36850
  flags: 1 /* Recursive */
36840
36851
  };
36841
36852
  }
@@ -37517,22 +37528,50 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
37517
37528
  }
37518
37529
  function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
37519
37530
  let cache;
37520
- return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2, entries, getInternalMap };
37531
+ let canonicalPathToCacheKey;
37532
+ return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, deletePackageJsonInfo, clear: clear2, entries };
37521
37533
  function getPackageJsonInfo2(packageJsonPath) {
37522
- return cache == null ? void 0 : cache.get(toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
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;
37523
37547
  }
37524
37548
  function setPackageJsonInfo(packageJsonPath, info) {
37525
- (cache || (cache = /* @__PURE__ */ new Map())).set(toPath(packageJsonPath, currentDirectory, getCanonicalFileName), 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
+ }
37526
37569
  }
37527
37570
  function clear2() {
37528
37571
  cache = void 0;
37529
37572
  }
37530
37573
  function entries() {
37531
- const iter = cache == null ? void 0 : cache.entries();
37532
- return iter ? arrayFrom(iter) : [];
37533
- }
37534
- function getInternalMap() {
37535
- return cache;
37574
+ return cache == null ? void 0 : cache.entries();
37536
37575
  }
37537
37576
  }
37538
37577
  function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
@@ -42464,7 +42503,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
42464
42503
  if (!moduleSourceFile)
42465
42504
  return { moduleSpecifiers: emptyArray, computedWithoutCache };
42466
42505
  computedWithoutCache = true;
42467
- modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.path, moduleSourceFile.originalFileName, host));
42506
+ modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.fileName, moduleSourceFile.originalFileName, host));
42468
42507
  const result = computeModuleSpecifiers(
42469
42508
  modulePaths,
42470
42509
  compilerOptions,
@@ -42478,7 +42517,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
42478
42517
  return { moduleSpecifiers: result, computedWithoutCache };
42479
42518
  }
42480
42519
  function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
42481
- const info = getInfo(importingSourceFile.path, host);
42520
+ const info = getInfo(importingSourceFile.fileName, host);
42482
42521
  const preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
42483
42522
  const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
42484
42523
  host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
@@ -42542,6 +42581,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
42542
42581
  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);
42543
42582
  }
42544
42583
  function getInfo(importingSourceFileName, host) {
42584
+ importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
42545
42585
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : true);
42546
42586
  const sourceDirectory = getDirectoryPath(importingSourceFileName);
42547
42587
  return { getCanonicalFileName, importingSourceFileName, sourceDirectory };
@@ -42576,7 +42616,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
42576
42616
  if (relativePreference === 3 /* ExternalNonRelative */ && !pathIsRelative(maybeNonRelative)) {
42577
42617
  const projectDirectory = compilerOptions.configFilePath ? toPath(getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory());
42578
42618
  const modulePath = toPath(moduleFileName, projectDirectory, getCanonicalFileName);
42579
- const sourceIsInternal = startsWith(sourceDirectory, projectDirectory);
42619
+ const sourceIsInternal = startsWith(info.getCanonicalFileName(sourceDirectory), projectDirectory);
42580
42620
  const targetIsInternal = startsWith(modulePath, projectDirectory);
42581
42621
  if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
42582
42622
  return maybeNonRelative;
@@ -42649,8 +42689,9 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
42649
42689
  });
42650
42690
  return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
42651
42691
  }
42652
- function getAllModulePaths(importingFilePath, importedFileName, host, preferences, options = {}) {
42692
+ function getAllModulePaths(importingFileName, importedFileName, host, preferences, options = {}) {
42653
42693
  var _a;
42694
+ const importingFilePath = toPath(importingFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
42654
42695
  const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
42655
42696
  const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
42656
42697
  if (cache) {
@@ -42658,7 +42699,7 @@ function getAllModulePaths(importingFilePath, importedFileName, host, preference
42658
42699
  if (cached == null ? void 0 : cached.modulePaths)
42659
42700
  return cached.modulePaths;
42660
42701
  }
42661
- const modulePaths = getAllModulePathsWorker(importingFilePath, importedFileName, host);
42702
+ const modulePaths = getAllModulePathsWorker(importingFileName, importedFileName, host);
42662
42703
  if (cache) {
42663
42704
  cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
42664
42705
  }
@@ -42681,7 +42722,7 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
42681
42722
  }
42682
42723
  );
42683
42724
  const sortedPaths = [];
42684
- for (let directory = getDirectoryPath(importingFileName); allFileNames.size !== 0; ) {
42725
+ for (let directory = getDirectoryPath(getCanonicalFileName(importingFileName)); allFileNames.size !== 0; ) {
42685
42726
  const directoryStart = ensureTrailingDirectorySeparator(directory);
42686
42727
  let pathsInDirectory;
42687
42728
  allFileNames.forEach(({ path, isRedirect, isInNodeModules }, fileName) => {
@@ -42702,7 +42743,10 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
42702
42743
  directory = newDirectory;
42703
42744
  }
42704
42745
  if (allFileNames.size) {
42705
- const remainingPaths = arrayFrom(allFileNames.values());
42746
+ const remainingPaths = arrayFrom(
42747
+ allFileNames.entries(),
42748
+ ([fileName, { isRedirect, isInNodeModules }]) => ({ path: fileName, isRedirect, isInNodeModules })
42749
+ );
42706
42750
  if (remainingPaths.length > 1)
42707
42751
  remainingPaths.sort(comparePathsByRedirectAndNumberOfDirectorySeparators);
42708
42752
  sortedPaths.push(...remainingPaths);
@@ -42906,7 +42950,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
42906
42950
  }
42907
42951
  const globalTypingsCacheLocation = host.getGlobalTypingsCacheLocation && host.getGlobalTypingsCacheLocation();
42908
42952
  const pathToTopLevelNodeModules = getCanonicalFileName(moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex));
42909
- if (!(startsWith(sourceDirectory, pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
42953
+ if (!(startsWith(getCanonicalFileName(sourceDirectory), pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
42910
42954
  return void 0;
42911
42955
  }
42912
42956
  const nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
@@ -54201,7 +54245,12 @@ function createTypeChecker(host) {
54201
54245
  const checkType = type.checkType;
54202
54246
  const constraint = getLowerBoundOfKeyType(checkType);
54203
54247
  if (constraint !== checkType) {
54204
- return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
54248
+ return getConditionalTypeInstantiation(
54249
+ type,
54250
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
54251
+ /*forConstraint*/
54252
+ false
54253
+ );
54205
54254
  }
54206
54255
  }
54207
54256
  return type;
@@ -54553,7 +54602,12 @@ function createTypeChecker(host) {
54553
54602
  );
54554
54603
  const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
54555
54604
  if (constraint && constraint !== type.checkType) {
54556
- const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
54605
+ const instantiated = getConditionalTypeInstantiation(
54606
+ type,
54607
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
54608
+ /*forConstraint*/
54609
+ true
54610
+ );
54557
54611
  if (!(instantiated.flags & 131072 /* Never */)) {
54558
54612
  type.resolvedConstraintOfDistributive = instantiated;
54559
54613
  return instantiated;
@@ -57421,19 +57475,17 @@ function createTypeChecker(host) {
57421
57475
  return constraintType;
57422
57476
  }
57423
57477
  const keyTypes = [];
57424
- if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
57425
- if (!isGenericIndexType(constraintType)) {
57426
- const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
57427
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
57428
- } else {
57478
+ if (isGenericIndexType(constraintType)) {
57479
+ if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
57429
57480
  return getIndexTypeForGenericType(type, indexFlags);
57430
57481
  }
57482
+ forEachType(constraintType, addMemberForKeyType);
57483
+ } else if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
57484
+ const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
57485
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
57431
57486
  } else {
57432
57487
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
57433
57488
  }
57434
- if (isGenericIndexType(constraintType)) {
57435
- forEachType(constraintType, addMemberForKeyType);
57436
- }
57437
57489
  const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
57438
57490
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
57439
57491
  return constraintType;
@@ -57581,7 +57633,7 @@ function createTypeChecker(host) {
57581
57633
  return type;
57582
57634
  function addSpans(texts2, types2) {
57583
57635
  for (let i = 0; i < types2.length; i++) {
57584
- const t = stripObjectTypeTags(types2[i]);
57636
+ const t = types2[i];
57585
57637
  if (t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) {
57586
57638
  text += getTemplateStringForType(t) || "";
57587
57639
  text += texts2[i + 1];
@@ -57601,15 +57653,6 @@ function createTypeChecker(host) {
57601
57653
  return true;
57602
57654
  }
57603
57655
  }
57604
- function stripObjectTypeTags(type) {
57605
- if (type.flags & 2097152 /* Intersection */) {
57606
- const nonObjectTypes = filter(type.types, (t) => !(t.flags & 524288 /* Object */));
57607
- if (nonObjectTypes !== type.types) {
57608
- return getIntersectionType(nonObjectTypes);
57609
- }
57610
- }
57611
- return type;
57612
- }
57613
57656
  function getTemplateStringForType(type) {
57614
57657
  return type.flags & 128 /* StringLiteral */ ? type.value : type.flags & 256 /* NumberLiteral */ ? "" + type.value : type.flags & 2048 /* BigIntLiteral */ ? pseudoBigIntToString(type.value) : type.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) ? type.intrinsicName : void 0;
57615
57658
  }
@@ -57908,7 +57951,18 @@ function createTypeChecker(host) {
57908
57951
  return accessNode.kind === 212 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.kind === 199 /* IndexedAccessType */ ? accessNode.indexType : accessNode.kind === 167 /* ComputedPropertyName */ ? accessNode.expression : accessNode;
57909
57952
  }
57910
57953
  function isPatternLiteralPlaceholderType(type) {
57911
- return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || isPatternLiteralType(type) || type.flags & 2097152 /* Intersection */ && every(type.types, isPatternLiteralType));
57954
+ if (type.flags & 2097152 /* Intersection */) {
57955
+ let seenPlaceholder = false;
57956
+ for (const t of type.types) {
57957
+ if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
57958
+ seenPlaceholder = true;
57959
+ } else if (!(t.flags & 524288 /* Object */)) {
57960
+ return false;
57961
+ }
57962
+ }
57963
+ return seenPlaceholder;
57964
+ }
57965
+ return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
57912
57966
  }
57913
57967
  function isPatternLiteralType(type) {
57914
57968
  return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
@@ -58116,7 +58170,7 @@ function createTypeChecker(host) {
58116
58170
  function isDeferredType(type, checkTuples) {
58117
58171
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
58118
58172
  }
58119
- function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
58173
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
58120
58174
  let result;
58121
58175
  let extraTypes;
58122
58176
  let tailCount = 0;
@@ -58162,7 +58216,7 @@ function createTypeChecker(host) {
58162
58216
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
58163
58217
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
58164
58218
  if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
58165
- if (checkType.flags & 1 /* Any */) {
58219
+ if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
58166
58220
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
58167
58221
  }
58168
58222
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -58272,7 +58326,9 @@ function createTypeChecker(host) {
58272
58326
  links.resolvedType = getConditionalType(
58273
58327
  root,
58274
58328
  /*mapper*/
58275
- void 0
58329
+ void 0,
58330
+ /*forConstraint*/
58331
+ false
58276
58332
  );
58277
58333
  if (outerTypeParameters) {
58278
58334
  root.instantiations = /* @__PURE__ */ new Map();
@@ -59127,17 +59183,17 @@ function createTypeChecker(host) {
59127
59183
  result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
59128
59184
  return result;
59129
59185
  }
59130
- function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
59186
+ function getConditionalTypeInstantiation(type, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
59131
59187
  const root = type.root;
59132
59188
  if (root.outerTypeParameters) {
59133
59189
  const typeArguments = map(root.outerTypeParameters, (t) => getMappedType(t, mapper));
59134
- const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
59190
+ const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
59135
59191
  let result = root.instantiations.get(id);
59136
59192
  if (!result) {
59137
59193
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
59138
59194
  const checkType = root.checkType;
59139
59195
  const distributionType = root.isDistributive ? getMappedType(checkType, newMapper) : void 0;
59140
- 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);
59196
+ 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);
59141
59197
  root.instantiations.set(id, result);
59142
59198
  }
59143
59199
  return result;
@@ -59225,7 +59281,14 @@ function createTypeChecker(host) {
59225
59281
  );
59226
59282
  }
59227
59283
  if (flags & 16777216 /* Conditional */) {
59228
- return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
59284
+ return getConditionalTypeInstantiation(
59285
+ type,
59286
+ combineTypeMappers(type.mapper, mapper),
59287
+ /*forConstraint*/
59288
+ false,
59289
+ aliasSymbol,
59290
+ aliasTypeArguments
59291
+ );
59229
59292
  }
59230
59293
  if (flags & 33554432 /* Substitution */) {
59231
59294
  const newBaseType = instantiateType(type.baseType, mapper);
@@ -60869,7 +60932,7 @@ function createTypeChecker(host) {
60869
60932
  return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState);
60870
60933
  }
60871
60934
  if (target2.flags & 1048576 /* Union */) {
60872
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */));
60935
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState);
60873
60936
  }
60874
60937
  if (target2.flags & 2097152 /* Intersection */) {
60875
60938
  return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
@@ -60914,7 +60977,8 @@ function createTypeChecker(host) {
60914
60977
  sourceType,
60915
60978
  target2,
60916
60979
  /*reportErrors*/
60917
- false
60980
+ false,
60981
+ 0 /* None */
60918
60982
  );
60919
60983
  if (!related) {
60920
60984
  return 0 /* False */;
@@ -60923,7 +60987,7 @@ function createTypeChecker(host) {
60923
60987
  }
60924
60988
  return result2;
60925
60989
  }
60926
- function typeRelatedToSomeType(source2, target2, reportErrors2) {
60990
+ function typeRelatedToSomeType(source2, target2, reportErrors2, intersectionState) {
60927
60991
  const targetTypes = target2.types;
60928
60992
  if (target2.flags & 1048576 /* Union */) {
60929
60993
  if (containsType(targetTypes, source2)) {
@@ -60941,7 +61005,10 @@ function createTypeChecker(host) {
60941
61005
  match,
60942
61006
  2 /* Target */,
60943
61007
  /*reportErrors*/
60944
- false
61008
+ false,
61009
+ /*headMessage*/
61010
+ void 0,
61011
+ intersectionState
60945
61012
  );
60946
61013
  if (related) {
60947
61014
  return related;
@@ -60954,7 +61021,10 @@ function createTypeChecker(host) {
60954
61021
  type,
60955
61022
  2 /* Target */,
60956
61023
  /*reportErrors*/
60957
- false
61024
+ false,
61025
+ /*headMessage*/
61026
+ void 0,
61027
+ intersectionState
60958
61028
  );
60959
61029
  if (related) {
60960
61030
  return related;
@@ -60968,7 +61038,10 @@ function createTypeChecker(host) {
60968
61038
  bestMatchingType,
60969
61039
  2 /* Target */,
60970
61040
  /*reportErrors*/
60971
- true
61041
+ true,
61042
+ /*headMessage*/
61043
+ void 0,
61044
+ intersectionState
60972
61045
  );
60973
61046
  }
60974
61047
  }
@@ -61766,13 +61839,6 @@ function createTypeChecker(host) {
61766
61839
  return result2;
61767
61840
  }
61768
61841
  }
61769
- } else {
61770
- const distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
61771
- if (distributiveConstraint) {
61772
- if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
61773
- return result2;
61774
- }
61775
- }
61776
61842
  }
61777
61843
  const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
61778
61844
  if (defaultConstraint) {
@@ -61780,6 +61846,13 @@ function createTypeChecker(host) {
61780
61846
  return result2;
61781
61847
  }
61782
61848
  }
61849
+ const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
61850
+ if (distributiveConstraint) {
61851
+ resetErrorInfo(saveErrorInfo);
61852
+ if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
61853
+ return result2;
61854
+ }
61855
+ }
61783
61856
  } else {
61784
61857
  if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) {
61785
61858
  return -1 /* True */;
@@ -107945,8 +108018,8 @@ function transformDeclarations(context) {
107945
108018
  const specifier = getModuleSpecifier(
107946
108019
  options,
107947
108020
  currentSourceFile,
107948
- toPath(outputFilePath2, host.getCurrentDirectory(), host.getCanonicalFileName),
107949
- toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName),
108021
+ getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
108022
+ getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
107950
108023
  host
107951
108024
  );
107952
108025
  if (!pathIsRelative(specifier)) {
@@ -115372,8 +115445,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
115372
115445
  }
115373
115446
  const baseName = getBaseNameOfFileName(fileOrDirectory);
115374
115447
  const fsQueryResult = {
115375
- fileExists: host.fileExists(fileOrDirectoryPath),
115376
- directoryExists: host.directoryExists(fileOrDirectoryPath)
115448
+ fileExists: host.fileExists(fileOrDirectory),
115449
+ directoryExists: host.directoryExists(fileOrDirectory)
115377
115450
  };
115378
115451
  if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
115379
115452
  clearCache();
@@ -115456,11 +115529,9 @@ function cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, t
115456
115529
  });
115457
115530
  }
115458
115531
  function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) {
115459
- const missingFilePaths = program.getMissingFilePaths();
115460
- const newMissingFilePathMap = arrayToMap(missingFilePaths, identity, returnTrue);
115461
115532
  mutateMap(
115462
115533
  missingFileWatches,
115463
- newMissingFilePathMap,
115534
+ program.getMissingFilePaths(),
115464
115535
  {
115465
115536
  // Watch the missing files
115466
115537
  createNewValue: createMissingFileWatch,
@@ -116287,7 +116358,8 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
116287
116358
  return false;
116288
116359
  if (program.getSourceFiles().some(sourceFileNotUptoDate))
116289
116360
  return false;
116290
- if (program.getMissingFilePaths().some(fileExists))
116361
+ const missingPaths = program.getMissingFilePaths();
116362
+ if (missingPaths && forEachEntry(missingPaths, fileExists))
116291
116363
  return false;
116292
116364
  const currentOptions = program.getCompilerOptions();
116293
116365
  if (!compareDataObjects(currentOptions, newOptions))
@@ -116587,7 +116659,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116587
116659
  let redirectTargetsMap = createMultiMap();
116588
116660
  let usesUriStyleNodeCoreModules = false;
116589
116661
  const filesByName = /* @__PURE__ */ new Map();
116590
- let missingFilePaths;
116662
+ let missingFileNames = /* @__PURE__ */ new Map();
116591
116663
  const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
116592
116664
  let resolvedProjectReferences;
116593
116665
  let projectReferenceRedirects;
@@ -116706,12 +116778,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116706
116778
  });
116707
116779
  }
116708
116780
  }
116709
- missingFilePaths = arrayFrom(mapDefinedIterator(filesByName.entries(), ([path, file]) => file === void 0 ? path : void 0));
116710
116781
  files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
116711
116782
  processingDefaultLibFiles = void 0;
116712
116783
  processingOtherFiles = void 0;
116713
116784
  }
116714
- Debug.assert(!!missingFilePaths);
116715
116785
  if (oldProgram && host.onReleaseOldSourceFile) {
116716
116786
  const oldSourceFiles = oldProgram.getSourceFiles();
116717
116787
  for (const oldSourceFile of oldSourceFiles) {
@@ -116756,8 +116826,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116756
116826
  getSourceFile,
116757
116827
  getSourceFileByPath,
116758
116828
  getSourceFiles: () => files,
116759
- getMissingFilePaths: () => missingFilePaths,
116760
- // TODO: GH#18217
116829
+ getMissingFilePaths: () => missingFileNames,
116761
116830
  getModuleResolutionCache: () => moduleResolutionCache,
116762
116831
  getFilesByNameMap: () => filesByName,
116763
116832
  getCompilerOptions: () => options,
@@ -117184,7 +117253,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117184
117253
  const newSourceFiles = [];
117185
117254
  const modifiedSourceFiles = [];
117186
117255
  structureIsReused = 2 /* Completely */;
117187
- if (oldProgram.getMissingFilePaths().some((missingFilePath) => host.fileExists(missingFilePath))) {
117256
+ if (forEachEntry(oldProgram.getMissingFilePaths(), (missingFilePath) => host.fileExists(missingFilePath))) {
117188
117257
  return 0 /* Not */;
117189
117258
  }
117190
117259
  const oldSourceFiles = oldProgram.getSourceFiles();
@@ -117324,7 +117393,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117324
117393
  if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
117325
117394
  return 1 /* SafeModules */;
117326
117395
  }
117327
- missingFilePaths = oldProgram.getMissingFilePaths();
117396
+ missingFileNames = oldProgram.getMissingFilePaths();
117328
117397
  Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
117329
117398
  for (const newSourceFile of newSourceFiles) {
117330
117399
  filesByName.set(newSourceFile.path, newSourceFile);
@@ -117381,7 +117450,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117381
117450
  const path = toPath3(f);
117382
117451
  if (getSourceFileByPath(path))
117383
117452
  return true;
117384
- if (contains(missingFilePaths, path))
117453
+ if (missingFileNames.has(path))
117385
117454
  return false;
117386
117455
  return host.fileExists(f);
117387
117456
  },
@@ -118193,6 +118262,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118193
118262
  addFileToFilesByName(
118194
118263
  file2,
118195
118264
  path,
118265
+ fileName,
118196
118266
  /*redirectedPath*/
118197
118267
  void 0
118198
118268
  );
@@ -118265,7 +118335,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118265
118335
  if (fileFromPackageId) {
118266
118336
  const dupFile = createRedirectedSourceFile(fileFromPackageId, file, fileName, path, toPath3(fileName), originalFileName, sourceFileOptions);
118267
118337
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
118268
- addFileToFilesByName(dupFile, path, redirectedPath);
118338
+ addFileToFilesByName(dupFile, path, fileName, redirectedPath);
118269
118339
  addFileIncludeReason(dupFile, reason);
118270
118340
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
118271
118341
  processingOtherFiles.push(dupFile);
@@ -118275,7 +118345,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118275
118345
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
118276
118346
  }
118277
118347
  }
118278
- addFileToFilesByName(file, path, redirectedPath);
118348
+ addFileToFilesByName(file, path, fileName, redirectedPath);
118279
118349
  if (file) {
118280
118350
  sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
118281
118351
  file.fileName = fileName;
@@ -118315,14 +118385,21 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118315
118385
  if (file)
118316
118386
  fileReasons.add(file.path, reason);
118317
118387
  }
118318
- function addFileToFilesByName(file, path, redirectedPath) {
118388
+ function addFileToFilesByName(file, path, fileName, redirectedPath) {
118319
118389
  if (redirectedPath) {
118320
- filesByName.set(redirectedPath, file);
118321
- filesByName.set(path, file || false);
118390
+ updateFilesByNameMap(fileName, redirectedPath, file);
118391
+ updateFilesByNameMap(fileName, path, file || false);
118322
118392
  } else {
118323
- filesByName.set(path, file);
118393
+ updateFilesByNameMap(fileName, path, file);
118324
118394
  }
118325
118395
  }
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
+ }
118326
118403
  function getProjectReferenceRedirect(fileName) {
118327
118404
  const referencedProject = getProjectReferenceRedirectProject(fileName);
118328
118405
  return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
@@ -118643,6 +118720,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118643
118720
  /*file*/
118644
118721
  void 0,
118645
118722
  sourceFilePath,
118723
+ refPath,
118646
118724
  /*redirectedPath*/
118647
118725
  void 0
118648
118726
  );
@@ -118654,6 +118732,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118654
118732
  addFileToFilesByName(
118655
118733
  sourceFile,
118656
118734
  sourceFilePath,
118735
+ refPath,
118657
118736
  /*redirectedPath*/
118658
118737
  void 0
118659
118738
  );
@@ -118663,6 +118742,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118663
118742
  addFileToFilesByName(
118664
118743
  sourceFile,
118665
118744
  sourceFilePath,
118745
+ refPath,
118666
118746
  /*redirectedPath*/
118667
118747
  void 0
118668
118748
  );
@@ -122164,7 +122244,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122164
122244
  const watcher = {
122165
122245
  watcher: canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
122166
122246
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
122167
- invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache().getInternalMap());
122247
+ invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache());
122168
122248
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
122169
122249
  }) : noopFileWatcher,
122170
122250
  resolutions: isSymlink ? 0 : resolutions,
@@ -122204,7 +122284,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122204
122284
  if (watcher == null ? void 0 : watcher.files)
122205
122285
  (affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path);
122206
122286
  (_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
122207
- packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
122287
+ packageJsonMap.deletePackageJsonInfo(path);
122208
122288
  }
122209
122289
  function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
122210
122290
  const program = resolutionHost.getCurrentProgram();
@@ -122389,9 +122469,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122389
122469
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
122390
122470
  }
122391
122471
  function invalidatePackageJsonMap() {
122392
- const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
122472
+ const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().entries();
122393
122473
  if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
122394
- packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
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
+ }
122395
122480
  }
122396
122481
  }
122397
122482
  function invalidateResolutionsOfFailedLookupLocations() {
@@ -123408,7 +123493,11 @@ function createWatchProgram(host) {
123408
123493
  const oldProgram = getCurrentProgram();
123409
123494
  builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
123410
123495
  resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
123411
- updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()), watchMissingFilePath);
123496
+ updateMissingFilePathsWatch(
123497
+ builderProgram.getProgram(),
123498
+ missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()),
123499
+ watchMissingFilePath
123500
+ );
123412
123501
  if (needsUpdateInTypeRootWatch) {
123413
123502
  resolutionCache.updateTypeRootsWatch();
123414
123503
  }
@@ -123701,8 +123790,15 @@ function createWatchProgram(host) {
123701
123790
  cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
123702
123791
  }
123703
123792
  }
123704
- function watchMissingFilePath(missingFilePath) {
123705
- return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(missingFilePath, missingFilePath, onMissingFileChange, 500 /* Medium */, watchOptions, WatchType.MissingFile);
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
+ );
123706
123802
  }
123707
123803
  function onMissingFileChange(fileName, eventKind, missingFilePath) {
123708
123804
  updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
@@ -124177,6 +124273,7 @@ function createStateBuildOrder(state) {
124177
124273
  mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124178
124274
  mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124179
124275
  mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124276
+ mutateMapSkippingNewValues(state.lastCachedPackageJsonLookups, currentProjects, noopOnDelete);
124180
124277
  if (state.watch) {
124181
124278
  mutateMapSkippingNewValues(
124182
124279
  state.allWatchedConfigFiles,
@@ -124425,7 +124522,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
124425
124522
  return withProgramOrUndefined(action) || emptyArray;
124426
124523
  }
124427
124524
  function createProgram2() {
124428
- var _a, _b;
124525
+ var _a, _b, _c;
124429
124526
  Debug.assert(program === void 0);
124430
124527
  if (state.options.dry) {
124431
124528
  reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
@@ -124454,12 +124551,16 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
124454
124551
  config.projectReferences
124455
124552
  );
124456
124553
  if (state.watch) {
124554
+ const entries = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().entries();
124457
124555
  state.lastCachedPackageJsonLookups.set(
124458
124556
  projectPath,
124459
- state.moduleResolutionCache && map(
124460
- state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
124461
- ([path, data]) => [state.host.realpath && data ? toPath2(state, state.host.realpath(path)) : path, data]
124462
- )
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
+ ))
124463
124564
  );
124464
124565
  state.builderPrograms.set(projectPath, program);
124465
124566
  }
@@ -125192,9 +125293,10 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
125192
125293
  const extendedConfigStatus = forEach(project.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName));
125193
125294
  if (extendedConfigStatus)
125194
125295
  return extendedConfigStatus;
125195
- const dependentPackageFileStatus = forEach(
125196
- state.lastCachedPackageJsonLookups.get(resolvedPath) || emptyArray,
125197
- ([path]) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
125296
+ const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath);
125297
+ const dependentPackageFileStatus = packageJsonLookups && forEachEntry(
125298
+ packageJsonLookups,
125299
+ (path) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
125198
125300
  );
125199
125301
  if (dependentPackageFileStatus)
125200
125302
  return dependentPackageFileStatus;
@@ -125605,9 +125707,9 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
125605
125707
  getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath),
125606
125708
  new Map(state.lastCachedPackageJsonLookups.get(resolvedPath)),
125607
125709
  {
125608
- createNewValue: (path, _input) => watchFile(
125710
+ createNewValue: (_path, input) => watchFile(
125609
125711
  state,
125610
- path,
125712
+ input,
125611
125713
  () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
125612
125714
  2e3 /* High */,
125613
125715
  parsed == null ? void 0 : parsed.watchOptions,