typescript 5.3.0-dev.20230920 → 5.3.0-dev.20230921

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/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.3";
38
- version = `${versionMajorMinor}.0-dev.20230920`;
38
+ version = `${versionMajorMinor}.0-dev.20230921`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -12936,26 +12936,6 @@ ${lanes.join("\n")}
12936
12936
  function getFullWidth(node) {
12937
12937
  return node.end - node.pos;
12938
12938
  }
12939
- function getResolvedModule(sourceFile, moduleNameText, mode) {
12940
- var _a, _b;
12941
- return (_b = (_a = sourceFile == null ? void 0 : sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleNameText, mode)) == null ? void 0 : _b.resolvedModule;
12942
- }
12943
- function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
12944
- if (!sourceFile.resolvedModules) {
12945
- sourceFile.resolvedModules = createModeAwareCache();
12946
- }
12947
- sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
12948
- }
12949
- function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective, mode) {
12950
- if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
12951
- sourceFile.resolvedTypeReferenceDirectiveNames = createModeAwareCache();
12952
- }
12953
- sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
12954
- }
12955
- function getResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, mode) {
12956
- var _a, _b;
12957
- return (_b = (_a = sourceFile == null ? void 0 : sourceFile.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(typeReferenceDirectiveName, mode)) == null ? void 0 : _b.resolvedTypeReferenceDirective;
12958
- }
12959
12939
  function projectReferenceIsEqualTo(oldRef, newRef) {
12960
12940
  return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
12961
12941
  }
@@ -12963,8 +12943,8 @@ ${lanes.join("\n")}
12963
12943
  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) && oldResolution.node10Result === newResolution.node10Result;
12964
12944
  }
12965
12945
  function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
12966
- var _a, _b;
12967
- const node10Result = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleReference, mode)) == null ? void 0 : _b.node10Result;
12946
+ var _a, _b, _c;
12947
+ const node10Result = (_c = (_b = (_a = host.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(moduleReference, mode)) == null ? void 0 : _c.node10Result;
12968
12948
  const result = node10Result ? chainDiagnosticMessages(
12969
12949
  /*details*/
12970
12950
  void 0,
@@ -17907,14 +17887,11 @@ ${lanes.join("\n")}
17907
17887
  (symlinkedDirectories || (symlinkedDirectories = /* @__PURE__ */ new Map())).set(symlinkPath, real);
17908
17888
  }
17909
17889
  },
17910
- setSymlinksFromResolutions(files, typeReferenceDirectives) {
17911
- var _a, _b;
17890
+ setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, typeReferenceDirectives) {
17912
17891
  Debug.assert(!hasProcessedResolutions);
17913
17892
  hasProcessedResolutions = true;
17914
- for (const file of files) {
17915
- (_a = file.resolvedModules) == null ? void 0 : _a.forEach((resolution) => processResolution(this, resolution.resolvedModule));
17916
- (_b = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _b.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
17917
- }
17893
+ resolvedModules == null ? void 0 : resolvedModules.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedModule)));
17894
+ resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective)));
17918
17895
  typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
17919
17896
  },
17920
17897
  hasProcessedResolutions: () => hasProcessedResolutions
@@ -23480,7 +23457,6 @@ ${lanes.join("\n")}
23480
23457
  node.imports = void 0;
23481
23458
  node.moduleAugmentations = void 0;
23482
23459
  node.ambientModuleNames = void 0;
23483
- node.resolvedModules = void 0;
23484
23460
  node.classifiableNames = void 0;
23485
23461
  node.impliedNodeFormat = void 0;
23486
23462
  return node;
@@ -37968,6 +37944,7 @@ ${lanes.join("\n")}
37968
37944
  node16: 100 /* Node16 */,
37969
37945
  nodenext: 199 /* NodeNext */
37970
37946
  })),
37947
+ affectsSourceFile: true,
37971
37948
  affectsModuleResolution: true,
37972
37949
  affectsEmit: true,
37973
37950
  affectsBuildInfo: true,
@@ -38404,6 +38381,7 @@ ${lanes.join("\n")}
38404
38381
  bundler: 100 /* Bundler */
38405
38382
  })),
38406
38383
  deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
38384
+ affectsSourceFile: true,
38407
38385
  affectsModuleResolution: true,
38408
38386
  paramType: Diagnostics.STRATEGY,
38409
38387
  category: Diagnostics.Modules,
@@ -38946,6 +38924,7 @@ ${lanes.join("\n")}
38946
38924
  legacy: 1 /* Legacy */,
38947
38925
  force: 3 /* Force */
38948
38926
  })),
38927
+ affectsSourceFile: true,
38949
38928
  affectsModuleResolution: true,
38950
38929
  description: Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
38951
38930
  category: Diagnostics.Language_and_Environment,
@@ -38965,7 +38944,7 @@ ${lanes.join("\n")}
38965
38944
  affectsEmitOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsEmit);
38966
38945
  affectsDeclarationPathOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsDeclarationPath);
38967
38946
  moduleResolutionOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsModuleResolution);
38968
- sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics);
38947
+ sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsBindDiagnostics);
38969
38948
  optionsAffectingProgramStructure = optionDeclarations.filter((option) => !!option.affectsProgramStructure);
38970
38949
  transpileOptionValueCompilerOptions = optionDeclarations.filter((option) => hasProperty(option, "transpileOptionValue"));
38971
38950
  optionsForBuild = [
@@ -39815,15 +39794,6 @@ ${lanes.join("\n")}
39815
39794
  return result;
39816
39795
  }
39817
39796
  }
39818
- function zipToModeAwareCache(file, keys, values, nameAndModeGetter) {
39819
- Debug.assert(keys.length === values.length);
39820
- const map2 = createModeAwareCache();
39821
- for (let i = 0; i < keys.length; ++i) {
39822
- const entry = keys[i];
39823
- map2.set(nameAndModeGetter.getName(entry), nameAndModeGetter.getMode(entry, file), values[i]);
39824
- }
39825
- return map2;
39826
- }
39827
39797
  function getOriginalOrResolvedModuleFileName(result) {
39828
39798
  return result.resolvedModule && (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
39829
39799
  }
@@ -48779,7 +48749,7 @@ ${lanes.join("\n")}
48779
48749
  return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
48780
48750
  }
48781
48751
  function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
