typescript 5.0.0-dev.20221204 → 5.0.0-dev.20221206

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
@@ -536,6 +536,7 @@ var ts = (() => {
536
536
  createModuleBlock: () => createModuleBlock,
537
537
  createModuleDeclaration: () => createModuleDeclaration,
538
538
  createModuleResolutionCache: () => createModuleResolutionCache,
539
+ createModuleResolutionLoader: () => createModuleResolutionLoader,
539
540
  createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
540
541
  createMultiMap: () => createMultiMap,
541
542
  createNamedExports: () => createNamedExports,
@@ -658,6 +659,7 @@ var ts = (() => {
658
659
  createTypeQueryNode: () => createTypeQueryNode,
659
660
  createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache,
660
661
  createTypeReferenceNode: () => createTypeReferenceNode,
662
+ createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader,
661
663
  createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap,
662
664
  createUnionTypeNode: () => createUnionTypeNode,
663
665
  createUniqueName: () => createUniqueName,
@@ -1147,9 +1149,7 @@ var ts = (() => {
1147
1149
  getRenameLocation: () => getRenameLocation,
1148
1150
  getReplacementSpanForContextToken: () => getReplacementSpanForContextToken,
1149
1151
  getResolutionDiagnostic: () => getResolutionDiagnostic,
1150
- getResolutionMode: () => getResolutionMode,
1151
1152
  getResolutionModeOverrideForClause: () => getResolutionModeOverrideForClause,
1152
- getResolutionName: () => getResolutionName,
1153
1153
  getResolvedExternalModuleName: () => getResolvedExternalModuleName,
1154
1154
  getResolvedModule: () => getResolvedModule,
1155
1155
  getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
@@ -1968,7 +1968,6 @@ var ts = (() => {
1968
1968
  listFiles: () => listFiles,
1969
1969
  loadModuleFromGlobalCache: () => loadModuleFromGlobalCache,
1970
1970
  loadWithModeAwareCache: () => loadWithModeAwareCache,
1971
- loadWithTypeDirectiveCache: () => loadWithTypeDirectiveCache,
1972
1971
  makeIdentifierFromModuleName: () => makeIdentifierFromModuleName,
1973
1972
  makeImport: () => makeImport,
1974
1973
  makeImportIfNecessary: () => makeImportIfNecessary,
@@ -2000,6 +1999,7 @@ var ts = (() => {
2000
1999
  modifiersToFlags: () => modifiersToFlags,
2001
2000
  moduleOptionDeclaration: () => moduleOptionDeclaration,
2002
2001
  moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
2002
+ moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
2003
2003
  moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
2004
2004
  moduleResolutionRespectsExports: () => moduleResolutionRespectsExports,
2005
2005
  moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
@@ -2376,6 +2376,7 @@ var ts = (() => {
2376
2376
  typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
2377
2377
  typeKeywords: () => typeKeywords,
2378
2378
  typeParameterNamePart: () => typeParameterNamePart,
2379
+ typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
2379
2380
  typeToDisplayParts: () => typeToDisplayParts,
2380
2381
  unchangedPollThresholds: () => unchangedPollThresholds,
2381
2382
  unchangedTextChangeRange: () => unchangedTextChangeRange,
@@ -2491,6 +2492,7 @@ var ts = (() => {
2491
2492
  updatePropertyAssignment: () => updatePropertyAssignment,
2492
2493
  updatePropertySignature: () => updatePropertySignature,
2493
2494
  updateQualifiedName: () => updateQualifiedName,
2495
+ updateResolutionField: () => updateResolutionField,
2494
2496
  updateRestTypeNode: () => updateRestTypeNode,
2495
2497
  updateReturn: () => updateReturn,
2496
2498
  updateSetAccessor: () => updateSetAccessor,
@@ -2655,7 +2657,7 @@ var ts = (() => {
2655
2657
 
2656
2658
  // src/compiler/corePublic.ts
2657
2659
  var versionMajorMinor = "5.0";
2658
- var version = `${versionMajorMinor}.0-dev.20221204`;
2660
+ var version = `${versionMajorMinor}.0-dev.20221206`;
2659
2661
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2660
2662
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2661
2663
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6652,6 +6654,7 @@ ${lanes.join("\n")}
6652
6654
  var FilePreprocessingDiagnosticsKind = /* @__PURE__ */ ((FilePreprocessingDiagnosticsKind2) => {
6653
6655
  FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["FilePreprocessingReferencedDiagnostic"] = 0] = "FilePreprocessingReferencedDiagnostic";
6654
6656
  FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["FilePreprocessingFileExplainingDiagnostic"] = 1] = "FilePreprocessingFileExplainingDiagnostic";
6657
+ FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["ResolutionDiagnostics"] = 2] = "ResolutionDiagnostics";
6655
6658
  return FilePreprocessingDiagnosticsKind2;
6656
6659
  })(FilePreprocessingDiagnosticsKind || {});
6657
6660
  var EmitOnly = /* @__PURE__ */ ((EmitOnly4) => {
@@ -14771,7 +14774,8 @@ ${lanes.join("\n")}
14771
14774
  return node.end - node.pos;
14772
14775
  }
14773
14776
  function getResolvedModule(sourceFile, moduleNameText, mode) {
14774
- return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText, mode);
14777
+ var _a2, _b;
14778
+ return (_b = (_a2 = sourceFile == null ? void 0 : sourceFile.resolvedModules) == null ? void 0 : _a2.get(moduleNameText, mode)) == null ? void 0 : _b.resolvedModule;
14775
14779
  }
14776
14780
  function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
14777
14781
  if (!sourceFile.resolvedModules) {
@@ -14786,14 +14790,14 @@ ${lanes.join("\n")}
14786
14790
  sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
14787
14791
  }
14788
14792
  function getResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, mode) {
14789
- var _a2;
14790
- return (_a2 = sourceFile == null ? void 0 : sourceFile.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a2.get(typeReferenceDirectiveName, mode);
14793
+ var _a2, _b;
14794
+ return (_b = (_a2 = sourceFile == null ? void 0 : sourceFile.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a2.get(typeReferenceDirectiveName, mode)) == null ? void 0 : _b.resolvedTypeReferenceDirective;
14791
14795
  }
14792
14796
  function projectReferenceIsEqualTo(oldRef, newRef) {
14793
14797
  return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
14794
14798
  }
14795
14799
  function moduleResolutionIsEqualTo(oldResolution, newResolution) {
14796
- return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport && oldResolution.extension === newResolution.extension && oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.originalPath === newResolution.originalPath && packageIdIsEqual(oldResolution.packageId, newResolution.packageId);
14800
+ return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId);
14797
14801
  }
14798
14802
  function packageIdIsEqual(a, b) {
14799
14803
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
@@ -14805,15 +14809,15 @@ ${lanes.join("\n")}
14805
14809
  return `${packageIdToPackageName(packageId)}@${packageId.version}`;
14806
14810
  }
14807
14811
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
14808
- return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary && oldResolution.originalPath === newResolution.originalPath;
14812
+ return oldResolution === newResolution || oldResolution.resolvedTypeReferenceDirective === newResolution.resolvedTypeReferenceDirective || !!oldResolution.resolvedTypeReferenceDirective && !!newResolution.resolvedTypeReferenceDirective && oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName && !!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary && oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
14809
14813
  }
14810
- function hasChangesInResolutions(names, newSourceFile, newResolutions, oldResolutions, comparer) {
14814
+ function hasChangesInResolutions(names, newSourceFile, newResolutions, oldResolutions, comparer, nameAndModeGetter) {
14811
14815
  Debug.assert(names.length === newResolutions.length);
14812
14816
  for (let i = 0; i < names.length; i++) {
14813
14817
  const newResolution = newResolutions[i];
14814
14818
  const entry = names[i];
14815
- const name = getResolutionName(entry);
14816
- const mode = getResolutionMode(entry, newSourceFile);
14819
+ const name = nameAndModeGetter.getName(entry);
14820
+ const mode = nameAndModeGetter.getMode(entry, newSourceFile);
14817
14821
  const oldResolution = oldResolutions && oldResolutions.get(name, mode);
14818
14822
  const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
14819
14823
  if (changed) {
@@ -19270,13 +19274,14 @@ ${lanes.join("\n")}
19270
19274
  }
19271
19275
  },
19272
19276
  setSymlinksFromResolutions(files, typeReferenceDirectives) {
19273
- var _a2;
19277
+ var _a2, _b;
19274
19278
  Debug.assert(!hasProcessedResolutions);
19275
19279
  hasProcessedResolutions = true;
19276
19280
  for (const file of files) {
19277
- (_a2 = file.resolvedModules) == null ? void 0 : _a2.forEach((resolution) => processResolution(this, resolution));
19281
+ (_a2 = file.resolvedModules) == null ? void 0 : _a2.forEach((resolution) => processResolution(this, resolution.resolvedModule));
19282
+ (_b = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _b.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
19278
19283
  }
19279
- typeReferenceDirectives == null ? void 0 : typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution));
19284
+ typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
19280
19285
  },
19281
19286
  hasProcessedResolutions: () => hasProcessedResolutions
19282
19287
  };
@@ -37440,17 +37445,29 @@ ${lanes.join("\n")}
37440
37445
  }
37441
37446
  function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
37442
37447
  if (resultFromCache) {
37443
- resultFromCache.failedLookupLocations.push(...failedLookupLocations);
37444
- resultFromCache.affectingLocations.push(...affectingLocations);
37448
+ resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
37449
+ resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
37450
+ resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
37445
37451
  return resultFromCache;
37446
37452
  }
37447
37453
  return {
37448
37454
  resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? void 0 : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport, packageId: resolved.packageId },
37449
- failedLookupLocations,
37450
- affectingLocations,
37451
- resolutionDiagnostics: diagnostics
37455
+ failedLookupLocations: initializeResolutionField(failedLookupLocations),
37456
+ affectingLocations: initializeResolutionField(affectingLocations),
37457
+ resolutionDiagnostics: initializeResolutionField(diagnostics)
37452
37458
  };
37453
37459
  }
37460
+ function initializeResolutionField(value) {
37461
+ return value.length ? value : void 0;
37462
+ }
37463
+ function updateResolutionField(to, value) {
37464
+ if (!(value == null ? void 0 : value.length))
37465
+ return to;
37466
+ if (!(to == null ? void 0 : to.length))
37467
+ return value;
37468
+ to.push(...value);
37469
+ return to;
37470
+ }
37454
37471
  function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
37455
37472
  if (!hasProperty(jsonContent, fieldName)) {
37456
37473
  if (state.traceEnabled) {
@@ -37656,7 +37673,12 @@ ${lanes.join("\n")}
37656
37673
  isExternalLibraryImport: pathContainsNodeModules(fileName)
37657
37674
  };
37658
37675
  }
37659
- result = { resolvedTypeReferenceDirective, failedLookupLocations, affectingLocations, resolutionDiagnostics: diagnostics };
37676
+ result = {
37677
+ resolvedTypeReferenceDirective,
37678
+ failedLookupLocations: initializeResolutionField(failedLookupLocations),
37679
+ affectingLocations: initializeResolutionField(affectingLocations),
37680
+ resolutionDiagnostics: initializeResolutionField(diagnostics)
37681
+ };
37660
37682
  perFolderCache == null ? void 0 : perFolderCache.set(typeReferenceDirectiveName, resolutionMode, result);
37661
37683
  if (traceEnabled)
37662
37684
  traceResult(result);
@@ -37926,18 +37948,12 @@ ${lanes.join("\n")}
37926
37948
  return result;
37927
37949
  }
37928
37950
  }
37929
- function getResolutionName(entry) {
37930
- return !isString(entry) ? isStringLiteralLike(entry) ? entry.text : toFileNameLowerCase(entry.fileName) : entry;
37931
- }
37932
- function getResolutionMode(entry, file) {
37933
- return isStringLiteralLike(entry) ? getModeForUsageLocation(file, entry) : entry.resolutionMode || file.impliedNodeFormat;
37934
- }
37935
- function zipToModeAwareCache(file, keys, values) {
37951
+ function zipToModeAwareCache(file, keys, values, nameAndModeGetter) {
37936
37952
  Debug.assert(keys.length === values.length);
37937
37953
  const map2 = createModeAwareCache();
37938
37954
  for (let i = 0; i < keys.length; ++i) {
37939
37955
  const entry = keys[i];
37940
- map2.set(getResolutionName(entry), getResolutionMode(entry, file), values[i]);
37956
+ map2.set(nameAndModeGetter.getName(entry), nameAndModeGetter.getMode(entry, file), values[i]);
37941
37957
  }
37942
37958
  return map2;
37943
37959
  }
@@ -38226,7 +38242,7 @@ ${lanes.join("\n")}
38226
38242
  function resolveJSModule(moduleName, initialDir, host) {
38227
38243
  const { resolvedModule, failedLookupLocations } = tryResolveJSModuleWorker(moduleName, initialDir, host);
38228
38244
  if (!resolvedModule) {
38229
- throw new Error(`Could not resolve JS module '${moduleName}' starting at '${initialDir}'. Looked in: ${failedLookupLocations.join(", ")}`);
38245
+ throw new Error(`Could not resolve JS module '${moduleName}' starting at '${initialDir}'. Looked in: ${failedLookupLocations == null ? void 0 : failedLookupLocations.join(", ")}`);
38230
38246
  }
38231
38247
  return resolvedModule.resolvedFileName;
38232
38248
  }
@@ -43029,9 +43045,9 @@ ${lanes.join("\n")}
43029
43045
  host.getSourceFiles().forEach((sf) => {
43030
43046
  if (!sf.resolvedModules)
43031
43047
  return;
43032
- sf.resolvedModules.forEach((r) => {
43033
- if (r && r.packageId)
43034
- map2.set(r.packageId.name, r.extension === ".d.ts" /* Dts */ || !!map2.get(r.packageId.name));
43048
+ sf.resolvedModules.forEach(({ resolvedModule }) => {
43049
+ if (resolvedModule == null ? void 0 : resolvedModule.packageId)
43050
+ map2.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!map2.get(resolvedModule.packageId.name));
43035
43051
  });
43036
43052
  });
43037
43053
  return map2;
@@ -43835,6 +43851,12 @@ ${lanes.join("\n")}
43835
43851
  return diagnostic;
43836
43852
  }
43837
43853
  function isDeprecatedSymbol(symbol) {
43854
+ if (length(symbol.declarations) > 1) {
43855
+ const parentSymbol = getParentOfSymbol(symbol);
43856
+ if (parentSymbol && parentSymbol.flags & 64 /* Interface */) {
43857
+ return some(symbol.declarations, (d) => !!(getCombinedNodeFlags(d) & 268435456 /* Deprecated */));
43858
+ }
43859
+ }
43838
43860
  return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 268435456 /* Deprecated */);
43839
43861
  }
43840
43862
  function addDeprecatedSuggestion(location2, declarations, deprecatedEntity) {
@@ -53528,7 +53550,7 @@ ${lanes.join("\n")}
53528
53550
  const resolved = resolveAlias(aliasSymbol2);
53529
53551
  if (resolved && resolved.flags & 524288 /* TypeAlias */) {
53530
53552
  newAliasSymbol = resolved;
53531
- aliasTypeArguments = typeArgumentsFromTypeReferenceNode(node);
53553
+ aliasTypeArguments = typeArgumentsFromTypeReferenceNode(node) || (typeParameters ? [] : void 0);
53532
53554
  }
53533
53555
  }
53534
53556
  }
@@ -62344,13 +62366,13 @@ ${lanes.join("\n")}
62344
62366
  }
62345
62367
  const target = getReferenceCandidate(typeOfExpr.expression);
62346
62368
  if (!isMatchingReference(reference, target)) {
62347
- const propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type);
62369
+ if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
62370
+ type = getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
62371
+ }
62372
+ const propertyAccess = getDiscriminantPropertyAccess(target, type);
62348
62373
  if (propertyAccess) {
62349
62374
  return narrowTypeByDiscriminant(type, propertyAccess, (t) => narrowTypeByLiteralExpression(t, literal, assumeTrue));
62350
62375
  }
62351
- if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) {
62352
- return getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
62353
- }
62354
62376
  return type;
62355
62377
  }
62356
62378
  return narrowTypeByLiteralExpression(type, literal, assumeTrue);
@@ -75961,11 +75983,11 @@ ${lanes.join("\n")}
75961
75983
  let fileToDirective;
75962
75984
  if (resolvedTypeReferenceDirectives) {
75963
75985
  fileToDirective = /* @__PURE__ */ new Map();
75964
- resolvedTypeReferenceDirectives.forEach((resolvedDirective, key, mode) => {
75965
- if (!resolvedDirective || !resolvedDirective.resolvedFileName) {
75986
+ resolvedTypeReferenceDirectives.forEach(({ resolvedTypeReferenceDirective }, key, mode) => {
75987
+ if (!(resolvedTypeReferenceDirective == null ? void 0 : resolvedTypeReferenceDirective.resolvedFileName)) {
75966
75988
  return;
75967
75989
  }
75968
- const file = host.getSourceFile(resolvedDirective.resolvedFileName);
75990
+ const file = host.getSourceFile(resolvedTypeReferenceDirective.resolvedFileName);
75969
75991
  if (file) {
75970
75992
  addReferencedFilesToTypeDirective(file, key, mode);
75971
75993
  }
@@ -102439,25 +102461,6 @@ ${lanes.join("\n")}
102439
102461
  }
102440
102462
  return result;
102441
102463
  }
102442
- function loadWithTypeDirectiveCache(names, containingFile, redirectedReference, containingFileMode, loader) {
102443
- if (names.length === 0) {
102444
- return [];
102445
- }
102446
- const resolutions = [];
102447
- const cache = createModeAwareCache();
102448
- for (const name of names) {
102449
- let result;
102450
- const mode = getModeForFileReference(name, containingFileMode);
102451
- const strName = getResolutionName(name);
102452
- if (cache.has(strName, mode)) {
102453
- result = cache.get(strName, mode);
102454
- } else {
102455
- cache.set(strName, mode, result = loader(strName, containingFile, redirectedReference, mode));
102456
- }
102457
- resolutions.push(result);
102458
- }
102459
- return resolutions;
102460
- }
102461
102464
  function getModeForFileReference(ref, containingFileMode) {
102462
102465
  return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
102463
102466
  }
@@ -102523,22 +102526,65 @@ ${lanes.join("\n")}
102523
102526
  }
102524
102527
  return elem.value.text === "import" ? 99 /* ESNext */ : 1 /* CommonJS */;
102525
102528
  }
102526
- function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, resolutionInfo, loader) {
102527
- if (names.length === 0) {
102528
- return [];
102529
- }
102529
+ var emptyResolution = {
102530
+ resolvedModule: void 0,
102531
+ resolvedTypeReferenceDirective: void 0
102532
+ };
102533
+ function getModuleResolutionName(literal) {
102534
+ return literal.text;
102535
+ }
102536
+ var moduleResolutionNameAndModeGetter = {
102537
+ getName: getModuleResolutionName,
102538
+ getMode: (entry, file) => getModeForUsageLocation(file, entry)
102539
+ };
102540
+ function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
102541
+ return {
102542
+ nameAndMode: moduleResolutionNameAndModeGetter,
102543
+ resolve: (moduleName, resoluionMode) => resolveModuleName(
102544
+ moduleName,
102545
+ containingFile,
102546
+ options,
102547
+ host,
102548
+ cache,
102549
+ redirectedReference,
102550
+ resoluionMode
102551
+ )
102552
+ };
102553
+ }
102554
+ function getTypeReferenceResolutionName(entry) {
102555
+ return !isString(entry) ? toFileNameLowerCase(entry.fileName) : entry;
102556
+ }
102557
+ var typeReferenceResolutionNameAndModeGetter = {
102558
+ getName: getTypeReferenceResolutionName,
102559
+ getMode: (entry, file) => getModeForFileReference(entry, file == null ? void 0 : file.impliedNodeFormat)
102560
+ };
102561
+ function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
102562
+ return {
102563
+ nameAndMode: typeReferenceResolutionNameAndModeGetter,
102564
+ resolve: (typeRef, resoluionMode) => resolveTypeReferenceDirective(
102565
+ typeRef,
102566
+ containingFile,
102567
+ options,
102568
+ host,
102569
+ redirectedReference,
102570
+ cache,
102571
+ resoluionMode
102572
+ )
102573
+ };
102574
+ }
102575
+ function loadWithModeAwareCache(entries, containingFile, redirectedReference, options, containingSourceFile, host, resolutionCache, createLoader) {
102576
+ if (entries.length === 0)
102577
+ return emptyArray;
102530
102578
  const resolutions = [];
102531
- const cache = createModeAwareCache();
102532
- let i = 0;
102533
- for (const entry of resolutionInfo ? resolutionInfo.names : names) {
102534
- let result;
102535
- const mode = !isString(entry) ? getModeForUsageLocation(containingFile, entry) : getModeForResolutionAtIndex(containingFile, i);
102536
- i++;
102537
- const name = isString(entry) ? entry : entry.text;
102538
- if (cache.has(name, mode)) {
102539
- result = cache.get(name, mode);
102540
- } else {
102541
- cache.set(name, mode, result = loader(name, mode, containingFileName, redirectedReference));
102579
+ const cache = /* @__PURE__ */ new Map();
102580
+ const loader = createLoader(containingFile, redirectedReference, options, host, resolutionCache);
102581
+ for (const entry of entries) {
102582
+ const name = loader.nameAndMode.getName(entry);
102583
+ const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
102584
+ const key = createModeAwareCacheKey(name, mode);
102585
+ let result = cache.get(key);
102586
+ if (!result) {
102587
+ cache.set(key, result = loader.resolve(name, mode));
102542
102588
  }
102543
102589
  resolutions.push(result);
102544
102590
  }
@@ -102584,14 +102630,14 @@ ${lanes.join("\n")}
102584
102630
  return location2.pos !== void 0;
102585
102631
  }
102586
102632
  function getReferencedFileLocation(getSourceFileByPath, ref) {
102587
- var _a2, _b, _c, _d;
102633
+ var _a2, _b, _c, _d, _e, _f;
102588
102634
  const file = Debug.checkDefined(getSourceFileByPath(ref.file));
102589
102635
  const { kind, index } = ref;
102590
102636
  let pos, end, packageId, resolutionMode;
102591
102637
  switch (kind) {
102592
102638
  case 3 /* Import */:
102593
102639
  const importLiteral = getModuleNameStringLiteralAt(file, index);
102594
- packageId = (_b = (_a2 = file.resolvedModules) == null ? void 0 : _a2.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _b.packageId;
102640
+ packageId = (_c = (_b = (_a2 = file.resolvedModules) == null ? void 0 : _a2.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _b.resolvedModule) == null ? void 0 : _c.packageId;
102595
102641
  if (importLiteral.pos === -1)
102596
102642
  return { file, packageId, text: importLiteral.text };
102597
102643
  pos = skipTrivia(file.text, importLiteral.pos);
@@ -102602,7 +102648,7 @@ ${lanes.join("\n")}
102602
102648
  break;
102603
102649
  case 5 /* TypeReferenceDirective */:
102604
102650
  ({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
102605
- packageId = (_d = (_c = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _c.get(toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) == null ? void 0 : _d.packageId;
102651
+ packageId = (_f = (_e = (_d = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _d.get(toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) == null ? void 0 : _e.resolvedTypeReferenceDirective) == null ? void 0 : _f.packageId;
102606
102652
  break;
102607
102653
  case 7 /* LibReferenceDirective */:
102608
102654
  ({ pos, end } = file.libReferenceDirectives[index]);
@@ -102791,7 +102837,7 @@ ${lanes.join("\n")}
102791
102837
  };
102792
102838
  }
102793
102839
  function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
102794
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
102840
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
102795
102841
  const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
102796
102842
  const { rootNames, options, configFileParsingDiagnostics, projectReferences } = createProgramOptions;
102797
102843
  let { oldProgram } = createProgramOptions;
@@ -102808,6 +102854,8 @@ ${lanes.join("\n")}
102808
102854
  const cachedDeclarationDiagnosticsForFile = {};
102809
102855
  let resolvedTypeReferenceDirectives = createModeAwareCache();
102810
102856
  let fileProcessingDiagnostics;
102857
+ let automaticTypeDirectiveNames;
102858
+ let automaticTypeDirectiveResolutions;
102811
102859
  const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
102812
102860
  let currentNodeModulesDepth = 0;
102813
102861
  const modulesWithElidedImports = /* @__PURE__ */ new Map();
@@ -102826,50 +102874,59 @@ ${lanes.join("\n")}
102826
102874
  const hasEmitBlockingDiagnostics = /* @__PURE__ */ new Map();
102827
102875
  let _compilerOptionsObjectLiteralSyntax;
102828
102876
  let moduleResolutionCache;
102829
- let typeReferenceDirectiveResolutionCache;
102830
102877
  let actualResolveModuleNamesWorker;
102831
102878
  const hasInvalidatedResolutions = host.hasInvalidatedResolutions || returnFalse;
102832
- if (host.resolveModuleNames) {
102833
- actualResolveModuleNamesWorker = (moduleNames, containingFile, containingFileName, redirectedReference, resolutionInfo) => {
102834
- var _a3;
102835
- return host.resolveModuleNames(
102836
- moduleNames.map((literal) => literal.text),
102837
- containingFileName,
102838
- (_a3 = resolutionInfo == null ? void 0 : resolutionInfo.reusedNames) == null ? void 0 : _a3.map((literal) => literal.text),
102839
- redirectedReference,
102840
- options,
102841
- containingFile,
102842
- resolutionInfo
102843
- ).map((resolved) => {
102844
- if (!resolved || resolved.extension !== void 0) {
102845
- return resolved;
102846
- }
102847
- const withExtension = clone(resolved);
102848
- withExtension.extension = extensionFromPath(resolved.resolvedFileName);
102849
- return withExtension;
102850
- });
102851
- };
102879
+ if (host.resolveModuleNameLiterals) {
102880
+ actualResolveModuleNamesWorker = host.resolveModuleNameLiterals.bind(host);
102852
102881
  moduleResolutionCache = (_b = host.getModuleResolutionCache) == null ? void 0 : _b.call(host);
102882
+ } else if (host.resolveModuleNames) {
102883
+ actualResolveModuleNamesWorker = (moduleNames, containingFile, redirectedReference, options2, containingSourceFile, reusedNames) => host.resolveModuleNames(
102884
+ moduleNames.map(getModuleResolutionName),
102885
+ containingFile,
102886
+ reusedNames == null ? void 0 : reusedNames.map(getModuleResolutionName),
102887
+ redirectedReference,
102888
+ options2,
102889
+ containingSourceFile
102890
+ ).map(
102891
+ (resolved) => resolved ? resolved.extension !== void 0 ? { resolvedModule: resolved } : { resolvedModule: { ...resolved, extension: extensionFromPath(resolved.resolvedFileName) } } : emptyResolution
102892
+ );
102893
+ moduleResolutionCache = (_c = host.getModuleResolutionCache) == null ? void 0 : _c.call(host);
102853
102894
  } else {
102854
102895
  moduleResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
102855
- const loader = (moduleName, resolverMode, containingFileName, redirectedReference) => resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule;
102856
- actualResolveModuleNamesWorker = (moduleNames, containingFile, containingFileName, redirectedReference, resolutionInfo) => loadWithModeAwareCache(moduleNames, containingFile, containingFileName, redirectedReference, resolutionInfo, loader);
102896
+ actualResolveModuleNamesWorker = (moduleNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
102897
+ moduleNames,
102898
+ containingFile,
102899
+ redirectedReference,
102900
+ options2,
102901
+ containingSourceFile,
102902
+ host,
102903
+ moduleResolutionCache,
102904
+ createModuleResolutionLoader
102905
+ );
102857
102906
  }
102858
102907
  let actualResolveTypeReferenceDirectiveNamesWorker;
102859
- if (host.resolveTypeReferenceDirectives) {
102860
- actualResolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile, redirectedReference, containingFileMode, resolutionInfo) => host.resolveTypeReferenceDirectives(Debug.checkEachDefined(typeDirectiveNames), containingFile, redirectedReference, options, containingFileMode, resolutionInfo);
102908
+ if (host.resolveTypeReferenceDirectiveReferences) {
102909
+ actualResolveTypeReferenceDirectiveNamesWorker = host.resolveTypeReferenceDirectiveReferences.bind(host);
102910
+ } else if (host.resolveTypeReferenceDirectives) {
102911
+ actualResolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => host.resolveTypeReferenceDirectives(
102912
+ typeDirectiveNames.map(getTypeReferenceResolutionName),
102913
+ containingFile,
102914
+ redirectedReference,
102915
+ options2,
102916
+ containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat
102917
+ ).map((resolvedTypeReferenceDirective) => ({ resolvedTypeReferenceDirective }));
102861
102918
  } else {
102862
- typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
102863
- const loader = (typesRef, containingFile, redirectedReference, resolutionMode) => resolveTypeReferenceDirective(
102864
- typesRef,
102919
+ const typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
102920
+ actualResolveTypeReferenceDirectiveNamesWorker = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
102921
+ typeDirectiveNames,
102865
102922
  containingFile,
102866
- options,
102867
- host,
102868
102923
  redirectedReference,
102924
+ options2,
102925
+ containingSourceFile,
102926
+ host,
102869
102927
  typeReferenceDirectiveResolutionCache,
102870
- resolutionMode
102871
- ).resolvedTypeReferenceDirective;
102872
- actualResolveTypeReferenceDirectiveNamesWorker = (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) => loadWithTypeDirectiveCache(Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader);
102928
+ createTypeReferenceResolutionLoader
102929
+ );
102873
102930
  }
102874
102931
  const packageIdToSourceFile = /* @__PURE__ */ new Map();
102875
102932
  let sourceFileToPackageName = /* @__PURE__ */ new Map();
@@ -102882,7 +102939,7 @@ ${lanes.join("\n")}
102882
102939
  let projectReferenceRedirects;
102883
102940
  let mapFromFileToProjectReferenceRedirects;
102884
102941
  let mapFromToProjectReferenceRedirectSource;
102885
- const useSourceOfProjectReferenceRedirect = !!((_c = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _c.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
102942
+ const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
102886
102943
  const { onProgramCreateComplete, fileExists, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
102887
102944
  compilerHost: host,
102888
102945
  getSymlinkCache,
@@ -102893,13 +102950,13 @@ ${lanes.join("\n")}
102893
102950
  forEachResolvedProjectReference: forEachResolvedProjectReference2
102894
102951
  });
102895
102952
  const readFile = host.readFile.bind(host);
102896
- (_d = tracing) == null ? void 0 : _d.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
102953
+ (_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
102897
102954
  const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
102898
- (_e = tracing) == null ? void 0 : _e.pop();
102955
+ (_f = tracing) == null ? void 0 : _f.pop();
102899
102956
  let structureIsReused;
102900
- (_f = tracing) == null ? void 0 : _f.push(tracing.Phase.Program, "tryReuseStructureFromOldProgram", {});
102957
+ (_g = tracing) == null ? void 0 : _g.push(tracing.Phase.Program, "tryReuseStructureFromOldProgram", {});
102901
102958
  structureIsReused = tryReuseStructureFromOldProgram();
102902
- (_g = tracing) == null ? void 0 : _g.pop();
102959
+ (_h = tracing) == null ? void 0 : _h.pop();
102903
102960
  if (structureIsReused !== 2 /* Completely */) {
102904
102961
  processingDefaultLibFiles = [];
102905
102962
  processingOtherFiles = [];
@@ -102933,19 +102990,30 @@ ${lanes.join("\n")}
102933
102990
  });
102934
102991
  }
102935
102992
  }
102936
- (_h = tracing) == null ? void 0 : _h.push(tracing.Phase.Program, "processRootFiles", { count: rootNames.length });
102993
+ (_i = tracing) == null ? void 0 : _i.push(tracing.Phase.Program, "processRootFiles", { count: rootNames.length });
102937
102994
  forEach(rootNames, (name, index) => processRootFile(name, false, false, { kind: 0 /* RootFile */, index }));
102938
- (_i = tracing) == null ? void 0 : _i.pop();
102939
- const typeReferences = rootNames.length ? getAutomaticTypeDirectiveNames(options, host) : emptyArray;
102940
- if (typeReferences.length) {
102941
- (_j = tracing) == null ? void 0 : _j.push(tracing.Phase.Program, "processTypeReferences", { count: typeReferences.length });
102995
+ (_j = tracing) == null ? void 0 : _j.pop();
102996
+ automaticTypeDirectiveNames != null ? automaticTypeDirectiveNames : automaticTypeDirectiveNames = rootNames.length ? getAutomaticTypeDirectiveNames(options, host) : emptyArray;
102997
+ automaticTypeDirectiveResolutions = createModeAwareCache();
102998
+ if (automaticTypeDirectiveNames.length) {
102999
+ (_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
102942
103000
  const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
102943
103001
  const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
102944
- const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typeReferences, containingFilename);
102945
- for (let i = 0; i < typeReferences.length; i++) {
102946
- processTypeReferenceDirective(typeReferences[i], void 0, resolutions[i], { kind: 8 /* AutomaticTypeDirectiveFile */, typeReference: typeReferences[i], packageId: (_k = resolutions[i]) == null ? void 0 : _k.packageId });
103002
+ const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
103003
+ for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
103004
+ automaticTypeDirectiveResolutions.set(automaticTypeDirectiveNames[i], void 0, resolutions[i]);
103005
+ processTypeReferenceDirective(
103006
+ automaticTypeDirectiveNames[i],
103007
+ void 0,
103008
+ resolutions[i],
103009
+ {
103010
+ kind: 8 /* AutomaticTypeDirectiveFile */,
103011
+ typeReference: automaticTypeDirectiveNames[i],
103012
+ packageId: (_m = (_l = resolutions[i]) == null ? void 0 : _l.resolvedTypeReferenceDirective) == null ? void 0 : _m.packageId
103013
+ }
103014
+ );
102947
103015
  }
102948
- (_l = tracing) == null ? void 0 : _l.pop();
103016
+ (_n = tracing) == null ? void 0 : _n.pop();
102949
103017
  }
102950
103018
  if (rootNames.length && !skipDefaultLib) {
102951
103019
  const defaultLibraryFileName = getDefaultLibraryFileName();
@@ -102992,7 +103060,6 @@ ${lanes.join("\n")}
102992
103060
  }
102993
103061
  );
102994
103062
  }
102995
- typeReferenceDirectiveResolutionCache = void 0;
102996
103063
  oldProgram = void 0;
102997
103064
  const program = {
102998
103065
  getRootFileNames: () => rootNames,
@@ -103025,6 +103092,8 @@ ${lanes.join("\n")}
103025
103092
  getRelationCacheSizes: () => getTypeChecker().getRelationCacheSizes(),
103026
103093
  getFileProcessingDiagnostics: () => fileProcessingDiagnostics,
103027
103094
  getResolvedTypeReferenceDirectives: () => resolvedTypeReferenceDirectives,
103095
+ getAutomaticTypeDirectiveNames: () => automaticTypeDirectiveNames,
103096
+ getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
103028
103097
  isSourceFileFromExternalLibrary,
103029
103098
  isSourceFileDefaultLibrary,
103030
103099
  getSourceFileFromReference,
@@ -103034,7 +103103,6 @@ ${lanes.join("\n")}
103034
103103
  usesUriStyleNodeCoreModules,
103035
103104
  isEmittedFile,
103036
103105
  getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
103037
- getResolvedModuleWithFailedLookupLocationsFromCache,
103038
103106
  getProjectReferences,
103039
103107
  getResolvedProjectReferences,
103040
103108
  getProjectReferenceRedirect,
@@ -103047,7 +103115,7 @@ ${lanes.join("\n")}
103047
103115
  readFile,
103048
103116
  directoryExists,
103049
103117
  getSymlinkCache,
103050
- realpath: (_m = host.realpath) == null ? void 0 : _m.bind(host),
103118
+ realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
103051
103119
  useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
103052
103120
  getFileIncludeReasons: () => fileReasons,
103053
103121
  structureIsReused,
@@ -103061,6 +103129,8 @@ ${lanes.join("\n")}
103061
103129
  case 0 /* FilePreprocessingReferencedDiagnostic */:
103062
103130
  const { file, pos, end } = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason);
103063
103131
  return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
103132
+ case 2 /* ResolutionDiagnostics */:
103133
+ return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
103064
103134
  default:
103065
103135
  Debug.assertNever(diagnostic);
103066
103136
  }
@@ -103068,32 +103138,30 @@ ${lanes.join("\n")}
103068
103138
  verifyCompilerOptions();
103069
103139
  mark("afterProgram");
103070
103140
  measure("Program", "beforeProgram", "afterProgram");
103071
- (_n = tracing) == null ? void 0 : _n.pop();
103141
+ (_p = tracing) == null ? void 0 : _p.pop();
103072
103142
  return program;
103073
- function addResolutionDiagnostics(list) {
103074
- if (!list)
103143
+ function addResolutionDiagnostics(resolution) {
103144
+ var _a3;
103145
+ if (!((_a3 = resolution.resolutionDiagnostics) == null ? void 0 : _a3.length))
103075
103146
  return;
103076
- for (const elem of list) {
103077
- programDiagnostics.add(elem);
103078
- }
103147
+ (fileProcessingDiagnostics != null ? fileProcessingDiagnostics : fileProcessingDiagnostics = []).push({
103148
+ kind: 2 /* ResolutionDiagnostics */,
103149
+ diagnostics: resolution.resolutionDiagnostics
103150
+ });
103079
103151
  }
103080
- function pullDiagnosticsFromCache(names, containingFile) {
103081
- var _a3;
103082
- if (!moduleResolutionCache)
103152
+ function addResolutionDiagnosticsFromResolutionOrCache(containingFile, name, resolution, mode) {
103153
+ if (host.resolveModuleNameLiterals || !host.resolveModuleNames)
103154
+ return addResolutionDiagnostics(resolution);
103155
+ if (!moduleResolutionCache || isExternalModuleNameRelative(name))
103083
103156
  return;
103084
103157
  const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
103085
103158
  const containingDir = getDirectoryPath(containingFileName);
103086
103159
  const redirectedReference = getRedirectReferenceForResolution(containingFile);
103087
- for (const n of names) {
103088
- const mode = getResolutionMode(n, containingFile);
103089
- const name = getResolutionName(n);
103090
- if (isExternalModuleNameRelative(name))
103091
- continue;
103092
- const diags = (_a3 = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) == null ? void 0 : _a3.resolutionDiagnostics;
103093
- addResolutionDiagnostics(diags);
103094
- }
103160
+ const fromCache = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir);
103161
+ if (fromCache)
103162
+ addResolutionDiagnostics(fromCache);
103095
103163
  }
103096
- function resolveModuleNamesWorker(moduleNames, containingFile, resolutionInfo) {
103164
+ function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
103097
103165
  var _a3, _b2;
103098
103166
  if (!moduleNames.length)
103099
103167
  return emptyArray;
@@ -103101,23 +103169,22 @@ ${lanes.join("\n")}
103101
103169
  const redirectedReference = getRedirectReferenceForResolution(containingFile);
103102
103170
  (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName });
103103
103171
  mark("beforeResolveModule");
103104
- const result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName, redirectedReference, resolutionInfo);
103172
+ const result = actualResolveModuleNamesWorker(moduleNames, containingFileName, redirectedReference, options, containingFile, reusedNames);
103105
103173
  mark("afterResolveModule");
103106
103174
  measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
103107
103175
  (_b2 = tracing) == null ? void 0 : _b2.pop();
103108
- pullDiagnosticsFromCache(moduleNames, containingFile);
103109
103176
  return result;
103110
103177
  }
103111
- function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, resolutionInfo) {
103178
+ function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, reusedNames) {
103112
103179
  var _a3, _b2;
103113
103180
  if (!typeDirectiveNames.length)
103114
103181
  return [];
103182
+ const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
103115
103183
  const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
103116
- const redirectedReference = !isString(containingFile) ? getRedirectReferenceForResolution(containingFile) : void 0;
103117
- const containingFileMode = !isString(containingFile) ? containingFile.impliedNodeFormat : void 0;
103184
+ const redirectedReference = containingSourceFile && getRedirectReferenceForResolution(containingSourceFile);
103118
103185
  (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName });
103119
103186
  mark("beforeResolveTypeReference");
103120
- const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, containingFileMode, resolutionInfo);
103187
+ const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, options, containingSourceFile, reusedNames);
103121
103188
  mark("afterResolveTypeReference");
103122
103189
  measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
103123
103190
  (_b2 = tracing) == null ? void 0 : _b2.pop();
@@ -103163,9 +103230,6 @@ ${lanes.join("\n")}
103163
103230
  }
103164
103231
  return libs.length + 2;
103165
103232
  }
103166
- function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
103167
- return moduleResolutionCache && resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
103168
- }
103169
103233
  function toPath3(fileName) {
103170
103234
  return toPath(fileName, currentDirectory, getCanonicalFileName);
103171
103235
  }
@@ -103194,6 +103258,7 @@ ${lanes.join("\n")}
103194
103258
  return classifiableNames;
103195
103259
  }
103196
103260
  function resolveModuleNamesReusingOldState(moduleNames, file) {
103261
+ var _a3;
103197
103262
  if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
103198
103263
  return resolveModuleNamesWorker(moduleNames, file, void 0);
103199
103264
  }
@@ -103209,24 +103274,24 @@ ${lanes.join("\n")}
103209
103274
  let unknownModuleNames;
103210
103275
  let result;
103211
103276
  let reusedNames;
103212
- const predictedToResolveToAmbientModuleMarker = {};
103277
+ const predictedToResolveToAmbientModuleMarker = emptyResolution;
103213
103278
  for (let i = 0; i < moduleNames.length; i++) {
103214
103279
  const moduleName = moduleNames[i];
103215
103280
  if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) {
103216
103281
  const mode = getModeForUsageLocation(file, moduleName);
103217
- const oldResolvedModule = getResolvedModule(oldSourceFile, moduleName.text, mode);
103218
- if (oldResolvedModule) {
103282
+ const oldResolution = (_a3 = oldSourceFile.resolvedModules) == null ? void 0 : _a3.get(moduleName.text, mode);
103283
+ if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
103219
103284
  if (isTraceEnabled(options, host)) {
103220
103285
  trace(
103221
103286
  host,
103222
- oldResolvedModule.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2,
103287
+ oldResolution.resolvedModule.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2,
103223
103288
  moduleName.text,
103224
103289
  getNormalizedAbsolutePath(file.originalFileName, currentDirectory),
103225
- oldResolvedModule.resolvedFileName,
103226
- oldResolvedModule.packageId && packageIdToString(oldResolvedModule.packageId)
103290
+ oldResolution.resolvedModule.resolvedFileName,
103291
+ oldResolution.resolvedModule.packageId && packageIdToString(oldResolution.resolvedModule.packageId)
103227
103292
  );
103228
103293
  }
103229
- (result != null ? result : result = new Array(moduleNames.length))[i] = oldResolvedModule;
103294
+ (result != null ? result : result = new Array(moduleNames.length))[i] = oldResolution;
103230
103295
  (reusedNames != null ? reusedNames : reusedNames = []).push(moduleName);
103231
103296
  continue;
103232
103297
  }
@@ -103246,18 +103311,14 @@ ${lanes.join("\n")}
103246
103311
  (unknownModuleNames != null ? unknownModuleNames : unknownModuleNames = []).push(moduleName);
103247
103312
  }
103248
103313
  }
