@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/tsserver.js CHANGED
@@ -724,6 +724,7 @@ __export(server_exports, {
724
724
  getDirectoryToWatchFailedLookupLocation: () => getDirectoryToWatchFailedLookupLocation,
725
725
  getDirectoryToWatchFailedLookupLocationFromTypeRoot: () => getDirectoryToWatchFailedLookupLocationFromTypeRoot,
726
726
  getDocumentPositionMapper: () => getDocumentPositionMapper,
727
+ getDocumentSpansEqualityComparer: () => getDocumentSpansEqualityComparer,
727
728
  getESModuleInterop: () => getESModuleInterop,
728
729
  getEditsForFileRename: () => getEditsForFileRename,
729
730
  getEffectiveBaseTypeNode: () => getEffectiveBaseTypeNode,
@@ -2330,7 +2331,7 @@ module.exports = __toCommonJS(server_exports);
2330
2331
 
2331
2332
  // src/compiler/corePublic.ts
2332
2333
  var versionMajorMinor = "5.4";
2333
- var version = `${versionMajorMinor}.0-insiders.20231120`;
2334
+ var version = `${versionMajorMinor}.0-insiders.20231121`;
2334
2335
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2335
2336
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2336
2337
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -41247,34 +41248,39 @@ function specToDiagnostic(spec, disallowTrailingRecursion) {
41247
41248
  return [Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
41248
41249
  }
41249
41250
  }
41250
- function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, path, useCaseSensitiveFileNames2) {
41251
- const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude");
41251
+ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, basePath, useCaseSensitiveFileNames2) {
41252
+ const rawExcludeRegex = getRegularExpressionForWildcard(exclude, basePath, "exclude");
41252
41253
  const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames2 ? "" : "i");
41253
41254
  const wildcardDirectories = {};
41255
+ const wildCardKeyToPath = /* @__PURE__ */ new Map();
41254
41256
  if (include !== void 0) {
41255
41257
  const recursiveKeys = [];
41256
41258
  for (const file of include) {
41257
- const spec = normalizePath(combinePaths(path, file));
41259
+ const spec = normalizePath(combinePaths(basePath, file));
41258
41260
  if (excludeRegex && excludeRegex.test(spec)) {
41259
41261
  continue;
41260
41262
  }
41261
41263
  const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
41262
41264
  if (match) {
41263
- const { key, flags } = match;
41264
- const existingFlags = wildcardDirectories[key];
41265
+ const { key, path, flags } = match;
41266
+ const existingPath = wildCardKeyToPath.get(key);
41267
+ const existingFlags = existingPath !== void 0 ? wildcardDirectories[existingPath] : void 0;
41265
41268
  if (existingFlags === void 0 || existingFlags < flags) {
41266
- wildcardDirectories[key] = flags;
41269
+ wildcardDirectories[existingPath !== void 0 ? existingPath : path] = flags;
41270
+ if (existingPath === void 0)
41271
+ wildCardKeyToPath.set(key, path);
41267
41272
  if (flags === 1 /* Recursive */) {
41268
41273
  recursiveKeys.push(key);
41269
41274
  }
41270
41275
  }
41271
41276
  }
41272
41277
  }
41273
- for (const key in wildcardDirectories) {
41274
- if (hasProperty(wildcardDirectories, key)) {
41278
+ for (const path in wildcardDirectories) {
41279
+ if (hasProperty(wildcardDirectories, path)) {
41275
41280
  for (const recursiveKey of recursiveKeys) {
41276
- if (key !== recursiveKey && containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames2)) {
41277
- delete wildcardDirectories[key];
41281
+ const key = toCanonicalKey(path, useCaseSensitiveFileNames2);
41282
+ if (key !== recursiveKey && containsPath(recursiveKey, key, basePath, !useCaseSensitiveFileNames2)) {
41283
+ delete wildcardDirectories[path];
41278
41284
  }
41279
41285
  }
41280
41286
  }
@@ -41282,6 +41288,9 @@ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExclu
41282
41288
  }
41283
41289
  return wildcardDirectories;
41284
41290
  }
41291
+ function toCanonicalKey(path, useCaseSensitiveFileNames2) {
41292
+ return useCaseSensitiveFileNames2 ? path : toFileNameLowerCase(path);
41293
+ }
41285
41294
  function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
41286
41295
  const match = wildcardDirectoryPattern.exec(spec);
41287
41296
  if (match) {
@@ -41289,13 +41298,16 @@ function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
41289
41298
  const starWildcardIndex = spec.indexOf("*");
41290
41299
  const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator);
41291
41300
  return {
41292
- key: useCaseSensitiveFileNames2 ? match[0] : toFileNameLowerCase(match[0]),
41301
+ key: toCanonicalKey(match[0], useCaseSensitiveFileNames2),
41302
+ path: match[0],
41293
41303
  flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 /* Recursive */ : 0 /* None */
41294
41304
  };
41295
41305
  }
41296
41306
  if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) {
41307
+ const path = removeTrailingDirectorySeparator(spec);
41297
41308
  return {
41298
- key: removeTrailingDirectorySeparator(useCaseSensitiveFileNames2 ? spec : toFileNameLowerCase(spec)),
41309
+ key: toCanonicalKey(path, useCaseSensitiveFileNames2),
41310
+ path,
41299
41311
  flags: 1 /* Recursive */
41300
41312
  };
41301
41313
  }
@@ -42042,22 +42054,50 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
42042
42054
  }
42043
42055
  function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
42044
42056
  let cache;
42045
- return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2, entries, getInternalMap };
42057
+ let canonicalPathToCacheKey;
42058
+ return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, deletePackageJsonInfo, clear: clear2, entries };
42046
42059
  function getPackageJsonInfo2(packageJsonPath) {
42047
- return cache == null ? void 0 : cache.get(toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
42060
+ if (!cache)
42061
+ return void 0;
42062
+ const absolute = getNormalizedAbsolutePath(packageJsonPath, currentDirectory);
42063
+ const result = cache.get(absolute);
42064
+ if (result !== void 0)
42065
+ return result;
42066
+ if (!canonicalPathToCacheKey)
42067
+ return void 0;
42068
+ const path = getCanonicalFileName(absolute);
42069
+ if (path === absolute)
42070
+ return void 0;
42071
+ const cacheKey = canonicalPathToCacheKey.get(path);
42072
+ return cacheKey !== void 0 ? cache.get(cacheKey) : void 0;
42048
42073
  }
42049
42074
  function setPackageJsonInfo(packageJsonPath, info) {
42050
- (cache || (cache = /* @__PURE__ */ new Map())).set(toPath(packageJsonPath, currentDirectory, getCanonicalFileName), info);
42075
+ const absolute = getNormalizedAbsolutePath(packageJsonPath, currentDirectory);
42076
+ (cache || (cache = /* @__PURE__ */ new Map())).set(absolute, info);
42077
+ const path = getCanonicalFileName(absolute);
42078
+ if (path !== absolute) {
42079
+ (canonicalPathToCacheKey ?? (canonicalPathToCacheKey = /* @__PURE__ */ new Map())).set(path, absolute);
42080
+ }
42081
+ }
42082
+ function deletePackageJsonInfo(packageJsonPath) {
42083
+ if (!cache)
42084
+ return;
42085
+ const absolute = getNormalizedAbsolutePath(packageJsonPath, currentDirectory);
42086
+ cache.delete(absolute);
42087
+ if (canonicalPathToCacheKey) {
42088
+ const path = getCanonicalFileName(absolute);
42089
+ const cacheKey = canonicalPathToCacheKey.get(path);
42090
+ if (cacheKey !== void 0) {
42091
+ cache.delete(cacheKey);
42092
+ canonicalPathToCacheKey.delete(path);
42093
+ }
42094
+ }
42051
42095
  }
42052
42096
  function clear2() {
42053
42097
  cache = void 0;
42054
42098
  }
42055
42099
  function entries() {
42056
- const iter = cache == null ? void 0 : cache.entries();
42057
- return iter ? arrayFrom(iter) : [];
42058
- }
42059
- function getInternalMap() {
42060
- return cache;
42100
+ return cache == null ? void 0 : cache.entries();
42061
42101
  }
42062
42102
  }
42063
42103
  function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
@@ -47111,8 +47151,8 @@ function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourc
47111
47151
  return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getPreferences({}, compilerOptions, importingSourceFile), {}, options);
47112
47152
  }
47113
47153
  function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
47114
- const info = getInfo(importingSourceFile.path, host);
47115
- const modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options);
47154
+ const info = getInfo(importingSourceFile.fileName, host);
47155
+ const modulePaths = getAllModulePaths(importingSourceFile.fileName, nodeModulesFileName, host, preferences, options);
47116
47156
  return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
47117
47157
  modulePath,
47118
47158
  info,
@@ -47189,7 +47229,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
47189
47229
  if (!moduleSourceFile)