48782
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
48752
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
48783
48753
  if (startsWith(moduleReference, "@types/")) {
48784
48754
  const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
48785
48755
  const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
@@ -48797,7 +48767,7 @@ ${lanes.join("\n")}
48797
48767
  const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
48798
48768
  const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
48799
48769
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
48800
- const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
48770
+ const resolvedModule = (_i = (_h = (_g = host.resolvedModules) == null ? void 0 : _g.get(currentSourceFile.path)) == null ? void 0 : _h.get(moduleReference, mode)) == null ? void 0 : _i.resolvedModule;
48801
48771
  const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
48802
48772
  const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
48803
48773
  if (sourceFile) {
@@ -48805,7 +48775,7 @@ ${lanes.join("\n")}
48805
48775
  error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
48806
48776
  }
48807
48777
  if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
48808
- const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
48778
+ const importOrExport = ((_j = findAncestor(location, isImportDeclaration)) == null ? void 0 : _j.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
48809
48779
  if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
48810
48780
  error2(
48811
48781
  errorNode,
@@ -48814,7 +48784,7 @@ ${lanes.join("\n")}
48814
48784
  );
48815
48785
  }
48816
48786
  } else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
48817
- const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
48787
+ const importOrExport = ((_k = findAncestor(location, isImportDeclaration)) == null ? void 0 : _k.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
48818
48788
  if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
48819
48789
  const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
48820
48790
  error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
@@ -48835,7 +48805,7 @@ ${lanes.join("\n")}
48835
48805
  if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
48836
48806
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
48837
48807
  const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
48838
- const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_i = overrideClauseHost.assertions) == null ? void 0 : _i.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
48808
+ const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_l = overrideClauseHost.assertions) == null ? void 0 : _l.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
48839
48809
  if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