103249
- const resolutions = unknownModuleNames && unknownModuleNames.length ? resolveModuleNamesWorker(unknownModuleNames, file, { names: unknownModuleNames, reusedNames }) : emptyArray;
103314
+ const resolutions = unknownModuleNames && unknownModuleNames.length ? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames) : emptyArray;
103250
103315
  if (!result) {
103251
103316
  Debug.assert(resolutions.length === moduleNames.length);
103252
103317
  return resolutions;
103253
103318
  }
103254
103319
  let j = 0;
103255
103320
  for (let i = 0; i < result.length; i++) {
103256
- if (result[i]) {
103257
- if (result[i] === predictedToResolveToAmbientModuleMarker) {
103258
- result[i] = void 0;
103259
- }
103260
- } else {
103321
+ if (!result[i]) {
103261
103322
  result[i] = resolutions[j];
103262
103323
  j++;
103263
103324
  }
@@ -103281,6 +103342,7 @@ ${lanes.join("\n")}
103281
103342
  }
103282
103343
  }
103283
103344
  function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
103345
+ var _a3;
103284
103346
  if (structureIsReused === 0 /* Not */) {
103285
103347
  return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, void 0);
103286
103348
  }
@@ -103289,7 +103351,7 @@ ${lanes.join("\n")}
103289
103351
  if (oldSourceFile !== containingFile && containingFile.resolvedTypeReferenceDirectiveNames) {
103290
103352
  const result2 = [];
103291
103353
  for (const typeDirectiveName of typeDirectiveNames) {
103292
- const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getResolutionName(typeDirectiveName), typeDirectiveName.resolutionMode || containingFile.impliedNodeFormat);
103354
+ const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getTypeReferenceResolutionName(typeDirectiveName), getModeForFileReference(typeDirectiveName, containingFile.impliedNodeFormat));
103293
103355
  result2.push(resolvedTypeReferenceDirective);