47190
47230
  return { moduleSpecifiers: emptyArray, computedWithoutCache };
47191
47231
  computedWithoutCache = true;
47192
- modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.path, moduleSourceFile.originalFileName, host));
47232
+ modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.fileName, moduleSourceFile.originalFileName, host));
47193
47233
  const result = computeModuleSpecifiers(
47194
47234
  modulePaths,
47195
47235
  compilerOptions,
@@ -47203,7 +47243,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
47203
47243
  return { moduleSpecifiers: result, computedWithoutCache };
47204
47244
  }
47205
47245
  function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
47206
- const info = getInfo(importingSourceFile.path, host);
47246
+ const info = getInfo(importingSourceFile.fileName, host);
47207
47247
  const preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
47208
47248
  const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
47209
47249
  host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
@@ -47267,6 +47307,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
47267
47307
  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);
47268
47308
  }
47269
47309
  function getInfo(importingSourceFileName, host) {
47310
+ importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
47270
47311
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : true);
47271
47312
  const sourceDirectory = getDirectoryPath(importingSourceFileName);
47272
47313
  return { getCanonicalFileName, importingSourceFileName, sourceDirectory };
@@ -47301,7 +47342,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
47301
47342
  if (relativePreference === 3 /* ExternalNonRelative */ && !pathIsRelative(maybeNonRelative)) {
47302
47343
  const projectDirectory = compilerOptions.configFilePath ? toPath(getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory());
47303
47344
  const modulePath = toPath(moduleFileName, projectDirectory, getCanonicalFileName);
47304
- const sourceIsInternal = startsWith(sourceDirectory, projectDirectory);
47345
+ const sourceIsInternal = startsWith(info.getCanonicalFileName(sourceDirectory), projectDirectory);
47305
47346
  const targetIsInternal = startsWith(modulePath, projectDirectory);
47306
47347
  if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
47307
47348
  return maybeNonRelative;
@@ -47374,8 +47415,9 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
47374
47415
  });
47375
47416
  return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
47376
47417
  }