48840
48810
  if (findAncestor(location, isImportEqualsDeclaration)) {
48841
48811
  error2(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
@@ -48942,7 +48912,7 @@ ${lanes.join("\n")}
48942
48912
  error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
48943
48913
  } else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
48944
48914
  const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
48945
- const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
48915
+ const suggestedExt = (_m = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _m[1];
48946
48916
  if (suggestedExt) {
48947
48917
  error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
48948
48918
  } else {
@@ -118409,15 +118379,15 @@ ${lanes.join("\n")}
118409
118379
  function isReferenceFileLocation(location) {
118410
118380
  return location.pos !== void 0;
118411
118381
  }
118412
- function getReferencedFileLocation(getSourceFileByPath, ref) {
118413
- var _a, _b, _c, _d, _e, _f;
118414
- const file = Debug.checkDefined(getSourceFileByPath(ref.file));
118382
+ function getReferencedFileLocation(program, ref) {
118383
+ var _a, _b, _c, _d, _e, _f, _g, _h;
118384
+ const file = Debug.checkDefined(program.getSourceFileByPath(ref.file));
118415
118385
  const { kind, index } = ref;
118416
118386
  let pos, end, packageId, resolutionMode;
118417
118387
  switch (kind) {
118418
118388
  case 3 /* Import */:
118419
118389
  const importLiteral = getModuleNameStringLiteralAt(file, index);
118420
- packageId = (_c = (_b = (_a = file.resolvedModules) == null ? void 0 : _a.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _b.resolvedModule) == null ? void 0 : _c.packageId;
118390
+ packageId = (_d = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(file.path)) == null ? void 0 : _b.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.packageId;
118421
118391
  if (importLiteral.pos === -1)
118422
118392
  return { file, packageId, text: importLiteral.text };
118423
118393
  pos = skipTrivia(file.text, importLiteral.pos);
@@ -118428,7 +118398,7 @@ ${lanes.join("\n")}
118428
118398
  break;
118429
118399
  case 5 /* TypeReferenceDirective */:
118430
118400
  ({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
118431
- 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;
118401
+ packageId = (_h = (_g = (_f = (_e = program.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _e.get(file.path)) == null ? void 0 : _f.get(toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) == null ? void 0 : _g.resolvedTypeReferenceDirective) == null ? void 0 : _h.packageId;
118432
118402
  break;
118433
118403
  case 7 /* LibReferenceDirective */:
118434
118404
  ({ pos, end } = file.libReferenceDirectives[index]);
@@ -118549,6 +118519,10 @@ ${lanes.join("\n")}
118549
118519
  let automaticTypeDirectiveResolutions;
118550
118520
  let resolvedLibReferences;
118551
118521
  let resolvedLibProcessing;
118522
+ let resolvedModules;
118523
+ let resolvedModulesProcessing;
118524
+ let resolvedTypeReferenceDirectiveNames;
118525
+ let resolvedTypeReferenceDirectiveNamesProcessing;
118552
118526
  let packageMap;
118553
118527
  const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
118554
118528
  let currentNodeModulesDepth = 0;
@@ -118813,6 +118787,8 @@ ${lanes.join("\n")}
118813
118787
  }
118814
118788
  oldProgram = void 0;
118815
118789
  resolvedLibProcessing = void 0;
118790
+ resolvedModulesProcessing = void 0;
118791
+ resolvedTypeReferenceDirectiveNamesProcessing = void 0;
118816
118792
  const program = {
118817
118793
  getRootFileNames: () => rootNames,
118818
118794
  getSourceFile,
@@ -118854,6 +118830,8 @@ ${lanes.join("\n")}
118854
118830
  sourceFileToPackageName,
118855
118831
  redirectTargetsMap,
118856
118832
  usesUriStyleNodeCoreModules,
118833
+ resolvedModules,
118834
+ resolvedTypeReferenceDirectiveNames,
118857
118835
  resolvedLibReferences,
118858
118836
  getCurrentPackagesMap: () => packageMap,
118859
118837
  typesPackageExists,
@@ -118885,7 +118863,7 @@ ${lanes.join("\n")}
118885
118863
  case 1 /* FilePreprocessingFileExplainingDiagnostic */:
118886
118864
  return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray));
118887
118865
  case 0 /* FilePreprocessingReferencedDiagnostic */:
118888
- const { file, pos, end } = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason);
118866
+ const { file, pos, end } = getReferencedFileLocation(program, diagnostic.reason);
118889
118867
  return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
118890
118868
  case 2 /* ResolutionDiagnostics */:
118891
118869
  return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
@@ -118902,14 +118880,15 @@ ${lanes.join("\n")}
118902
118880
  if (packageMap)
118903
118881
  return packageMap;
118904
118882
  packageMap = /* @__PURE__ */ new Map();
118905
- files.forEach((sf) => {
118906
- if (!sf.resolvedModules)
118907
- return;
118908
- sf.resolvedModules.forEach(({ resolvedModule }) => {
118909
- if (resolvedModule == null ? void 0 : resolvedModule.packageId)
118910
- packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
118911
- });
118912
- });
118883
+ files.forEach(
118884
+ (sf) => {
118885
+ var _a2;
118886
+ return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(sf.path)) == null ? void 0 : _a2.forEach(({ resolvedModule }) => {
118887
+ if (resolvedModule == null ? void 0 : resolvedModule.packageId)
118888
+ packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
118889
+ });
118890
+ }
118891
+ );
118913
118892
  return packageMap;
118914
118893
  }
118915
118894
  function typesPackageExists(packageName) {
@@ -119041,7 +119020,7 @@ ${lanes.join("\n")}
119041
119020
  return classifiableNames;
119042
119021
  }
119043
119022
  function resolveModuleNamesReusingOldState(moduleNames, file) {
119044
- var _a2;
119023
+ var _a2, _b2;
119045
119024
  if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
119046
119025
  return resolveModuleNamesWorker(
119047
119026
  moduleNames,
@@ -119050,24 +119029,16 @@ ${lanes.join("\n")}
119050
119029
  void 0
119051
119030
  );
119052
119031
  }
119053
- const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
119054
- if (oldSourceFile !== file && file.resolvedModules) {
119055
- const result2 = [];
119056
- for (const moduleName of moduleNames) {
119057
- const resolvedModule = file.resolvedModules.get(moduleName.text, getModeForUsageLocation(file, moduleName));
119058
- result2.push(resolvedModule);
119059
- }
119060
- return result2;
119061
- }
119062
119032
  let unknownModuleNames;
119063
119033
  let result;
119064
119034
  let reusedNames;
119065
119035
  const predictedToResolveToAmbientModuleMarker = emptyResolution;
119036
+ const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
119066
119037
  for (let i = 0; i < moduleNames.length; i++) {
119067
119038
  const moduleName = moduleNames[i];
119068
- if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) {
119039
+ if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
119069
119040
  const mode = getModeForUsageLocation(file, moduleName);
119070
- const oldResolution = (_a2 = oldSourceFile.resolvedModules) == null ? void 0 : _a2.get(moduleName.text, mode);
119041
+ const oldResolution = (_b2 = (_a2 = oldProgram == null ? void 0 : oldProgram.resolvedModules) == null ? void 0 : _a2.get(file.path)) == null ? void 0 : _b2.get(moduleName.text, mode);
119071
119042
  if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
119072
119043
  if (isTraceEnabled(options, host)) {
119073
119044
  trace(
@@ -119114,7 +119085,8 @@ ${lanes.join("\n")}
119114
119085
  Debug.assert(j === resolutions.length);
119115
119086
  return result;
119116
119087
  function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
119117
- const resolutionToFile = getResolvedModule(oldSourceFile, moduleName.text, getModeForUsageLocation(file, moduleName));
119088
+ var _a3, _b3, _c2;
119089
+ const resolutionToFile = (_c2 = (_b3 = (_a3 = oldProgram == null ? void 0 : oldProgram.resolvedModules) == null ? void 0 : _a3.get(file.path)) == null ? void 0 : _b3.get(moduleName.text, getModeForUsageLocation(file, moduleName))) == null ? void 0 : _c2.resolvedModule;
119118
119090
  const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
119119
119091
  if (resolutionToFile && resolvedFile) {
119120
119092
  return false;
@@ -119130,7 +119102,7 @@ ${lanes.join("\n")}
119130
119102
  }
119131
119103
  }
119132
119104
  function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
119133
- var _a2;
119105
+ var _a2, _b2;
119134
119106
  if (structureIsReused === 0 /* Not */) {
119135
119107
  return resolveTypeReferenceDirectiveNamesWorker(
119136
119108
  typeDirectiveNames,
@@ -119139,28 +119111,18 @@ ${lanes.join("\n")}
119139
119111
  void 0
119140
119112
  );
119141
119113
  }
119142
- const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
119143
- if (!isString(containingFile)) {
119144
- if (oldSourceFile !== containingFile && containingFile.resolvedTypeReferenceDirectiveNames) {
119145
- const result2 = [];
119146
- for (const typeDirectiveName of typeDirectiveNames) {
119147
- const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getTypeReferenceResolutionName(typeDirectiveName), getModeForFileReference(typeDirectiveName, containingFile.impliedNodeFormat));
119148
- result2.push(resolvedTypeReferenceDirective);
119149
- }
119150
- return result2;
119151
- }
119152
- }
119153
119114
  let unknownTypeReferenceDirectiveNames;
119154
119115
  let result;
119155
119116
  let reusedNames;
119156
119117
  const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
119157
- const canReuseResolutions = !isString(containingFile) ? containingFile === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path) : !hasInvalidatedResolutions(toPath3(containingFile));
119118
+ const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
119119
+ const canReuseResolutions = !isString(containingFile) ? containingFile === oldSourceFile && !hasInvalidatedResolutions(containingFile.path) : !hasInvalidatedResolutions(toPath3(containingFile));
119158
119120
  for (let i = 0; i < typeDirectiveNames.length; i++) {
119159
119121
  const entry = typeDirectiveNames[i];
119160
119122
  if (canReuseResolutions) {
119161
119123
  const typeDirectiveName = getTypeReferenceResolutionName(entry);
119162
119124
  const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
119163
- const oldResolution = (_a2 = !isString(containingFile) ? oldSourceFile == null ? void 0 : oldSourceFile.resolvedTypeReferenceDirectiveNames : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a2.get(typeDirectiveName, mode);
119125
+ const oldResolution = (_b2 = !isString(containingFile) ? (_a2 = oldProgram == null ? void 0 : oldProgram.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a2.get(containingFile.path) : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _b2.get(typeDirectiveName, mode);
119164
119126
  if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
119165
119127
  if (isTraceEnabled(options, host)) {
119166
119128
  trace(
@@ -119220,7 +119182,7 @@ ${lanes.join("\n")}
119220
119182
  );
119221
119183
  }
119222
119184
  function tryReuseStructureFromOldProgram() {
119223
- var _a2;
119185
+ var _a2, _b2, _c2;
119224
119186
  if (!oldProgram) {
119225
119187
  return 0 /* Not */;
119226
119188
  }
@@ -119322,42 +119284,37 @@ ${lanes.join("\n")}
119322
119284
  structureIsReused = 1 /* SafeModules */;
119323
119285
  }
119324
119286
  }
119325
- modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
119287
+ modifiedSourceFiles.push(newSourceFile);
119326
119288
  } else if (hasInvalidatedResolutions(oldSourceFile.path)) {
119327
119289
  structureIsReused = 1 /* SafeModules */;
119328
- modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
119290
+ modifiedSourceFiles.push(newSourceFile);
119291
+ } else {
119292
+ for (const moduleName of oldSourceFile.ambientModuleNames) {
119293
+ ambientModuleNameToUnmodifiedFileName.set(moduleName, oldSourceFile.fileName);
119294
+ }
119329
119295
  }
119330
119296
  newSourceFiles.push(newSourceFile);
119331
119297
  }
119332
119298
  if (structureIsReused !== 2 /* Completely */) {
119333
119299
  return structureIsReused;
119334
119300
  }
119335
- const modifiedFiles = modifiedSourceFiles.map((f) => f.oldFile);
119336
- for (const oldFile of oldSourceFiles) {
119337
- if (!contains(modifiedFiles, oldFile)) {
119338
- for (const moduleName of oldFile.ambientModuleNames) {
119339
- ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
119340
- }
119341
- }
119342
- }
119343
- for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
119301
+ for (const newSourceFile of modifiedSourceFiles) {
119344
119302
  const moduleNames = getModuleNames(newSourceFile);
119345
119303
  const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
119346
- const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
119347
- if (resolutionsChanged) {
119304
+ (resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
119305
+ const oldResolutions = (_b2 = oldProgram.resolvedModules) == null ? void 0 : _b2.get(newSourceFile.path);
119306
+ const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldResolutions, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
119307
+ if (resolutionsChanged)
119348
119308
  structureIsReused = 1 /* SafeModules */;
119349
- newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions, moduleResolutionNameAndModeGetter);
119350
- } else {
119351
- newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
119352
- }
119353
119309
  const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
119354
119310
  const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
119355
- const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
119311
+ (resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
119312
+ const oldTypeResolutions = (_c2 = oldProgram.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _c2.get(newSourceFile.path);
119313
+ const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldTypeResolutions, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
119356
119314
  if (typeReferenceResolutionsChanged) {
119357
119315
  structureIsReused = 1 /* SafeModules */;
119358
- newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions, typeReferenceResolutionNameAndModeGetter);
119359
- } else {
119360
- newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
119316
+ } else if (oldTypeResolutions) {
119317
+ (resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, oldTypeResolutions);
119361
119318
  }
119362
119319
  }
119363
119320
  if (structureIsReused !== 2 /* Completely */) {
@@ -119405,6 +119362,8 @@ ${lanes.join("\n")}
119405
119362
  sourceFileToPackageName = oldProgram.sourceFileToPackageName;
119406
119363
  redirectTargetsMap = oldProgram.redirectTargetsMap;
119407
119364
  usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
119365
+ resolvedModules = oldProgram.resolvedModules;
119366
+ resolvedTypeReferenceDirectiveNames = oldProgram.resolvedTypeReferenceDirectiveNames;
119408
119367
  resolvedLibReferences = oldProgram.resolvedLibReferences;
119409
119368
  packageMap = oldProgram.getCurrentPackagesMap();
119410
119369
  return 2 /* Completely */;
@@ -120450,16 +120409,16 @@ ${lanes.join("\n")}
120450
120409
  }
120451
120410
  function processTypeReferenceDirectives(file) {
120452
120411
  const typeDirectives = file.typeReferenceDirectives;
120453
- if (!typeDirectives.length) {
120454
- file.resolvedTypeReferenceDirectiveNames = void 0;
120412
+ if (!typeDirectives.length)
120455
120413
  return;
120456
- }
120457
- const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
120414
+ const resolutions = (resolvedTypeReferenceDirectiveNamesProcessing == null ? void 0 : resolvedTypeReferenceDirectiveNamesProcessing.get(file.path)) || resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
120415
+ const resolutionsInFile = createModeAwareCache();
120416
+ (resolvedTypeReferenceDirectiveNames ?? (resolvedTypeReferenceDirectiveNames = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
120458
120417
  for (let index = 0; index < typeDirectives.length; index++) {
120459
120418
  const ref = file.typeReferenceDirectives[index];
120460
120419
  const resolvedTypeReferenceDirective = resolutions[index];
120461
120420
  const fileName = toFileNameLowerCase(ref.fileName);
120462
- setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective, getModeForFileReference(ref, file.impliedNodeFormat));
120421
+ resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
120463
120422
  const mode = ref.resolutionMode || file.impliedNodeFormat;
120464
120423
  if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
120465
120424
  (fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({
@@ -120623,14 +120582,16 @@ ${lanes.join("\n")}
120623
120582
  collectExternalModuleReferences(file);
120624
120583
  if (file.imports.length || file.moduleAugmentations.length) {
120625
120584
  const moduleNames = getModuleNames(file);
120626
- const resolutions = resolveModuleNamesReusingOldState(moduleNames, file);
120585
+ const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
120627
120586
  Debug.assert(resolutions.length === moduleNames.length);
120628
120587
  const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options : void 0) || options;
120588
+ const resolutionsInFile = createModeAwareCache();
120589
+ (resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
120629
120590
  for (let index = 0; index < moduleNames.length; index++) {
120630
120591
  const resolution = resolutions[index].resolvedModule;
120631
120592
  const moduleName = moduleNames[index].text;
120632
120593
  const mode = getModeForUsageLocation(file, moduleNames[index]);
120633
- setResolvedModule(file, moduleName, resolutions[index], mode);
120594
+ resolutionsInFile.set(moduleName, mode, resolutions[index]);
120634
120595
  addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
120635
120596
  if (!resolution) {
120636
120597
  continue;
@@ -120661,8 +120622,6 @@ ${lanes.join("\n")}
120661
120622
  currentNodeModulesDepth--;
120662
120623
  }
120663
120624
  }
120664
- } else {
120665
- file.resolvedModules = void 0;
120666
120625
  }
120667
120626
  }
120668
120627
  function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {
@@ -121177,7 +121136,7 @@ ${lanes.join("\n")}
121177
121136
  processReason(fileProcessingReason);
121178
121137
  if (locationReason && (fileIncludeReasons == null ? void 0 : fileIncludeReasons.length) === 1)
121179
121138
  fileIncludeReasons = void 0;
121180
- const location = locationReason && getReferencedFileLocation(getSourceFileByPath, locationReason);
121139
+ const location = locationReason && getReferencedFileLocation(program, locationReason);
121181
121140
  const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
121182
121141
  const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
121183
121142
  const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
@@ -121213,7 +121172,7 @@ ${lanes.join("\n")}
121213
121172
  }
121214
121173
  function fileIncludeReasonToRelatedInformation(reason) {
121215
121174
  if (isReferencedFile(reason)) {
121216
- const referenceLocation = getReferencedFileLocation(getSourceFileByPath, reason);
121175
+ const referenceLocation = getReferencedFileLocation(program, reason);
121217
121176
  let message2;
121218
121177
  switch (reason.kind) {
121219
121178
  case 3 /* Import */:
@@ -121502,8 +121461,8 @@ ${lanes.join("\n")}
121502
121461
  if (!symlinks) {
121503
121462
  symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
121504
121463
  }
121505
- if (files && automaticTypeDirectiveResolutions && !symlinks.hasProcessedResolutions()) {
121506
- symlinks.setSymlinksFromResolutions(files, automaticTypeDirectiveResolutions);
121464
+ if (files && !symlinks.hasProcessedResolutions()) {
121465
+ symlinks.setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, automaticTypeDirectiveResolutions);
121507
121466
  }
121508
121467
  return symlinks;
121509
121468
  }
@@ -122008,6 +121967,7 @@ ${lanes.join("\n")}
122008
121967
  return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
122009
121968
  }
122010
121969
  function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
121970
+ var _a;
122011
121971
  let referencedFiles;
122012
121972
  if (sourceFile.imports && sourceFile.imports.length > 0) {
122013
121973
  const checker = program.getTypeChecker();
@@ -122023,8 +121983,9 @@ ${lanes.join("\n")}
122023
121983
  addReferencedFile(referencedPath);
122024
121984
  }
122025
121985
  }
122026
- if (sourceFile.resolvedTypeReferenceDirectiveNames) {
122027
- sourceFile.resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
121986
+ const resolvedTypeReferenceDirectiveNames = (_a = program.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(sourceFile.path);
121987
+ if (resolvedTypeReferenceDirectiveNames) {
121988
+ resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
122028
121989
  if (!resolvedTypeReferenceDirective) {
122029
121990
  return;
122030
121991
  }
@@ -123862,10 +123823,10 @@ ${lanes.join("\n")}
123862
123823
  clear: clear2,
123863
123824
  onChangesAffectModuleResolution
123864
123825
  };
123865
- function getResolvedModule2(resolution) {
123826
+ function getResolvedModule(resolution) {
123866
123827
  return resolution.resolvedModule;
123867
123828
  }
123868
- function getResolvedTypeReferenceDirective2(resolution) {
123829
+ function getResolvedTypeReferenceDirective(resolution) {
123869
123830
  return resolution.resolvedTypeReferenceDirective;
123870
123831
  }
123871
123832
  function clear2() {
@@ -123941,7 +123902,7 @@ ${lanes.join("\n")}
123941
123902
  stopWatchFailedLookupLocationOfResolution(
123942
123903
  resolution,
123943
123904
  resolutionHost.toPath(getInferredLibraryNameResolveFrom(newProgram.getCompilerOptions(), getCurrentDirectory(), libFileName)),
123944
- getResolvedModule2
123905
+ getResolvedModule
123945
123906
  );
123946
123907
  resolvedLibraries.delete(libFileName);
123947
123908
  }
@@ -124147,7 +124108,7 @@ ${lanes.join("\n")}
124147
124108
  ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost,
124148
124109
  typeReferenceDirectiveResolutionCache
124149
124110
  ),
124150
- getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective2,
124111
+ getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
124151
124112
  shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
124152
124113
  deferWatchingNonRelativeResolution: false
124153
124114
  });
@@ -124166,7 +124127,7 @@ ${lanes.join("\n")}
124166
124127
  redirectedReference,
124167
124128
  options
124168
124129
  ),
124169
- getResolutionWithResolvedFileName: getResolvedModule2,
124130
+ getResolutionWithResolvedFileName: getResolvedModule,
124170
124131
  shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
124171
124132
  logChanges: logChangesWhenResolvingModule,
124172
124133
  deferWatchingNonRelativeResolution: true
@@ -124185,17 +124146,17 @@ ${lanes.join("\n")}
124185
124146
  libraryName,
124186
124147
  resolution,
124187
124148
  path,
124188
- getResolvedModule2,
124149
+ getResolvedModule,
124189
124150
  /*deferWatchingNonRelativeResolution*/
124190
124151
  false
124191
124152
  );
124192
124153
  resolvedLibraries.set(libFileName, resolution);
124193
124154
  if (existingResolution) {
124194
- stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule2);
124155
+ stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule);
124195
124156
  }
124196
124157
  } else {
124197
124158
  if (isTraceEnabled(options, host)) {
124198
- const resolved = getResolvedModule2(resolution);
124159
+ const resolved = getResolvedModule(resolution);
124199
124160
  trace(
124200
124161
  host,
124201
124162
  (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,
@@ -124472,8 +124433,8 @@ ${lanes.join("\n")}
124472
124433
  resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
124473
124434
  }
124474
124435
  function removeResolutionsOfFile(filePath) {
124475
- removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule2);
124476
- removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective2);
124436
+ removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
124437
+ removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
124477
124438
  }
124478
124439
  function invalidateResolutions(resolutions, canInvalidate) {
124479
124440
  if (!resolutions)
@@ -124896,7 +124857,7 @@ ${lanes.join("\n")}
124896
124857
  var _a, _b;
124897
124858
  const options = program.getCompilerOptions();
124898
124859
  if (isReferencedFile(reason)) {
124899
- const referenceLocation = getReferencedFileLocation((path) => program.getSourceFileByPath(path), reason);
124860
+ const referenceLocation = getReferencedFileLocation(program, reason);
124900
124861
  const referenceText = isReferenceFileLocation(referenceLocation) ? referenceLocation.file.text.substring(referenceLocation.pos, referenceLocation.end) : `"${referenceLocation.text}"`;
124901
124862
  let message;
124902
124863
  Debug.assert(isReferenceFileLocation(referenceLocation) || reason.kind === 3 /* Import */, "Only synthetic references are imports");
@@ -133781,14 +133742,14 @@ ${lanes.join("\n")}
133781
133742
  return ensurePathIsNonModuleName(combineNormal(pathA, pathB));
133782
133743
  }
133783
133744
  function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) {
133784
- var _a;
133745
+ var _a, _b;
133785
133746
  if (importedModuleSymbol) {
133786
133747
  const oldFileName = find(importedModuleSymbol.declarations, isSourceFile).fileName;
133787
133748
  const newFileName = oldToNew(oldFileName);
133788
133749
  return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true };
133789
133750
  } else {
133790
133751
  const mode = getModeForUsageLocation(importingSourceFile, importLiteral);
133791
- const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? (_a = importingSourceFile.resolvedModules) == null ? void 0 : _a.get(importLiteral.text, mode) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
133752
+ const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(importingSourceFile.path)) == null ? void 0 : _b.get(importLiteral.text, mode) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
133792
133753
  return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
133793
133754
  }
133794
133755
  }
@@ -134708,6 +134669,7 @@ ${lanes.join("\n")}
134708
134669
 
134709
134670
  // src/services/suggestionDiagnostics.ts
134710
134671
  function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
134672
+ var _a, _b, _c;
134711
134673
  program.getSemanticDiagnostics(sourceFile, cancellationToken);
134712
134674
  const diags = [];
134713
134675
  const checker = program.getTypeChecker();
@@ -134724,7 +134686,7 @@ ${lanes.join("\n")}
134724
134686
  const name = importNameForConvertToDefaultImport(importNode);
134725
134687
  if (!name)
134726
134688
  continue;
134727
- const module2 = getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier));
134689
+ const module2 = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))) == null ? void 0 : _c.resolvedModule;
134728
134690
  const resolvedFile = module2 && program.getSourceFile(module2.resolvedFileName);
134729
134691
  if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
134730
134692
  diags.push(createDiagnosticForNode(name, Diagnostics.Import_may_be_converted_to_a_default_import));
@@ -137140,10 +137102,10 @@ ${lanes.join("\n")}
137140
137102
  const targetSourceFile = program.getSourceFile(targetFile);
137141
137103
  for (const oldStatement of oldFile.statements) {
137142
137104
  forEachImportInStatement(oldStatement, (i) => {
137143
- var _a, _b;
137105
+ var _a, _b, _c;
137144
137106
  const moduleSpecifier = moduleSpecifierFromImport(i);
137145
- const resolved = (_a = oldFile.resolvedModules) == null ? void 0 : _a.get(moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
137146
- const fileName = (_b = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _b.resolvedFileName;
137107
+ const resolved = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(oldFile.path)) == null ? void 0 : _b.get(moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
137108
+ const fileName = (_c = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _c.resolvedFileName;
137147
137109
  if (fileName && targetSourceFile) {
137148
137110
  const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.path, fileName, createModuleSpecifierResolutionHost(program, host));
137149
137111
  append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
@@ -147758,9 +147720,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
147758
147720
  });
147759
147721
 
147760
147722
  // src/services/codefixes/convertToEsModule.ts
147761
- function fixImportOfModuleExports(importingFile, exportingFile, changes, quotePreference) {
147723
+ function fixImportOfModuleExports(importingFile, exportingFile, program, changes, quotePreference) {
147724
+ var _a, _b, _c;
147762
147725
  for (const moduleSpecifier of importingFile.imports) {
147763
- const imported = getResolvedModule(importingFile, moduleSpecifier.text, getModeForUsageLocation(importingFile, moduleSpecifier));
147726
+ const imported = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(importingFile.path)) == null ? void 0 : _b.get(moduleSpecifier.text, getModeForUsageLocation(importingFile, moduleSpecifier))) == null ? void 0 : _c.resolvedModule;
147764
147727
  if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
147765
147728
  continue;
147766
147729
  }
@@ -148288,7 +148251,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
148288
148251
  const moduleExportsChangedToDefault = convertFileToEsModule(sourceFile, program.getTypeChecker(), changes2, getEmitScriptTarget(program.getCompilerOptions()), getQuotePreference(sourceFile, preferences));
148289
148252
  if (moduleExportsChangedToDefault) {
148290
148253
  for (const importingFile of program.getSourceFiles()) {
148291
- fixImportOfModuleExports(importingFile, sourceFile, changes2, getQuotePreference(importingFile, preferences));
148254
+ fixImportOfModuleExports(importingFile, sourceFile, program, changes2, getQuotePreference(importingFile, preferences));
148292
148255
  }
148293
148256
  }
148294
148257
  });
@@ -149177,7 +149140,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149177
149140
  }
149178
149141
  }
149179
149142
  function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
149180
- const compilerOptions = program.getCompilerOptions();
149181
149143
  let exportInfos;
149182
149144
  if (exportMapKey) {
149183
149145
  exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
@@ -149198,7 +149160,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149198
149160
  fix,
149199
149161
  /*includeSymbolNameInDescription*/
149200
149162
  false,
149201
- compilerOptions,
149163
+ program,
149202
149164
  preferences
149203
149165
  ))
149204
149166
  };
@@ -149208,7 +149170,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149208
149170
  const symbolName2 = single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions));