103294
103356
  }
103295
103357
  return result2;
@@ -103303,21 +103365,21 @@ ${lanes.join("\n")}
103303
103365
  for (let i = 0; i < typeDirectiveNames.length; i++) {
103304
103366
  const entry = typeDirectiveNames[i];
103305
103367
  if (canReuseResolutions) {
103306
- const typeDirectiveName = getResolutionName(entry);
103368
+ const typeDirectiveName = getTypeReferenceResolutionName(entry);
103307
103369
  const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
103308
- const oldResolvedTypeReferenceDirective = getResolvedTypeReferenceDirective(oldSourceFile, typeDirectiveName, mode);
103309
- if (oldResolvedTypeReferenceDirective) {
103370
+ const oldResolution = (_a3 = !isString(containingFile) ? oldSourceFile == null ? void 0 : oldSourceFile.resolvedTypeReferenceDirectiveNames : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a3.get(typeDirectiveName, mode);
103371
+ if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
103310
103372
  if (isTraceEnabled(options, host)) {
103311
103373
  trace(
103312
103374
  host,
103313
- oldResolvedTypeReferenceDirective.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2,
103375
+ oldResolution.resolvedTypeReferenceDirective.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2,
103314
103376
  typeDirectiveName,
103315
103377
  !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile,
103316
- oldResolvedTypeReferenceDirective.resolvedFileName,
103317
- oldResolvedTypeReferenceDirective.packageId && packageIdToString(oldResolvedTypeReferenceDirective.packageId)
103378
+ oldResolution.resolvedTypeReferenceDirective.resolvedFileName,
103379
+ oldResolution.resolvedTypeReferenceDirective.packageId && packageIdToString(oldResolution.resolvedTypeReferenceDirective.packageId)
103318
103380
  );
103319
103381
  }
103320
- (result != null ? result : result = new Array(typeDirectiveNames.length))[i] = oldResolvedTypeReferenceDirective;
103382
+ (result != null ? result : result = new Array(typeDirectiveNames.length))[i] = oldResolution;
103321
103383
  (reusedNames != null ? reusedNames : reusedNames = []).push(entry);
103322
103384
  continue;
103323
103385
  }
@@ -103329,7 +103391,7 @@ ${lanes.join("\n")}
103329
103391
  const resolutions = resolveTypeReferenceDirectiveNamesWorker(
103330
103392
  unknownTypeReferenceDirectiveNames,
103331
103393
  containingFile,
103332
- { names: unknownTypeReferenceDirectiveNames, reusedNames }
103394
+ reusedNames
103333
103395
  );
103334
103396
  if (!result) {
103335
103397
  Debug.assert(resolutions.length === typeDirectiveNames.length);
@@ -103365,7 +103427,7 @@ ${lanes.join("\n")}
103365
103427
  );
103366
103428
  }
103367
103429
  function tryReuseStructureFromOldProgram() {
103368
- var _a3, _b2;
103430
+ var _a3;
103369
103431
  if (!oldProgram) {
103370
103432
  return 0 /* Not */;
103371
103433
  }
@@ -103475,19 +103537,19 @@ ${lanes.join("\n")}
103475
103537
  for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
103476
103538
  const moduleNames = getModuleNames(newSourceFile);
103477
103539
  const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
103478
- const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo);
103540
+ const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
103479
103541
  if (resolutionsChanged) {
103480
103542
  structureIsReused = 1 /* SafeModules */;
103481
- newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
103543
+ newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions, moduleResolutionNameAndModeGetter);
103482
103544
  } else {
103483
103545
  newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
103484
103546
  }
103485
103547
  const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
103486
103548
  const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
103487
- const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo);
103549
+ const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
103488
103550
  if (typeReferenceResolutionsChanged) {
103489
103551
  structureIsReused = 1 /* SafeModules */;
103490
- newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
103552
+ newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions, typeReferenceResolutionNameAndModeGetter);
103491
103553
  } else {
103492
103554
  newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
103493
103555
  }
