@typescript-deploys/pr-build 5.4.0-pr-56488-8 → 5.4.0-pr-56439-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsserver.js CHANGED
@@ -6675,7 +6675,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
6675
6675
  TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
6676
6676
  TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
6677
6677
  TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
6678
- TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
6678
+ TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
6679
6679
  TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
6680
6680
  TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
6681
6681
  TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
@@ -20061,7 +20061,7 @@ function getClassLikeDeclarationOfSymbol(symbol) {
20061
20061
  return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike);
20062
20062
  }
20063
20063
  function getObjectFlags(type) {
20064
- return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
20064
+ return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
20065
20065
  }
20066
20066
  function forSomeAncestorDirectory(directory, callback) {
20067
20067
  return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
@@ -22350,6 +22350,7 @@ function addNodeFactoryPatcher(fn) {
22350
22350
  }
22351
22351
  function createNodeFactory(flags, baseFactory2) {
22352
22352
  const update = flags & 8 /* NoOriginalNode */ ? updateWithoutOriginal : updateWithOriginal;
22353
+ const setOriginal = flags & 8 /* NoOriginalNode */ ? identity : setOriginalNode;
22353
22354
  const parenthesizerRules = memoize(() => flags & 1 /* NoParenthesizerRules */ ? nullParenthesizerRules : createParenthesizerRules(factory2));
22354
22355
  const converters = memoize(() => flags & 2 /* NoNodeConverters */ ? nullNodeConverters : createNodeConverters(factory2));
22355
22356
  const getBinaryCreateFunction = memoizeOne((operator) => (left, right) => createBinaryExpression(left, operator, right));
@@ -25847,7 +25848,7 @@ function createNodeFactory(flags, baseFactory2) {
25847
25848
  }
25848
25849
  function cloneSourceFile(source) {
25849
25850
  const node = source.redirectInfo ? cloneRedirectedSourceFile(source) : cloneSourceFileWorker(source);
25850
- setOriginalNode(node, source);
25851
+ setOriginal(node, source);
25851
25852
  return node;
25852
25853
  }
25853
25854
  function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
@@ -25980,7 +25981,7 @@ function createNodeFactory(flags, baseFactory2) {
25980
25981
  const clone2 = createBaseIdentifier(node.escapedText);
25981
25982
  clone2.flags |= node.flags & ~16 /* Synthesized */;
25982
25983
  clone2.transformFlags = node.transformFlags;
25983
- setOriginalNode(clone2, node);
25984
+ setOriginal(clone2, node);
25984
25985
  setIdentifierAutoGenerate(clone2, { ...node.emitNode.autoGenerate });
25985
25986
  return clone2;
25986
25987
  }
@@ -25991,7 +25992,7 @@ function createNodeFactory(flags, baseFactory2) {
25991
25992
  clone2.flowNode = node.flowNode;
25992
25993
  clone2.symbol = node.symbol;
25993
25994
  clone2.transformFlags = node.transformFlags;
25994
- setOriginalNode(clone2, node);
25995
+ setOriginal(clone2, node);
25995
25996
  const typeArguments = getIdentifierTypeArguments(node);
25996
25997
  if (typeArguments)
25997
25998
  setIdentifierTypeArguments(clone2, typeArguments);
@@ -26001,7 +26002,7 @@ function createNodeFactory(flags, baseFactory2) {
26001
26002
  const clone2 = createBasePrivateIdentifier(node.escapedText);
26002
26003
  clone2.flags |= node.flags & ~16 /* Synthesized */;
26003
26004
  clone2.transformFlags = node.transformFlags;
26004
- setOriginalNode(clone2, node);
26005
+ setOriginal(clone2, node);
26005
26006
  setIdentifierAutoGenerate(clone2, { ...node.emitNode.autoGenerate });
26006
26007
  return clone2;
26007
26008
  }
@@ -26009,7 +26010,7 @@ function createNodeFactory(flags, baseFactory2) {
26009
26010
  const clone2 = createBasePrivateIdentifier(node.escapedText);
26010
26011
  clone2.flags |= node.flags & ~16 /* Synthesized */;
26011
26012
  clone2.transformFlags = node.transformFlags;
26012
- setOriginalNode(clone2, node);
26013
+ setOriginal(clone2, node);
26013
26014
  return clone2;
26014
26015
  }
26015
26016
  function cloneNode(node) {
@@ -26034,7 +26035,7 @@ function createNodeFactory(flags, baseFactory2) {
26034
26035
  const clone2 = !isNodeKind(node.kind) ? baseFactory2.createBaseTokenNode(node.kind) : baseFactory2.createBaseNode(node.kind);
26035
26036
  clone2.flags |= node.flags & ~16 /* Synthesized */;
26036
26037
  clone2.transformFlags = node.transformFlags;
26037
- setOriginalNode(clone2, node);
26038
+ setOriginal(clone2, node);
26038
26039
  for (const key in node) {
26039
26040
  if (hasProperty(clone2, key) || !hasProperty(node, key)) {
26040
26041
  continue;
@@ -26559,7 +26560,7 @@ function createNodeFactory(flags, baseFactory2) {
26559
26560
  return typeof value === "number" ? createToken(value) : value;
26560
26561
  }
26561
26562
  function asEmbeddedStatement(statement) {
26562
- return statement && isNotEmittedStatement(statement) ? setTextRange(setOriginalNode(createEmptyStatement(), statement), statement) : statement;
26563
+ return statement && isNotEmittedStatement(statement) ? setTextRange(setOriginal(createEmptyStatement(), statement), statement) : statement;
26563
26564
  }
26564
26565
  function asVariableDeclaration(variableDeclaration) {
26565
26566
  if (typeof variableDeclaration === "string" || variableDeclaration && !isVariableDeclaration(variableDeclaration)) {
@@ -31323,8 +31324,10 @@ var Parser;
31323
31324
  setTextRangePosWidth(sourceFile, 0, sourceText.length);
31324
31325
  setFields(sourceFile);
31325
31326
  if (!isDeclarationFile && isExternalModule(sourceFile) && sourceFile.transformFlags & 67108864 /* ContainsPossibleTopLevelAwait */) {
31327
+ const oldSourceFile = sourceFile;
31326
31328
  sourceFile = reparseTopLevelAwait(sourceFile);
31327
- setFields(sourceFile);
31329
+ if (oldSourceFile !== sourceFile)
31330
+ setFields(sourceFile);
31328
31331
  }
31329
31332
  return sourceFile;
31330
31333
  function setFields(sourceFile2) {
@@ -41248,39 +41251,34 @@ function specToDiagnostic(spec, disallowTrailingRecursion) {
41248
41251
  return [Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
41249
41252
  }
41250
41253
  }
41251
- function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, basePath, useCaseSensitiveFileNames2) {
41252
- const rawExcludeRegex = getRegularExpressionForWildcard(exclude, basePath, "exclude");
41254
+ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, path, useCaseSensitiveFileNames2) {
41255
+ const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude");
41253
41256
  const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames2 ? "" : "i");
41254
41257
  const wildcardDirectories = {};
41255
- const wildCardKeyToPath = /* @__PURE__ */ new Map();
41256
41258
  if (include !== void 0) {
41257
41259
  const recursiveKeys = [];
41258
41260
  for (const file of include) {
41259
- const spec = normalizePath(combinePaths(basePath, file));
41261
+ const spec = normalizePath(combinePaths(path, file));
41260
41262
  if (excludeRegex && excludeRegex.test(spec)) {
41261
41263
  continue;
41262
41264
  }
41263
41265
  const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
41264
41266
  if (match) {
41265
- const { key, path, flags } = match;
41266
- const existingPath = wildCardKeyToPath.get(key);
41267
- const existingFlags = existingPath !== void 0 ? wildcardDirectories[existingPath] : void 0;
41267
+ const { key, flags } = match;
41268
+ const existingFlags = wildcardDirectories[key];
41268
41269
  if (existingFlags === void 0 || existingFlags < flags) {
41269
- wildcardDirectories[existingPath !== void 0 ? existingPath : path] = flags;
41270
- if (existingPath === void 0)
41271
- wildCardKeyToPath.set(key, path);
41270
+ wildcardDirectories[key] = flags;
41272
41271
  if (flags === 1 /* Recursive */) {
41273
41272
  recursiveKeys.push(key);
41274
41273
  }
41275
41274
  }
41276
41275
  }
41277
41276
  }
41278
- for (const path in wildcardDirectories) {
41279
- if (hasProperty(wildcardDirectories, path)) {
41277
+ for (const key in wildcardDirectories) {
41278
+ if (hasProperty(wildcardDirectories, key)) {
41280
41279
  for (const recursiveKey of recursiveKeys) {
41281
- const key = toCanonicalKey(path, useCaseSensitiveFileNames2);
41282
- if (key !== recursiveKey && containsPath(recursiveKey, key, basePath, !useCaseSensitiveFileNames2)) {
41283
- delete wildcardDirectories[path];
41280
+ if (key !== recursiveKey && containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames2)) {
41281
+ delete wildcardDirectories[key];
41284
41282
  }
41285
41283
  }
41286
41284
  }
@@ -41288,9 +41286,6 @@ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExclu
41288
41286
  }
41289
41287
  return wildcardDirectories;
41290
41288
  }
41291
- function toCanonicalKey(path, useCaseSensitiveFileNames2) {
41292
- return useCaseSensitiveFileNames2 ? path : toFileNameLowerCase(path);
41293
- }
41294
41289
  function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
41295
41290
  const match = wildcardDirectoryPattern.exec(spec);
41296
41291
  if (match) {
@@ -41298,16 +41293,13 @@ function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
41298
41293
  const starWildcardIndex = spec.indexOf("*");
41299
41294
  const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator);
41300
41295
  return {
41301
- key: toCanonicalKey(match[0], useCaseSensitiveFileNames2),
41302
- path: match[0],
41296
+ key: useCaseSensitiveFileNames2 ? match[0] : toFileNameLowerCase(match[0]),
41303
41297
  flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 /* Recursive */ : 0 /* None */
41304
41298
  };
41305
41299
  }
41306
41300
  if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) {
41307
- const path = removeTrailingDirectorySeparator(spec);
41308
41301
  return {
41309
- key: toCanonicalKey(path, useCaseSensitiveFileNames2),
41310
- path,
41302
+ key: removeTrailingDirectorySeparator(useCaseSensitiveFileNames2 ? spec : toFileNameLowerCase(spec)),
41311
41303
  flags: 1 /* Recursive */
41312
41304
  };
41313
41305
  }
@@ -42054,50 +42046,22 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
42054
42046
  }
42055
42047
  function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
42056
42048
  let cache;
42057
- let canonicalPathToCacheKey;
42058
- return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, deletePackageJsonInfo, clear: clear2, entries };
42049
+ return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2, entries, getInternalMap };
42059
42050
  function getPackageJsonInfo2(packageJsonPath) {
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;
42051
+ return cache == null ? void 0 : cache.get(toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
42073
42052
  }
42074
42053
  function setPackageJsonInfo(packageJsonPath, 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
- }
42054
+ (cache || (cache = /* @__PURE__ */ new Map())).set(toPath(packageJsonPath, currentDirectory, getCanonicalFileName), info);
42095
42055
  }
42096
42056
  function clear2() {
42097
42057
  cache = void 0;
42098
42058
  }
42099
42059
  function entries() {
42100
- return cache == null ? void 0 : cache.entries();
42060
+ const iter = cache == null ? void 0 : cache.entries();
42061
+ return iter ? arrayFrom(iter) : [];
42062
+ }
42063
+ function getInternalMap() {
42064
+ return cache;
42101
42065
  }
42102
42066
  }
42103
42067
  function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
@@ -47151,8 +47115,8 @@ function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourc
47151
47115
  return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getPreferences({}, compilerOptions, importingSourceFile), {}, options);
47152
47116
  }
47153
47117
  function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
47154
- const info = getInfo(importingSourceFile.fileName, host);
47155
- const modulePaths = getAllModulePaths(importingSourceFile.fileName, nodeModulesFileName, host, preferences, options);
47118
+ const info = getInfo(importingSourceFile.path, host);
47119
+ const modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options);
47156
47120
  return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
47157
47121
  modulePath,
47158
47122
  info,
@@ -47229,7 +47193,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
47229
47193
  if (!moduleSourceFile)
47230
47194
  return { moduleSpecifiers: emptyArray, computedWithoutCache };
47231
47195
  computedWithoutCache = true;
47232
- modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.fileName, moduleSourceFile.originalFileName, host));
47196
+ modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.path, moduleSourceFile.originalFileName, host));
47233
47197
  const result = computeModuleSpecifiers(
47234
47198
  modulePaths,
47235
47199
  compilerOptions,
@@ -47243,7 +47207,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
47243
47207
  return { moduleSpecifiers: result, computedWithoutCache };
47244
47208
  }