149209
149171
  const fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName2, program);
149210
149172
  const includeSymbolNameInDescription = symbolName2 !== symbolToken.text;
149211
- return fix && codeFixActionToCodeAction(codeActionForFix({ host, formatContext, preferences }, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences));
149173
+ return fix && codeFixActionToCodeAction(codeActionForFix(
149174
+ { host, formatContext, preferences },
149175
+ sourceFile,
149176
+ symbolName2,
149177
+ fix,
149178
+ includeSymbolNameInDescription,
149179
+ program,
149180
+ preferences
149181
+ ));
149212
149182
  }
149213
149183
  function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
149214
149184
  const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
@@ -149778,14 +149748,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149778
149748
  }
149779
149749
  return allowSyntheticDefaults ? 1 /* Default */ : 3 /* CommonJS */;
149780
149750
  }
149781
- function codeActionForFix(context, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences) {
149751
+ function codeActionForFix(context, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences) {
149782
149752
  let diag2;
149783
149753
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
149784
- diag2 = codeActionForFixWorker(tracker, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences);
149754
+ diag2 = codeActionForFixWorker(tracker, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences);
149785
149755
  });
149786
149756
  return createCodeFixAction(importFixName, changes, diag2, importFixId, Diagnostics.Add_all_missing_imports);