@@ -103495,9 +103557,17 @@ ${lanes.join("\n")}
103495
103557
  if (structureIsReused !== 2 /* Completely */) {
103496
103558
  return structureIsReused;
103497
103559
  }
103498
- if (changesAffectingProgramStructure(oldOptions, options) || ((_b2 = host.hasChangedAutomaticTypeDirectiveNames) == null ? void 0 : _b2.call(host))) {
103560
+ if (changesAffectingProgramStructure(oldOptions, options)) {
103499
103561
  return 1 /* SafeModules */;
103500
103562
  }
103563
+ if (host.hasChangedAutomaticTypeDirectiveNames) {
103564
+ if (host.hasChangedAutomaticTypeDirectiveNames())
103565
+ return 1 /* SafeModules */;
103566
+ } else {
103567
+ automaticTypeDirectiveNames = getAutomaticTypeDirectiveNames(options, host);
103568
+ if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
103569
+ return 1 /* SafeModules */;
103570
+ }
103501
103571
  missingFilePaths = oldProgram.getMissingFilePaths();
103502
103572
  Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
103503
103573
  for (const newSourceFile of newSourceFiles) {
@@ -103521,6 +103591,8 @@ ${lanes.join("\n")}
103521
103591
  fileReasons = oldProgram.getFileIncludeReasons();
103522
103592
  fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
103523
103593
  resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
103594
+ automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
103595
+ automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
103524
103596
  sourceFileToPackageName = oldProgram.sourceFileToPackageName;
103525
103597
  redirectTargetsMap = oldProgram.redirectTargetsMap;
103526
103598
  usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
@@ -104464,7 +104536,8 @@ ${lanes.join("\n")}
104464
104536
  }
104465
104537
  function processTypeReferenceDirectives(file) {
104466
104538
  const typeDirectives = file.typeReferenceDirectives;
104467
- if (!typeDirectives) {
104539
+ if (!typeDirectives.length) {
104540
+ file.resolvedTypeReferenceDirectiveNames = void 0;
104468
104541
  return;
104469
104542
  }
104470
104543
  const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
@@ -104475,23 +104548,31 @@ ${lanes.join("\n")}
104475
104548
  setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective, getModeForFileReference(ref, file.impliedNodeFormat));
104476
104549
  const mode = ref.resolutionMode || file.impliedNodeFormat;
104477
104550
  if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
104478
- programDiagnostics.add(createDiagnosticForRange(file, ref, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
104551
+ (fileProcessingDiagnostics != null ? fileProcessingDiagnostics : fileProcessingDiagnostics = []).push({
104552
+ kind: 2 /* ResolutionDiagnostics */,
104553
+ diagnostics: [
104554
+ createDiagnosticForRange(file, ref, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)
104555
+ ]
104556
+ });
104479
104557
  }
104480
104558
  processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
104481
104559
  }
104482
104560
  }
104483
- function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
104561
+ function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
104484
104562
  var _a3, _b2;
104485
- (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 });
104486
- processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason);
104563
+ (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 });
104564
+ processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason);
104487
104565
  (_b2 = tracing) == null ? void 0 : _b2.pop();