47245
47209
  function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
47246
- const info = getInfo(importingSourceFile.fileName, host);
47210
+ const info = getInfo(importingSourceFile.path, host);
47247
47211
  const preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
47248
47212
  const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
47249
47213
  host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
@@ -47307,7 +47271,6 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
47307
47271
  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);
47308
47272
  }
47309
47273
  function getInfo(importingSourceFileName, host) {
47310
- importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
47311
47274
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : true);
47312
47275
  const sourceDirectory = getDirectoryPath(importingSourceFileName);
47313
47276
  return { getCanonicalFileName, importingSourceFileName, sourceDirectory };
@@ -47342,7 +47305,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
47342
47305
  if (relativePreference === 3 /* ExternalNonRelative */ && !pathIsRelative(maybeNonRelative)) {
47343
47306
  const projectDirectory = compilerOptions.configFilePath ? toPath(getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory());
47344
47307
  const modulePath = toPath(moduleFileName, projectDirectory, getCanonicalFileName);
47345
- const sourceIsInternal = startsWith(info.getCanonicalFileName(sourceDirectory), projectDirectory);
47308
+ const sourceIsInternal = startsWith(sourceDirectory, projectDirectory);
47346
47309
  const targetIsInternal = startsWith(modulePath, projectDirectory);
47347
47310
  if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
47348
47311
  return maybeNonRelative;
@@ -47415,9 +47378,8 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
47415
47378
  });
47416
47379
  return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
47417
47380
  }