149787
149757
  }
149788
- function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences) {
149758
+ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences) {
149789
149759
  const quotePreference = getQuotePreference(sourceFile, preferences);
149790
149760
  switch (fix.kind) {
149791
149761
  case 0 /* UseNamespace */:
@@ -149822,7 +149792,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149822
149792
  defaultImport,
149823
149793
  namedImports,
149824
149794
  namespaceLikeImport,
149825
- compilerOptions
149795
+ program.getCompilerOptions()
149826
149796
  ),
149827
149797
  /*blankLineBetween*/
149828
149798
  true,
@@ -149835,7 +149805,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149835
149805
  }
149836
149806
  case 4 /* PromoteTypeOnly */: {
149837
149807
  const { typeOnlyAliasDeclaration } = fix;
149838
- const promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile, preferences);
149808
+ const promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, program, sourceFile, preferences);
149839
149809
  return promotedDeclaration.kind === 276 /* ImportSpecifier */ ? [Diagnostics.Remove_type_from_import_of_0_from_1, symbolName2, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)];
149840
149810
  }
149841
149811
  default:
@@ -149846,7 +149816,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149846
149816
  var _a, _b;
149847
149817
  return promotedDeclaration.kind === 271 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text;
149848
149818
  }
149849
- function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile, preferences) {
149819
+ function promoteFromTypeOnly(changes, aliasDeclaration, program, sourceFile, preferences) {
149820
+ const compilerOptions = program.getCompilerOptions();
149850
149821
  const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions);
149851
149822
  switch (aliasDeclaration.kind) {
149852
149823
  case 276 /* ImportSpecifier */:
@@ -149888,10 +149859,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149888
149859
  Debug.failBadSyntaxKind(aliasDeclaration);
149889
149860
  }
149890
149861
  function promoteImportClause(importClause) {
149862
+ var _a, _b, _c;
149891
149863
  changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
149892
149864
  if (!compilerOptions.allowImportingTsExtensions) {
149893
149865
  const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
149894
- const resolvedModule = moduleSpecifier && getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier));
149866
+ const resolvedModule = moduleSpecifier && ((_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))) == null ? void 0 : _c.resolvedModule);
149895
149867
  if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