104488
104566
  }
104489
- function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
104490
- const previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode);
104567
+ function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason) {
104568
+ var _a3;
104569
+ addResolutionDiagnostics(resolution);
104570
+ const previousResolution = (_a3 = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode)) == null ? void 0 : _a3.resolvedTypeReferenceDirective;
104491
104571
  if (previousResolution && previousResolution.primary) {
104492
104572
  return;
104493
104573
  }
104494
104574
  let saveResolution = true;
104575
+ const { resolvedTypeReferenceDirective } = resolution;
104495
104576
  if (resolvedTypeReferenceDirective) {
104496
104577
  if (resolvedTypeReferenceDirective.isExternalLibraryImport)
104497
104578
  currentNodeModulesDepth++;
@@ -104522,7 +104603,7 @@ ${lanes.join("\n")}
104522
104603
  addFilePreprocessingFileExplainingDiagnostic(void 0, reason, Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
104523
104604
  }
104524
104605
  if (saveResolution) {
104525
- resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolvedTypeReferenceDirective);
104606
+ resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolution);
104526
104607
  }
104527
104608
  }
104528
104609
  function pathForLibFile(libFileName) {
@@ -104571,8 +104652,11 @@ ${lanes.join("\n")}
104571
104652
  Debug.assert(resolutions.length === moduleNames.length);
104572
104653
  const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a3 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a3.commandLine.options : void 0) || options;
104573
104654
  for (let index = 0; index < moduleNames.length; index++) {
104574
- const resolution = resolutions[index];
104575
- setResolvedModule(file, moduleNames[index].text, resolution, getModeForUsageLocation(file, moduleNames[index]));
104655
+ const resolution = resolutions[index].resolvedModule;
104656
+ const moduleName = moduleNames[index].text;
104657
+ const mode = getModeForUsageLocation(file, moduleNames[index]);
104658
+ setResolvedModule(file, moduleName, resolutions[index], mode);
104659
+ addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
104576
104660
  if (!resolution) {
104577
104661
  continue;
104578
104662
  }
@@ -105213,8 +105297,8 @@ ${lanes.join("\n")}
105213
105297
  if (!symlinks) {
105214
105298
  symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
105215
105299
  }
105216
- if (files && resolvedTypeReferenceDirectives && !symlinks.hasProcessedResolutions()) {
105217
- symlinks.setSymlinksFromResolutions(files, resolvedTypeReferenceDirectives);
105300
+ if (files && automaticTypeDirectiveResolutions && !symlinks.hasProcessedResolutions()) {
105301
+ symlinks.setSymlinksFromResolutions(files, automaticTypeDirectiveResolutions);
105218
105302
  }
105219
105303
  return symlinks;
105220
105304
  }
@@ -105556,7 +105640,7 @@ ${lanes.join("\n")}
105556
105640
  }
105557
105641
  }
105558
105642
  if (sourceFile.resolvedTypeReferenceDirectiveNames) {
105559
- sourceFile.resolvedTypeReferenceDirectiveNames.forEach((resolvedTypeReferenceDirective) => {
105643
+ sourceFile.resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
105560
105644
  if (!resolvedTypeReferenceDirective) {
105561
105645
  return;
105562
105646
  }
@@ -107090,9 +107174,9 @@ ${lanes.join("\n")}
107090
107174
  finishRecordingFilesWithChangedResolutions,
107091
107175
  startCachingPerDirectoryResolution,
107092
107176
  finishCachingPerDirectoryResolution,
107093
- resolveModuleNames,
107094
- getResolvedModuleWithFailedLookupLocationsFromCache,
107095
- resolveTypeReferenceDirectives,
107177
+ resolveModuleNameLiterals,
107178
+ resolveTypeReferenceDirectiveReferences,
107179
+ resolveSingleModuleNameWithoutWatching,
107096
107180
  removeResolutionsFromProjectReferenceRedirects,
107097
107181
  removeResolutionsOfFile,
107098
107182
  hasChangedAutomaticTypeDirectiveNames: () => hasChangedAutomaticTypeDirectiveNames,
@@ -107210,14 +107294,16 @@ ${lanes.join("\n")}
107210
107294
  });
107211
107295
  hasChangedAutomaticTypeDirectiveNames = false;
107212
107296
  }
107213
- function resolveModuleName2(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) {
107297
+ function resolveModuleName2(moduleName, containingFile, compilerOptions, redirectedReference, mode) {
107298
+ var _a2;
107299
+ const host = ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost;
107214
107300
  const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
107215
107301
  if (!resolutionHost.getGlobalCache) {
107216
107302
  return primaryResult;
107217
107303
  }
107218
107304
  const globalCache = resolutionHost.getGlobalCache();
107219
107305
  if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
107220
- const { resolvedModule, failedLookupLocations, affectingLocations } = loadModuleFromGlobalCache(
107306
+ const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
107221
107307
  Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
107222
107308
  resolutionHost.projectName,
107223
107309
  compilerOptions,
@@ -107227,49 +107313,55 @@ ${lanes.join("\n")}
107227
107313
  );
107228
107314
  if (resolvedModule) {
107229
107315
  primaryResult.resolvedModule = resolvedModule;
107230
- primaryResult.failedLookupLocations.push(...failedLookupLocations);
107231
- primaryResult.affectingLocations.push(...affectingLocations);
107316
+ primaryResult.failedLookupLocations = updateResolutionField(primaryResult.failedLookupLocations, failedLookupLocations);
107317
+ primaryResult.affectingLocations = updateResolutionField(primaryResult.affectingLocations, affectingLocations);
107318
+ primaryResult.resolutionDiagnostics = updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
107232
107319
  return primaryResult;
107233
107320
  }
107234
107321
  }
107235
107322
  return primaryResult;
107236
107323
  }
107237
- function resolveTypeReferenceDirective2(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, _containingSourceFile, resolutionMode) {
107238
- return resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode);
107324
+ function createModuleResolutionLoader2(containingFile, redirectedReference, options) {
107325
+ return {
107326
+ nameAndMode: moduleResolutionNameAndModeGetter,
107327
+ resolve: (moduleName, resoluionMode) => resolveModuleName2(
107328
+ moduleName,
107329
+ containingFile,
107330
+ options,
107331
+ redirectedReference,
107332
+ resoluionMode
107333
+ )
107334
+ };
107239
107335
  }
