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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsserver.js CHANGED
@@ -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);
@@ -112915,8 +112874,8 @@ function transformDeclarations(context) {
112915
112874
  const specifier = getModuleSpecifier(
112916
112875
  options,
112917
112876
  currentSourceFile,
112918
- getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
112919
- getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
112877
+ toPath(outputFilePath2, host.getCurrentDirectory(), host.getCanonicalFileName),
112878
+ toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName),
112920
112879
  host
112921
112880
  );
112922
112881
  if (!pathIsRelative(specifier)) {
@@ -120353,8 +120312,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
120353
120312
  }
120354
120313
  const baseName = getBaseNameOfFileName(fileOrDirectory);
120355
120314
  const fsQueryResult = {
120356
- fileExists: host.fileExists(fileOrDirectory),
120357
- directoryExists: host.directoryExists(fileOrDirectory)
120315
+ fileExists: host.fileExists(fileOrDirectoryPath),
120316
+ directoryExists: host.directoryExists(fileOrDirectoryPath)
120358
120317
  };
120359
120318
  if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
120360
120319
  clearCache();
@@ -120454,9 +120413,11 @@ function updatePackageJsonWatch(lookups, packageJsonWatches, createPackageJsonWa
120454
120413
  );
120455
120414
  }
120456
120415
  function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) {
120416
+ const missingFilePaths = program.getMissingFilePaths();
120417
+ const newMissingFilePathMap = arrayToMap(missingFilePaths, identity, returnTrue);
120457
120418
  mutateMap(
120458
120419
  missingFileWatches,
120459
- program.getMissingFilePaths(),
120420
+ newMissingFilePathMap,
120460
120421
  {
120461
120422
  // Watch the missing files
120462
120423
  createNewValue: createMissingFileWatch,
@@ -121316,8 +121277,7 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
121316
121277
  return false;
121317
121278
  if (program.getSourceFiles().some(sourceFileNotUptoDate))
121318
121279
  return false;
121319
- const missingPaths = program.getMissingFilePaths();
121320
- if (missingPaths && forEachEntry(missingPaths, fileExists))
121280
+ if (program.getMissingFilePaths().some(fileExists))
121321
121281
  return false;
121322
121282
  const currentOptions = program.getCompilerOptions();
121323
121283
  if (!compareDataObjects(currentOptions, newOptions))
@@ -121621,7 +121581,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121621
121581
  let redirectTargetsMap = createMultiMap();
121622
121582
  let usesUriStyleNodeCoreModules = false;
121623
121583
  const filesByName = /* @__PURE__ */ new Map();
121624
- let missingFileNames = /* @__PURE__ */ new Map();
121584
+ let missingFilePaths;
121625
121585
  const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
121626
121586
  let resolvedProjectReferences;
121627
121587
  let projectReferenceRedirects;
@@ -121740,10 +121700,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121740
121700
  });
121741
121701
  }
121742
121702
  }
121703
+ missingFilePaths = arrayFrom(mapDefinedIterator(filesByName.entries(), ([path, file]) => file === void 0 ? path : void 0));
121743
121704
  files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
121744
121705
  processingDefaultLibFiles = void 0;
121745
121706
  processingOtherFiles = void 0;
121746
121707
  }