47418
- function getAllModulePaths(importingFileName, importedFileName, host, preferences, options = {}) {
47381
+ function getAllModulePaths(importingFilePath, importedFileName, host, preferences, options = {}) {
47419
47382
  var _a;
47420
- const importingFilePath = toPath(importingFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
47421
47383
  const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
47422
47384
  const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
47423
47385
  if (cache) {
@@ -47425,7 +47387,7 @@ function getAllModulePaths(importingFileName, importedFileName, host, preference
47425
47387
  if (cached == null ? void 0 : cached.modulePaths)
47426
47388
  return cached.modulePaths;
47427
47389
  }
47428
- const modulePaths = getAllModulePathsWorker(importingFileName, importedFileName, host);
47390
+ const modulePaths = getAllModulePathsWorker(importingFilePath, importedFileName, host);
47429
47391
  if (cache) {
47430
47392
  cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
47431
47393
  }
@@ -47448,7 +47410,7 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
47448
47410
  }
47449
47411
  );
47450
47412
  const sortedPaths = [];
47451
- for (let directory = getDirectoryPath(getCanonicalFileName(importingFileName)); allFileNames.size !== 0; ) {
47413
+ for (let directory = getDirectoryPath(importingFileName); allFileNames.size !== 0; ) {
47452
47414
  const directoryStart = ensureTrailingDirectorySeparator(directory);
47453
47415
  let pathsInDirectory;
47454
47416
  allFileNames.forEach(({ path, isRedirect, isInNodeModules }, fileName) => {
@@ -47469,10 +47431,7 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
47469
47431
  directory = newDirectory;
47470
47432
  }
47471
47433
  if (allFileNames.size) {
47472
- const remainingPaths = arrayFrom(
47473
- allFileNames.entries(),
47474
- ([fileName, { isRedirect, isInNodeModules }]) => ({ path: fileName, isRedirect, isInNodeModules })
47475
- );
47434
+ const remainingPaths = arrayFrom(allFileNames.values());
47476
47435
  if (remainingPaths.length > 1)
47477
47436
  remainingPaths.sort(comparePathsByRedirectAndNumberOfDirectorySeparators);
47478
47437
  sortedPaths.push(...remainingPaths);
@@ -47676,7 +47635,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
47676
47635
  }
47677
47636
  const globalTypingsCacheLocation = host.getGlobalTypingsCacheLocation && host.getGlobalTypingsCacheLocation();
47678
47637
  const pathToTopLevelNodeModules = getCanonicalFileName(moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex));
47679
- if (!(startsWith(getCanonicalFileName(sourceDirectory), pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
47638
+ if (!(startsWith(sourceDirectory, pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
47680
47639
  return void 0;
47681
47640
  }
47682
47641
  const nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
@@ -58971,7 +58930,12 @@ function createTypeChecker(host) {
58971
58930
  const checkType = type.checkType;
58972
58931
  const constraint = getLowerBoundOfKeyType(checkType);
58973
58932
  if (constraint !== checkType) {
58974
- return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
58933
+ return getConditionalTypeInstantiation(
58934
+ type,
58935
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
58936
+ /*forConstraint*/
58937
+ false
58938
+ );
58975
58939
  }
58976
58940
  }
58977
58941
  return type;
@@ -59323,7 +59287,12 @@ function createTypeChecker(host) {
59323
59287
  );
59324
59288
  const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
59325
59289
  if (constraint && constraint !== type.checkType) {
59326
- const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
59290
+ const instantiated = getConditionalTypeInstantiation(
59291
+ type,
59292
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
59293
+ /*forConstraint*/
59294
+ true
59295
+ );
59327
59296
  if (!(instantiated.flags & 131072 /* Never */)) {
59328
59297
  type.resolvedConstraintOfDistributive = instantiated;
59329
59298
  return instantiated;
@@ -61757,7 +61726,7 @@ function createTypeChecker(host) {
61757
61726
  }
61758
61727
  }
61759
61728
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
61760
- const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
61729
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
61761
61730
  if (templates.length) {
61762
61731
  let i = types.length;
61763
61732
  while (i > 0) {
@@ -62157,19 +62126,14 @@ function createTypeChecker(host) {
62157
62126
  function getConstituentCountOfTypes(types) {
62158
62127
  return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
62159
62128
  }
62160
- function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
62161
- if (types.length !== 2) {
62162
- return false;
62163
- }
62164
- const [t1, t2] = types;
62165
- return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
62166
- }
62167
62129
  function getTypeFromIntersectionTypeNode(node) {
62168
62130
  const links = getNodeLinks(node);
62169
62131
  if (!links.resolvedType) {
62170
62132
  const aliasSymbol = getAliasSymbolForTypeNode(node);
62171
62133
  const types = map(node.types, getTypeFromTypeNode);
62172
- const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
62134
+ const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
62135
+ const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
62136
+ const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
62173
62137
  links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
62174
62138
  }
62175
62139
  return links.resolvedType;
@@ -62196,19 +62160,17 @@ function createTypeChecker(host) {
62196
62160
  return constraintType;
62197
62161
  }
62198
62162
  const keyTypes = [];
62199
- if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
62200
- if (!isGenericIndexType(constraintType)) {
62201
- const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
62202
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
62203
- } else {
62163
+ if (isGenericIndexType(constraintType)) {
62164
+ if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
62204
62165
  return getIndexTypeForGenericType(type, indexFlags);
62205
62166
  }
62167
+ forEachType(constraintType, addMemberForKeyType);
62168
+ } else if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
62169
+ const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
62170
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
62206
62171
  } else {
62207
62172
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
62208
62173
  }
62209
- if (isGenericIndexType(constraintType)) {
62210
- forEachType(constraintType, addMemberForKeyType);
62211
- }
62212
62174
  const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
62213
62175
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
62214
62176
  return constraintType;
@@ -62381,11 +62343,6 @@ function createTypeChecker(host) {
62381
62343
  }
62382
62344
  function createTemplateLiteralType(texts, types) {
62383
62345
  const type = createType(134217728 /* TemplateLiteral */);
62384
- type.objectFlags = getPropagatingFlagsOfTypes(
62385
- types,
62386
- /*excludeKinds*/
62387
- 98304 /* Nullable */
62388
- );
62389
62346
  type.texts = texts;
62390
62347
  type.types = types;
62391
62348
  return type;
@@ -62680,7 +62637,15 @@ function createTypeChecker(host) {
62680
62637
  }
62681
62638
  function isPatternLiteralPlaceholderType(type) {
62682
62639
  if (type.flags & 2097152 /* Intersection */) {
62683
- return !isGenericType(type) && some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 98304 /* Nullable */)) || isPatternLiteralPlaceholderType(t));
62640
+ let seenPlaceholder = false;
62641
+ for (const t of type.types) {
62642
+ if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
62643
+ seenPlaceholder = true;
62644
+ } else if (!(t.flags & 524288 /* Object */)) {
62645
+ return false;
62646
+ }
62647
+ }
62648
+ return seenPlaceholder;
62684
62649
  }
62685
62650
  return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
62686
62651
  }
@@ -62697,7 +62662,7 @@ function createTypeChecker(host) {
62697
62662
  return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
62698
62663
  }
62699
62664
  function getGenericObjectFlags(type) {
62700
- if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
62665
+ if (type.flags & 3145728 /* UnionOrIntersection */) {
62701
62666
  if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
62702
62667
  type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
62703
62668
  }
@@ -62709,7 +62674,7 @@ function createTypeChecker(host) {
62709
62674
  }
62710
62675
  return type.objectFlags & 12582912 /* IsGenericType */;
62711
62676
  }
62712
- return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
62677
+ return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
62713
62678
  }
62714
62679
  function getSimplifiedType(type, writing) {
62715
62680
  return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -62890,7 +62855,7 @@ function createTypeChecker(host) {
62890
62855
  function isDeferredType(type, checkTuples) {
62891
62856
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
62892
62857
  }
62893
- function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
62858
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
62894
62859
  let result;
62895
62860
  let extraTypes;
62896
62861
  let tailCount = 0;
@@ -62936,7 +62901,7 @@ function createTypeChecker(host) {
62936
62901
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
62937
62902
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
62938
62903
  if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
62939
- if (checkType.flags & 1 /* Any */) {
62904
+ if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
62940
62905
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
62941
62906
  }
62942
62907
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -63046,7 +63011,9 @@ function createTypeChecker(host) {
63046
63011
  links.resolvedType = getConditionalType(
63047
63012
  root,
63048
63013
  /*mapper*/
63049
- void 0
63014
+ void 0,
63015
+ /*forConstraint*/
63016
+ false
63050
63017
  );
63051
63018
  if (outerTypeParameters) {
63052
63019
  root.instantiations = /* @__PURE__ */ new Map();
@@ -63735,7 +63702,7 @@ function createTypeChecker(host) {
63735
63702
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
63736
63703
  target.instantiations.set(id, result);
63737
63704
  const resultObjectFlags = getObjectFlags(result);
63738
- if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
63705
+ if (result.flags & 3899393 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
63739
63706
  const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
63740
63707
  if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
63741
63708
  if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
@@ -63901,17 +63868,17 @@ function createTypeChecker(host) {
63901
63868
  result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
63902
63869
  return result;
63903
63870
  }
63904
- function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
63871
+ function getConditionalTypeInstantiation(type, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
63905
63872
  const root = type.root;
63906
63873
  if (root.outerTypeParameters) {
63907
63874
  const typeArguments = map(root.outerTypeParameters, (t) => getMappedType(t, mapper));
63908
- const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
63875
+ const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
63909
63876
  let result = root.instantiations.get(id);
63910
63877
  if (!result) {
63911
63878
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
63912
63879
  const checkType = root.checkType;
63913
63880
  const distributionType = root.isDistributive ? getMappedType(checkType, newMapper) : void 0;
63914
- 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);
63881
+ 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);
63915
63882
  root.instantiations.set(id, result);
63916
63883
  }
63917
63884
  return result;
@@ -63999,7 +63966,14 @@ function createTypeChecker(host) {
63999
63966
  );
64000
63967
  }
64001
63968
  if (flags & 16777216 /* Conditional */) {
64002
- return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
63969
+ return getConditionalTypeInstantiation(
63970
+ type,
63971
+ combineTypeMappers(type.mapper, mapper),
63972
+ /*forConstraint*/
63973
+ false,
63974
+ aliasSymbol,
63975
+ aliasTypeArguments
63976
+ );
64003
63977
  }
64004
63978
  if (flags & 33554432 /* Substitution */) {
64005
63979
  const newBaseType = instantiateType(type.baseType, mapper);
@@ -65643,7 +65617,7 @@ function createTypeChecker(host) {
65643
65617
  return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState);
65644
65618
  }
65645
65619
  if (target2.flags & 1048576 /* Union */) {
65646
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */));
65620
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState);
65647
65621
  }
65648
65622
  if (target2.flags & 2097152 /* Intersection */) {
65649
65623
  return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
@@ -65688,7 +65662,8 @@ function createTypeChecker(host) {
65688
65662
  sourceType,
65689
65663
  target2,
65690
65664
  /*reportErrors*/
65691
- false
65665
+ false,
65666
+ 0 /* None */
65692
65667
  );
65693
65668
  if (!related) {
65694
65669
  return 0 /* False */;
@@ -65697,7 +65672,7 @@ function createTypeChecker(host) {
65697
65672
  }
65698
65673
  return result2;
65699
65674
  }
65700
- function typeRelatedToSomeType(source2, target2, reportErrors2) {
65675
+ function typeRelatedToSomeType(source2, target2, reportErrors2, intersectionState) {
65701
65676
  const targetTypes = target2.types;
65702
65677
  if (target2.flags & 1048576 /* Union */) {
65703
65678
  if (containsType(targetTypes, source2)) {
@@ -65715,7 +65690,10 @@ function createTypeChecker(host) {
65715
65690
  match,
65716
65691
  2 /* Target */,
65717
65692
  /*reportErrors*/
65718
- false
65693
+ false,
65694
+ /*headMessage*/
65695
+ void 0,
65696
+ intersectionState
65719
65697
  );
65720
65698
  if (related) {
65721
65699
  return related;
@@ -65728,7 +65706,10 @@ function createTypeChecker(host) {
65728
65706
  type,
65729
65707
  2 /* Target */,
65730
65708
  /*reportErrors*/
65731
- false
65709
+ false,
65710
+ /*headMessage*/
65711
+ void 0,
65712
+ intersectionState
65732
65713
  );
65733
65714
  if (related) {
65734
65715
  return related;
@@ -65742,7 +65723,10 @@ function createTypeChecker(host) {
65742
65723
  bestMatchingType,
65743
65724
  2 /* Target */,
65744
65725
  /*reportErrors*/
65745
- true
65726
+ true,
65727
+ /*headMessage*/
65728
+ void 0,
65729
+ intersectionState
65746
65730
  );
65747
65731
  }
65748
65732
  }
@@ -66540,13 +66524,6 @@ function createTypeChecker(host) {
66540
66524
  return result2;
66541
66525
  }
66542
66526
  }
66543
- } else {
66544
- const distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
66545
- if (distributiveConstraint) {
66546
- if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
66547
- return result2;
66548
- }
66549
- }
66550
66527
  }
66551
66528
  const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
66552
66529
  if (defaultConstraint) {
@@ -66554,6 +66531,13 @@ function createTypeChecker(host) {
66554
66531
  return result2;
66555
66532
  }
66556
66533
  }
66534
+ const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
66535
+ if (distributiveConstraint) {
66536
+ resetErrorInfo(saveErrorInfo);
66537
+ if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
66538
+ return result2;
66539
+ }
66540
+ }
66557
66541
  } else {
66558
66542
  if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) {
66559
66543
  return -1 /* True */;
@@ -68451,8 +68435,8 @@ function createTypeChecker(host) {
68451
68435
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
68452
68436
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
68453
68437
  }
68454
- const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
68455
- if (type.flags & 138117121 /* ObjectFlagsType */) {
68438
+ const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
68439
+ if (type.flags & 3899393 /* ObjectFlagsType */) {
68456
68440
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
68457
68441
  }
68458
68442
  return result;
@@ -112890,8 +112874,8 @@ function transformDeclarations(context) {
112890
112874
  const specifier = getModuleSpecifier(
112891
112875
  options,
112892
112876
  currentSourceFile,
112893
- getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
112894
- getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
112877
+ toPath(outputFilePath2, host.getCurrentDirectory(), host.getCanonicalFileName),
112878
+ toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName),
112895
112879
  host
112896
112880
  );
112897
112881
  if (!pathIsRelative(specifier)) {
@@ -120328,8 +120312,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
120328
120312
  }
120329
120313
  const baseName = getBaseNameOfFileName(fileOrDirectory);
120330
120314
  const fsQueryResult = {
120331
- fileExists: host.fileExists(fileOrDirectory),
120332
- directoryExists: host.directoryExists(fileOrDirectory)
120315
+ fileExists: host.fileExists(fileOrDirectoryPath),
120316
+ directoryExists: host.directoryExists(fileOrDirectoryPath)
120333
120317
  };
120334
120318
  if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
120335
120319
  clearCache();
@@ -120429,9 +120413,11 @@ function updatePackageJsonWatch(lookups, packageJsonWatches, createPackageJsonWa
120429
120413
  );
120430
120414
  }
120431
120415
  function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) {
120416
+ const missingFilePaths = program.getMissingFilePaths();
120417
+ const newMissingFilePathMap = arrayToMap(missingFilePaths, identity, returnTrue);
120432
120418
  mutateMap(
120433
120419
  missingFileWatches,
120434
- program.getMissingFilePaths(),
120420
+ newMissingFilePathMap,
120435
120421
  {
120436
120422
  // Watch the missing files
120437
120423
  createNewValue: createMissingFileWatch,
@@ -121291,8 +121277,7 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
121291
121277
  return false;
121292
121278
  if (program.getSourceFiles().some(sourceFileNotUptoDate))
121293
121279
  return false;
121294
- const missingPaths = program.getMissingFilePaths();
121295
- if (missingPaths && forEachEntry(missingPaths, fileExists))
121280
+ if (program.getMissingFilePaths().some(fileExists))
121296
121281
  return false;
121297
121282
  const currentOptions = program.getCompilerOptions();
121298
121283
  if (!compareDataObjects(currentOptions, newOptions))
@@ -121596,7 +121581,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121596
121581
  let redirectTargetsMap = createMultiMap();
121597
121582
  let usesUriStyleNodeCoreModules = false;
121598
121583
  const filesByName = /* @__PURE__ */ new Map();
121599
- let missingFileNames = /* @__PURE__ */ new Map();
121584
+ let missingFilePaths;
121600
121585
  const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
121601
121586
  let resolvedProjectReferences;
121602
121587
  let projectReferenceRedirects;
@@ -121715,10 +121700,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121715
121700
  });
121716
121701
  }
121717
121702
  }
121703
+ missingFilePaths = arrayFrom(mapDefinedIterator(filesByName.entries(), ([path, file]) => file === void 0 ? path : void 0));
121718
121704
  files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
121719
121705
  processingDefaultLibFiles = void 0;
121720
121706
  processingOtherFiles = void 0;
121721
121707
  }
121708
+ Debug.assert(!!missingFilePaths);
121722
121709
  if (oldProgram && host.onReleaseOldSourceFile) {
121723
121710
  const oldSourceFiles = oldProgram.getSourceFiles();
121724
121711
  for (const oldSourceFile of oldSourceFiles) {
@@ -121763,7 +121750,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121763
121750
  getSourceFile,
121764
121751
  getSourceFileByPath,
121765
121752
  getSourceFiles: () => files,
121766
- getMissingFilePaths: () => missingFileNames,
121753
+ getMissingFilePaths: () => missingFilePaths,
121754
+ // TODO: GH#18217
121767
121755
  getModuleResolutionCache: () => moduleResolutionCache,
121768
121756
  getFilesByNameMap: () => filesByName,
121769
121757
  getCompilerOptions: () => options,
@@ -122190,7 +122178,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122190
122178
  const newSourceFiles = [];
122191
122179
  const modifiedSourceFiles = [];
122192
122180
  structureIsReused = 2 /* Completely */;
122193
- if (forEachEntry(oldProgram.getMissingFilePaths(), (missingFilePath) => host.fileExists(missingFilePath))) {
122181
+ if (oldProgram.getMissingFilePaths().some((missingFilePath) => host.fileExists(missingFilePath))) {
122194
122182
  return 0 /* Not */;
122195
122183
  }
122196
122184
  const oldSourceFiles = oldProgram.getSourceFiles();
@@ -122330,7 +122318,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122330
122318
  if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
122331
122319
  return 1 /* SafeModules */;
122332
122320
  }
122333
- missingFileNames = oldProgram.getMissingFilePaths();
122321
+ missingFilePaths = oldProgram.getMissingFilePaths();
122334
122322
  Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
122335
122323
  for (const newSourceFile of newSourceFiles) {
122336
122324
  filesByName.set(newSourceFile.path, newSourceFile);
@@ -122387,7 +122375,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122387
122375
  const path = toPath3(f);
122388
122376
  if (getSourceFileByPath(path))
122389
122377
  return true;
122390
- if (missingFileNames.has(path))
122378
+ if (contains(missingFilePaths, path))
122391
122379
  return false;
122392
122380
  return host.fileExists(f);
122393
122381
  },
@@ -123199,7 +123187,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123199
123187
  addFileToFilesByName(
123200
123188
  file2,
123201
123189
  path,
123202
- fileName,
123203
123190
  /*redirectedPath*/
123204
123191
  void 0
123205
123192
  );
@@ -123272,7 +123259,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123272
123259
  if (fileFromPackageId) {
123273
123260
  const dupFile = createRedirectedSourceFile(fileFromPackageId, file, fileName, path, toPath3(fileName), originalFileName, sourceFileOptions);
123274
123261
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
123275
- addFileToFilesByName(dupFile, path, fileName, redirectedPath);
123262
+ addFileToFilesByName(dupFile, path, redirectedPath);
123276
123263
  addFileIncludeReason(dupFile, reason);
123277
123264
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
123278
123265
  processingOtherFiles.push(dupFile);
@@ -123282,7 +123269,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123282
123269
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
123283
123270
  }
123284
123271
  }
123285
- addFileToFilesByName(file, path, fileName, redirectedPath);
123272
+ addFileToFilesByName(file, path, redirectedPath);
123286
123273
  if (file) {
123287
123274
  sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
123288
123275
  file.fileName = fileName;
@@ -123322,21 +123309,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123322
123309
  if (file)
123323
123310
  fileReasons.add(file.path, reason);
123324
123311
  }
123325
- function addFileToFilesByName(file, path, fileName, redirectedPath) {
123312
+ function addFileToFilesByName(file, path, redirectedPath) {
123326
123313
  if (redirectedPath) {
123327
- updateFilesByNameMap(fileName, redirectedPath, file);
123328
- updateFilesByNameMap(fileName, path, file || false);
123314
+ filesByName.set(redirectedPath, file);
123315
+ filesByName.set(path, file || false);
123329
123316
  } else {
123330
- updateFilesByNameMap(fileName, path, file);
123317
+ filesByName.set(path, file);
123331
123318
  }
123332
123319
  }
123333
- function updateFilesByNameMap(fileName, path, file) {
123334
- filesByName.set(path, file);
123335
- if (file !== void 0)
123336
- missingFileNames.delete(path);
123337
- else
123338
- missingFileNames.set(path, fileName);
123339
- }
123340
123320
  function getProjectReferenceRedirect(fileName) {
123341
123321
  const referencedProject = getProjectReferenceRedirectProject(fileName);
123342
123322
  return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
@@ -123657,7 +123637,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123657
123637
  /*file*/
123658
123638
  void 0,
123659
123639
  sourceFilePath,
123660
- refPath,
123661
123640
  /*redirectedPath*/
123662
123641
  void 0
123663
123642
  );
@@ -123669,7 +123648,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123669
123648
  addFileToFilesByName(
123670
123649
  sourceFile,
123671
123650
  sourceFilePath,
123672
- refPath,
123673
123651
  /*redirectedPath*/
123674
123652
  void 0
123675
123653
  );
@@ -123679,7 +123657,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123679
123657
  addFileToFilesByName(
123680
123658
  sourceFile,
123681
123659
  sourceFilePath,
123682
- refPath,
123683
123660
  /*redirectedPath*/
123684
123661
  void 0
123685
123662
  );
@@ -127216,7 +127193,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
127216
127193
  const watcher = {
127217
127194
  watcher: canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
127218
127195
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
127219
- invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache());
127196
+ invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache().getInternalMap());
127220
127197
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
127221
127198
  }) : noopFileWatcher,
127222
127199
  resolutions: isSymlink ? 0 : resolutions,
@@ -127256,7 +127233,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
127256
127233
  if (watcher == null ? void 0 : watcher.files)
127257
127234
  (affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path);
127258
127235
  (_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
127259
- packageJsonMap.deletePackageJsonInfo(path);
127236
+ packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
127260
127237
  }
127261
127238
  function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
127262
127239
  const program = resolutionHost.getCurrentProgram();
@@ -127441,14 +127418,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
127441
127418
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
127442
127419
  }
127443
127420
  function invalidatePackageJsonMap() {
127444
- const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().entries();
127421
+ const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
127445
127422
  if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
127446
- for (const key of packageJsonMap) {
127447
- const path = resolutionHost.toPath(key[0]);
127448
- if (isInvalidatedFailedLookup(path)) {
127449
- moduleResolutionCache.getPackageJsonInfoCache().deletePackageJsonInfo(key[0]);
127450
- }
127451
- }
127423
+ packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
127452
127424
  }
127453
127425
  }
127454
127426
  function invalidateResolutionsOfFailedLookupLocations() {
@@ -128490,11 +128462,7 @@ function createWatchProgram(host) {
128490
128462
  const oldProgram = getCurrentProgram();
128491
128463
  builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
128492
128464
  resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
128493
- updateMissingFilePathsWatch(
128494
- builderProgram.getProgram(),
128495
- missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()),
128496
- watchMissingFilePath
128497
- );
128465
+ updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()), watchMissingFilePath);
128498
128466
  if (needsUpdateInTypeRootWatch) {
128499
128467
  resolutionCache.updateTypeRootsWatch();
128500
128468
  }
@@ -128787,15 +128755,8 @@ function createWatchProgram(host) {
128787
128755
  cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
128788
128756
  }
128789
128757
  }
128790
- function watchMissingFilePath(missingFilePath, missingFileName) {
128791
- return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
128792
- missingFilePath,
128793
- missingFileName,
128794
- onMissingFileChange,
128795
- 500 /* Medium */,
128796
- watchOptions,
128797
- WatchType.MissingFile
128798
- );
128758
+ function watchMissingFilePath(missingFilePath) {
128759
+ return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(missingFilePath, missingFilePath, onMissingFileChange, 500 /* Medium */, watchOptions, WatchType.MissingFile);
128799
128760
  }
128800
128761
  function onMissingFileChange(fileName, eventKind, missingFilePath) {
128801
128762
  updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
@@ -129291,7 +129252,6 @@ function createStateBuildOrder(state) {
129291
129252
  mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
129292
129253
  mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
129293
129254
  mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
129294
- mutateMapSkippingNewValues(state.lastCachedPackageJsonLookups, currentProjects, noopOnDelete);
129295
129255
  if (state.watch) {
129296
129256
  mutateMapSkippingNewValues(
129297
129257
  state.allWatchedConfigFiles,
@@ -129546,7 +129506,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
129546
129506
  return withProgramOrUndefined(action) || emptyArray;
129547
129507
  }
129548
129508
  function createProgram2() {
129549
- var _a, _b, _c;
129509
+ var _a, _b;
129550
129510
  Debug.assert(program === void 0);
129551
129511
  if (state.options.dry) {
129552
129512
  reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
@@ -129575,16 +129535,12 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
129575
129535
  config.projectReferences
129576
129536
  );
129577
129537
  if (state.watch) {
129578
- const entries = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().entries();
129579
129538
  state.lastCachedPackageJsonLookups.set(
129580
129539
  projectPath,
129581
- entries && new Map(arrayFrom(
129582
- entries,
129583
- ([path, data]) => {
129584
- path = state.host.realpath && data ? state.host.realpath(path) : path;
129585
- return [toPath2(state, path), path];
129586
- }
129587
- ))
129540
+ state.moduleResolutionCache && map(
129541
+ state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
129542
+ ([path, data]) => [state.host.realpath && data ? toPath2(state, state.host.realpath(path)) : path, data]
129543
+ )
129588
129544
  );
129589
129545
  state.builderPrograms.set(projectPath, program);
129590
129546
  }
@@ -130317,10 +130273,9 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
130317
130273
  const extendedConfigStatus = forEach(project.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName));
130318
130274
  if (extendedConfigStatus)
130319
130275
  return extendedConfigStatus;
130320
- const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath);
130321
- const dependentPackageFileStatus = packageJsonLookups && forEachEntry(
130322
- packageJsonLookups,
130323
- (path) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
130276
+ const dependentPackageFileStatus = forEach(
130277
+ state.lastCachedPackageJsonLookups.get(resolvedPath) || emptyArray,
130278
+ ([path]) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
130324
130279
  );
130325
130280
  if (dependentPackageFileStatus)
130326
130281
  return dependentPackageFileStatus;
@@ -130731,9 +130686,9 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
130731
130686
  getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath),
130732
130687
  new Map(state.lastCachedPackageJsonLookups.get(resolvedPath)),
130733
130688
  {
130734
- createNewValue: (_path, input) => watchFile(
130689
+ createNewValue: (path, _input) => watchFile(
130735
130690
  state,
130736
- input,
130691
+ path,
130737
130692
  () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
130738
130693
  2e3 /* High */,
130739
130694
  parsed == null ? void 0 : parsed.watchOptions,
@@ -136516,7 +136471,7 @@ function updateImports(program, changeTracker, oldToNew, newToOld, host, getCano
136516
136471
  if ((importedModuleSymbol == null ? void 0 : importedModuleSymbol.declarations) && importedModuleSymbol.declarations.some((d) => isAmbientModule(d)))
136517
136472
  return void 0;
136518
136473
  const toImport = oldFromNew !== void 0 ? getSourceFileToImportFromResolved(importLiteral, resolveModuleName(importLiteral.text, oldImportFromPath, program.getCompilerOptions(), host), oldToNew, allFiles) : getSourceFileToImport(importedModuleSymbol, importLiteral, sourceFile, program, host, oldToNew);
136519
- 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;
136474
+ 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;
136520
136475
  });
136521
136476
  }
136522
136477
  }
@@ -137355,11 +137310,11 @@ function getSourceMapper(host) {
137355
137310
  const fileFromCache = sourceFileLike.get(path);
137356
137311
  if (fileFromCache !== void 0)
137357
137312
  return fileFromCache ? fileFromCache : void 0;
137358
- if (!host.readFile || host.fileExists && !host.fileExists(fileName)) {
137313
+ if (!host.readFile || host.fileExists && !host.fileExists(path)) {
137359
137314
  sourceFileLike.set(path, false);
137360
137315
  return void 0;
137361
137316
  }
137362
- const text = host.readFile(fileName);
137317
+ const text = host.readFile(path);
137363
137318
  const file = text ? createSourceFileLike(text) : false;
137364
137319
  sourceFileLike.set(path, file);
137365
137320
  return file ? file : void 0;
@@ -139912,7 +139867,7 @@ function getTargetFileImportsAndAddExportInOldFile(oldFile, targetFile, importsT
139912
139867
  const resolved = program.getResolvedModule(oldFile, moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
139913
139868
  const fileName = (_a = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _a.resolvedFileName;
139914
139869
  if (fileName && targetSourceFile) {
139915
- const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.fileName, fileName, createModuleSpecifierResolutionHost(program, host));
139870
+ const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.path, fileName, createModuleSpecifierResolutionHost(program, host));
139916
139871
  append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
139917
139872
  } else {
139918
139873
  append(copiedOldImports, filterImport(i, factory.createStringLiteral(moduleSpecifierFromImport(i).text), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
@@ -139990,7 +139945,7 @@ function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols
139990
139945
  };
139991
139946
  deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
139992
139947
  const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(oldFile.path), targetFileName);
139993
- const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
139948
+ const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.path, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
139994
139949
  const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove);
139995
139950
  if (newImportDeclaration)
139996
139951
  changes.insertNodeAfter(sourceFile, statement, newImportDeclaration);
@@ -140125,7 +140080,7 @@ function createOldFileImportsFromTargetFile(sourceFile, targetFileNeedExport, ta
140125
140080
  }
140126
140081
  function makeImportOrRequire(sourceFile, defaultImport, imports, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference) {
140127
140082
  const pathToTargetFile = resolvePath(getDirectoryPath(sourceFile.path), targetFileNameWithExtension);
140128
- const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFile, createModuleSpecifierResolutionHost(program, host));
140083
+ const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.path, pathToTargetFile, createModuleSpecifierResolutionHost(program, host));
140129
140084
  if (useEs6Imports) {
140130
140085
  const specifiers = imports.map((i) => factory.createImportSpecifier(
140131
140086
  /*isTypeOnly*/
@@ -177549,7 +177504,6 @@ var Project3 = class _Project {
177549
177504
  return path === options.configFilePath ? options.configFile : this.getSourceFile(path);
177550
177505
  }
177551
177506
  close() {
177552
- var _a;
177553
177507
  this.projectService.typingsCache.onProjectClosed(this);
177554
177508
  this.closeWatchingTypingLocations();
177555
177509
  this.cleanupProgram();
@@ -177566,12 +177520,6 @@ var Project3 = class _Project {
177566
177520
  this.resolutionCache.clear();
177567
177521
  this.resolutionCache = void 0;
177568
177522
  this.cachedUnresolvedImportsPerFile = void 0;
177569
- (_a = this.packageJsonWatches) == null ? void 0 : _a.forEach((watcher) => {
177570
- watcher.projects.delete(this);
177571
- watcher.close();
177572
- });
177573
- this.packageJsonWatches = void 0;
177574
- this.moduleSpecifierCache.clear();
177575
177523
  this.moduleSpecifierCache = void 0;
177576
177524
  this.directoryStructureHost = void 0;
177577
177525
  this.exportMapCache = void 0;
@@ -177766,10 +177714,13 @@ var Project3 = class _Project {
177766
177714
  }
177767
177715
  }
177768
177716
  /** @internal */
177769
- onPackageJsonChange() {
177770
- this.moduleSpecifierCache.clear();
177771
- if (this.autoImportProviderHost) {
177772
- this.autoImportProviderHost.markAsDirty();
177717
+ onPackageJsonChange(packageJsonPath) {
177718
+ var _a;
177719
+ if ((_a = this.packageJsonsForAutoImport) == null ? void 0 : _a.has(packageJsonPath)) {
177720
+ this.moduleSpecifierCache.clear();
177721
+ if (this.autoImportProviderHost) {
177722
+ this.autoImportProviderHost.markAsDirty();
177723
+ }
177773
177724
  }
177774
177725
  }
177775
177726
  /** @internal */
@@ -177984,7 +177935,7 @@ var Project3 = class _Project {
177984
177935
  this.program,
177985
177936
  this.missingFilesMap || (this.missingFilesMap = /* @__PURE__ */ new Map()),
177986
177937
  // Watch the missing files
177987
- (missingFilePath, missingFileName) => this.addMissingFileWatcher(missingFilePath, missingFileName)
177938
+ (missingFilePath) => this.addMissingFileWatcher(missingFilePath)
177988
177939
  );
177989
177940
  if (this.generatedFilesMap) {
177990
177941
  const outPath = outFile(this.compilerOptions);
@@ -178098,7 +178049,7 @@ var Project3 = class _Project {
178098
178049
  }
178099
178050
  }
178100
178051
  }
178101
- addMissingFileWatcher(missingFilePath, missingFileName) {
178052
+ addMissingFileWatcher(missingFilePath) {
178102
178053
  var _a;
178103
178054
  if (isConfiguredProject(this)) {
178104
178055
  const configFileExistenceInfo = this.projectService.configFileExistenceInfoCache.get(missingFilePath);
@@ -178106,7 +178057,7 @@ var Project3 = class _Project {
178106
178057
  return noopFileWatcher;
178107
178058
  }
178108
178059
  const fileWatcher = this.projectService.watchFactory.watchFile(
178109
- getNormalizedAbsolutePath(missingFileName, this.currentDirectory),
178060
+ missingFilePath,
178110
178061
  (fileName, eventKind) => {
178111
178062
  if (isConfiguredProject(this)) {
178112
178063
  this.getCachedDirectoryStructureHost().addOrDeleteFile(fileName, missingFilePath, eventKind);
@@ -178443,7 +178394,7 @@ var Project3 = class _Project {
178443
178394
  getPackageJsonsVisibleToFile(fileName, rootDir) {
178444
178395
  if (this.projectService.serverMode !== 0 /* Semantic */)
178445
178396
  return emptyArray2;
178446
- return this.projectService.getPackageJsonsVisibleToFile(fileName, this, rootDir);
178397
+ return this.projectService.getPackageJsonsVisibleToFile(fileName, rootDir);
178447
178398
  }
178448
178399
  /** @internal */
178449
178400
  getNearestAncestorDirectoryWithPackageJson(fileName) {
@@ -178451,7 +178402,9 @@ var Project3 = class _Project {
178451
178402
  }
178452
178403
  /** @internal */
178453
178404
  getPackageJsonsForAutoImport(rootDir) {
178454
- return this.getPackageJsonsVisibleToFile(combinePaths(this.currentDirectory, inferredTypesContainingFile), rootDir);
178405
+ const packageJsons = this.getPackageJsonsVisibleToFile(combinePaths(this.currentDirectory, inferredTypesContainingFile), rootDir);
178406
+ this.packageJsonsForAutoImport = new Set(packageJsons.map((p) => p.fileName));
178407
+ return packageJsons;
178455
178408
  }
178456
178409
  /** @internal */
178457
178410
  getPackageJsonCache() {
@@ -178537,7 +178490,7 @@ var Project3 = class _Project {
178537
178490
  }
178538
178491
  /** @internal */
178539
178492
  watchNodeModulesForPackageJsonChanges(directoryPath) {
178540
- return this.projectService.watchPackageJsonsInNodeModules(directoryPath, this);
178493
+ return this.projectService.watchPackageJsonsInNodeModules(this.toPath(directoryPath), this);
178541
178494
  }
178542
178495
  /** @internal */
178543
178496
  getIncompleteCompletionsCache() {
@@ -180113,20 +180066,18 @@ var _ProjectService = class _ProjectService {
180113
180066
  * @internal
180114
180067
  */
180115
180068
  watchWildcardDirectory(directory, flags, configFileName, config) {
180116
- let watcher = this.watchFactory.watchDirectory(
180069
+ return this.watchFactory.watchDirectory(
180117
180070
  directory,
180118
180071
  (fileOrDirectory) => {
180119
180072
  const fileOrDirectoryPath = this.toPath(fileOrDirectory);
180120
180073
  const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
180121
- if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
180122
- const file = this.getNormalizedAbsolutePath(fileOrDirectory);
180123
- this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
180124
- this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
180125
- this.watchPackageJsonFile(file, fileOrDirectoryPath, result);
180074
+ if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectoryPath))) {
180075
+ this.logger.info(`Config: ${configFileName} Detected new package.json: ${fileOrDirectory}`);
180076
+ this.onAddPackageJson(fileOrDirectoryPath);
180126
180077
  }
180127
180078
  const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
180128
180079
  if (isIgnoredFileFromWildCardWatching({
180129
- watchedDirPath: this.toPath(directory),
180080
+ watchedDirPath: directory,
180130
180081
  fileOrDirectory,
180131
180082
  fileOrDirectoryPath,
180132
180083
  configFileName,
@@ -180171,22 +180122,6 @@ var _ProjectService = class _ProjectService {
180171
180122
  WatchType.WildcardDirectory,
180172
180123
  configFileName
180173
180124
  );
180174
- const result = {
180175
- packageJsonWatches: void 0,
180176
- close() {
180177
- var _a;
180178
- if (watcher) {
180179
- watcher.close();
180180
- watcher = void 0;
180181
- (_a = result.packageJsonWatches) == null ? void 0 : _a.forEach((watcher2) => {
180182
- watcher2.projects.delete(result);
180183
- watcher2.close();
180184
- });
180185
- result.packageJsonWatches = void 0;
180186
- }
180187
- }
180188
- };
180189
- return result;
180190
180125
  }
180191
180126
  /** @internal */
180192
180127
  delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
@@ -181013,7 +180948,7 @@ var _ProjectService = class _ProjectService {
181013
180948
  if (value.info) {
181014
180949
  project.removeFile(
181015
180950
  value.info,
181016
- project.fileExists(value.info.fileName),
180951
+ project.fileExists(path),
181017
180952
  /*detachFromProject*/
181018
180953
  true
181019
180954
  );
@@ -181245,7 +181180,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181245
181180
  watchClosedScriptInfo(info) {
181246
181181
  Debug.assert(!info.fileWatcher);
181247
181182
  if (!info.isDynamicOrHasMixedContent() && (!this.globalCacheLocationDirectoryPath || !startsWith(info.path, this.globalCacheLocationDirectoryPath))) {
181248
- const indexOfNodeModules = info.fileName.indexOf("/node_modules/");
181183
+ const indexOfNodeModules = info.path.indexOf("/node_modules/");
181249
181184
  if (!this.host.getModifiedTime || indexOfNodeModules === -1) {
181250
181185
  info.fileWatcher = this.watchFactory.watchFile(
181251
181186
  info.fileName,
@@ -181256,12 +181191,12 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181256
181191
  );
181257
181192
  } else {
181258
181193
  info.mTime = this.getModifiedTime(info);
181259
- info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.fileName.substring(0, indexOfNodeModules));
181194
+ info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.path.substr(0, indexOfNodeModules));
181260
181195
  }
181261
181196
  }
181262
181197
  }
181263
- createNodeModulesWatcher(dir, dirPath) {
181264
- let watcher = this.watchFactory.watchDirectory(
181198
+ createNodeModulesWatcher(dir) {
181199
+ const watcher = this.watchFactory.watchDirectory(
181265
181200
  dir,
181266
181201
  (fileOrDirectory) => {
181267
181202
  var _a;
@@ -181270,14 +181205,14 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181270
181205
  return;
181271
181206
  const basename = getBaseFileName(fileOrDirectoryPath);
181272
181207
  if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (basename === "package.json" || basename === "node_modules")) {
181273
- result.affectedModuleSpecifierCacheProjects.forEach((project) => {
181274
- var _a2;
181275
- (_a2 = project.getModuleSpecifierCache()) == null ? void 0 : _a2.clear();
181208
+ result.affectedModuleSpecifierCacheProjects.forEach((projectName) => {
181209
+ var _a2, _b;
181210
+ (_b = (_a2 = this.findProject(projectName)) == null ? void 0 : _a2.getModuleSpecifierCache()) == null ? void 0 : _b.clear();
181276
181211
  });
181277
181212
  }
181278
181213
  if (result.refreshScriptInfoRefCount) {
181279
- if (dirPath === fileOrDirectoryPath) {
181280
- this.refreshScriptInfosInDirectory(dirPath);
181214
+ if (dir === fileOrDirectoryPath) {
181215
+ this.refreshScriptInfosInDirectory(dir);
181281
181216
  } else {
181282
181217
  const info = this.getScriptInfoForPath(fileOrDirectoryPath);
181283
181218
  if (info) {
@@ -181300,34 +181235,29 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181300
181235
  close: () => {
181301
181236
  var _a;
181302
181237
  if (!result.refreshScriptInfoRefCount && !((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size)) {
181303
- watcher == null ? void 0 : watcher.close();
181304
- watcher = void 0;
181305
- this.nodeModulesWatchers.delete(dirPath);
181238
+ watcher.close();
181239
+ this.nodeModulesWatchers.delete(dir);
181306
181240
  }
181307
181241
  }
181308
181242
  };
181309
- this.nodeModulesWatchers.set(dirPath, result);
181243
+ this.nodeModulesWatchers.set(dir, result);
181310
181244
  return result;
181311
181245
  }
181312
181246
  /** @internal */
181313
181247
  watchPackageJsonsInNodeModules(dir, project) {
181314
- var _a;
181315
- const dirPath = this.toPath(dir);
181316
- const watcher = this.nodeModulesWatchers.get(dirPath) || this.createNodeModulesWatcher(dir, dirPath);
181317
- Debug.assert(!((_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.has(project)));
181318
- (watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project);
181248
+ const watcher = this.nodeModulesWatchers.get(dir) || this.createNodeModulesWatcher(dir);
181249
+ (watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project.getProjectName());
181319
181250
  return {
181320
181251
  close: () => {
181321
- var _a2;
181322
- (_a2 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a2.delete(project);
181252
+ var _a;
181253
+ (_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.delete(project.getProjectName());
181323
181254
  watcher.close();
181324
181255
  }
181325
181256
  };
181326
181257
  }
181327
181258
  watchClosedScriptInfoInNodeModules(dir) {
181328
181259
  const watchDir = dir + "/node_modules";
181329
- const watchedDirPath = this.toPath(watchDir);
181330
- const watcher = this.nodeModulesWatchers.get(watchedDirPath) || this.createNodeModulesWatcher(watchDir, watchedDirPath);
181260
+ const watcher = this.nodeModulesWatchers.get(watchDir) || this.createNodeModulesWatcher(watchDir);
181331
181261
  watcher.refreshScriptInfoRefCount++;
181332
181262
  return {
181333
181263
  close: () => {
@@ -181337,7 +181267,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181337
181267
  };
181338
181268
  }
181339
181269
  getModifiedTime(info) {
181340
- return (this.host.getModifiedTime(info.fileName) || missingFileModifiedTime).getTime();
181270
+ return (this.host.getModifiedTime(info.path) || missingFileModifiedTime).getTime();
181341
181271
  }
181342
181272
  refreshScriptInfo(info) {
181343
181273
  const mTime = this.getModifiedTime(info);
@@ -181601,9 +181531,10 @@ Dynamic files must always be opened with service's current directory or service
181601
181531
  });
181602
181532
  }
181603
181533
  if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports) {
181604
- this.forEachProject((project) => {
181605
- project.onAutoImportProviderSettingsChanged();
181606
- });
181534
+ this.invalidateProjectPackageJson(
181535
+ /*packageJsonPath*/
181536
+ void 0
181537
+ );
181607
181538
  }
181608
181539
  }
181609
181540
  if (args.extraFileExtensions) {
@@ -182522,9 +182453,10 @@ Dynamic files must always be opened with service's current directory or service
182522
182453
  this.currentPluginConfigOverrides.set(args.pluginName, args.configuration);
182523
182454
  }
182524
182455
  /** @internal */
182525
- getPackageJsonsVisibleToFile(fileName, project, rootDir) {
182456
+ getPackageJsonsVisibleToFile(fileName, rootDir) {
182526
182457
  const packageJsonCache = this.packageJsonCache;
182527
182458
  const rootPath = rootDir && this.toPath(rootDir);
182459
+ const filePath = this.toPath(fileName);
182528
182460
  const result = [];
182529
182461
  const processDirectory = (directory) => {
182530
182462
  switch (packageJsonCache.directoryHasPackageJson(directory)) {
@@ -182533,7 +182465,7 @@ Dynamic files must always be opened with service's current directory or service
182533
182465
  return processDirectory(directory);
182534
182466
  case -1 /* True */:
182535
182467
  const packageJsonFileName = combinePaths(directory, "package.json");
182536
- this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName), project);
182468
+ this.watchPackageJsonFile(packageJsonFileName);
182537
182469
  const info = packageJsonCache.getInDirectory(directory);
182538
182470
  if (info)
182539
182471
  result.push(info);
@@ -182542,13 +182474,13 @@ Dynamic files must always be opened with service's current directory or service
182542
182474
  return true;
182543
182475
  }
182544
182476
  };
182545
- forEachAncestorDirectory(getDirectoryPath(fileName), processDirectory);
182477
+ forEachAncestorDirectory(getDirectoryPath(filePath), processDirectory);
182546
182478
  return result;
182547
182479
  }
182548
182480
  /** @internal */
182549
182481
  getNearestAncestorDirectoryWithPackageJson(fileName) {
182550
182482
  return forEachAncestorDirectory(fileName, (directory) => {
182551
- switch (this.packageJsonCache.directoryHasPackageJson(directory)) {
182483
+ switch (this.packageJsonCache.directoryHasPackageJson(this.toPath(directory))) {
182552
182484
  case -1 /* True */:
182553
182485
  return directory;
182554
182486
  case 0 /* False */:
@@ -182559,54 +182491,41 @@ Dynamic files must always be opened with service's current directory or service
182559
182491
  });
182560
182492
  }
182561
182493
  /** @internal */
182562
- watchPackageJsonFile(file, path, project) {
182563
- Debug.assert(project !== void 0);
182564
- let result = (this.packageJsonFilesMap ?? (this.packageJsonFilesMap = /* @__PURE__ */ new Map())).get(path);
182565
- if (!result) {
182566
- let watcher = this.watchFactory.watchFile(
182567
- file,
182568
- (fileName, eventKind) => {
182569
- switch (eventKind) {
182570
- case 0 /* Created */:
182571
- return Debug.fail();
182572
- case 1 /* Changed */:
182573
- this.packageJsonCache.addOrUpdate(fileName, path);
182574
- this.onPackageJsonChange(result);
182575
- break;
182576
- case 2 /* Deleted */:
182577
- this.packageJsonCache.delete(path);
182578
- this.onPackageJsonChange(result);
182579
- result.projects.clear();
182580
- result.close();
182581
- }
182582
- },
182583
- 250 /* Low */,
182584
- this.hostConfiguration.watchOptions,
182585
- WatchType.PackageJson
182494
+ watchPackageJsonFile(path) {
182495
+ const watchers = this.packageJsonFilesMap || (this.packageJsonFilesMap = /* @__PURE__ */ new Map());
182496
+ if (!watchers.has(path)) {
182497
+ this.invalidateProjectPackageJson(path);
182498
+ watchers.set(
182499
+ path,
182500
+ this.watchFactory.watchFile(
182501
+ path,
182502
+ (fileName, eventKind) => {
182503
+ const path2 = this.toPath(fileName);
182504
+ switch (eventKind) {
182505
+ case 0 /* Created */:
182506
+ return Debug.fail();
182507
+ case 1 /* Changed */:
182508
+ this.packageJsonCache.addOrUpdate(path2);
182509
+ this.invalidateProjectPackageJson(path2);
182510
+ break;
182511
+ case 2 /* Deleted */:
182512
+ this.packageJsonCache.delete(path2);
182513
+ this.invalidateProjectPackageJson(path2);
182514
+ watchers.get(path2).close();
182515
+ watchers.delete(path2);
182516
+ }
182517
+ },
182518
+ 250 /* Low */,
182519
+ this.hostConfiguration.watchOptions,
182520
+ WatchType.PackageJson
182521
+ )
182586
182522
  );
182587
- result = {
182588
- projects: /* @__PURE__ */ new Set(),
182589
- close: () => {
182590
- var _a;
182591
- if (result.projects.size || !watcher)
182592
- return;
182593
- watcher.close();
182594
- watcher = void 0;
182595
- (_a = this.packageJsonFilesMap) == null ? void 0 : _a.delete(path);
182596
- this.packageJsonCache.invalidate(path);
182597
- }
182598
- };
182599
- this.packageJsonFilesMap.set(path, result);
182600
182523
  }
182601
- result.projects.add(project);
182602
- (project.packageJsonWatches ?? (project.packageJsonWatches = /* @__PURE__ */ new Set())).add(result);
182603
182524
  }
182604
182525
  /** @internal */
182605
- onPackageJsonChange(result) {
182606
- result.projects.forEach((project) => {
182607
- var _a;
182608
- return (_a = project.onPackageJsonChange) == null ? void 0 : _a.call(project);
182609
- });
182526
+ onAddPackageJson(path) {
182527
+ this.packageJsonCache.addOrUpdate(path);
182528
+ this.watchPackageJsonFile(path);
182610
182529
  }
182611
182530
  /** @internal */
182612
182531
  includePackageJsonAutoImports() {
@@ -182620,6 +182539,19 @@ Dynamic files must always be opened with service's current directory or service
182620
182539
  }
182621
182540
  }
182622
182541
  /** @internal */
182542
+ invalidateProjectPackageJson(packageJsonPath) {
182543
+ this.configuredProjects.forEach(invalidate);
182544
+ this.inferredProjects.forEach(invalidate);
182545
+ this.externalProjects.forEach(invalidate);
182546
+ function invalidate(project) {
182547
+ if (packageJsonPath) {
182548
+ project.onPackageJsonChange(packageJsonPath);
182549
+ } else {
182550
+ project.onAutoImportProviderSettingsChanged();
182551
+ }
182552
+ }
182553
+ }
182554
+ /** @internal */
182623
182555
  getIncompleteCompletionsCache() {
182624
182556
  return this.incompleteCompletionsCache || (this.incompleteCompletionsCache = createIncompleteCompletionsCache());
182625
182557
  }
@@ -182677,10 +182609,9 @@ function createModuleSpecifierCache(host) {
182677
182609
  for (const p of modulePaths) {
182678
182610
  if (p.isInNodeModules) {
182679
182611
  const nodeModulesPath = p.path.substring(0, p.path.indexOf(nodeModulesPathPart) + nodeModulesPathPart.length - 1);
182680
- const key2 = host.toPath(nodeModulesPath);
182681
- if (!(containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.has(key2))) {
182612
+ if (!(containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.has(nodeModulesPath))) {
182682
182613
  (containedNodeModulesWatchers || (containedNodeModulesWatchers = /* @__PURE__ */ new Map())).set(
182683
- key2,
182614
+ nodeModulesPath,
182684
182615
  host.watchNodeModulesForPackageJsonChanges(nodeModulesPath)
182685
182616
  );
182686
182617
  }
@@ -182719,7 +182650,7 @@ function createModuleSpecifierCache(host) {
182719
182650
  }
182720
182651
  },
182721
182652
  clear() {
182722
- containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach(closeFileWatcher);
182653
+ containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach((watcher) => watcher.close());
182723
182654
  cache == null ? void 0 : cache.clear();
182724
182655
  containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.clear();
182725
182656
  currentKey = void 0;
@@ -182754,42 +182685,37 @@ function createPackageJsonCache(host) {
182754
182685
  const directoriesWithoutPackageJson = /* @__PURE__ */ new Map();
182755
182686
  return {
182756
182687
  addOrUpdate,
182757
- invalidate,
182688
+ forEach: packageJsons.forEach.bind(packageJsons),
182689
+ get: packageJsons.get.bind(packageJsons),
182758
182690
  delete: (fileName) => {
182759
182691
  packageJsons.delete(fileName);
182760
182692
  directoriesWithoutPackageJson.set(getDirectoryPath(fileName), true);
182761
182693
  },
182762
182694
  getInDirectory: (directory) => {
182763
- return packageJsons.get(host.toPath(combinePaths(directory, "package.json"))) || void 0;
182695
+ return packageJsons.get(combinePaths(directory, "package.json")) || void 0;
182764
182696
  },
182765
- directoryHasPackageJson: (directory) => directoryHasPackageJson(host.toPath(directory)),
182697
+ directoryHasPackageJson,
182766
182698
  searchDirectoryAndAncestors: (directory) => {
182767
182699
  forEachAncestorDirectory(directory, (ancestor) => {
182768
- const ancestorPath = host.toPath(ancestor);
182769
- if (directoryHasPackageJson(ancestorPath) !== 3 /* Maybe */) {
182700
+ if (directoryHasPackageJson(ancestor) !== 3 /* Maybe */) {
182770
182701
  return true;
182771
182702
  }
182772
- const packageJsonFileName = combinePaths(ancestor, "package.json");
182703
+ const packageJsonFileName = host.toPath(combinePaths(ancestor, "package.json"));
182773
182704
  if (tryFileExists(host, packageJsonFileName)) {
182774
- addOrUpdate(packageJsonFileName, combinePaths(ancestorPath, "package.json"));
182705
+ addOrUpdate(packageJsonFileName);
182775
182706
  } else {
182776
- directoriesWithoutPackageJson.set(ancestorPath, true);
182707
+ directoriesWithoutPackageJson.set(ancestor, true);
182777
182708
  }
182778
182709
  });
182779
182710
  }
182780
182711
  };
182781
- function addOrUpdate(file, path) {
182782
- const packageJsonInfo = Debug.checkDefined(createPackageJsonInfo(file, host.host));
182783
- packageJsons.set(path, packageJsonInfo);
182784
- directoriesWithoutPackageJson.delete(getDirectoryPath(path));
182785
- }
182786
- function invalidate(path) {
182787
- packageJsons.delete(path);
182788
- directoriesWithoutPackageJson.delete(getDirectoryPath(path));
182712
+ function addOrUpdate(fileName) {
182713
+ const packageJsonInfo = Debug.checkDefined(createPackageJsonInfo(fileName, host.host));
182714
+ packageJsons.set(fileName, packageJsonInfo);
182715
+ directoriesWithoutPackageJson.delete(getDirectoryPath(fileName));
182789
182716
  }
182790
182717
  function directoryHasPackageJson(directory) {
182791
- const path = host.toPath(directory);
182792
- return packageJsons.has(combinePaths(path, "package.json")) ? -1 /* True */ : directoriesWithoutPackageJson.has(path) ? 0 /* False */ : 3 /* Maybe */;
182718
+ return packageJsons.has(combinePaths(directory, "package.json")) ? -1 /* True */ : directoriesWithoutPackageJson.has(directory) ? 0 /* False */ : 3 /* Maybe */;
182793
182719
  }
182794
182720
  }
182795
182721