107240
107336
  function resolveNamesWithLocalCache({
107241
- names,
107337
+ entries,
107242
107338
  containingFile,
107339
+ containingSourceFile,
107243
107340
  redirectedReference,
107341
+ options,
107244
107342
  perFileCache,
107343
+ reusedNames,
107245
107344
  loader,
107246
107345
  getResolutionWithResolvedFileName,
107247
107346
  shouldRetryResolution,
107248
- reusedNames,
107249
- resolutionInfo,
107250
- logChanges,
107251
- containingSourceFile,
107252
- containingSourceFileMode
107347
+ logChanges
107253
107348
  }) {
107254
- var _a2, _b, _c;
107349
+ var _a2;
107255
107350
  const path = resolutionHost.toPath(containingFile);
107256
107351
  const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
107257
107352
  const resolvedModules = [];
107258
- const compilerOptions = resolutionHost.getCompilationSettings();
107259
107353
  const hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
107260
107354
  const program = resolutionHost.getCurrentProgram();
107261
107355
  const oldRedirect = program && program.getResolvedProjectReferenceToRedirect(containingFile);
107262
107356
  const unmatchedRedirects = oldRedirect ? !redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path : !!redirectedReference;
107263
107357
  const seenNamesInFile = createModeAwareCache();
107264
- let i = 0;
107265
- for (const entry of containingSourceFile && resolutionInfo ? resolutionInfo.names : names) {
107266
- const name = getResolutionName(entry);
107267
- const mode = !isString(entry) ? isStringLiteralLike(entry) ? getModeForUsageLocation(containingSourceFile, entry) : getModeForFileReference(entry, containingSourceFileMode) : containingSourceFile ? getModeForResolutionAtIndex(containingSourceFile, i) : void 0;
107268
- i++;
107358
+ for (const entry of entries) {
107359
+ const name = loader.nameAndMode.getName(entry);
107360
+ const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
107269
107361
  let resolution = resolutionsInFile.get(name, mode);
107270
107362
  if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
107271
107363
  const existingResolution = resolution;
107272
- resolution = loader(name, containingFile, compilerOptions, ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
107364
+ resolution = loader.resolve(name, mode);
107273
107365
  if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
107274
107366
  resolutionHost.onDiscoveredSymlink();
107275
107367
  }
@@ -107283,12 +107375,12 @@ ${lanes.join("\n")}
107283
107375
  logChanges = false;
107284
107376
  }
107285
107377
  } else {
107286
- const host = ((_b = resolutionHost.getCompilerHost) == null ? void 0 : _b.call(resolutionHost)) || resolutionHost;
107287
- if (isTraceEnabled(compilerOptions, host) && !seenNamesInFile.has(name, mode)) {
107378
+ const host = ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost;
107379
+ if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) {
107288
107380
  const resolved = getResolutionWithResolvedFileName(resolution);
107289
107381
  trace(
107290
107382
  host,
107291
- loader === resolveModuleName2 ? (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved : (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved,
107383
+ perFileCache === resolvedModuleNames ? (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved : (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved,
107292
107384
  name,
107293
107385
  containingFile,
107294
107386
  resolved == null ? void 0 : resolved.resolvedFileName,
@@ -107298,19 +107390,16 @@ ${lanes.join("\n")}
107298
107390
  }
107299
107391
  Debug.assert(resolution !== void 0 && !resolution.isInvalidated);
107300
107392
  seenNamesInFile.set(name, mode, true);
107301
- resolvedModules.push(getResolutionWithResolvedFileName(resolution));
107302
- }
107303
- if (resolutionInfo && (loader === resolveTypeReferenceDirective2 || containingSourceFile)) {
107304
- (_c = resolutionInfo.reusedNames) == null ? void 0 : _c.forEach((entry) => seenNamesInFile.set(
107305
- getResolutionName(entry),
107306
- !isString(entry) && isStringLiteralLike(entry) ? getModeForUsageLocation(containingSourceFile, entry) : getModeForFileReference(entry, containingSourceFileMode),
107307
- true
107308
- ));
107309
- reusedNames = void 0;
107393
+ resolvedModules.push(resolution);
107310
107394
  }
107395
+ reusedNames == null ? void 0 : reusedNames.forEach((entry) => seenNamesInFile.set(
107396
+ loader.nameAndMode.getName(entry),
107397
+ loader.nameAndMode.getMode(entry, containingSourceFile),
107398
+ true
107399
+ ));
107311
107400
  if (resolutionsInFile.size() !== seenNamesInFile.size()) {
107312
107401
  resolutionsInFile.forEach((resolution, name, mode) => {
107313
- if (!seenNamesInFile.has(name, mode) && !contains(reusedNames, name)) {
107402
+ if (!seenNamesInFile.has(name, mode)) {
107314
107403
  stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
107315
107404
  resolutionsInFile.delete(name, mode);
107316
107405
  }
@@ -107335,39 +107424,53 @@ ${lanes.join("\n")}
107335
107424
  return oldResult.resolvedFileName === newResult.resolvedFileName;
107336
107425
  }
107337
107426
  }
107338
- function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode, resolutionInfo) {
107427
+ function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
107428
+ var _a2;
107339
107429
  return resolveNamesWithLocalCache({
107340
- names: typeDirectiveNames,
107430
+ entries: typeDirectiveReferences,
107341
107431
  containingFile,
107432
+ containingSourceFile,
107342
107433
  redirectedReference,
107434
+ options,
107435
+ reusedNames,
107343
107436
  perFileCache: resolvedTypeReferenceDirectives,
107344
- loader: resolveTypeReferenceDirective2,
107437
+ loader: createTypeReferenceResolutionLoader(
107438
+ containingFile,
107439
+ redirectedReference,
107440
+ options,
107441
+ ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost,
107442
+ typeReferenceDirectiveResolutionCache
107443
+ ),
107345
107444
  getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective2,
107346
- shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
107347
- containingSourceFileMode: containingFileMode,
107348
- resolutionInfo
107445
+ shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0
107349
107446
  });
107350
107447
  }
107351
- function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile, resolutionInfo) {
107448
+ function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
107352
107449
  return resolveNamesWithLocalCache({
107353
- names: moduleNames,
107450
+ entries: moduleLiterals,
107354
107451
  containingFile,
107452
+ containingSourceFile,
107355
107453
  redirectedReference,
107454
+ options,
107455
+ reusedNames,
107356
107456
  perFileCache: resolvedModuleNames,
107357
- loader: resolveModuleName2,
107457
+ loader: createModuleResolutionLoader2(
107458
+ containingFile,
107459
+ redirectedReference,
107460
+ options
107461
+ ),
107358
107462
  getResolutionWithResolvedFileName: getResolvedModule2,
107359
107463
  shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
107360
- reusedNames,
107361
- resolutionInfo,
107362
- logChanges: logChangesWhenResolvingModule,
107363
- containingSourceFile
107464
+ logChanges: logChangesWhenResolvingModule
107364
107465
  });
107365
107466
  }
107366
- function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode) {
107367
- const cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile));
107368
- if (!cache)
107369
- return void 0;
107370
- return cache.get(moduleName, resolutionMode);
107467
+ function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
107468
+ const path = resolutionHost.toPath(containingFile);
107469
+ const resolutionsInFile = resolvedModuleNames.get(path);
107470
+ const resolution = resolutionsInFile == null ? void 0 : resolutionsInFile.get(moduleName, void 0);
107471
+ if (resolution && !resolution.isInvalidated)
107472
+ return resolution;
107473
+ return resolveModuleName2(moduleName, containingFile, resolutionHost.getCompilationSettings());
107371
107474
  }
107372
107475
  function isNodeModulesAtTypesDirectory(dirPath) {
107373
107476
  return endsWith(dirPath, "/node_modules/@types");
@@ -107446,37 +107549,39 @@ ${lanes.join("\n")}
107446
107549
  function watchFailedLookupLocationOfResolution(resolution) {
107447
107550
  Debug.assert(!!resolution.refCount);
107448
107551
  const { failedLookupLocations, affectingLocations } = resolution;
107449
- if (!failedLookupLocations.length && !affectingLocations.length)
107552
+ if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length))
107450
107553
  return;
107451
- if (failedLookupLocations.length)
107554
+ if (failedLookupLocations == null ? void 0 : failedLookupLocations.length)
107452
107555
  resolutionsWithFailedLookups.push(resolution);
107453
107556
  let setAtRoot = false;
107454
- for (const failedLookupLocation of failedLookupLocations) {
107455
- const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
107456
- const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
107457
- if (toWatch) {
107458
- const { dir, dirPath, nonRecursive } = toWatch;
107459
- if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
107460
- const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
107461
- customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
107462
- }
107463
- if (dirPath === rootPath) {
107464
- Debug.assert(!nonRecursive);
107465
- setAtRoot = true;
107466
- } else {
107467
- setDirectoryWatcher(dir, dirPath, nonRecursive);
107557
+ if (failedLookupLocations) {
107558
+ for (const failedLookupLocation of failedLookupLocations) {
107559
+ const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
107560
+ const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
107561
+ if (toWatch) {
107562
+ const { dir, dirPath, nonRecursive } = toWatch;
107563
+ if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
107564
+ const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
107565
+ customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
107566
+ }
107567
+ if (dirPath === rootPath) {
107568
+ Debug.assert(!nonRecursive);
107569
+ setAtRoot = true;
107570
+ } else {
107571
+ setDirectoryWatcher(dir, dirPath, nonRecursive);
107572
+ }
107468
107573
  }
107469
107574
  }
107575
+ if (setAtRoot) {
107576
+ setDirectoryWatcher(rootDir, rootPath, true);
107577
+ }
107470
107578
  }
107471
- if (setAtRoot) {
107472
- setDirectoryWatcher(rootDir, rootPath, true);
107473
- }
107474
- watchAffectingLocationsOfResolution(resolution, !failedLookupLocations.length);
107579
+ watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length));
107475
107580
  }
107476
107581
  function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
107477
107582
  Debug.assert(!!resolution.refCount);
107478
107583
  const { affectingLocations } = resolution;
107479
- if (!affectingLocations.length)
107584
+ if (!(affectingLocations == null ? void 0 : affectingLocations.length))
107480
107585
  return;
107481
107586
  if (addToResolutionsWithOnlyAffectingLocations)
107482
107587
  resolutionsWithOnlyAffectingLocations.push(resolution);
@@ -107594,12 +107699,14 @@ ${lanes.join("\n")}
107594
107699
  if (removeAtRoot) {
107595
107700
  removeDirectoryWatcher(rootPath);
107596
107701
  }
107597
- } else if (affectingLocations.length) {
107702
+ } else if (affectingLocations == null ? void 0 : affectingLocations.length) {
107598
107703
  unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
107599
107704
  }
107600
- for (const affectingLocation of affectingLocations) {
107601
- const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
107602
- watcher.resolutions--;
107705
+ if (affectingLocations) {
107706
+ for (const affectingLocation of affectingLocations) {
107707
+ const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
107708
+ watcher.resolutions--;
107709
+ }
107603
107710
  }
107604
107711
  }
107605
107712
  function removeDirectoryWatcher(dirPath) {
@@ -107721,17 +107828,19 @@ ${lanes.join("\n")}
107721
107828
  return invalidated;
107722
107829
  }
107723
107830
  function canInvalidateFailedLookupResolution(resolution) {
107831
+ var _a2;
107724
107832
  if (canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution))
107725
107833
  return true;
107726
107834
  if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
107727
107835
  return false;
107728
- return resolution.failedLookupLocations.some((location2) => isInvalidatedFailedLookup(resolutionHost.toPath(location2)));
107836
+ return (_a2 = resolution.failedLookupLocations) == null ? void 0 : _a2.some((location2) => isInvalidatedFailedLookup(resolutionHost.toPath(location2)));
107729
107837
  }
107730
107838
  function isInvalidatedFailedLookup(locationPath) {
107731
107839
  return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || emptyIterator, (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || emptyIterator, (fileOrDirectoryPath) => isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : void 0);
107732
107840
  }
107733
107841
  function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
107734
- return !!affectingPathChecks && resolution.affectingLocations.some((location2) => affectingPathChecks.has(location2));
107842
+ var _a2;
107843
+ return !!affectingPathChecks && ((_a2 = resolution.affectingLocations) == null ? void 0 : _a2.some((location2) => affectingPathChecks.has(location2)));
107735
107844
  }
107736
107845
  function closeTypeRootsWatch() {
107737
107846
  clearMap(typeRootsWatches, closeFileWatcher);
@@ -108522,10 +108631,18 @@ ${lanes.join("\n")}
108522
108631
  configFileName ? getDirectoryPath(getNormalizedAbsolutePath(configFileName, currentDirectory)) : currentDirectory,
108523
108632
  false
108524
108633
  );
108525
- compilerHost.resolveModuleNames = host.resolveModuleNames ? (...args) => host.resolveModuleNames(...args) : (moduleNames, containingFile, reusedNames, redirectedReference, _options, sourceFile, resolutionInfo) => resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, sourceFile, resolutionInfo);
108526
- compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ? (...args) => host.resolveTypeReferenceDirectives(...args) : (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode, resolutionInfo) => resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode, resolutionInfo);
108527
- compilerHost.getModuleResolutionCache = host.resolveModuleNames ? maybeBind(host, host.getModuleResolutionCache) : () => resolutionCache.getModuleResolutionCache();
108528
- const userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
108634
+ compilerHost.resolveModuleNameLiterals = maybeBind(host, host.resolveModuleNameLiterals);
108635
+ compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
108636
+ if (!compilerHost.resolveModuleNameLiterals && !compilerHost.resolveModuleNames) {
108637
+ compilerHost.resolveModuleNameLiterals = resolutionCache.resolveModuleNameLiterals.bind(resolutionCache);
108638
+ }
108639
+ compilerHost.resolveTypeReferenceDirectiveReferences = maybeBind(host, host.resolveTypeReferenceDirectiveReferences);
108640
+ compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
108641
+ if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) {
108642
+ compilerHost.resolveTypeReferenceDirectiveReferences = resolutionCache.resolveTypeReferenceDirectiveReferences.bind(resolutionCache);
108643
+ }
108644
+ compilerHost.getModuleResolutionCache = host.resolveModuleNameLiterals || host.resolveModuleNames ? maybeBind(host, host.getModuleResolutionCache) : () => resolutionCache.getModuleResolutionCache();
108645
+ const userProvidedResolution = !!host.resolveModuleNameLiterals || !!host.resolveTypeReferenceDirectiveReferences || !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
108529
108646
  const customHasInvalidatedResolutions = userProvidedResolution ? maybeBind(host, host.hasInvalidatedResolutions) || returnTrue : returnFalse;