149896
149868
  const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
149897
149869
  changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
@@ -150185,7 +150157,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150185
150157
  fix,
150186
150158
  /*includeSymbolNameInDescription*/
150187
150159
  symbolName2 !== errorIdentifierText,
150188
- program.getCompilerOptions(),
150160
+ program,
150189
150161
  preferences
150190
150162
  )
150191
150163
  );
@@ -150598,7 +150570,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150598
150570
 
150599
150571
  // src/services/codefixes/fixImportNonExportedMember.ts
150600
150572
  function getInfo7(sourceFile, pos, program) {
150601
- var _a;
150573
+ var _a, _b, _c, _d;
150602
150574
  const token = getTokenAtPosition(sourceFile, pos);
150603
150575
  if (isIdentifier(token)) {
150604
150576
  const importDeclaration = findAncestor(token, isImportDeclaration);
@@ -150607,19 +150579,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150607
150579
  const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : void 0;
150608
150580
  if (moduleSpecifier === void 0)
150609
150581
  return void 0;
150610
- const resolvedModule = getResolvedModule(
150611
- sourceFile,
150582
+ const resolvedModule = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(
150612
150583
  moduleSpecifier,
150613
150584
  /*mode*/
150614
150585
  void 0
150615
- );
150586
+ )) == null ? void 0 : _c.resolvedModule;
150616
150587
  if (resolvedModule === void 0)
150617
150588
  return void 0;
150618
150589
  const moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
150619
150590
  if (moduleSourceFile === void 0 || isSourceFileFromLibrary(program, moduleSourceFile))
150620
150591
  return void 0;
150621
150592
  const moduleSymbol = moduleSourceFile.symbol;
150622
- const locals = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals;
150593
+ const locals = (_d = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _d.locals;
150623
150594
  if (locals === void 0)
150624
150595
  return void 0;
150625
150596
  const localSymbol = locals.get(token.escapedText);
@@ -150909,9 +150880,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150909
150880
  return flags;
150910
150881
  }
150911
150882
  function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) {
150883
+ var _a, _b, _c;
150912
150884
  if (!importDeclaration || !isStringLiteralLike(importDeclaration.moduleSpecifier))
150913
150885
  return void 0;
150914
- const resolvedModule = getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text, getModeForUsageLocation(sourceFile, importDeclaration.moduleSpecifier));
150886
+ const resolvedModule = (_c = (_b = (_a = context.program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(importDeclaration.moduleSpecifier.text, getModeForUsageLocation(sourceFile, importDeclaration.moduleSpecifier))) == null ? void 0 : _c.resolvedModule;
150915
150887
  if (!resolvedModule)
150916
150888
  return void 0;
150917
150889
  return context.program.getSourceFile(resolvedModule.resolvedFileName);
@@ -162223,7 +162195,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162223
162195
  })(FindReferencesUse || {});