121708
+ Debug.assert(!!missingFilePaths);
121747
121709
  if (oldProgram && host.onReleaseOldSourceFile) {
121748
121710
  const oldSourceFiles = oldProgram.getSourceFiles();
121749
121711
  for (const oldSourceFile of oldSourceFiles) {
@@ -121788,7 +121750,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121788
121750
  getSourceFile,
121789
121751
  getSourceFileByPath,
121790
121752
  getSourceFiles: () => files,
121791
- getMissingFilePaths: () => missingFileNames,
121753
+ getMissingFilePaths: () => missingFilePaths,
121754
+ // TODO: GH#18217
121792
121755
  getModuleResolutionCache: () => moduleResolutionCache,
121793
121756
  getFilesByNameMap: () => filesByName,
121794
121757
  getCompilerOptions: () => options,
@@ -122215,7 +122178,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122215
122178
  const newSourceFiles = [];
122216
122179
  const modifiedSourceFiles = [];
122217
122180
  structureIsReused = 2 /* Completely */;
122218
- if (forEachEntry(oldProgram.getMissingFilePaths(), (missingFilePath) => host.fileExists(missingFilePath))) {
122181
+ if (oldProgram.getMissingFilePaths().some((missingFilePath) => host.fileExists(missingFilePath))) {
122219
122182
  return 0 /* Not */;
122220
122183
  }
122221
122184
  const oldSourceFiles = oldProgram.getSourceFiles();
@@ -122355,7 +122318,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122355
122318
  if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
122356
122319
  return 1 /* SafeModules */;
122357
122320
  }
122358
- missingFileNames = oldProgram.getMissingFilePaths();
122321
+ missingFilePaths = oldProgram.getMissingFilePaths();
122359
122322
  Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
122360
122323
  for (const newSourceFile of newSourceFiles) {
122361
122324
  filesByName.set(newSourceFile.path, newSourceFile);
@@ -122412,7 +122375,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122412
122375
  const path = toPath3(f);
122413
122376
  if (getSourceFileByPath(path))
122414
122377
  return true;
122415
- if (missingFileNames.has(path))
122378
+ if (contains(missingFilePaths, path))
122416
122379
  return false;
122417
122380
  return host.fileExists(f);
122418
122381
  },
@@ -123224,7 +123187,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123224
123187
  addFileToFilesByName(
123225
123188
  file2,
123226
123189
  path,
123227
- fileName,
123228
123190
  /*redirectedPath*/
123229
123191
  void 0
123230
123192
  );
@@ -123297,7 +123259,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123297
123259
  if (fileFromPackageId) {
123298
123260
  const dupFile = createRedirectedSourceFile(fileFromPackageId, file, fileName, path, toPath3(fileName), originalFileName, sourceFileOptions);
123299
123261
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
123300
- addFileToFilesByName(dupFile, path, fileName, redirectedPath);
123262
+ addFileToFilesByName(dupFile, path, redirectedPath);
123301
123263
  addFileIncludeReason(dupFile, reason);
123302
123264
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
123303
123265
  processingOtherFiles.push(dupFile);
@@ -123307,7 +123269,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123307
123269
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
123308
123270
  }
123309
123271
  }
123310
- addFileToFilesByName(file, path, fileName, redirectedPath);
123272
+ addFileToFilesByName(file, path, redirectedPath);
123311
123273
  if (file) {
123312
123274
  sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
123313
123275
  file.fileName = fileName;
@@ -123347,21 +123309,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123347
123309
  if (file)
123348
123310
  fileReasons.add(file.path, reason);
123349
123311
  }
123350
- function addFileToFilesByName(file, path, fileName, redirectedPath) {
123312
+ function addFileToFilesByName(file, path, redirectedPath) {
123351
123313
  if (redirectedPath) {
123352
- updateFilesByNameMap(fileName, redirectedPath, file);
123353
- updateFilesByNameMap(fileName, path, file || false);
123314
+ filesByName.set(redirectedPath, file);
123315
+ filesByName.set(path, file || false);
123354
123316
  } else {
123355
- updateFilesByNameMap(fileName, path, file);
123317
+ filesByName.set(path, file);
123356
123318
  }
123357
123319
  }
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
- }
123365
123320
  function getProjectReferenceRedirect(fileName) {
123366
123321
  const referencedProject = getProjectReferenceRedirectProject(fileName);
123367
123322
  return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
@@ -123682,7 +123637,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123682
123637
  /*file*/
123683
123638
  void 0,
123684
123639
  sourceFilePath,
123685
- refPath,
123686
123640
  /*redirectedPath*/
123687
123641
  void 0
123688
123642
  );
@@ -123694,7 +123648,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123694
123648
  addFileToFilesByName(
123695
123649
  sourceFile,
123696
123650
  sourceFilePath,
123697
- refPath,
123698
123651
  /*redirectedPath*/
123699
123652
  void 0
123700
123653
  );
@@ -123704,7 +123657,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123704
123657
  addFileToFilesByName(
123705
123658
  sourceFile,
123706
123659
  sourceFilePath,
123707
- refPath,
123708
123660
  /*redirectedPath*/
123709
123661
  void 0
123710
123662
  );
@@ -127241,7 +127193,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
127241
127193
  const watcher = {
127242
127194
  watcher: canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
127243
127195
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
127244
- invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache());
127196
+ invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache().getInternalMap());
127245
127197
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
127246
127198
  }) : noopFileWatcher,