108530
108647
  builderProgram = readBuilderProgram(compilerOptions, compilerHost);
108531
108648
  synchronizeProgram();
@@ -109184,19 +109301,38 @@ ${lanes.join("\n")}
109184
109301
  const compilerHost = createCompilerHostFromProgramHost(host, () => state.projectCompilerOptions);
109185
109302
  setGetSourceFileAsHashVersioned(compilerHost);
109186
109303
  compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
109304
+ compilerHost.resolveModuleNameLiterals = maybeBind(host, host.resolveModuleNameLiterals);
109305
+ compilerHost.resolveTypeReferenceDirectiveReferences = maybeBind(host, host.resolveTypeReferenceDirectiveReferences);
109187
109306
  compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
109188
109307
  compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
109189
109308
  compilerHost.getModuleResolutionCache = maybeBind(host, host.getModuleResolutionCache);
109190
- const moduleResolutionCache = !compilerHost.resolveModuleNames ? createModuleResolutionCache(currentDirectory, getCanonicalFileName) : void 0;
109191
- const typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : void 0;
109192
- if (!compilerHost.resolveModuleNames) {
109193
- const loader = (moduleName, resolverMode, containingFile, redirectedReference) => resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule;
109194
- compilerHost.resolveModuleNames = (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile, resolutionInfo) => loadWithModeAwareCache(Debug.checkEachDefined(moduleNames), Debug.checkDefined(containingSourceFile), containingFile, redirectedReference, resolutionInfo, loader);
109309
+ let moduleResolutionCache, typeReferenceDirectiveResolutionCache;
109310
+ if (!compilerHost.resolveModuleNameLiterals && !compilerHost.resolveModuleNames) {
109311
+ moduleResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName);
109312
+ compilerHost.resolveModuleNameLiterals = (moduleNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
109313
+ moduleNames,
109314
+ containingFile,
109315
+ redirectedReference,
109316
+ options2,
109317
+ containingSourceFile,
109318
+ host,
109319
+ moduleResolutionCache,
109320
+ createModuleResolutionLoader
109321
+ );
109195
109322
  compilerHost.getModuleResolutionCache = () => moduleResolutionCache;
109196
109323
  }
109197
- if (!compilerHost.resolveTypeReferenceDirectives) {
109198
- const loader = (moduleName, containingFile, redirectedReference, containingFileMode) => resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode).resolvedTypeReferenceDirective;
109199
- compilerHost.resolveTypeReferenceDirectives = (typeReferenceDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) => loadWithTypeDirectiveCache(Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader);
109324
+ if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) {
109325
+ typeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, void 0, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
109326
+ compilerHost.resolveTypeReferenceDirectiveReferences = (typeDirectiveNames, containingFile, redirectedReference, options2, containingSourceFile) => loadWithModeAwareCache(
109327
+ typeDirectiveNames,
109328
+ containingFile,
109329
+ redirectedReference,
109330
+ options2,
109331
+ containingSourceFile,
109332
+ host,
109333
+ typeReferenceDirectiveResolutionCache,
109334
+ createTypeReferenceResolutionLoader
109335
+ );
109200
109336
  }
109201
109337
  compilerHost.getBuildInfo = (fileName, configFilePath) => getBuildInfo3(state, fileName, toResolvedConfigFilePath(state, configFilePath), void 0);
109202
109338
  const { watchFile: watchFile2, watchDirectory, writeLog } = createWatchFactory(hostWithWatch, options);
@@ -111885,6 +112021,7 @@ ${lanes.join("\n")}
111885
112021
  createModuleBlock: () => createModuleBlock,
111886
112022
  createModuleDeclaration: () => createModuleDeclaration,
111887
112023
  createModuleResolutionCache: () => createModuleResolutionCache,
112024
+ createModuleResolutionLoader: () => createModuleResolutionLoader,
111888
112025
  createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
111889
112026
  createMultiMap: () => createMultiMap,
111890
112027
  createNamedExports: () => createNamedExports,
@@ -112007,6 +112144,7 @@ ${lanes.join("\n")}
112007
112144
  createTypeQueryNode: () => createTypeQueryNode,
112008
112145
  createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache,
112009
112146
  createTypeReferenceNode: () => createTypeReferenceNode,
112147
+ createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader,
112010
112148
  createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap,
112011
112149
  createUnionTypeNode: () => createUnionTypeNode,
112012
112150
  createUniqueName: () => createUniqueName,
@@ -112496,9 +112634,7 @@ ${lanes.join("\n")}
112496
112634
  getRenameLocation: () => getRenameLocation,
112497
112635
  getReplacementSpanForContextToken: () => getReplacementSpanForContextToken,
112498
112636
  getResolutionDiagnostic: () => getResolutionDiagnostic,
112499
- getResolutionMode: () => getResolutionMode,
112500
112637
  getResolutionModeOverrideForClause: () => getResolutionModeOverrideForClause,
112501
- getResolutionName: () => getResolutionName,
112502
112638
  getResolvedExternalModuleName: () => getResolvedExternalModuleName,
112503
112639
  getResolvedModule: () => getResolvedModule,
112504
112640
  getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
@@ -113317,7 +113453,6 @@ ${lanes.join("\n")}
113317
113453
  listFiles: () => listFiles,
113318
113454
  loadModuleFromGlobalCache: () => loadModuleFromGlobalCache,
113319
113455
  loadWithModeAwareCache: () => loadWithModeAwareCache,
113320
- loadWithTypeDirectiveCache: () => loadWithTypeDirectiveCache,
113321
113456
  makeIdentifierFromModuleName: () => makeIdentifierFromModuleName,
113322
113457
  makeImport: () => makeImport,
113323
113458
  makeImportIfNecessary: () => makeImportIfNecessary,
@@ -113349,6 +113484,7 @@ ${lanes.join("\n")}
113349
113484
  modifiersToFlags: () => modifiersToFlags,
113350
113485
  moduleOptionDeclaration: () => moduleOptionDeclaration,
113351
113486
  moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
113487
+ moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
113352
113488
  moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
113353
113489
  moduleResolutionRespectsExports: () => moduleResolutionRespectsExports,
113354
113490
  moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
@@ -113725,6 +113861,7 @@ ${lanes.join("\n")}
113725
113861
  typeHasCallOrConstructSignatures: () => typeHasCallOrConstructSignatures,
113726
113862
  typeKeywords: () => typeKeywords,
113727
113863
  typeParameterNamePart: () => typeParameterNamePart,
113864
+ typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
113728
113865
  typeToDisplayParts: () => typeToDisplayParts,
113729
113866
  unchangedPollThresholds: () => unchangedPollThresholds,
113730
113867
  unchangedTextChangeRange: () => unchangedTextChangeRange,
@@ -113840,6 +113977,7 @@ ${lanes.join("\n")}
113840
113977
  updatePropertyAssignment: () => updatePropertyAssignment,
113841
113978
  updatePropertySignature: () => updatePropertySignature,
113842
113979
  updateQualifiedName: () => updateQualifiedName,
113980
+ updateResolutionField: () => updateResolutionField,
113843
113981
  updateRestTypeNode: () => updateRestTypeNode,
113844
113982
  updateReturn: () => updateReturn,
113845
113983
  updateSetAccessor: () => updateSetAccessor,
@@ -118665,13 +118803,14 @@ ${lanes.join("\n")}
118665
118803
  return ensurePathIsNonModuleName(combineNormal(pathA, pathB));
118666
118804
  }
118667
118805
  function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) {
118806
+ var _a2;
118668
118807
  if (importedModuleSymbol) {
118669
118808
  const oldFileName = find(importedModuleSymbol.declarations, isSourceFile).fileName;
118670
118809
  const newFileName = oldToNew(oldFileName);
118671
118810
  return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true };
118672
118811
  } else {
118673
118812
  const mode = getModeForUsageLocation(importingSourceFile, importLiteral);
118674
- const resolved = host.resolveModuleNames ? host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode) : program.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
118813
+ const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? (_a2 = importingSourceFile.resolvedModules) == null ? void 0 : _a2.get(importLiteral.text, mode) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
118675
118814
  return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
118676
118815
  }
118677
118816
  }
@@ -121580,6 +121719,8 @@ ${lanes.join("\n")}
121580
121719
  getModuleResolutionCache: maybeBind(host, host.getModuleResolutionCache),
121581
121720
  createHash: maybeBind(host, host.createHash),
121582
121721
  resolveTypeReferenceDirectives: maybeBind(host, host.resolveTypeReferenceDirectives),
121722
+ resolveModuleNameLiterals: maybeBind(host, host.resolveModuleNameLiterals),
121723
+ resolveTypeReferenceDirectiveReferences: maybeBind(host, host.resolveTypeReferenceDirectiveReferences),
121583
121724
  useSourceOfProjectReferenceRedirect: maybeBind(host, host.useSourceOfProjectReferenceRedirect),
121584
121725
  getParsedCommandLine
121585
121726
  };
@@ -128978,6 +129119,7 @@ ${lanes.join("\n")}
128978
129119
  }
128979
129120
  });
128980
129121
  function getInfo7(sourceFile, tokenPos, errorCode, checker, program) {
129122
+ var _a2;
128981
129123
  const token = getTokenAtPosition(sourceFile, tokenPos);
128982
129124
  const parent2 = token.parent;
128983
129125
  if (errorCode === Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code) {
@@ -129013,7 +129155,7 @@ ${lanes.join("\n")}
129013
129155
  return { kind: 4 /* JsxAttributes */, token, attributes, parentDeclaration: token.parent };
129014
129156
  }
129015
129157
  if (isIdentifier(token)) {
129016
- const type = checker.getContextualType(token);
129158
+ const type = (_a2 = checker.getContextualType(token)) == null ? void 0 : _a2.getNonNullableType();
129017
129159
  if (type && getObjectFlags(type) & 16 /* Anonymous */) {
129018
129160
  const signature = firstOrUndefined(checker.getSignaturesOfType(type, 0 /* Call */));
129019
129161
  if (signature === void 0)
@@ -137348,6 +137490,7 @@ ${lanes.join("\n")}
137348
137490
  });
137349
137491
  }
137350
137492
  function findModuleReferences(program, sourceFiles, searchModuleSymbol) {
137493
+ var _a2;
137351
137494
  const refs = [];
137352
137495
  const checker = program.getTypeChecker();
137353
137496
  for (const referencingFile of sourceFiles) {
@@ -137359,7 +137502,7 @@ ${lanes.join("\n")}
137359
137502
  }
137360
137503
  }