162224
162196
  ((Core2) => {
162225
162197
  function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options = {}, sourceFilesSet = new Set(sourceFiles.map((f) => f.fileName))) {
162226
- var _a, _b, _c;
162198
+ var _a, _b, _c, _d;
162227
162199
  node = getAdjustedNode2(node, options);
162228
162200
  if (isSourceFile(node)) {
162229
162201
  const resolvedRef = ts_GoToDefinition_exports.getReferenceAtPosition(node, position, program);
@@ -162262,7 +162234,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162262
162234
  if (!options.implementations && isStringLiteralLike(node)) {
162263
162235
  if (isModuleSpecifierLike(node)) {
162264
162236
  const fileIncludeReasons = program.getFileIncludeReasons();
162265
- const referencedFileName = (_c = (_b = (_a = node.getSourceFile().resolvedModules) == null ? void 0 : _a.get(node.text, getModeForUsageLocation(node.getSourceFile(), node))) == null ? void 0 : _b.resolvedModule) == null ? void 0 : _c.resolvedFileName;
162237
+ const referencedFileName = (_d = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(node.getSourceFile().path)) == null ? void 0 : _b.get(node.text, getModeForUsageLocation(node.getSourceFile(), node))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.resolvedFileName;
162266
162238
  const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0;
162267
162239
  if (referencedFile) {
162268
162240
  return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }];
@@ -162325,7 +162297,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162325
162297
  for (const ref of references) {
162326
162298
  if (isReferencedFile(ref)) {
162327
162299
  const referencingFile = program.getSourceFileByPath(ref.file);
162328
- const location = getReferencedFileLocation(program.getSourceFileByPath, ref);
162300
+ const location = getReferencedFileLocation(program, ref);
162329
162301
  if (isReferenceFileLocation(location)) {
162330
162302
  entries = append(entries, {
162331
162303
  kind: 0 /* Span */,
@@ -163692,7 +163664,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163692
163664
 
163693
163665
  // src/services/goToDefinition.ts
163694
163666
  function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
163695
- var _a, _b;
163667
+ var _a, _b, _c;
163696
163668
  const resolvedRef = getReferenceAtPosition(sourceFile, position, program);
163697
163669
  const fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || emptyArray;
163698
163670
  if (resolvedRef == null ? void 0 : resolvedRef.file) {
@@ -163765,7 +163737,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163765
163737
  }
163766
163738
  }
163767
163739
  if (!symbol && isModuleSpecifierLike(fallbackNode)) {
163768
- const ref = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode))) == null ? void 0 : _b.resolvedModule;
163740
+ const ref = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode))) == null ? void 0 : _c.resolvedModule;
163769
163741
  if (ref) {
163770
163742
  return [{
163771
163743
  name: fallbackNode.text,
@@ -163877,10 +163849,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163877
163849
  const file = program.getLibFileFromReference(libReferenceDirective);
163878
163850
  return file && { reference: libReferenceDirective, fileName: file.fileName, file, unverified: false };
163879
163851
  }
163880
- if ((_b = sourceFile.resolvedModules) == null ? void 0 : _b.size()) {
163852
+ const resolvedModules = (_b = program.resolvedModules) == null ? void 0 : _b.get(sourceFile.path);
163853
+ if (resolvedModules == null ? void 0 : resolvedModules.size()) {
163881
163854
  const node = getTouchingToken(sourceFile, position);
163882
- if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, getModeForUsageLocation(sourceFile, node))) {
163883
- const verifiedFileName = (_d = (_c = sourceFile.resolvedModules.get(node.text, getModeForUsageLocation(sourceFile, node))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.resolvedFileName;
163855
+ if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && resolvedModules.has(node.text, getModeForUsageLocation(sourceFile, node))) {
163856
+ const verifiedFileName = (_d = (_c = resolvedModules.get(node.text, getModeForUsageLocation(sourceFile, node))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.resolvedFileName;
163884
163857
  const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text);
163885
163858
  return {
163886
163859
  file: program.getSourceFile(fileName),
@@ -173801,16 +173774,23 @@ ${options.prefix}` : "\n" : options.prefix
173801
173774
  const sourceFiles = program.getSourceFiles();
173802
173775
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "getUnresolvedImports", { count: sourceFiles.length });
173803
173776
  const ambientModules = program.getTypeChecker().getAmbientModules().map((mod) => stripQuotes(mod.getName()));
173804
- const result = sortAndDeduplicate(flatMap(sourceFiles, (sourceFile) => extractUnresolvedImportsFromSourceFile(sourceFile, ambientModules, cachedUnresolvedImportsPerFile)));
173777
+ const result = sortAndDeduplicate(flatMap(sourceFiles, (sourceFile) => extractUnresolvedImportsFromSourceFile(
173778
+ program,
173779
+ sourceFile,
173780
+ ambientModules,
173781
+ cachedUnresolvedImportsPerFile
173782
+ )));
173805
173783
  (_b = tracing) == null ? void 0 : _b.pop();
173806
173784
  return result;
173807
173785
  }
173808
- function extractUnresolvedImportsFromSourceFile(file, ambientModules, cachedUnresolvedImportsPerFile) {
173786
+ function extractUnresolvedImportsFromSourceFile(program, file, ambientModules, cachedUnresolvedImportsPerFile) {
173809
173787
  return getOrUpdate(cachedUnresolvedImportsPerFile, file.path, () => {
173810
- if (!file.resolvedModules)
173788
+ var _a;
173789
+ const resolvedModules = (_a = program.resolvedModules) == null ? void 0 : _a.get(file.path);
173790
+ if (!resolvedModules)
173811
173791
  return emptyArray2;
173812
173792
  let unresolvedImports;
173813
- file.resolvedModules.forEach(({ resolvedModule }, name) => {
173793
+ resolvedModules.forEach(({ resolvedModule }, name) => {
173814
173794
  if ((!resolvedModule || !resolutionExtensionIsTSOrJson(resolvedModule.extension)) && !isExternalModuleNameRelative(name) && !ambientModules.some((m) => m === name)) {
173815
173795
  unresolvedImports = append(unresolvedImports, parsePackageName(name).packageName);
173816
173796
  }
@@ -174022,7 +174002,8 @@ ${options.prefix}` : "\n" : options.prefix
174022
174002
  }
174023
174003
  if (this.program && !this.symlinks.hasProcessedResolutions()) {
174024
174004
  this.symlinks.setSymlinksFromResolutions(
174025
- this.program.getSourceFiles(),
174005
+ this.program.resolvedModules,
174006
+ this.program.resolvedTypeReferenceDirectiveNames,
174026
174007
  this.program.getAutomaticTypeDirectiveResolutions()
174027
174008
  );
174028
174009
  }
@@ -184668,8 +184649,6 @@ ${e.message}`;
184668
184649
  getResolvePackageJsonExports: () => getResolvePackageJsonExports,
184669
184650
  getResolvePackageJsonImports: () => getResolvePackageJsonImports,
184670
184651
  getResolvedExternalModuleName: () => getResolvedExternalModuleName,
184671
- getResolvedModule: () => getResolvedModule,
184672
- getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
184673
184652
  getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
184674
184653
  getRestParameterElementType: () => getRestParameterElementType,
184675
184654
  getRightMostAssignedExpression: () => getRightMostAssignedExpression,
@@ -185767,8 +185746,6 @@ ${e.message}`;
185767
185746
  setParent: () => setParent,
185768
185747
  setParentRecursive: () => setParentRecursive,
185769
185748
  setPrivateIdentifier: () => setPrivateIdentifier,
185770
- setResolvedModule: () => setResolvedModule,
185771
- setResolvedTypeReferenceDirective: () => setResolvedTypeReferenceDirective,
185772
185749
  setSnippetElement: () => setSnippetElement,
185773
185750
  setSourceMapRange: () => setSourceMapRange,
185774
185751
  setStackTraceLimit: () => setStackTraceLimit,
@@ -185995,7 +185972,6 @@ ${e.message}`;
185995
185972
  writeCommentRange: () => writeCommentRange,
185996
185973
  writeFile: () => writeFile,
185997
185974
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
185998
- zipToModeAwareCache: () => zipToModeAwareCache,
185999
185975
  zipWith: () => zipWith
186000
185976
  });
186001
185977
  var init_ts7 = __esm({
@@ -187072,8 +187048,6 @@ ${e.message}`;
187072
187048
  getResolvePackageJsonExports: () => getResolvePackageJsonExports,
187073
187049
  getResolvePackageJsonImports: () => getResolvePackageJsonImports,
187074
187050
  getResolvedExternalModuleName: () => getResolvedExternalModuleName,
187075
- getResolvedModule: () => getResolvedModule,
187076
- getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
187077
187051
  getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
187078
187052
  getRestParameterElementType: () => getRestParameterElementType,
187079
187053
  getRightMostAssignedExpression: () => getRightMostAssignedExpression,
@@ -188171,8 +188145,6 @@ ${e.message}`;
188171
188145
  setParent: () => setParent,
188172
188146
  setParentRecursive: () => setParentRecursive,
188173
188147
  setPrivateIdentifier: () => setPrivateIdentifier,
188174
- setResolvedModule: () => setResolvedModule,
188175
- setResolvedTypeReferenceDirective: () => setResolvedTypeReferenceDirective,
188176
188148
  setSnippetElement: () => setSnippetElement,
188177
188149
  setSourceMapRange: () => setSourceMapRange,
188178
188150
  setStackTraceLimit: () => setStackTraceLimit,
@@ -188399,7 +188371,6 @@ ${e.message}`;
188399
188371
  writeCommentRange: () => writeCommentRange,
188400
188372
  writeFile: () => writeFile,
188401
188373
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
188402
- zipToModeAwareCache: () => zipToModeAwareCache,
188403
188374
  zipWith: () => zipWith
188404
188375
  });
188405
188376
  var init_ts8 = __esm({