127247
127199
  resolutions: isSymlink ? 0 : resolutions,
@@ -127281,7 +127233,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
127281
127233
  if (watcher == null ? void 0 : watcher.files)
127282
127234
  (affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path);
127283
127235
  (_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
127284
- packageJsonMap.deletePackageJsonInfo(path);
127236
+ packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
127285
127237
  }
127286
127238
  function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
127287
127239
  const program = resolutionHost.getCurrentProgram();
@@ -127466,14 +127418,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
127466
127418
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
127467
127419
  }
127468
127420
  function invalidatePackageJsonMap() {
127469
- const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().entries();
127421
+ const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
127470
127422
  if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
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
- }
127423
+ packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
127477
127424
  }
127478
127425
  }
127479
127426
  function invalidateResolutionsOfFailedLookupLocations() {
@@ -128515,11 +128462,7 @@ function createWatchProgram(host) {
128515
128462
  const oldProgram = getCurrentProgram();
128516
128463
  builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
128517
128464
  resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
128518
- updateMissingFilePathsWatch(
128519
- builderProgram.getProgram(),
128520
- missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()),
128521
- watchMissingFilePath
128522
- );
128465
+ updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()), watchMissingFilePath);
128523
128466
  if (needsUpdateInTypeRootWatch) {
128524
128467
  resolutionCache.updateTypeRootsWatch();
128525
128468
  }
@@ -128812,15 +128755,8 @@ function createWatchProgram(host) {
128812
128755
  cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
128813
128756
  }
128814
128757
  }
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
- );
128758
+ function watchMissingFilePath(missingFilePath) {
128759
+ return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(missingFilePath, missingFilePath, onMissingFileChange, 500 /* Medium */, watchOptions, WatchType.MissingFile);
128824
128760
  }
128825
128761
  function onMissingFileChange(fileName, eventKind, missingFilePath) {
128826
128762
  updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
@@ -129316,7 +129252,6 @@ function createStateBuildOrder(state) {
129316
129252
  mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
129317
129253
  mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
129318
129254
  mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
129319
- mutateMapSkippingNewValues(state.lastCachedPackageJsonLookups, currentProjects, noopOnDelete);
129320
129255
  if (state.watch) {
129321
129256
  mutateMapSkippingNewValues(
129322
129257
  state.allWatchedConfigFiles,
@@ -129571,7 +129506,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
129571
129506
  return withProgramOrUndefined(action) || emptyArray;
129572
129507
  }
129573
129508
  function createProgram2() {
129574
- var _a, _b, _c;
129509
+ var _a, _b;
129575
129510
  Debug.assert(program === void 0);
129576
129511
  if (state.options.dry) {
129577
129512
  reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
@@ -129600,16 +129535,12 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
129600
129535
  config.projectReferences
129601
129536
  );
129602
129537
  if (state.watch) {
129603
- const entries = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().entries();
129604
129538
  state.lastCachedPackageJsonLookups.set(
129605
129539
  projectPath,
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
- ))
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
+ )
129613
129544
  );
129614
129545
  state.builderPrograms.set(projectPath, program);
129615
129546
  }
@@ -130342,10 +130273,9 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
130342
130273
  const extendedConfigStatus = forEach(project.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName));
130343
130274
  if (extendedConfigStatus)
130344
130275
  return extendedConfigStatus;
130345
- const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath);
130346
- const dependentPackageFileStatus = packageJsonLookups && forEachEntry(
130347
- packageJsonLookups,
130348
- (path) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
130276
+ const dependentPackageFileStatus = forEach(
130277
+ state.lastCachedPackageJsonLookups.get(resolvedPath) || emptyArray,
130278
+ ([path]) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
130349
130279
  );
130350
130280
  if (dependentPackageFileStatus)
130351
130281
  return dependentPackageFileStatus;
@@ -130756,9 +130686,9 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
130756
130686
  getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath),
130757
130687
  new Map(state.lastCachedPackageJsonLookups.get(resolvedPath)),