137361
137504
  for (const ref of referencingFile.typeReferenceDirectives) {
137362
- const referenced = program.getResolvedTypeReferenceDirectives().get(ref.fileName, ref.resolutionMode || referencingFile.impliedNodeFormat);
137505
+ const referenced = (_a2 = program.getResolvedTypeReferenceDirectives().get(ref.fileName, ref.resolutionMode || referencingFile.impliedNodeFormat)) == null ? void 0 : _a2.resolvedTypeReferenceDirective;
137363
137506
  if (referenced !== void 0 && referenced.resolvedFileName === searchSourceFile.fileName) {
137364
137507
  refs.push({ kind: "reference", referencingFile, ref });
137365
137508
  }
@@ -138047,7 +138190,7 @@ ${lanes.join("\n")}
138047
138190
  var Core;
138048
138191
  ((Core2) => {
138049
138192
  function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options = {}, sourceFilesSet = new Set(sourceFiles.map((f) => f.fileName))) {
138050
- var _a2, _b;
138193
+ var _a2, _b, _c;
138051
138194
  node = getAdjustedNode(node, options);
138052
138195
  if (isSourceFile(node)) {
138053
138196
  const resolvedRef = ts_GoToDefinition_exports.getReferenceAtPosition(node, position, program);
@@ -138079,7 +138222,7 @@ ${lanes.join("\n")}
138079
138222
  if (!options.implementations && isStringLiteralLike(node)) {
138080
138223
  if (isModuleSpecifierLike(node)) {
138081
138224
  const fileIncludeReasons = program.getFileIncludeReasons();
138082
- const referencedFileName = (_b = (_a2 = node.getSourceFile().resolvedModules) == null ? void 0 : _a2.get(node.text, getModeForUsageLocation(node.getSourceFile(), node))) == null ? void 0 : _b.resolvedFileName;
138225
+ const referencedFileName = (_c = (_b = (_a2 = node.getSourceFile().resolvedModules) == null ? void 0 : _a2.get(node.text, getModeForUsageLocation(node.getSourceFile(), node))) == null ? void 0 : _b.resolvedModule) == null ? void 0 : _c.resolvedFileName;
138083
138226
  const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0;
138084
138227
  if (referencedFile) {
138085
138228
  return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }];
@@ -139298,7 +139441,7 @@ ${lanes.join("\n")}
139298
139441
 
139299
139442
  // src/services/goToDefinition.ts
139300
139443
  function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
139301
- var _a2;
139444
+ var _a2, _b;
139302
139445
  const resolvedRef = getReferenceAtPosition(sourceFile, position, program);
139303
139446
  const fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || emptyArray;
139304
139447
  if (resolvedRef == null ? void 0 : resolvedRef.file) {
@@ -139344,7 +139487,7 @@ ${lanes.join("\n")}
139344
139487
  }
139345
139488
  }
139346
139489
  if (!symbol && isModuleSpecifierLike(fallbackNode)) {
139347
- const ref = (_a2 = sourceFile.resolvedModules) == null ? void 0 : _a2.get(fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode));
139490
+ const ref = (_b = (_a2 = sourceFile.resolvedModules) == null ? void 0 : _a2.get(fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode))) == null ? void 0 : _b.resolvedModule;
139348
139491
  if (ref) {
139349
139492
  return [{
139350
139493
  name: fallbackNode.text,
@@ -139422,7 +139565,7 @@ ${lanes.join("\n")}
139422
139565
  return getDefinitionFromSymbol(typeChecker, symbol, node);
139423
139566
  }
139424
139567
  function getReferenceAtPosition(sourceFile, position, program) {
139425
- var _a2, _b;
139568
+ var _a2, _b, _c, _d;
139426
139569
  const referencePath = findReferenceInPosition(sourceFile.referencedFiles, position);
139427
139570
  if (referencePath) {
139428
139571
  const file = program.getSourceFileFromReference(sourceFile, referencePath);
@@ -139430,7 +139573,7 @@ ${lanes.join("\n")}
139430
139573
  }
139431
139574
  const typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position);
139432
139575
  if (typeReferenceDirective) {
139433
- const reference = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName, typeReferenceDirective.resolutionMode || sourceFile.impliedNodeFormat);
139576
+ const reference = (_a2 = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName, typeReferenceDirective.resolutionMode || sourceFile.impliedNodeFormat)) == null ? void 0 : _a2.resolvedTypeReferenceDirective;
139434
139577
  const file = reference && program.getSourceFile(reference.resolvedFileName);
139435
139578
  return file && { reference: typeReferenceDirective, fileName: file.fileName, file, unverified: false };
139436
139579
  }
@@ -139439,10 +139582,10 @@ ${lanes.join("\n")}
139439
139582
  const file = program.getLibFileFromReference(libReferenceDirective);
139440
139583
  return file && { reference: libReferenceDirective, fileName: file.fileName, file, unverified: false };
139441
139584
  }
139442
- if ((_a2 = sourceFile.resolvedModules) == null ? void 0 : _a2.size()) {
139585
+ if ((_b = sourceFile.resolvedModules) == null ? void 0 : _b.size()) {
139443
139586
  const node = getTouchingToken(sourceFile, position);
139444
139587
  if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, getModeForUsageLocation(sourceFile, node))) {
139445
- const verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text, getModeForUsageLocation(sourceFile, node))) == null ? void 0 : _b.resolvedFileName;
139588
+ const verifiedFileName = (_d = (_c = sourceFile.resolvedModules.get(node.text, getModeForUsageLocation(sourceFile, node))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.resolvedFileName;
139446
139589
  const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text);
139447
139590
  return {
139448
139591
  file: program.getSourceFile(fileName),
@@ -141526,7 +141669,7 @@ ${lanes.join("\n")}
141526
141669
  return emptyArray;
141527
141670
  },
141528
141671
  getEditsForAction: function getRefactorEditsToExtractType(context, actionName2) {
141529
- const { file, program } = context;
141672
+ const { file } = context;
141530
141673
  const info = getRangeToExtract(context);
141531
141674
  Debug.assert(info && !isRefactorErrorInfo(info), "Expected to find a range to extract");
141532
141675
  const name = getUniqueName("NewType", file);
@@ -141537,7 +141680,7 @@ ${lanes.join("\n")}
141537
141680
  return doTypeAliasChange(changes, file, name, info);
141538
141681
  case extractToTypeDefAction.name:
141539
141682
  Debug.assert(info.isJS, "Invalid actionName/JS combo");
141540
- return doTypedefChange(changes, program, file, name, info);
141683
+ return doTypedefChange(changes, context, file, name, info);
141541
141684
  case extractToInterfaceAction.name:
141542
141685
  Debug.assert(!info.isJS && !!info.typeElements, "Invalid actionName/JS combo");
141543
141686
  return doInterfaceChange(changes, file, name, info);
@@ -141666,7 +141809,8 @@ ${lanes.join("\n")}
141666
141809
  changes.insertNodeBefore(file, enclosingNode, ignoreSourceNewlines(newTypeNode), true);
141667
141810
  changes.replaceNode(file, selection, factory.createTypeReferenceNode(name, typeParameters.map((id) => factory.createTypeReferenceNode(id.name, void 0))), { leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.Exclude, trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.ExcludeWhitespace });
141668
141811
  }
141669
- function doTypedefChange(changes, program, file, name, info) {
141812
+ function doTypedefChange(changes, context, file, name, info) {
141813
+ var _a2;
141670
141814
  const { enclosingNode, selection, typeParameters } = info;
141671
141815
  setEmitFlags(selection, 3072 /* NoComments */ | 4096 /* NoNestedComments */);
141672
141816
  const node = factory.createJSDocTypedefTag(
@@ -141688,7 +141832,7 @@ ${lanes.join("\n")}
141688
141832
  const jsDoc = factory.createJSDocComment(void 0, factory.createNodeArray(concatenate(templates, [node])));
141689
141833
  if (isJSDoc(enclosingNode)) {
141690
141834
  const pos = enclosingNode.getStart(file);
141691
- const newLineCharacter = getNewLineCharacter(program.getCompilerOptions());
141835
+ const newLineCharacter = getNewLineOrDefaultFromHost(context.host, (_a2 = context.formatContext) == null ? void 0 : _a2.options);
141692
141836
  changes.insertNodeAt(file, enclosingNode.getStart(file), jsDoc, {
141693
141837
  suffix: newLineCharacter + newLineCharacter + file.text.slice(getPrecedingNonSpaceCharacterPosition(file.text, pos - 1), pos)
141694
141838
  });
@@ -152985,7 +153129,7 @@ ${options.prefix}` : "\n" : options.prefix
152985
153129
  if (this.program && !this.symlinks.hasProcessedResolutions()) {
152986
153130
  this.symlinks.setSymlinksFromResolutions(
152987
153131
  this.program.getSourceFiles(),
152988
- this.program.getResolvedTypeReferenceDirectives()
153132
+ this.program.getAutomaticTypeDirectiveResolutions()
152989
153133
  );
152990
153134
  }
152991
153135
  return this.symlinks;
@@ -153069,17 +153213,21 @@ ${options.prefix}` : "\n" : options.prefix
153069
153213
  const path = this.toPath(file);
153070
153214
  return !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file);
153071
153215
  }
153072
- resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, _options, containingSourceFile, resolutionInfo) {
153073
- return this.resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile, resolutionInfo);
153216
+ resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
153217
+ return this.resolutionCache.resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames);
153074
153218
  }
153075
153219
  getModuleResolutionCache() {
153076
153220
  return this.resolutionCache.getModuleResolutionCache();
153077
153221
  }
153078
- getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode) {
153079
- return this.resolutionCache.getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode);
153080
- }
153081
- resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode, resolutionInfo) {
153082
- return this.resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode, resolutionInfo);
153222
+ resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
153223
+ return this.resolutionCache.resolveTypeReferenceDirectiveReferences(
153224
+ typeDirectiveReferences,
153225
+ containingFile,
153226
+ redirectedReference,
153227
+ options,
153228
+ containingSourceFile,
153229
+ reusedNames
153230
+ );
153083
153231
  }
153084
153232
  directoryExists(path) {
153085
153233
  return this.directoryStructureHost.directoryExists(path);
@@ -154191,7 +154339,7 @@ ${options.prefix}` : "\n" : options.prefix
154191
154339
  if (!file.resolvedModules)
154192
154340
  return emptyArray2;
154193
154341
  let unresolvedImports;
154194
- file.resolvedModules.forEach((resolvedModule, name) => {
154342
+ file.resolvedModules.forEach(({ resolvedModule }, name) => {
154195
154343
  if ((!resolvedModule || !resolutionExtensionIsTSOrJson(resolvedModule.extension)) && !isExternalModuleNameRelative(name) && !ambientModules.some((m) => m === name)) {
154196
154344
  unresolvedImports = append(unresolvedImports, parsePackageName(name).packageName);
154197
154345
  }
@@ -159125,7 +159273,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
159125
159273
  definitions = definitions.filter((d) => !d.isAmbient && !d.failedAliasResolution);
159126
159274
  return this.mapDefinitionInfo(definitions, project);
159127
159275
  function findImplementationFileFromDtsFileName(fileName, resolveFromFile, auxiliaryProject) {
159128
- var _a3;
159276
+ var _a3, _b, _c;
159129
159277
  const nodeModulesPathParts = getNodeModulePathParts(fileName);
159130
159278
  if (nodeModulesPathParts && fileName.lastIndexOf(nodeModulesPathPart) === nodeModulesPathParts.topLevelNodeModulesIndex) {
159131
159279
  const packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
@@ -159147,13 +159295,11 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
159147
159295
  const packageName = getPackageNameFromTypesPackageName(unmangleScopedPackageName(packageNamePathPart));
159148
159296
  const path = project.toPath(fileName);
159149
159297
  if (entrypoints && some(entrypoints, (e) => project.toPath(e) === path)) {
159150
- const [implementationResolution] = auxiliaryProject.resolveModuleNames([packageName], resolveFromFile);
159151
- return implementationResolution == null ? void 0 : implementationResolution.resolvedFileName;
159298
+ return (_b = auxiliaryProject.resolutionCache.resolveSingleModuleNameWithoutWatching(packageName, resolveFromFile).resolvedModule) == null ? void 0 : _b.resolvedFileName;
159152
159299
  } else {
159153
159300
  const pathToFileInPackage = fileName.substring(nodeModulesPathParts.packageRootIndex + 1);
159154
159301
  const specifier = `${packageName}/${removeFileExtension(pathToFileInPackage)}`;
159155
- const [implementationResolution] = auxiliaryProject.resolveModuleNames([specifier], resolveFromFile);
159156
- return implementationResolution == null ? void 0 : implementationResolution.resolvedFileName;
159302
+ return (_c = auxiliaryProject.resolutionCache.resolveSingleModuleNameWithoutWatching(specifier, resolveFromFile).resolvedModule) == null ? void 0 : _c.resolvedFileName;
159157
159303
  }
159158
159304
  }
159159
159305
  return void 0;