47377
- function getAllModulePaths(importingFilePath, importedFileName, host, preferences, options = {}) {
47418
+ function getAllModulePaths(importingFileName, importedFileName, host, preferences, options = {}) {
47378
47419
  var _a;
47420
+ const importingFilePath = toPath(importingFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
47379
47421
  const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
47380
47422
  const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
47381
47423
  if (cache) {
@@ -47383,7 +47425,7 @@ function getAllModulePaths(importingFilePath, importedFileName, host, preference
47383
47425
  if (cached == null ? void 0 : cached.modulePaths)
47384
47426
  return cached.modulePaths;
47385
47427
  }
47386
- const modulePaths = getAllModulePathsWorker(importingFilePath, importedFileName, host);
47428
+ const modulePaths = getAllModulePathsWorker(importingFileName, importedFileName, host);
47387
47429
  if (cache) {
47388
47430
  cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
47389
47431
  }
@@ -47406,7 +47448,7 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
47406
47448
  }
47407
47449
  );
47408
47450
  const sortedPaths = [];
47409
- for (let directory = getDirectoryPath(importingFileName); allFileNames.size !== 0; ) {
47451
+ for (let directory = getDirectoryPath(getCanonicalFileName(importingFileName)); allFileNames.size !== 0; ) {
47410
47452
  const directoryStart = ensureTrailingDirectorySeparator(directory);
47411
47453
  let pathsInDirectory;
47412
47454
  allFileNames.forEach(({ path, isRedirect, isInNodeModules }, fileName) => {
@@ -47427,7 +47469,10 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
47427
47469
  directory = newDirectory;
47428
47470
  }
47429
47471
  if (allFileNames.size) {
47430
- const remainingPaths = arrayFrom(allFileNames.values());
47472
+ const remainingPaths = arrayFrom(
47473
+ allFileNames.entries(),
47474
+ ([fileName, { isRedirect, isInNodeModules }]) => ({ path: fileName, isRedirect, isInNodeModules })
47475
+ );
47431
47476
  if (remainingPaths.length > 1)
47432
47477
  remainingPaths.sort(comparePathsByRedirectAndNumberOfDirectorySeparators);
47433
47478
  sortedPaths.push(...remainingPaths);
@@ -47631,7 +47676,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
47631
47676
  }
47632
47677
  const globalTypingsCacheLocation = host.getGlobalTypingsCacheLocation && host.getGlobalTypingsCacheLocation();
47633
47678
  const pathToTopLevelNodeModules = getCanonicalFileName(moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex));
47634
- if (!(startsWith(sourceDirectory, pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
47679
+ if (!(startsWith(getCanonicalFileName(sourceDirectory), pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
47635
47680
  return void 0;
47636
47681
  }
47637
47682
  const nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
@@ -58926,7 +58971,12 @@ function createTypeChecker(host) {
58926
58971
  const checkType = type.checkType;
58927
58972
  const constraint = getLowerBoundOfKeyType(checkType);
58928
58973
  if (constraint !== checkType) {
58929
- return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
58974
+ return getConditionalTypeInstantiation(
58975
+ type,
58976
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
58977
+ /*forConstraint*/
58978
+ false
58979
+ );
58930
58980
  }
58931
58981
  }
58932
58982
  return type;
@@ -59278,7 +59328,12 @@ function createTypeChecker(host) {
59278
59328
  );
59279
59329
  const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
59280
59330
  if (constraint && constraint !== type.checkType) {
59281
- const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
59331
+ const instantiated = getConditionalTypeInstantiation(
59332
+ type,
59333
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
59334
+ /*forConstraint*/
59335
+ true
59336
+ );
59282
59337
  if (!(instantiated.flags & 131072 /* Never */)) {
59283
59338
  type.resolvedConstraintOfDistributive = instantiated;
59284
59339
  return instantiated;
@@ -62146,19 +62201,17 @@ function createTypeChecker(host) {
62146
62201
  return constraintType;
62147
62202
  }
62148
62203
  const keyTypes = [];
62149
- if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
62150
- if (!isGenericIndexType(constraintType)) {
62151
- const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
62152
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
62153
- } else {
62204
+ if (isGenericIndexType(constraintType)) {
62205
+ if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
62154
62206
  return getIndexTypeForGenericType(type, indexFlags);
62155
62207
  }
62208
+ forEachType(constraintType, addMemberForKeyType);
62209
+ } else if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
62210
+ const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
62211
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
62156
62212
  } else {
62157
62213
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
62158
62214
  }
62159
- if (isGenericIndexType(constraintType)) {
62160
- forEachType(constraintType, addMemberForKeyType);
62161
- }
62162
62215
  const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
62163
62216
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
62164
62217
  return constraintType;
@@ -62306,7 +62359,7 @@ function createTypeChecker(host) {
62306
62359
  return type;
62307
62360
  function addSpans(texts2, types2) {
62308
62361
  for (let i = 0; i < types2.length; i++) {
62309
- const t = stripObjectTypeTags(types2[i]);
62362
+ const t = types2[i];
62310
62363
  if (t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) {
62311
62364
  text += getTemplateStringForType(t) || "";
62312
62365
  text += texts2[i + 1];
@@ -62326,15 +62379,6 @@ function createTypeChecker(host) {
62326
62379
  return true;
62327
62380
  }
62328
62381
  }
62329
- function stripObjectTypeTags(type) {
62330
- if (type.flags & 2097152 /* Intersection */) {
62331
- const nonObjectTypes = filter(type.types, (t) => !(t.flags & 524288 /* Object */));
62332
- if (nonObjectTypes !== type.types) {
62333
- return getIntersectionType(nonObjectTypes);
62334
- }
62335
- }
62336
- return type;
62337
- }
62338
62382
  function getTemplateStringForType(type) {
62339
62383
  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;
62340
62384
  }
@@ -62633,7 +62677,18 @@ function createTypeChecker(host) {
62633
62677
  return accessNode.kind === 212 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.kind === 199 /* IndexedAccessType */ ? accessNode.indexType : accessNode.kind === 167 /* ComputedPropertyName */ ? accessNode.expression : accessNode;
62634
62678
  }
62635
62679
  function isPatternLiteralPlaceholderType(type) {
62636
- return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || isPatternLiteralType(type) || type.flags & 2097152 /* Intersection */ && every(type.types, isPatternLiteralType));
62680
+ if (type.flags & 2097152 /* Intersection */) {
62681
+ let seenPlaceholder = false;
62682
+ for (const t of type.types) {
62683
+ if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
62684
+ seenPlaceholder = true;
62685
+ } else if (!(t.flags & 524288 /* Object */)) {
62686
+ return false;
62687
+ }
62688
+ }
62689
+ return seenPlaceholder;
62690
+ }
62691
+ return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
62637
62692
  }
62638
62693
  function isPatternLiteralType(type) {
62639
62694
  return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type);
@@ -62841,7 +62896,7 @@ function createTypeChecker(host) {
62841
62896
  function isDeferredType(type, checkTuples) {
62842
62897
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
62843
62898
  }
62844
- function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
62899
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
62845
62900
  let result;
62846
62901
  let extraTypes;
62847
62902
  let tailCount = 0;
@@ -62887,7 +62942,7 @@ function createTypeChecker(host) {
62887
62942
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
62888
62943
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
62889
62944
  if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
62890
- if (checkType.flags & 1 /* Any */) {
62945
+ if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
62891
62946
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
62892
62947
  }
62893
62948
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -62997,7 +63052,9 @@ function createTypeChecker(host) {
62997
63052
  links.resolvedType = getConditionalType(
62998
63053
  root,
62999
63054
  /*mapper*/
63000
- void 0
63055
+ void 0,
63056
+ /*forConstraint*/
63057
+ false
63001
63058
  );
63002
63059
  if (outerTypeParameters) {
63003
63060
  root.instantiations = /* @__PURE__ */ new Map();
@@ -63852,17 +63909,17 @@ function createTypeChecker(host) {
63852
63909
  result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
63853
63910
  return result;
63854
63911
  }
63855
- function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
63912
+ function getConditionalTypeInstantiation(type, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
63856
63913
  const root = type.root;
63857
63914
  if (root.outerTypeParameters) {
63858
63915
  const typeArguments = map(root.outerTypeParameters, (t) => getMappedType(t, mapper));
63859
- const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
63916
+ const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
63860
63917
  let result = root.instantiations.get(id);
63861
63918
  if (!result) {
63862
63919
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
63863
63920
  const checkType = root.checkType;
63864
63921
  const distributionType = root.isDistributive ? getMappedType(checkType, newMapper) : void 0;
63865
- 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);
63922
+ 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);
63866
63923
  root.instantiations.set(id, result);
63867
63924
  }
63868
63925
  return result;
@@ -63950,7 +64007,14 @@ function createTypeChecker(host) {
63950
64007
  );
63951
64008
  }
63952
64009
  if (flags & 16777216 /* Conditional */) {
63953
- return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
64010
+ return getConditionalTypeInstantiation(
64011
+ type,
64012
+ combineTypeMappers(type.mapper, mapper),
64013
+ /*forConstraint*/
64014
+ false,
64015
+ aliasSymbol,
64016
+ aliasTypeArguments
64017
+ );
63954
64018
  }
63955
64019
  if (flags & 33554432 /* Substitution */) {
63956
64020
  const newBaseType = instantiateType(type.baseType, mapper);
@@ -65594,7 +65658,7 @@ function createTypeChecker(host) {
65594
65658
  return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState);
65595
65659
  }
65596
65660
  if (target2.flags & 1048576 /* Union */) {
65597
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */));
65661
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState);
65598
65662
  }
65599
65663
  if (target2.flags & 2097152 /* Intersection */) {
65600
65664
  return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
@@ -65639,7 +65703,8 @@ function createTypeChecker(host) {
65639
65703
  sourceType,
65640
65704
  target2,
65641
65705
  /*reportErrors*/
65642
- false
65706
+ false,
65707
+ 0 /* None */
65643
65708
  );
65644
65709
  if (!related) {
65645
65710
  return 0 /* False */;
@@ -65648,7 +65713,7 @@ function createTypeChecker(host) {
65648
65713
  }
65649
65714
  return result2;
65650
65715
  }
65651
- function typeRelatedToSomeType(source2, target2, reportErrors2) {
65716
+ function typeRelatedToSomeType(source2, target2, reportErrors2, intersectionState) {
65652
65717
  const targetTypes = target2.types;
65653
65718
  if (target2.flags & 1048576 /* Union */) {
65654
65719
  if (containsType(targetTypes, source2)) {
@@ -65666,7 +65731,10 @@ function createTypeChecker(host) {
65666
65731
  match,
65667
65732
  2 /* Target */,
65668
65733
  /*reportErrors*/
65669
- false
65734
+ false,
65735
+ /*headMessage*/
65736
+ void 0,
65737
+ intersectionState
65670
65738
  );
65671
65739
  if (related) {
65672
65740
  return related;
@@ -65679,7 +65747,10 @@ function createTypeChecker(host) {
65679
65747
  type,
65680
65748
  2 /* Target */,
65681
65749
  /*reportErrors*/
65682
- false
65750
+ false,
65751
+ /*headMessage*/
65752
+ void 0,
65753
+ intersectionState
65683
65754
  );
65684
65755
  if (related) {
65685
65756
  return related;
@@ -65693,7 +65764,10 @@ function createTypeChecker(host) {
65693
65764
  bestMatchingType,
65694
65765
  2 /* Target */,
65695
65766
  /*reportErrors*/
65696
- true
65767
+ true,
65768
+ /*headMessage*/
65769
+ void 0,
65770
+ intersectionState
65697
65771
  );
65698
65772
  }
65699
65773
  }
@@ -66491,13 +66565,6 @@ function createTypeChecker(host) {
66491
66565
  return result2;
66492
66566
  }
66493
66567
  }
66494
- } else {
66495
- const distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
66496
- if (distributiveConstraint) {
66497
- if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
66498
- return result2;
66499
- }
66500
- }
66501
66568
  }
66502
66569
  const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
66503
66570
  if (defaultConstraint) {
@@ -66505,6 +66572,13 @@ function createTypeChecker(host) {
66505
66572
  return result2;
66506
66573
  }
66507
66574
  }
66575
+ const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
66576
+ if (distributiveConstraint) {
66577
+ resetErrorInfo(saveErrorInfo);
66578
+ if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
66579
+ return result2;
66580
+ }
66581
+ }
66508
66582
  } else {
66509
66583
  if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) {
66510
66584
  return -1 /* True */;
@@ -112841,8 +112915,8 @@ function transformDeclarations(context) {
112841
112915
  const specifier = getModuleSpecifier(
112842
112916
  options,
112843
112917
  currentSourceFile,
112844
- toPath(outputFilePath2, host.getCurrentDirectory(), host.getCanonicalFileName),
112845
- toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName),
112918
+ getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
112919
+ getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
112846
112920
  host
112847
112921
  );
112848
112922
  if (!pathIsRelative(specifier)) {
@@ -120279,8 +120353,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
120279
120353
  }
120280
120354
  const baseName = getBaseNameOfFileName(fileOrDirectory);
120281
120355
  const fsQueryResult = {
120282
- fileExists: host.fileExists(fileOrDirectoryPath),
120283
- directoryExists: host.directoryExists(fileOrDirectoryPath)
120356
+ fileExists: host.fileExists(fileOrDirectory),
120357
+ directoryExists: host.directoryExists(fileOrDirectory)
120284
120358
  };
120285
120359
  if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
120286
120360
  clearCache();
@@ -120380,11 +120454,9 @@ function updatePackageJsonWatch(lookups, packageJsonWatches, createPackageJsonWa
120380
120454
  );
120381
120455
  }
120382
120456
  function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) {
120383
- const missingFilePaths = program.getMissingFilePaths();
120384
- const newMissingFilePathMap = arrayToMap(missingFilePaths, identity, returnTrue);
120385
120457
  mutateMap(
120386
120458
  missingFileWatches,
120387
- newMissingFilePathMap,
120459
+ program.getMissingFilePaths(),
120388
120460
  {
120389
120461
  // Watch the missing files
120390
120462
  createNewValue: createMissingFileWatch,
@@ -121244,7 +121316,8 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
121244
121316
  return false;
121245
121317
  if (program.getSourceFiles().some(sourceFileNotUptoDate))
121246
121318
  return false;
121247
- if (program.getMissingFilePaths().some(fileExists))
121319
+ const missingPaths = program.getMissingFilePaths();
121320
+ if (missingPaths && forEachEntry(missingPaths, fileExists))
121248
121321
  return false;
121249
121322
  const currentOptions = program.getCompilerOptions();
121250
121323
  if (!compareDataObjects(currentOptions, newOptions))
@@ -121548,7 +121621,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121548
121621
  let redirectTargetsMap = createMultiMap();
121549
121622
  let usesUriStyleNodeCoreModules = false;
121550
121623
  const filesByName = /* @__PURE__ */ new Map();
121551
- let missingFilePaths;
121624
+ let missingFileNames = /* @__PURE__ */ new Map();
121552
121625
  const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
121553
121626
  let resolvedProjectReferences;
121554
121627
  let projectReferenceRedirects;
@@ -121667,12 +121740,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121667
121740
  });
121668
121741
  }
121669
121742
  }
121670
- missingFilePaths = arrayFrom(mapDefinedIterator(filesByName.entries(), ([path, file]) => file === void 0 ? path : void 0));
121671
121743
  files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
121672
121744
  processingDefaultLibFiles = void 0;
121673
121745
  processingOtherFiles = void 0;
121674
121746
  }
121675
- Debug.assert(!!missingFilePaths);
121676
121747
  if (oldProgram && host.onReleaseOldSourceFile) {
121677
121748
  const oldSourceFiles = oldProgram.getSourceFiles();
121678
121749
  for (const oldSourceFile of oldSourceFiles) {
@@ -121717,8 +121788,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121717
121788
  getSourceFile,
121718
121789
  getSourceFileByPath,
121719
121790
  getSourceFiles: () => files,
121720
- getMissingFilePaths: () => missingFilePaths,
121721
- // TODO: GH#18217
121791
+ getMissingFilePaths: () => missingFileNames,
121722
121792
  getModuleResolutionCache: () => moduleResolutionCache,
121723
121793
  getFilesByNameMap: () => filesByName,
121724
121794
  getCompilerOptions: () => options,
@@ -122145,7 +122215,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122145
122215
  const newSourceFiles = [];
122146
122216
  const modifiedSourceFiles = [];
122147
122217
  structureIsReused = 2 /* Completely */;
122148
- if (oldProgram.getMissingFilePaths().some((missingFilePath) => host.fileExists(missingFilePath))) {
122218
+ if (forEachEntry(oldProgram.getMissingFilePaths(), (missingFilePath) => host.fileExists(missingFilePath))) {
122149
122219
  return 0 /* Not */;
122150
122220
  }
122151
122221
  const oldSourceFiles = oldProgram.getSourceFiles();
@@ -122285,7 +122355,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122285
122355
  if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
122286
122356
  return 1 /* SafeModules */;
122287
122357
  }
122288
- missingFilePaths = oldProgram.getMissingFilePaths();
122358
+ missingFileNames = oldProgram.getMissingFilePaths();
122289
122359
  Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
122290
122360
  for (const newSourceFile of newSourceFiles) {
122291
122361
  filesByName.set(newSourceFile.path, newSourceFile);
@@ -122342,7 +122412,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122342
122412
  const path = toPath3(f);
122343
122413
  if (getSourceFileByPath(path))
122344
122414
  return true;
122345
- if (contains(missingFilePaths, path))
122415
+ if (missingFileNames.has(path))
122346
122416
  return false;
122347
122417
  return host.fileExists(f);
122348
122418
  },
@@ -123154,6 +123224,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123154
123224
  addFileToFilesByName(
123155
123225
  file2,
123156
123226
  path,
123227
+ fileName,
123157
123228
  /*redirectedPath*/
123158
123229
  void 0
123159
123230
  );
@@ -123226,7 +123297,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123226
123297
  if (fileFromPackageId) {
123227
123298
  const dupFile = createRedirectedSourceFile(fileFromPackageId, file, fileName, path, toPath3(fileName), originalFileName, sourceFileOptions);
123228
123299
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
123229
- addFileToFilesByName(dupFile, path, redirectedPath);
123300
+ addFileToFilesByName(dupFile, path, fileName, redirectedPath);
123230
123301
  addFileIncludeReason(dupFile, reason);
123231
123302
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
123232
123303
  processingOtherFiles.push(dupFile);
@@ -123236,7 +123307,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123236
123307
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
123237
123308
  }
123238
123309
  }
123239
- addFileToFilesByName(file, path, redirectedPath);
123310
+ addFileToFilesByName(file, path, fileName, redirectedPath);
123240
123311
  if (file) {
123241
123312
  sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
123242
123313
  file.fileName = fileName;
@@ -123276,14 +123347,21 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123276
123347
  if (file)
123277
123348
  fileReasons.add(file.path, reason);
123278
123349
  }
123279
- function addFileToFilesByName(file, path, redirectedPath) {
123350
+ function addFileToFilesByName(file, path, fileName, redirectedPath) {
123280
123351
  if (redirectedPath) {
123281
- filesByName.set(redirectedPath, file);
123282
- filesByName.set(path, file || false);
123352
+ updateFilesByNameMap(fileName, redirectedPath, file);
123353
+ updateFilesByNameMap(fileName, path, file || false);
123283
123354
  } else {
123284
- filesByName.set(path, file);
123355
+ updateFilesByNameMap(fileName, path, file);
123285
123356
  }
123286
123357
  }
123358
+ function updateFilesByNameMap(fileName, path, file) {
123359
+ filesByName.set(path, file);
123360
+ if (file !== void 0)
123361
+ missingFileNames.delete(path);
123362
+ else
123363
+ missingFileNames.set(path, fileName);
123364
+ }
123287
123365
  function getProjectReferenceRedirect(fileName) {
123288
123366
  const referencedProject = getProjectReferenceRedirectProject(fileName);
123289
123367
  return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
@@ -123604,6 +123682,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123604
123682
  /*file*/
123605
123683
  void 0,
123606
123684
  sourceFilePath,
123685
+ refPath,
123607
123686
  /*redirectedPath*/
123608
123687
  void 0
123609
123688
  );
@@ -123615,6 +123694,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123615
123694
  addFileToFilesByName(
123616
123695
  sourceFile,
123617
123696
  sourceFilePath,
123697
+ refPath,
123618
123698
  /*redirectedPath*/
123619
123699
  void 0
123620
123700
  );
@@ -123624,6 +123704,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123624
123704
  addFileToFilesByName(
123625
123705
  sourceFile,
123626
123706
  sourceFilePath,
123707
+ refPath,
123627
123708
  /*redirectedPath*/
123628
123709
  void 0
123629
123710
  );
@@ -127160,7 +127241,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
127160
127241
  const watcher = {
127161
127242
  watcher: canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
127162
127243
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
127163
- invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache().getInternalMap());
127244
+ invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache());
127164
127245
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
127165
127246
  }) : noopFileWatcher,
127166
127247
  resolutions: isSymlink ? 0 : resolutions,
@@ -127200,7 +127281,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
127200
127281
  if (watcher == null ? void 0 : watcher.files)
127201
127282
  (affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path);
127202
127283
  (_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
127203
- packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
127284
+ packageJsonMap.deletePackageJsonInfo(path);
127204
127285
  }
127205
127286
  function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
127206
127287
  const program = resolutionHost.getCurrentProgram();
@@ -127385,9 +127466,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
127385
127466
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
127386
127467
  }
127387
127468
  function invalidatePackageJsonMap() {
127388
- const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
127469
+ const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().entries();
127389
127470
  if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
127390
- packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
127471
+ for (const key of packageJsonMap) {
127472
+ const path = resolutionHost.toPath(key[0]);
127473
+ if (isInvalidatedFailedLookup(path)) {
127474
+ moduleResolutionCache.getPackageJsonInfoCache().deletePackageJsonInfo(key[0]);
127475
+ }
127476
+ }
127391
127477
  }
127392
127478
  }
127393
127479
  function invalidateResolutionsOfFailedLookupLocations() {
@@ -128429,7 +128515,11 @@ function createWatchProgram(host) {
128429
128515
  const oldProgram = getCurrentProgram();
128430
128516
  builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
128431
128517
  resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
128432
- updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()), watchMissingFilePath);
128518
+ updateMissingFilePathsWatch(
128519
+ builderProgram.getProgram(),
128520
+ missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()),
128521
+ watchMissingFilePath
128522
+ );
128433
128523
  if (needsUpdateInTypeRootWatch) {
128434
128524
  resolutionCache.updateTypeRootsWatch();
128435
128525
  }
@@ -128722,8 +128812,15 @@ function createWatchProgram(host) {
128722
128812
  cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
128723
128813
  }
128724
128814
  }
128725
- function watchMissingFilePath(missingFilePath) {
128726
- return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(missingFilePath, missingFilePath, onMissingFileChange, 500 /* Medium */, watchOptions, WatchType.MissingFile);
128815
+ function watchMissingFilePath(missingFilePath, missingFileName) {
128816
+ return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
128817
+ missingFilePath,
128818
+ missingFileName,
128819
+ onMissingFileChange,
128820
+ 500 /* Medium */,
128821
+ watchOptions,
128822
+ WatchType.MissingFile
128823
+ );
128727
128824
  }
128728
128825
  function onMissingFileChange(fileName, eventKind, missingFilePath) {
128729
128826
  updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
@@ -129219,6 +129316,7 @@ function createStateBuildOrder(state) {
129219
129316
  mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
129220
129317
  mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
129221
129318
  mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
129319
+ mutateMapSkippingNewValues(state.lastCachedPackageJsonLookups, currentProjects, noopOnDelete);
129222
129320
  if (state.watch) {
129223
129321
  mutateMapSkippingNewValues(
129224
129322
  state.allWatchedConfigFiles,
@@ -129473,7 +129571,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
129473
129571
  return withProgramOrUndefined(action) || emptyArray;
129474
129572
  }
129475
129573
  function createProgram2() {
129476
- var _a, _b;
129574
+ var _a, _b, _c;
129477
129575
  Debug.assert(program === void 0);
129478
129576
  if (state.options.dry) {
129479
129577
  reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
@@ -129502,12 +129600,16 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
129502
129600
  config.projectReferences
129503
129601
  );
129504
129602
  if (state.watch) {
129603
+ const entries = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().entries();
129505
129604
  state.lastCachedPackageJsonLookups.set(
129506
129605
  projectPath,
129507
- state.moduleResolutionCache && map(
129508
- state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
129509
- ([path, data]) => [state.host.realpath && data ? toPath2(state, state.host.realpath(path)) : path, data]
129510
- )
129606
+ entries && new Map(arrayFrom(
129607
+ entries,
129608
+ ([path, data]) => {
129609
+ path = state.host.realpath && data ? state.host.realpath(path) : path;
129610
+ return [toPath2(state, path), path];
129611
+ }
129612
+ ))
129511
129613
  );
129512
129614
  state.builderPrograms.set(projectPath, program);
129513
129615
  }
@@ -130240,9 +130342,10 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
130240
130342
  const extendedConfigStatus = forEach(project.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName));
130241
130343
  if (extendedConfigStatus)
130242
130344
  return extendedConfigStatus;
130243
- const dependentPackageFileStatus = forEach(
130244
- state.lastCachedPackageJsonLookups.get(resolvedPath) || emptyArray,
130245
- ([path]) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
130345
+ const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath);
130346
+ const dependentPackageFileStatus = packageJsonLookups && forEachEntry(
130347
+ packageJsonLookups,
130348
+ (path) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
130246
130349
  );
130247
130350
  if (dependentPackageFileStatus)
130248
130351
  return dependentPackageFileStatus;
@@ -130653,9 +130756,9 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
130653
130756
  getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath),
130654
130757
  new Map(state.lastCachedPackageJsonLookups.get(resolvedPath)),
130655
130758
  {
130656
- createNewValue: (path, _input) => watchFile(
130759
+ createNewValue: (_path, input) => watchFile(
130657
130760
  state,
130658
- path,
130761
+ input,
130659
130762
  () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
130660
130763
  2e3 /* High */,
130661
130764
  parsed == null ? void 0 : parsed.watchOptions,
@@ -133204,8 +133307,11 @@ function getTypeKeywordOfTypeOnlyImport(importClause, sourceFile) {
133204
133307
  function textSpansEqual(a, b) {
133205
133308
  return !!a && !!b && a.start === b.start && a.length === b.length;
133206
133309
  }
133207
- function documentSpansEqual(a, b) {
133208
- return a.fileName === b.fileName && textSpansEqual(a.textSpan, b.textSpan);
133310
+ function documentSpansEqual(a, b, useCaseSensitiveFileNames2) {
133311
+ return (useCaseSensitiveFileNames2 ? equateStringsCaseSensitive : equateStringsCaseInsensitive)(a.fileName, b.fileName) && textSpansEqual(a.textSpan, b.textSpan);
133312
+ }
133313
+ function getDocumentSpansEqualityComparer(useCaseSensitiveFileNames2) {
133314
+ return (a, b) => documentSpansEqual(a, b, useCaseSensitiveFileNames2);
133209
133315
  }
133210
133316
  function forEachUnique(array, callback) {
133211
133317
  if (array) {
@@ -136435,7 +136541,7 @@ function updateImports(program, changeTracker, oldToNew, newToOld, host, getCano
136435
136541
  if ((importedModuleSymbol == null ? void 0 : importedModuleSymbol.declarations) && importedModuleSymbol.declarations.some((d) => isAmbientModule(d)))
136436
136542
  return void 0;
136437
136543
  const toImport = oldFromNew !== void 0 ? getSourceFileToImportFromResolved(importLiteral, resolveModuleName(importLiteral.text, oldImportFromPath, program.getCompilerOptions(), host), oldToNew, allFiles) : getSourceFileToImport(importedModuleSymbol, importLiteral, sourceFile, program, host, oldToNew);
136438
- return toImport !== void 0 && (toImport.updated || importingSourceFileMoved && pathIsRelative(importLiteral.text)) ? ts_moduleSpecifiers_exports.updateModuleSpecifier(program.getCompilerOptions(), sourceFile, getCanonicalFileName(newImportFromPath), toImport.newFileName, createModuleSpecifierResolutionHost(program, host), importLiteral.text) : void 0;
136544
+ return toImport !== void 0 && (toImport.updated || importingSourceFileMoved && pathIsRelative(importLiteral.text)) ? ts_moduleSpecifiers_exports.updateModuleSpecifier(program.getCompilerOptions(), sourceFile, newImportFromPath, toImport.newFileName, createModuleSpecifierResolutionHost(program, host), importLiteral.text) : void 0;
136439
136545
  });
136440
136546
  }
136441
136547
  }
@@ -137274,11 +137380,11 @@ function getSourceMapper(host) {
137274
137380
  const fileFromCache = sourceFileLike.get(path);
137275
137381
  if (fileFromCache !== void 0)
137276
137382
  return fileFromCache ? fileFromCache : void 0;
137277
- if (!host.readFile || host.fileExists && !host.fileExists(path)) {
137383
+ if (!host.readFile || host.fileExists && !host.fileExists(fileName)) {
137278
137384
  sourceFileLike.set(path, false);
137279
137385
  return void 0;
137280
137386
  }
137281
- const text = host.readFile(path);
137387
+ const text = host.readFile(fileName);
137282
137388
  const file = text ? createSourceFileLike(text) : false;
137283
137389
  sourceFileLike.set(path, file);
137284
137390
  return file ? file : void 0;
@@ -139831,7 +139937,7 @@ function getTargetFileImportsAndAddExportInOldFile(oldFile, targetFile, importsT
139831
139937
  const resolved = program.getResolvedModule(oldFile, moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
139832
139938
  const fileName = (_a = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _a.resolvedFileName;
139833
139939
  if (fileName && targetSourceFile) {
139834
- const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.path, fileName, createModuleSpecifierResolutionHost(program, host));
139940
+ const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.fileName, fileName, createModuleSpecifierResolutionHost(program, host));
139835
139941
  append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
139836
139942
  } else {
139837
139943
  append(copiedOldImports, filterImport(i, factory.createStringLiteral(moduleSpecifierFromImport(i).text), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
@@ -139909,7 +140015,7 @@ function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols
139909
140015
  };
139910
140016
  deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
139911
140017
  const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(oldFile.path), targetFileName);
139912
- const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.path, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
140018
+ const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
139913
140019
  const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove);
139914
140020
  if (newImportDeclaration)
139915
140021
  changes.insertNodeAfter(sourceFile, statement, newImportDeclaration);
@@ -140044,7 +140150,7 @@ function createOldFileImportsFromTargetFile(sourceFile, targetFileNeedExport, ta
140044
140150
  }
140045
140151
  function makeImportOrRequire(sourceFile, defaultImport, imports, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference) {
140046
140152
  const pathToTargetFile = resolvePath(getDirectoryPath(sourceFile.path), targetFileNameWithExtension);
140047
- const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.path, pathToTargetFile, createModuleSpecifierResolutionHost(program, host));
140153
+ const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFile, createModuleSpecifierResolutionHost(program, host));
140048
140154
  if (useEs6Imports) {
140049
140155
  const specifiers = imports.map((i) => factory.createImportSpecifier(
140050
140156
  /*isTypeOnly*/
@@ -160446,6 +160552,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
160446
160552
  }
160447
160553
  return void 0;
160448
160554
  }
160555
+ function isInDifferentLineThanContextToken(contextToken2, position2) {
160556
+ return sourceFile.getLineEndOfPosition(contextToken2.getEnd()) < position2;
160557
+ }
160449
160558
  function isSolelyIdentifierDefinitionLocation(contextToken2) {
160450
160559
  const parent2 = contextToken2.parent;
160451
160560
  const containingNodeKind = parent2.kind;
@@ -160487,11 +160596,19 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
160487
160596
  case 139 /* GetKeyword */:
160488
160597
  case 153 /* SetKeyword */:
160489
160598
  return !isFromObjectTypeDeclaration(contextToken2);
160490
- case 80 /* Identifier */:
160599
+ case 80 /* Identifier */: {
160491
160600
  if (containingNodeKind === 276 /* ImportSpecifier */ && contextToken2 === parent2.name && contextToken2.text === "type") {
160492
160601
  return false;
160493
160602
  }
160603
+ const ancestorVariableDeclaration = findAncestor(
160604
+ contextToken2.parent,
160605
+ isVariableDeclaration
160606
+ );
160607
+ if (ancestorVariableDeclaration && isInDifferentLineThanContextToken(contextToken2, position)) {
160608
+ return false;
160609
+ }
160494
160610
  break;
160611
+ }
160495
160612
  case 86 /* ClassKeyword */:
160496
160613
  case 94 /* EnumKeyword */:
160497
160614
  case 120 /* InterfaceKeyword */:
@@ -173541,6 +173658,7 @@ __export(ts_exports2, {
173541
173658
  getDirectoryToWatchFailedLookupLocation: () => getDirectoryToWatchFailedLookupLocation,
173542
173659
  getDirectoryToWatchFailedLookupLocationFromTypeRoot: () => getDirectoryToWatchFailedLookupLocationFromTypeRoot,
173543
173660
  getDocumentPositionMapper: () => getDocumentPositionMapper,
173661
+ getDocumentSpansEqualityComparer: () => getDocumentSpansEqualityComparer,
173544
173662
  getESModuleInterop: () => getESModuleInterop,
173545
173663
  getEditsForFileRename: () => getEditsForFileRename,
173546
173664
  getEffectiveBaseTypeNode: () => getEffectiveBaseTypeNode,
@@ -177472,6 +177590,7 @@ var Project3 = class _Project {
177472
177590
  this.resolutionCache.clear();
177473
177591
  this.resolutionCache = void 0;
177474
177592
  this.cachedUnresolvedImportsPerFile = void 0;
177593
+ this.moduleSpecifierCache.clear();
177475
177594
  this.moduleSpecifierCache = void 0;
177476
177595
  this.directoryStructureHost = void 0;
177477
177596
  this.exportMapCache = void 0;
@@ -177887,7 +178006,7 @@ var Project3 = class _Project {
177887
178006
  this.program,
177888
178007
  this.missingFilesMap || (this.missingFilesMap = /* @__PURE__ */ new Map()),
177889
178008
  // Watch the missing files
177890
- (missingFilePath) => this.addMissingFileWatcher(missingFilePath)
178009
+ (missingFilePath, missingFileName) => this.addMissingFileWatcher(missingFilePath, missingFileName)
177891
178010
  );
177892
178011
  if (this.generatedFilesMap) {
177893
178012
  const outPath = outFile(this.compilerOptions);
@@ -178001,7 +178120,7 @@ var Project3 = class _Project {
178001
178120
  }
178002
178121
  }
178003
178122
  }
178004
- addMissingFileWatcher(missingFilePath) {
178123
+ addMissingFileWatcher(missingFilePath, missingFileName) {
178005
178124
  var _a;
178006
178125
  if (isConfiguredProject(this)) {
178007
178126
  const configFileExistenceInfo = this.projectService.configFileExistenceInfoCache.get(missingFilePath);
@@ -178009,7 +178128,7 @@ var Project3 = class _Project {
178009
178128
  return noopFileWatcher;
178010
178129
  }
178011
178130
  const fileWatcher = this.projectService.watchFactory.watchFile(
178012
- missingFilePath,
178131
+ getNormalizedAbsolutePath(missingFileName, this.currentDirectory),
178013
178132
  (fileName, eventKind) => {
178014
178133
  if (isConfiguredProject(this)) {
178015
178134
  this.getCachedDirectoryStructureHost().addOrDeleteFile(fileName, missingFilePath, eventKind);
@@ -178355,7 +178474,7 @@ var Project3 = class _Project {
178355
178474
  /** @internal */
178356
178475
  getPackageJsonsForAutoImport(rootDir) {
178357
178476
  const packageJsons = this.getPackageJsonsVisibleToFile(combinePaths(this.currentDirectory, inferredTypesContainingFile), rootDir);
178358
- this.packageJsonsForAutoImport = new Set(packageJsons.map((p) => p.fileName));
178477
+ this.packageJsonsForAutoImport = new Set(packageJsons.map((p) => this.projectService.toPath(p.fileName)));
178359
178478
  return packageJsons;
178360
178479
  }
178361
178480
  /** @internal */
@@ -178442,7 +178561,7 @@ var Project3 = class _Project {
178442
178561
  }
178443
178562
  /** @internal */
178444
178563
  watchNodeModulesForPackageJsonChanges(directoryPath) {
178445
- return this.projectService.watchPackageJsonsInNodeModules(this.toPath(directoryPath), this);
178564
+ return this.projectService.watchPackageJsonsInNodeModules(directoryPath, this);
178446
178565
  }
178447
178566
  /** @internal */
178448
178567
  getIncompleteCompletionsCache() {
@@ -180023,13 +180142,13 @@ var _ProjectService = class _ProjectService {
180023
180142
  (fileOrDirectory) => {
180024
180143
  const fileOrDirectoryPath = this.toPath(fileOrDirectory);
180025
180144
  const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
180026
- if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectoryPath))) {
180145
+ if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
180027
180146
  this.logger.info(`Config: ${configFileName} Detected new package.json: ${fileOrDirectory}`);
180028
- this.onAddPackageJson(fileOrDirectoryPath);
180147
+ this.onAddPackageJson(this.getNormalizedAbsolutePath(fileOrDirectory), fileOrDirectoryPath);
180029
180148
  }
180030
180149
  const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
180031
180150
  if (isIgnoredFileFromWildCardWatching({
180032
- watchedDirPath: directory,
180151
+ watchedDirPath: this.toPath(directory),
180033
180152
  fileOrDirectory,
180034
180153
  fileOrDirectoryPath,
180035
180154
  configFileName,
@@ -180900,7 +181019,7 @@ var _ProjectService = class _ProjectService {
180900
181019
  if (value.info) {
180901
181020
  project.removeFile(
180902
181021
  value.info,
180903
- project.fileExists(path),
181022
+ project.fileExists(value.info.fileName),
180904
181023
  /*detachFromProject*/
180905
181024
  true
180906
181025
  );
@@ -181132,7 +181251,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181132
181251
  watchClosedScriptInfo(info) {
181133
181252
  Debug.assert(!info.fileWatcher);
181134
181253
  if (!info.isDynamicOrHasMixedContent() && (!this.globalCacheLocationDirectoryPath || !startsWith(info.path, this.globalCacheLocationDirectoryPath))) {
181135
- const indexOfNodeModules = info.path.indexOf("/node_modules/");
181254
+ const indexOfNodeModules = info.fileName.indexOf("/node_modules/");
181136
181255
  if (!this.host.getModifiedTime || indexOfNodeModules === -1) {
181137
181256
  info.fileWatcher = this.watchFactory.watchFile(
181138
181257
  info.fileName,
@@ -181143,12 +181262,12 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181143
181262
  );
181144
181263
  } else {
181145
181264
  info.mTime = this.getModifiedTime(info);
181146
- info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.path.substr(0, indexOfNodeModules));
181265
+ info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.fileName.substring(0, indexOfNodeModules));
181147
181266
  }
181148
181267
  }
181149
181268
  }
181150
- createNodeModulesWatcher(dir) {
181151
- const watcher = this.watchFactory.watchDirectory(
181269
+ createNodeModulesWatcher(dir, dirPath) {
181270
+ let watcher = this.watchFactory.watchDirectory(
181152
181271
  dir,
181153
181272
  (fileOrDirectory) => {
181154
181273
  var _a;
@@ -181163,8 +181282,8 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181163
181282
  });
181164
181283
  }
181165
181284
  if (result.refreshScriptInfoRefCount) {
181166
- if (dir === fileOrDirectoryPath) {
181167
- this.refreshScriptInfosInDirectory(dir);
181285
+ if (dirPath === fileOrDirectoryPath) {
181286
+ this.refreshScriptInfosInDirectory(dirPath);
181168
181287
  } else {
181169
181288
  const info = this.getScriptInfoForPath(fileOrDirectoryPath);
181170
181289
  if (info) {
@@ -181187,29 +181306,34 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181187
181306
  close: () => {
181188
181307
  var _a;
181189
181308
  if (!result.refreshScriptInfoRefCount && !((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size)) {
181190
- watcher.close();
181191
- this.nodeModulesWatchers.delete(dir);
181309
+ watcher == null ? void 0 : watcher.close();
181310
+ watcher = void 0;
181311
+ this.nodeModulesWatchers.delete(dirPath);
181192
181312
  }
181193
181313
  }
181194
181314
  };
181195
- this.nodeModulesWatchers.set(dir, result);
181315
+ this.nodeModulesWatchers.set(dirPath, result);
181196
181316
  return result;
181197
181317
  }
181198
181318
  /** @internal */
181199
181319
  watchPackageJsonsInNodeModules(dir, project) {
181200
- const watcher = this.nodeModulesWatchers.get(dir) || this.createNodeModulesWatcher(dir);
181320
+ var _a;
181321
+ const dirPath = this.toPath(dir);
181322
+ const watcher = this.nodeModulesWatchers.get(dirPath) || this.createNodeModulesWatcher(dir, dirPath);
181323
+ Debug.assert(!((_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.has(project.getProjectName())));
181201
181324
  (watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project.getProjectName());
181202
181325
  return {
181203
181326
  close: () => {
181204
- var _a;
181205
- (_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.delete(project.getProjectName());
181327
+ var _a2;
181328
+ (_a2 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a2.delete(project.getProjectName());
181206
181329
  watcher.close();
181207
181330
  }
181208
181331
  };
181209
181332
  }
181210
181333
  watchClosedScriptInfoInNodeModules(dir) {
181211
181334
  const watchDir = dir + "/node_modules";
181212
- const watcher = this.nodeModulesWatchers.get(watchDir) || this.createNodeModulesWatcher(watchDir);
181335
+ const watchedDirPath = this.toPath(watchDir);
181336
+ const watcher = this.nodeModulesWatchers.get(watchedDirPath) || this.createNodeModulesWatcher(watchDir, watchedDirPath);
181213
181337
  watcher.refreshScriptInfoRefCount++;
181214
181338
  return {
181215
181339
  close: () => {
@@ -181219,7 +181343,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181219
181343
  };
181220
181344
  }
181221
181345
  getModifiedTime(info) {
181222
- return (this.host.getModifiedTime(info.path) || missingFileModifiedTime).getTime();
181346
+ return (this.host.getModifiedTime(info.fileName) || missingFileModifiedTime).getTime();
181223
181347
  }
181224
181348
  refreshScriptInfo(info) {
181225
181349
  const mTime = this.getModifiedTime(info);
@@ -182408,7 +182532,6 @@ Dynamic files must always be opened with service's current directory or service
182408
182532
  getPackageJsonsVisibleToFile(fileName, rootDir) {
182409
182533
  const packageJsonCache = this.packageJsonCache;
182410
182534
  const rootPath = rootDir && this.toPath(rootDir);
182411
- const filePath = this.toPath(fileName);
182412
182535
  const result = [];
182413
182536
  const processDirectory = (directory) => {
182414
182537
  switch (packageJsonCache.directoryHasPackageJson(directory)) {
@@ -182417,7 +182540,7 @@ Dynamic files must always be opened with service's current directory or service
182417
182540
  return processDirectory(directory);
182418
182541
  case -1 /* True */:
182419
182542
  const packageJsonFileName = combinePaths(directory, "package.json");
182420
- this.watchPackageJsonFile(packageJsonFileName);
182543
+ this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName));
182421
182544
  const info = packageJsonCache.getInDirectory(directory);
182422
182545
  if (info)
182423
182546
  result.push(info);
@@ -182426,13 +182549,13 @@ Dynamic files must always be opened with service's current directory or service
182426
182549
  return true;
182427
182550
  }
182428
182551
  };
182429
- forEachAncestorDirectory(getDirectoryPath(filePath), processDirectory);
182552
+ forEachAncestorDirectory(getDirectoryPath(fileName), processDirectory);
182430
182553
  return result;
182431
182554
  }
182432
182555
  /** @internal */
182433
182556
  getNearestAncestorDirectoryWithPackageJson(fileName) {
182434
182557
  return forEachAncestorDirectory(fileName, (directory) => {
182435
- switch (this.packageJsonCache.directoryHasPackageJson(this.toPath(directory))) {
182558
+ switch (this.packageJsonCache.directoryHasPackageJson(directory)) {
182436
182559
  case -1 /* True */:
182437
182560
  return directory;
182438
182561
  case 0 /* False */:
@@ -182443,28 +182566,27 @@ Dynamic files must always be opened with service's current directory or service
182443
182566
  });
182444
182567
  }
182445
182568
  /** @internal */
182446
- watchPackageJsonFile(path) {
182569
+ watchPackageJsonFile(file, path) {
182447
182570
  const watchers = this.packageJsonFilesMap || (this.packageJsonFilesMap = /* @__PURE__ */ new Map());
182448
182571
  if (!watchers.has(path)) {
182449
182572
  this.invalidateProjectPackageJson(path);
182450
182573
  watchers.set(
182451
182574
  path,
182452
182575
  this.watchFactory.watchFile(
182453
- path,
182576
+ file,
182454
182577
  (fileName, eventKind) => {
182455
- const path2 = this.toPath(fileName);
182456
182578
  switch (eventKind) {
182457
182579
  case 0 /* Created */:
182458
182580
  return Debug.fail();
182459
182581
  case 1 /* Changed */:
182460
- this.packageJsonCache.addOrUpdate(path2);
182461
- this.invalidateProjectPackageJson(path2);
182582
+ this.packageJsonCache.addOrUpdate(fileName, path);
182583
+ this.invalidateProjectPackageJson(path);
182462
182584
  break;
182463
182585
  case 2 /* Deleted */:
182464
- this.packageJsonCache.delete(path2);
182465
- this.invalidateProjectPackageJson(path2);
182466
- watchers.get(path2).close();
182467
- watchers.delete(path2);
182586
+ this.packageJsonCache.delete(path);
182587
+ this.invalidateProjectPackageJson(path);
182588
+ watchers.get(path).close();
182589
+ watchers.delete(path);
182468
182590
  }
182469
182591
  },
182470
182592
  250 /* Low */,
@@ -182475,9 +182597,9 @@ Dynamic files must always be opened with service's current directory or service
182475
182597
  }
182476
182598
  }
182477
182599
  /** @internal */
182478
- onAddPackageJson(path) {
182479
- this.packageJsonCache.addOrUpdate(path);
182480
- this.watchPackageJsonFile(path);
182600
+ onAddPackageJson(file, path) {
182601
+ this.packageJsonCache.addOrUpdate(file, path);
182602
+ this.watchPackageJsonFile(file, path);
182481
182603
  }
182482
182604
  /** @internal */
182483
182605
  includePackageJsonAutoImports() {
@@ -182492,16 +182614,13 @@ Dynamic files must always be opened with service's current directory or service
182492
182614
  }
182493
182615
  /** @internal */
182494
182616
  invalidateProjectPackageJson(packageJsonPath) {
182495
- this.configuredProjects.forEach(invalidate);
182496
- this.inferredProjects.forEach(invalidate);
182497
- this.externalProjects.forEach(invalidate);
182498
- function invalidate(project) {
182617
+ this.forEachProject((project) => {
182499
182618
  if (packageJsonPath) {
182500
182619
  project.onPackageJsonChange(packageJsonPath);
182501
182620
  } else {
182502
182621
  project.onAutoImportProviderSettingsChanged();
182503
182622
  }
182504
- }
182623
+ });
182505
182624
  }
182506
182625
  /** @internal */
182507
182626
  getIncompleteCompletionsCache() {
@@ -182561,9 +182680,10 @@ function createModuleSpecifierCache(host) {
182561
182680
  for (const p of modulePaths) {
182562
182681
  if (p.isInNodeModules) {
182563
182682
  const nodeModulesPath = p.path.substring(0, p.path.indexOf(nodeModulesPathPart) + nodeModulesPathPart.length - 1);
182564
- if (!(containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.has(nodeModulesPath))) {
182683
+ const key2 = host.toPath(nodeModulesPath);
182684
+ if (!(containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.has(key2))) {
182565
182685
  (containedNodeModulesWatchers || (containedNodeModulesWatchers = /* @__PURE__ */ new Map())).set(
182566
- nodeModulesPath,
182686
+ key2,
182567
182687
  host.watchNodeModulesForPackageJsonChanges(nodeModulesPath)
182568
182688
  );
182569
182689
  }
@@ -182602,7 +182722,7 @@ function createModuleSpecifierCache(host) {
182602
182722
  }
182603
182723
  },
182604
182724
  clear() {
182605
- containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach((watcher) => watcher.close());
182725
+ containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach(closeFileWatcher);
182606
182726
  cache == null ? void 0 : cache.clear();
182607
182727
  containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.clear();
182608
182728
  currentKey = void 0;
@@ -182637,37 +182757,37 @@ function createPackageJsonCache(host) {
182637
182757
  const directoriesWithoutPackageJson = /* @__PURE__ */ new Map();
182638
182758
  return {
182639
182759
  addOrUpdate,
182640
- forEach: packageJsons.forEach.bind(packageJsons),
182641
- get: packageJsons.get.bind(packageJsons),
182642
182760
  delete: (fileName) => {
182643
182761
  packageJsons.delete(fileName);
182644
182762
  directoriesWithoutPackageJson.set(getDirectoryPath(fileName), true);
182645
182763
  },
182646
182764
  getInDirectory: (directory) => {
182647
- return packageJsons.get(combinePaths(directory, "package.json")) || void 0;
182765
+ return packageJsons.get(host.toPath(combinePaths(directory, "package.json"))) || void 0;
182648
182766
  },
182649
- directoryHasPackageJson,
182767
+ directoryHasPackageJson: (directory) => directoryHasPackageJson(host.toPath(directory)),
182650
182768
  searchDirectoryAndAncestors: (directory) => {
182651
182769
  forEachAncestorDirectory(directory, (ancestor) => {
182652
- if (directoryHasPackageJson(ancestor) !== 3 /* Maybe */) {
182770
+ const ancestorPath = host.toPath(ancestor);
182771
+ if (directoryHasPackageJson(ancestorPath) !== 3 /* Maybe */) {
182653
182772
  return true;
182654
182773
  }
182655
- const packageJsonFileName = host.toPath(combinePaths(ancestor, "package.json"));
182774
+ const packageJsonFileName = combinePaths(ancestor, "package.json");
182656
182775
  if (tryFileExists(host, packageJsonFileName)) {
182657
- addOrUpdate(packageJsonFileName);
182776
+ addOrUpdate(packageJsonFileName, combinePaths(ancestorPath, "package.json"));
182658
182777
  } else {
182659
- directoriesWithoutPackageJson.set(ancestor, true);
182778
+ directoriesWithoutPackageJson.set(ancestorPath, true);
182660
182779
  }
182661
182780
  });
182662
182781
  }
182663
182782
  };
182664
- function addOrUpdate(fileName) {
182665
- const packageJsonInfo = Debug.checkDefined(createPackageJsonInfo(fileName, host.host));
182666
- packageJsons.set(fileName, packageJsonInfo);
182667
- directoriesWithoutPackageJson.delete(getDirectoryPath(fileName));
182783
+ function addOrUpdate(file, path) {
182784
+ const packageJsonInfo = Debug.checkDefined(createPackageJsonInfo(file, host.host));
182785
+ packageJsons.set(path, packageJsonInfo);
182786
+ directoriesWithoutPackageJson.delete(getDirectoryPath(path));
182668
182787
  }
182669
182788
  function directoryHasPackageJson(directory) {
182670
- return packageJsons.has(combinePaths(directory, "package.json")) ? -1 /* True */ : directoriesWithoutPackageJson.has(directory) ? 0 /* False */ : 3 /* Maybe */;
182789
+ const path = host.toPath(directory);
182790
+ return packageJsons.has(combinePaths(path, "package.json")) ? -1 /* True */ : directoriesWithoutPackageJson.has(path) ? 0 /* False */ : 3 /* Maybe */;
182671
182791
  }
182672
182792
  }
182673
182793
 
@@ -182865,10 +182985,10 @@ function combineProjectOutput(defaultValue, getValue, projects, action) {
182865
182985
  }
182866
182986
  return deduplicate(outputs, equateValues);
182867
182987
  }
182868
- function createDocumentSpanSet() {
182869
- return createSet(({ textSpan }) => textSpan.start + 100003 * textSpan.length, documentSpansEqual);
182988
+ function createDocumentSpanSet(useCaseSensitiveFileNames2) {
182989
+ return createSet(({ textSpan }) => textSpan.start + 100003 * textSpan.length, getDocumentSpansEqualityComparer(useCaseSensitiveFileNames2));
182870
182990
  }
182871
- function getRenameLocationsWorker(projects, defaultProject, initialLocation, findInStrings, findInComments, preferences) {
182991
+ function getRenameLocationsWorker(projects, defaultProject, initialLocation, findInStrings, findInComments, preferences, useCaseSensitiveFileNames2) {
182872
182992
  const perProjectResults = getPerProjectReferences(
182873
182993
  projects,
182874
182994
  defaultProject,
@@ -182882,7 +183002,7 @@ function getRenameLocationsWorker(projects, defaultProject, initialLocation, fin
182882
183002
  return perProjectResults;
182883
183003
  }
182884
183004
  const results = [];
182885
- const seen = createDocumentSpanSet();
183005
+ const seen = createDocumentSpanSet(useCaseSensitiveFileNames2);
182886
183006
  perProjectResults.forEach((projectResults, project) => {
182887
183007
  for (const result of projectResults) {
182888
183008
  if (!seen.has(result) && !getMappedLocationForProject(documentSpanLocation(result), project)) {
@@ -182905,7 +183025,7 @@ function getDefinitionLocation(defaultProject, initialLocation, isForRename) {
182905
183025
  const info = infos && firstOrUndefined(infos);
182906
183026
  return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : void 0;
182907
183027
  }
182908
- function getReferencesWorker(projects, defaultProject, initialLocation, logger) {
183028
+ function getReferencesWorker(projects, defaultProject, initialLocation, useCaseSensitiveFileNames2, logger) {
182909
183029
  var _a, _b;
182910
183030
  const perProjectResults = getPerProjectReferences(
182911
183031
  projects,
@@ -182937,7 +183057,7 @@ function getReferencesWorker(projects, defaultProject, initialLocation, logger)
182937
183057
  }
182938
183058
  });
182939
183059
  } else {
182940
- const knownSymbolSpans = createDocumentSpanSet();
183060
+ const knownSymbolSpans = createDocumentSpanSet(useCaseSensitiveFileNames2);
182941
183061
  for (const referencedSymbol of defaultProjectResults) {
182942
183062
  for (const ref of referencedSymbol.references) {
182943
183063
  if (ref.isDefinition) {
@@ -182972,7 +183092,7 @@ function getReferencesWorker(projects, defaultProject, initialLocation, logger)
182972
183092
  });
182973
183093
  }
182974
183094
  const results = [];
182975
- const seenRefs = createDocumentSpanSet();
183095
+ const seenRefs = createDocumentSpanSet(useCaseSensitiveFileNames2);
182976
183096
  perProjectResults.forEach((projectResults, project) => {
182977
183097
  for (const referencedSymbol of projectResults) {
182978
183098
  const mappedDefinitionFile = getMappedLocationForProject(documentSpanLocation(referencedSymbol.definition), project);
@@ -182983,7 +183103,7 @@ function getReferencesWorker(projects, defaultProject, initialLocation, logger)
182983
183103
  fileName: mappedDefinitionFile.fileName,
182984
183104
  contextSpan: getMappedContextSpanForProject(referencedSymbol.definition, project)
182985
183105
  };
182986
- let symbolToAddTo = find(results, (o) => documentSpansEqual(o.definition, definition));
183106
+ let symbolToAddTo = find(results, (o) => documentSpansEqual(o.definition, definition, useCaseSensitiveFileNames2));
182987
183107
  if (!symbolToAddTo) {
182988
183108
  symbolToAddTo = { definition, references: [] };
182989
183109
  results.push(symbolToAddTo);
@@ -184343,7 +184463,10 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184343
184463
  let definitions = this.mapDefinitionInfoLocations(unmappedDefinitions || emptyArray2, project).slice();
184344
184464
  const needsJsResolution = this.projectService.serverMode === 0 /* Semantic */ && (!some(definitions, (d) => toNormalizedPath(d.fileName) !== file && !d.isAmbient) || some(definitions, (d) => !!d.failedAliasResolution));
184345
184465
  if (needsJsResolution) {
184346
- const definitionSet = createSet((d) => d.textSpan.start, documentSpansEqual);
184466
+ const definitionSet = createSet(
184467
+ (d) => d.textSpan.start,
184468
+ getDocumentSpansEqualityComparer(this.host.useCaseSensitiveFileNames)
184469
+ );
184347
184470
  definitions == null ? void 0 : definitions.forEach((d) => definitionSet.add(d));
184348
184471
  const noDtsProject = project.getNoDtsResolutionProject(file);
184349
184472
  const ls = noDtsProject.getLanguageService();
@@ -184784,7 +184907,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184784
184907
  { fileName: args.file, pos: position },
184785
184908
  !!args.findInStrings,
184786
184909
  !!args.findInComments,
184787
- preferences
184910
+ preferences,
184911
+ this.host.useCaseSensitiveFileNames
184788
184912
  );
184789
184913
  if (!simplifiedResult)
184790
184914
  return locations;
@@ -184819,6 +184943,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184819
184943
  projects,
184820
184944
  this.getDefaultProject(args),
184821
184945
  { fileName: args.file, pos: position },
184946
+ this.host.useCaseSensitiveFileNames,
184822
184947
  this.logger
184823
184948
  );
184824
184949
  if (!simplifiedResult)
@@ -184841,7 +184966,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
184841
184966
  const fileName = args.file;
184842
184967
  const preferences = this.getPreferences(toNormalizedPath(fileName));
184843
184968
  const references = [];
184844
- const seen = createDocumentSpanSet();
184969
+ const seen = createDocumentSpanSet(this.host.useCaseSensitiveFileNames);
184845
184970
  forEachProjectInProjects(
184846
184971
  projects,
184847
184972
  /*path*/
@@ -188298,6 +188423,7 @@ start(initializeNodeSystem(), require("os").platform());
188298
188423
  getDirectoryToWatchFailedLookupLocation,
188299
188424
  getDirectoryToWatchFailedLookupLocationFromTypeRoot,
188300
188425
  getDocumentPositionMapper,
188426
+ getDocumentSpansEqualityComparer,
188301
188427
  getESModuleInterop,
188302
188428
  getEditsForFileRename,
188303
188429
  getEffectiveBaseTypeNode,