130758
130688
  {
130759
- createNewValue: (_path, input) => watchFile(
130689
+ createNewValue: (path, _input) => watchFile(
130760
130690
  state,
130761
- input,
130691
+ path,
130762
130692
  () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
130763
130693
  2e3 /* High */,
130764
130694
  parsed == null ? void 0 : parsed.watchOptions,
@@ -136541,7 +136471,7 @@ function updateImports(program, changeTracker, oldToNew, newToOld, host, getCano
136541
136471
  if ((importedModuleSymbol == null ? void 0 : importedModuleSymbol.declarations) && importedModuleSymbol.declarations.some((d) => isAmbientModule(d)))
136542
136472
  return void 0;
136543
136473
  const toImport = oldFromNew !== void 0 ? getSourceFileToImportFromResolved(importLiteral, resolveModuleName(importLiteral.text, oldImportFromPath, program.getCompilerOptions(), host), oldToNew, allFiles) : getSourceFileToImport(importedModuleSymbol, importLiteral, sourceFile, program, host, oldToNew);
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;
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;
136545
136475
  });
136546
136476
  }
136547
136477
  }
@@ -137380,11 +137310,11 @@ function getSourceMapper(host) {
137380
137310
  const fileFromCache = sourceFileLike.get(path);
137381
137311
  if (fileFromCache !== void 0)
137382
137312
  return fileFromCache ? fileFromCache : void 0;
137383
- if (!host.readFile || host.fileExists && !host.fileExists(fileName)) {
137313
+ if (!host.readFile || host.fileExists && !host.fileExists(path)) {
137384
137314
  sourceFileLike.set(path, false);
137385
137315
  return void 0;
137386
137316
  }
137387
- const text = host.readFile(fileName);
137317
+ const text = host.readFile(path);
137388
137318
  const file = text ? createSourceFileLike(text) : false;
137389
137319
  sourceFileLike.set(path, file);
137390
137320
  return file ? file : void 0;
@@ -139937,7 +139867,7 @@ function getTargetFileImportsAndAddExportInOldFile(oldFile, targetFile, importsT
139937
139867
  const resolved = program.getResolvedModule(oldFile, moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
139938
139868
  const fileName = (_a = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _a.resolvedFileName;
139939
139869
  if (fileName && targetSourceFile) {
139940
- 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));
139941
139871
  append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
139942
139872
  } else {
139943
139873
  append(copiedOldImports, filterImport(i, factory.createStringLiteral(moduleSpecifierFromImport(i).text), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
@@ -140015,7 +139945,7 @@ function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols
140015
139945
  };
140016
139946
  deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
140017
139947
  const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(oldFile.path), targetFileName);
140018
- 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));
140019
139949
  const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove);
140020
139950
  if (newImportDeclaration)
140021
139951
  changes.insertNodeAfter(sourceFile, statement, newImportDeclaration);
@@ -140150,7 +140080,7 @@ function createOldFileImportsFromTargetFile(sourceFile, targetFileNeedExport, ta
140150
140080
  }
140151
140081
  function makeImportOrRequire(sourceFile, defaultImport, imports, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference) {
140152
140082
  const pathToTargetFile = resolvePath(getDirectoryPath(sourceFile.path), targetFileNameWithExtension);
140153
- 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));
140154
140084
  if (useEs6Imports) {
140155
140085
  const specifiers = imports.map((i) => factory.createImportSpecifier(
140156
140086
  /*isTypeOnly*/
@@ -177590,7 +177520,6 @@ var Project3 = class _Project {
177590
177520
  this.resolutionCache.clear();
177591
177521
  this.resolutionCache = void 0;
177592
177522
  this.cachedUnresolvedImportsPerFile = void 0;
177593
- this.moduleSpecifierCache.clear();
177594
177523
  this.moduleSpecifierCache = void 0;
177595
177524
  this.directoryStructureHost = void 0;
177596
177525
  this.exportMapCache = void 0;
@@ -178006,7 +177935,7 @@ var Project3 = class _Project {
178006
177935
  this.program,
178007
177936
  this.missingFilesMap || (this.missingFilesMap = /* @__PURE__ */ new Map()),
178008
177937
  // Watch the missing files
178009
- (missingFilePath, missingFileName) => this.addMissingFileWatcher(missingFilePath, missingFileName)
177938
+ (missingFilePath) => this.addMissingFileWatcher(missingFilePath)
178010
177939
  );
178011
177940
  if (this.generatedFilesMap) {
178012
177941
  const outPath = outFile(this.compilerOptions);
@@ -178120,7 +178049,7 @@ var Project3 = class _Project {
178120
178049
  }
178121
178050
  }
178122
178051
  }
178123
- addMissingFileWatcher(missingFilePath, missingFileName) {
178052
+ addMissingFileWatcher(missingFilePath) {
178124
178053
  var _a;
178125
178054
  if (isConfiguredProject(this)) {
178126
178055
  const configFileExistenceInfo = this.projectService.configFileExistenceInfoCache.get(missingFilePath);
@@ -178128,7 +178057,7 @@ var Project3 = class _Project {
178128
178057
  return noopFileWatcher;
178129
178058
  }
178130
178059
  const fileWatcher = this.projectService.watchFactory.watchFile(
178131
- getNormalizedAbsolutePath(missingFileName, this.currentDirectory),
178060
+ missingFilePath,
178132
178061
  (fileName, eventKind) => {
178133
178062
  if (isConfiguredProject(this)) {
178134
178063
  this.getCachedDirectoryStructureHost().addOrDeleteFile(fileName, missingFilePath, eventKind);
@@ -178474,7 +178403,7 @@ var Project3 = class _Project {
178474
178403
  /** @internal */
178475
178404
  getPackageJsonsForAutoImport(rootDir) {
178476
178405
  const packageJsons = this.getPackageJsonsVisibleToFile(combinePaths(this.currentDirectory, inferredTypesContainingFile), rootDir);
178477
- this.packageJsonsForAutoImport = new Set(packageJsons.map((p) => this.projectService.toPath(p.fileName)));
178406
+ this.packageJsonsForAutoImport = new Set(packageJsons.map((p) => p.fileName));
178478
178407
  return packageJsons;
178479
178408
  }
178480
178409
  /** @internal */
@@ -178561,7 +178490,7 @@ var Project3 = class _Project {
178561
178490
  }
178562
178491
  /** @internal */
178563
178492
  watchNodeModulesForPackageJsonChanges(directoryPath) {
178564
- return this.projectService.watchPackageJsonsInNodeModules(directoryPath, this);
178493
+ return this.projectService.watchPackageJsonsInNodeModules(this.toPath(directoryPath), this);
178565
178494
  }
178566
178495
  /** @internal */
178567
178496
  getIncompleteCompletionsCache() {
@@ -180142,13 +180071,13 @@ var _ProjectService = class _ProjectService {
180142
180071
  (fileOrDirectory) => {
180143
180072
  const fileOrDirectoryPath = this.toPath(fileOrDirectory);
180144
180073
  const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
180145
- if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
180074
+ if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectoryPath))) {
180146
180075
  this.logger.info(`Config: ${configFileName} Detected new package.json: ${fileOrDirectory}`);
180147
- this.onAddPackageJson(this.getNormalizedAbsolutePath(fileOrDirectory), fileOrDirectoryPath);
180076
+ this.onAddPackageJson(fileOrDirectoryPath);
180148
180077
  }
180149
180078
  const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
180150
180079
  if (isIgnoredFileFromWildCardWatching({
180151
- watchedDirPath: this.toPath(directory),
180080
+ watchedDirPath: directory,
180152
180081
  fileOrDirectory,
180153
180082
  fileOrDirectoryPath,
180154
180083
  configFileName,
@@ -181019,7 +180948,7 @@ var _ProjectService = class _ProjectService {
181019
180948
  if (value.info) {
181020
180949
  project.removeFile(
181021
180950
  value.info,
181022
- project.fileExists(value.info.fileName),
180951
+ project.fileExists(path),
181023
180952
  /*detachFromProject*/
181024
180953
  true
181025
180954
  );
@@ -181251,7 +181180,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181251
181180
  watchClosedScriptInfo(info) {
181252
181181
  Debug.assert(!info.fileWatcher);
181253
181182
  if (!info.isDynamicOrHasMixedContent() && (!this.globalCacheLocationDirectoryPath || !startsWith(info.path, this.globalCacheLocationDirectoryPath))) {
181254
- const indexOfNodeModules = info.fileName.indexOf("/node_modules/");
181183
+ const indexOfNodeModules = info.path.indexOf("/node_modules/");
181255
181184
  if (!this.host.getModifiedTime || indexOfNodeModules === -1) {
181256
181185
  info.fileWatcher = this.watchFactory.watchFile(
181257
181186
  info.fileName,
@@ -181262,12 +181191,12 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181262
181191
  );
181263
181192
  } else {
181264
181193
  info.mTime = this.getModifiedTime(info);
181265
- info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.fileName.substring(0, indexOfNodeModules));
181194
+ info.fileWatcher = this.watchClosedScriptInfoInNodeModules(info.path.substr(0, indexOfNodeModules));
181266
181195
  }
181267
181196
  }
181268
181197
  }
181269
- createNodeModulesWatcher(dir, dirPath) {
181270
- let watcher = this.watchFactory.watchDirectory(
181198
+ createNodeModulesWatcher(dir) {
181199
+ const watcher = this.watchFactory.watchDirectory(
181271
181200
  dir,
181272
181201
  (fileOrDirectory) => {
181273
181202
  var _a;
@@ -181282,8 +181211,8 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181282
181211
  });
181283
181212
  }
181284
181213
  if (result.refreshScriptInfoRefCount) {
181285
- if (dirPath === fileOrDirectoryPath) {
181286
- this.refreshScriptInfosInDirectory(dirPath);
181214
+ if (dir === fileOrDirectoryPath) {
181215
+ this.refreshScriptInfosInDirectory(dir);
181287
181216
  } else {
181288
181217
  const info = this.getScriptInfoForPath(fileOrDirectoryPath);
181289
181218
  if (info) {
@@ -181306,34 +181235,29 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181306
181235
  close: () => {
181307
181236
  var _a;
181308
181237
  if (!result.refreshScriptInfoRefCount && !((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size)) {
181309
- watcher == null ? void 0 : watcher.close();
181310
- watcher = void 0;
181311
- this.nodeModulesWatchers.delete(dirPath);
181238
+ watcher.close();
181239
+ this.nodeModulesWatchers.delete(dir);
181312
181240
  }
181313
181241
  }
181314
181242
  };
181315
- this.nodeModulesWatchers.set(dirPath, result);
181243
+ this.nodeModulesWatchers.set(dir, result);
181316
181244
  return result;
181317
181245
  }
181318
181246
  /** @internal */
181319
181247
  watchPackageJsonsInNodeModules(dir, project) {
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())));
181248
+ const watcher = this.nodeModulesWatchers.get(dir) || this.createNodeModulesWatcher(dir);
181324
181249
  (watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project.getProjectName());
181325
181250
  return {
181326
181251
  close: () => {
181327
- var _a2;
181328
- (_a2 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a2.delete(project.getProjectName());
181252
+ var _a;
181253
+ (_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.delete(project.getProjectName());
181329
181254
  watcher.close();
181330
181255
  }
181331
181256
  };
181332
181257
  }
181333
181258
  watchClosedScriptInfoInNodeModules(dir) {
181334
181259
  const watchDir = dir + "/node_modules";
181335
- const watchedDirPath = this.toPath(watchDir);
181336
- const watcher = this.nodeModulesWatchers.get(watchedDirPath) || this.createNodeModulesWatcher(watchDir, watchedDirPath);
181260
+ const watcher = this.nodeModulesWatchers.get(watchDir) || this.createNodeModulesWatcher(watchDir);
181337
181261
  watcher.refreshScriptInfoRefCount++;
181338
181262
  return {
181339
181263
  close: () => {
@@ -181343,7 +181267,7 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
181343
181267
  };
181344
181268
  }
181345
181269
  getModifiedTime(info) {
181346
- return (this.host.getModifiedTime(info.fileName) || missingFileModifiedTime).getTime();
181270
+ return (this.host.getModifiedTime(info.path) || missingFileModifiedTime).getTime();
181347
181271
  }
181348
181272
  refreshScriptInfo(info) {
181349
181273
  const mTime = this.getModifiedTime(info);
@@ -182532,6 +182456,7 @@ Dynamic files must always be opened with service's current directory or service
182532
182456
  getPackageJsonsVisibleToFile(fileName, rootDir) {
182533
182457
  const packageJsonCache = this.packageJsonCache;
182534
182458
  const rootPath = rootDir && this.toPath(rootDir);
182459
+ const filePath = this.toPath(fileName);
182535
182460
  const result = [];
182536
182461
  const processDirectory = (directory) => {
182537
182462
  switch (packageJsonCache.directoryHasPackageJson(directory)) {
@@ -182540,7 +182465,7 @@ Dynamic files must always be opened with service's current directory or service
182540
182465
  return processDirectory(directory);
182541
182466
  case -1 /* True */:
182542
182467
  const packageJsonFileName = combinePaths(directory, "package.json");
182543
- this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName));
182468
+ this.watchPackageJsonFile(packageJsonFileName);
182544
182469
  const info = packageJsonCache.getInDirectory(directory);
182545
182470
  if (info)
182546
182471
  result.push(info);
@@ -182549,13 +182474,13 @@ Dynamic files must always be opened with service's current directory or service
182549
182474
  return true;
182550
182475
  }
182551
182476
  };
182552
- forEachAncestorDirectory(getDirectoryPath(fileName), processDirectory);
182477
+ forEachAncestorDirectory(getDirectoryPath(filePath), processDirectory);
182553
182478
  return result;
182554
182479
  }
182555
182480
  /** @internal */
182556
182481
  getNearestAncestorDirectoryWithPackageJson(fileName) {
182557
182482
  return forEachAncestorDirectory(fileName, (directory) => {
182558
- switch (this.packageJsonCache.directoryHasPackageJson(directory)) {
182483
+ switch (this.packageJsonCache.directoryHasPackageJson(this.toPath(directory))) {
182559
182484
  case -1 /* True */:
182560
182485
  return directory;
182561
182486
  case 0 /* False */:
@@ -182566,27 +182491,28 @@ Dynamic files must always be opened with service's current directory or service
182566
182491
  });
182567
182492
  }
182568
182493
  /** @internal */
182569
- watchPackageJsonFile(file, path) {
182494
+ watchPackageJsonFile(path) {
182570
182495
  const watchers = this.packageJsonFilesMap || (this.packageJsonFilesMap = /* @__PURE__ */ new Map());
182571
182496
  if (!watchers.has(path)) {
182572
182497
  this.invalidateProjectPackageJson(path);
182573
182498
  watchers.set(
182574
182499
  path,
182575
182500
  this.watchFactory.watchFile(
182576
- file,
182501
+ path,
182577
182502
  (fileName, eventKind) => {
182503
+ const path2 = this.toPath(fileName);
182578
182504
  switch (eventKind) {
182579
182505
  case 0 /* Created */:
182580
182506
  return Debug.fail();
182581
182507
  case 1 /* Changed */:
182582
- this.packageJsonCache.addOrUpdate(fileName, path);
182583
- this.invalidateProjectPackageJson(path);
182508
+ this.packageJsonCache.addOrUpdate(path2);
182509
+ this.invalidateProjectPackageJson(path2);
182584
182510
  break;
182585
182511
  case 2 /* Deleted */:
182586
- this.packageJsonCache.delete(path);
182587
- this.invalidateProjectPackageJson(path);
182588
- watchers.get(path).close();
182589
- watchers.delete(path);
182512
+ this.packageJsonCache.delete(path2);
182513
+ this.invalidateProjectPackageJson(path2);
182514
+ watchers.get(path2).close();
182515
+ watchers.delete(path2);
182590
182516
  }
182591
182517
  },
182592
182518
  250 /* Low */,
@@ -182597,9 +182523,9 @@ Dynamic files must always be opened with service's current directory or service
182597
182523
  }
182598
182524
  }
182599
182525
  /** @internal */
182600
- onAddPackageJson(file, path) {
182601
- this.packageJsonCache.addOrUpdate(file, path);
182602
- this.watchPackageJsonFile(file, path);
182526
+ onAddPackageJson(path) {
182527
+ this.packageJsonCache.addOrUpdate(path);
182528
+ this.watchPackageJsonFile(path);
182603
182529
  }
182604
182530
  /** @internal */
182605
182531
  includePackageJsonAutoImports() {
@@ -182614,13 +182540,16 @@ Dynamic files must always be opened with service's current directory or service
182614
182540
  }
182615
182541
  /** @internal */
182616
182542
  invalidateProjectPackageJson(packageJsonPath) {
182617
- this.forEachProject((project) => {
182543
+ this.configuredProjects.forEach(invalidate);
182544
+ this.inferredProjects.forEach(invalidate);
182545
+ this.externalProjects.forEach(invalidate);
182546
+ function invalidate(project) {
182618
182547
  if (packageJsonPath) {
182619
182548
  project.onPackageJsonChange(packageJsonPath);
182620
182549
  } else {
182621
182550
  project.onAutoImportProviderSettingsChanged();
182622
182551
  }
182623
- });
182552
+ }
182624
182553
  }
182625
182554
  /** @internal */
182626
182555
  getIncompleteCompletionsCache() {
@@ -182680,10 +182609,9 @@ function createModuleSpecifierCache(host) {
182680
182609
  for (const p of modulePaths) {
182681
182610
  if (p.isInNodeModules) {
182682
182611
  const nodeModulesPath = p.path.substring(0, p.path.indexOf(nodeModulesPathPart) + nodeModulesPathPart.length - 1);
182683
- const key2 = host.toPath(nodeModulesPath);
182684
- if (!(containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.has(key2))) {
182612
+ if (!(containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.has(nodeModulesPath))) {
182685
182613
  (containedNodeModulesWatchers || (containedNodeModulesWatchers = /* @__PURE__ */ new Map())).set(
182686
- key2,
182614
+ nodeModulesPath,
182687
182615
  host.watchNodeModulesForPackageJsonChanges(nodeModulesPath)
182688
182616
  );
182689
182617
  }
@@ -182722,7 +182650,7 @@ function createModuleSpecifierCache(host) {
182722
182650
  }
182723
182651
  },
182724
182652
  clear() {
182725
- containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach(closeFileWatcher);
182653
+ containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.forEach((watcher) => watcher.close());
182726
182654
  cache == null ? void 0 : cache.clear();
182727
182655
  containedNodeModulesWatchers == null ? void 0 : containedNodeModulesWatchers.clear();
182728
182656
  currentKey = void 0;
@@ -182757,37 +182685,37 @@ function createPackageJsonCache(host) {
182757
182685
  const directoriesWithoutPackageJson = /* @__PURE__ */ new Map();
182758
182686
  return {
182759
182687
  addOrUpdate,
182688
+ forEach: packageJsons.forEach.bind(packageJsons),
182689
+ get: packageJsons.get.bind(packageJsons),
182760
182690
  delete: (fileName) => {
182761
182691
  packageJsons.delete(fileName);
182762
182692
  directoriesWithoutPackageJson.set(getDirectoryPath(fileName), true);
182763
182693
  },
182764
182694
  getInDirectory: (directory) => {
182765
- return packageJsons.get(host.toPath(combinePaths(directory, "package.json"))) || void 0;
182695
+ return packageJsons.get(combinePaths(directory, "package.json")) || void 0;
182766
182696
  },
182767
- directoryHasPackageJson: (directory) => directoryHasPackageJson(host.toPath(directory)),
182697
+ directoryHasPackageJson,
182768
182698
  searchDirectoryAndAncestors: (directory) => {
182769
182699
  forEachAncestorDirectory(directory, (ancestor) => {
182770
- const ancestorPath = host.toPath(ancestor);
182771
- if (directoryHasPackageJson(ancestorPath) !== 3 /* Maybe */) {
182700
+ if (directoryHasPackageJson(ancestor) !== 3 /* Maybe */) {
182772
182701
  return true;
182773
182702
  }
182774
- const packageJsonFileName = combinePaths(ancestor, "package.json");
182703
+ const packageJsonFileName = host.toPath(combinePaths(ancestor, "package.json"));
182775
182704
  if (tryFileExists(host, packageJsonFileName)) {
182776
- addOrUpdate(packageJsonFileName, combinePaths(ancestorPath, "package.json"));
182705
+ addOrUpdate(packageJsonFileName);
182777
182706
  } else {
182778
- directoriesWithoutPackageJson.set(ancestorPath, true);
182707
+ directoriesWithoutPackageJson.set(ancestor, true);
182779
182708
  }
182780
182709
  });
182781
182710
  }
182782
182711
  };
182783
- function addOrUpdate(file, path) {
182784
- const packageJsonInfo = Debug.checkDefined(createPackageJsonInfo(file, host.host));
182785
- packageJsons.set(path, packageJsonInfo);
182786
- 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));
182787
182716
  }
182788
182717
  function directoryHasPackageJson(directory) {
182789
- const path = host.toPath(directory);
182790
- 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 */;
182791
182719
  }
182792
182720
  }
182793
182721