typescript 5.3.0-dev.20230919 → 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.20230919`;
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,
@@ -17860,7 +17840,7 @@ ${lanes.join("\n")}
17860
17840
  return optionsHaveChanges(oldOptions, newOptions, affectsDeclarationPathOptionDeclarations);
17861
17841
  }
17862
17842
  function getCompilerOptionValue(options, option) {
17863
- return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
17843
+ return option.strictFlag ? getStrictOptionValue(options, option.name) : option.allowJsFlag ? getAllowJSCompilerOption(options) : options[option.name];
17864
17844
  }
17865
17845
  function getJSXTransformEnabled(options) {
17866
17846
  const jsx = options.jsx;
@@ -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,
@@ -38060,7 +38037,8 @@ ${lanes.join("\n")}
38060
38037
  {
38061
38038
  name: "allowJs",
38062
38039
  type: "boolean",
38063
- affectsModuleResolution: true,
38040
+ allowJsFlag: true,
38041
+ affectsBuildInfo: true,
38064
38042
  showInSimplifiedHelpView: true,
38065
38043
  category: Diagnostics.JavaScript_Support,
38066
38044
  description: Diagnostics.Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these_files,
@@ -38070,6 +38048,8 @@ ${lanes.join("\n")}
38070
38048
  name: "checkJs",
38071
38049
  type: "boolean",
38072
38050
  affectsModuleResolution: true,
38051
+ affectsSemanticDiagnostics: true,
38052
+ affectsBuildInfo: true,
38073
38053
  showInSimplifiedHelpView: true,
38074
38054
  category: Diagnostics.JavaScript_Support,
38075
38055
  description: Diagnostics.Enable_error_reporting_in_type_checked_JavaScript_files,
@@ -38082,6 +38062,10 @@ ${lanes.join("\n")}
38082
38062
  affectsEmit: true,
38083
38063
  affectsBuildInfo: true,
38084
38064
  affectsModuleResolution: true,
38065
+ // The checker emits an error when it sees JSX but this option is not set in compilerOptions.
38066
+ // This is effectively a semantic error, so mark this option as affecting semantic diagnostics
38067
+ // so we know to refresh errors when this option is changed.
38068
+ affectsSemanticDiagnostics: true,
38085
38069
  paramType: Diagnostics.KIND,
38086
38070
  showInSimplifiedHelpView: true,
38087
38071
  category: Diagnostics.Language_and_Environment,
@@ -38397,6 +38381,7 @@ ${lanes.join("\n")}
38397
38381
  bundler: 100 /* Bundler */
38398
38382
  })),
38399
38383
  deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
38384
+ affectsSourceFile: true,
38400
38385
  affectsModuleResolution: true,
38401
38386
  paramType: Diagnostics.STRATEGY,
38402
38387
  category: Diagnostics.Modules,
@@ -38939,6 +38924,7 @@ ${lanes.join("\n")}
38939
38924
  legacy: 1 /* Legacy */,
38940
38925
  force: 3 /* Force */
38941
38926
  })),
38927
+ affectsSourceFile: true,
38942
38928
  affectsModuleResolution: true,
38943
38929
  description: Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
38944
38930
  category: Diagnostics.Language_and_Environment,
@@ -38958,7 +38944,7 @@ ${lanes.join("\n")}
38958
38944
  affectsEmitOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsEmit);
38959
38945
  affectsDeclarationPathOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsDeclarationPath);
38960
38946
  moduleResolutionOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsModuleResolution);
38961
- sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics);
38947
+ sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsBindDiagnostics);
38962
38948
  optionsAffectingProgramStructure = optionDeclarations.filter((option) => !!option.affectsProgramStructure);
38963
38949
  transpileOptionValueCompilerOptions = optionDeclarations.filter((option) => hasProperty(option, "transpileOptionValue"));
38964
38950
  optionsForBuild = [
@@ -39808,15 +39794,6 @@ ${lanes.join("\n")}
39808
39794
  return result;
39809
39795
  }
39810
39796
  }
39811
- function zipToModeAwareCache(file, keys, values, nameAndModeGetter) {
39812
- Debug.assert(keys.length === values.length);
39813
- const map2 = createModeAwareCache();
39814
- for (let i = 0; i < keys.length; ++i) {
39815
- const entry = keys[i];
39816
- map2.set(nameAndModeGetter.getName(entry), nameAndModeGetter.getMode(entry, file), values[i]);
39817
- }
39818
- return map2;
39819
- }
39820
39797
  function getOriginalOrResolvedModuleFileName(result) {
39821
39798
  return result.resolvedModule && (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
39822
39799
  }
@@ -42424,7 +42401,7 @@ ${lanes.join("\n")}
42424
42401
  case 36 /* ExclamationEqualsToken */:
42425
42402
  case 37 /* EqualsEqualsEqualsToken */:
42426
42403
  case 38 /* ExclamationEqualsEqualsToken */:
42427
- return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
42404
+ return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right) || (isBooleanLiteral(expr.right) && isNarrowingExpression(expr.left) || isBooleanLiteral(expr.left) && isNarrowingExpression(expr.right));
42428
42405
  case 104 /* InstanceOfKeyword */:
42429
42406
  return isNarrowableOperand(expr.left);
42430
42407
  case 103 /* InKeyword */:
@@ -48772,7 +48749,7 @@ ${lanes.join("\n")}
48772
48749
  return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
48773
48750
  }
48774
48751
  function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
48775
- 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;
48776
48753
  if (startsWith(moduleReference, "@types/")) {
48777
48754
  const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
48778
48755
  const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
@@ -48790,7 +48767,7 @@ ${lanes.join("\n")}
48790
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);
48791
48768
  const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
48792
48769
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
48793
- 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;
48794
48771
  const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
48795
48772
  const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
48796
48773
  if (sourceFile) {
@@ -48798,7 +48775,7 @@ ${lanes.join("\n")}
48798
48775
  error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
48799
48776
  }
48800
48777
  if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
48801
- 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));
48802
48779
  if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
48803
48780
  error2(
48804
48781
  errorNode,
@@ -48807,7 +48784,7 @@ ${lanes.join("\n")}
48807
48784
  );
48808
48785
  }
48809
48786
  } else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
48810
- 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));
48811
48788
  if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
48812
48789
  const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
48813
48790
  error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
@@ -48828,7 +48805,7 @@ ${lanes.join("\n")}
48828
48805
  if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
48829
48806
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
48830
48807
  const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
48831
- 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;
48832
48809
  if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
48833
48810
  if (findAncestor(location, isImportEqualsDeclaration)) {
48834
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);
@@ -48935,7 +48912,7 @@ ${lanes.join("\n")}
48935
48912
  error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
48936
48913
  } else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
48937
48914
  const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
48938
- 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];
48939
48916
  if (suggestedExt) {
48940
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);
48941
48918
  } else {
@@ -56667,7 +56644,7 @@ ${lanes.join("\n")}
56667
56644
  }
56668
56645
  function isConstTypeVariable(type, depth = 0) {
56669
56646
  var _a;
56670
- return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 1048576 /* Union */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0));
56647
+ return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0));
56671
56648
  }
56672
56649
  function getConstraintOfIndexedAccess(type) {
56673
56650
  return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
@@ -68273,6 +68250,10 @@ ${lanes.join("\n")}
68273
68250
  }
68274
68251
  return type;
68275
68252
  }
68253
+ function narrowTypeByBooleanComparison(type, expr, bool, operator, assumeTrue) {
68254
+ assumeTrue = assumeTrue !== (bool.kind === 112 /* TrueKeyword */) !== (operator !== 38 /* ExclamationEqualsEqualsToken */ && operator !== 36 /* ExclamationEqualsToken */);
68255
+ return narrowType(type, expr, assumeTrue);
68256
+ }
68276
68257
  function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
68277
68258
  switch (expr.operatorToken.kind) {
68278
68259
  case 64 /* EqualsToken */:
@@ -68320,6 +68301,12 @@ ${lanes.join("\n")}
68320
68301
  if (isMatchingConstructorReference(right)) {
68321
68302
  return narrowTypeByConstructor(type, operator, left, assumeTrue);
68322
68303
  }
68304
+ if (isBooleanLiteral(right)) {
68305
+ return narrowTypeByBooleanComparison(type, left, right, operator, assumeTrue);
68306
+ }
68307
+ if (isBooleanLiteral(left)) {
68308
+ return narrowTypeByBooleanComparison(type, right, left, operator, assumeTrue);
68309
+ }
68323
68310
  break;
68324
68311
  case 104 /* InstanceOfKeyword */:
68325
68312
  return narrowTypeByInstanceof(type, expr, assumeTrue);
@@ -118392,15 +118379,15 @@ ${lanes.join("\n")}
118392
118379
  function isReferenceFileLocation(location) {
118393
118380
  return location.pos !== void 0;
118394
118381
  }
118395
- function getReferencedFileLocation(getSourceFileByPath, ref) {
118396
- var _a, _b, _c, _d, _e, _f;
118397
- 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));
118398
118385
  const { kind, index } = ref;
118399
118386
  let pos, end, packageId, resolutionMode;
118400
118387
  switch (kind) {
118401
118388
  case 3 /* Import */:
118402
118389
  const importLiteral = getModuleNameStringLiteralAt(file, index);
118403
- 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;
118404
118391
  if (importLiteral.pos === -1)
118405
118392
  return { file, packageId, text: importLiteral.text };
118406
118393
  pos = skipTrivia(file.text, importLiteral.pos);
@@ -118411,7 +118398,7 @@ ${lanes.join("\n")}
118411
118398
  break;
118412
118399
  case 5 /* TypeReferenceDirective */:
118413
118400
  ({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
118414
- 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;
118415
118402
  break;
118416
118403
  case 7 /* LibReferenceDirective */:
118417
118404
  ({ pos, end } = file.libReferenceDirectives[index]);
@@ -118532,6 +118519,10 @@ ${lanes.join("\n")}
118532
118519
  let automaticTypeDirectiveResolutions;
118533
118520
  let resolvedLibReferences;
118534
118521
  let resolvedLibProcessing;
118522
+ let resolvedModules;
118523
+ let resolvedModulesProcessing;
118524
+ let resolvedTypeReferenceDirectiveNames;
118525
+ let resolvedTypeReferenceDirectiveNamesProcessing;
118535
118526
  let packageMap;
118536
118527
  const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
118537
118528
  let currentNodeModulesDepth = 0;
@@ -118796,6 +118787,8 @@ ${lanes.join("\n")}
118796
118787
  }
118797
118788
  oldProgram = void 0;
118798
118789
  resolvedLibProcessing = void 0;
118790
+ resolvedModulesProcessing = void 0;
118791
+ resolvedTypeReferenceDirectiveNamesProcessing = void 0;
118799
118792
  const program = {
118800
118793
  getRootFileNames: () => rootNames,
118801
118794
  getSourceFile,
@@ -118837,6 +118830,8 @@ ${lanes.join("\n")}
118837
118830
  sourceFileToPackageName,
118838
118831
  redirectTargetsMap,
118839
118832
  usesUriStyleNodeCoreModules,
118833
+ resolvedModules,
118834
+ resolvedTypeReferenceDirectiveNames,
118840
118835
  resolvedLibReferences,
118841
118836
  getCurrentPackagesMap: () => packageMap,
118842
118837
  typesPackageExists,
@@ -118868,7 +118863,7 @@ ${lanes.join("\n")}
118868
118863
  case 1 /* FilePreprocessingFileExplainingDiagnostic */:
118869
118864
  return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray));
118870
118865
  case 0 /* FilePreprocessingReferencedDiagnostic */:
118871
- const { file, pos, end } = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason);
118866
+ const { file, pos, end } = getReferencedFileLocation(program, diagnostic.reason);
118872
118867
  return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
118873
118868
  case 2 /* ResolutionDiagnostics */:
118874
118869
  return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
@@ -118885,14 +118880,15 @@ ${lanes.join("\n")}
118885
118880
  if (packageMap)
118886
118881
  return packageMap;
118887
118882
  packageMap = /* @__PURE__ */ new Map();
118888
- files.forEach((sf) => {
118889
- if (!sf.resolvedModules)
118890
- return;
118891
- sf.resolvedModules.forEach(({ resolvedModule }) => {
118892
- if (resolvedModule == null ? void 0 : resolvedModule.packageId)
118893
- packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
118894
- });
118895
- });
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
+ );
118896
118892
  return packageMap;
118897
118893
  }
118898
118894
  function typesPackageExists(packageName) {
@@ -119024,7 +119020,7 @@ ${lanes.join("\n")}
119024
119020
  return classifiableNames;
119025
119021
  }
119026
119022
  function resolveModuleNamesReusingOldState(moduleNames, file) {
119027
- var _a2;
119023
+ var _a2, _b2;
119028
119024
  if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
119029
119025
  return resolveModuleNamesWorker(
119030
119026
  moduleNames,
@@ -119033,24 +119029,16 @@ ${lanes.join("\n")}
119033
119029
  void 0
119034
119030
  );
119035
119031
  }
119036
- const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
119037
- if (oldSourceFile !== file && file.resolvedModules) {
119038
- const result2 = [];
119039
- for (const moduleName of moduleNames) {
119040
- const resolvedModule = file.resolvedModules.get(moduleName.text, getModeForUsageLocation(file, moduleName));
119041
- result2.push(resolvedModule);
119042
- }
119043
- return result2;
119044
- }
119045
119032
  let unknownModuleNames;
119046
119033
  let result;
119047
119034
  let reusedNames;
119048
119035
  const predictedToResolveToAmbientModuleMarker = emptyResolution;
119036
+ const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
119049
119037
  for (let i = 0; i < moduleNames.length; i++) {
119050
119038
  const moduleName = moduleNames[i];
119051
- if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) {
119039
+ if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
119052
119040
  const mode = getModeForUsageLocation(file, moduleName);
119053
- 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);
119054
119042
  if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
119055
119043
  if (isTraceEnabled(options, host)) {
119056
119044
  trace(
@@ -119097,7 +119085,8 @@ ${lanes.join("\n")}
119097
119085
  Debug.assert(j === resolutions.length);
119098
119086
  return result;
119099
119087
  function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
119100
- 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;
119101
119090
  const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
119102
119091
  if (resolutionToFile && resolvedFile) {
119103
119092
  return false;
@@ -119113,7 +119102,7 @@ ${lanes.join("\n")}
119113
119102
  }
119114
119103
  }
119115
119104
  function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
119116
- var _a2;
119105
+ var _a2, _b2;
119117
119106
  if (structureIsReused === 0 /* Not */) {
119118
119107
  return resolveTypeReferenceDirectiveNamesWorker(
119119
119108
  typeDirectiveNames,
@@ -119122,28 +119111,18 @@ ${lanes.join("\n")}
119122
119111
  void 0
119123
119112
  );
119124
119113
  }
119125
- const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
119126
- if (!isString(containingFile)) {
119127
- if (oldSourceFile !== containingFile && containingFile.resolvedTypeReferenceDirectiveNames) {
119128
- const result2 = [];
119129
- for (const typeDirectiveName of typeDirectiveNames) {
119130
- const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getTypeReferenceResolutionName(typeDirectiveName), getModeForFileReference(typeDirectiveName, containingFile.impliedNodeFormat));
119131
- result2.push(resolvedTypeReferenceDirective);
119132
- }
119133
- return result2;
119134
- }
119135
- }
119136
119114
  let unknownTypeReferenceDirectiveNames;
119137
119115
  let result;
119138
119116
  let reusedNames;
119139
119117
  const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
119140
- 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));
119141
119120
  for (let i = 0; i < typeDirectiveNames.length; i++) {
119142
119121
  const entry = typeDirectiveNames[i];
119143
119122
  if (canReuseResolutions) {
119144
119123
  const typeDirectiveName = getTypeReferenceResolutionName(entry);
119145
119124
  const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
119146
- 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);
119147
119126
  if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
119148
119127
  if (isTraceEnabled(options, host)) {
119149
119128
  trace(
@@ -119203,7 +119182,7 @@ ${lanes.join("\n")}
119203
119182
  );
119204
119183
  }
119205
119184
  function tryReuseStructureFromOldProgram() {
119206
- var _a2;
119185
+ var _a2, _b2, _c2;
119207
119186
  if (!oldProgram) {
119208
119187
  return 0 /* Not */;
119209
119188
  }
@@ -119305,42 +119284,37 @@ ${lanes.join("\n")}
119305
119284
  structureIsReused = 1 /* SafeModules */;
119306
119285
  }
119307
119286
  }
119308
- modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
119287
+ modifiedSourceFiles.push(newSourceFile);
119309
119288
  } else if (hasInvalidatedResolutions(oldSourceFile.path)) {
119310
119289
  structureIsReused = 1 /* SafeModules */;
119311
- 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
+ }
119312
119295
  }
119313
119296
  newSourceFiles.push(newSourceFile);
119314
119297
  }
119315
119298
  if (structureIsReused !== 2 /* Completely */) {
119316
119299
  return structureIsReused;
119317
119300
  }
119318
- const modifiedFiles = modifiedSourceFiles.map((f) => f.oldFile);
119319
- for (const oldFile of oldSourceFiles) {
119320
- if (!contains(modifiedFiles, oldFile)) {
119321
- for (const moduleName of oldFile.ambientModuleNames) {
119322
- ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
119323
- }
119324
- }
119325
- }
119326
- for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
119301
+ for (const newSourceFile of modifiedSourceFiles) {
119327
119302
  const moduleNames = getModuleNames(newSourceFile);
119328
119303
  const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
119329
- const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
119330
- 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)
119331
119308
  structureIsReused = 1 /* SafeModules */;
119332
- newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions, moduleResolutionNameAndModeGetter);
119333
- } else {
119334
- newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
119335
- }
119336
119309
  const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
119337
119310
  const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
119338
- 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);
119339
119314
  if (typeReferenceResolutionsChanged) {
119340
119315
  structureIsReused = 1 /* SafeModules */;
119341
- newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions, typeReferenceResolutionNameAndModeGetter);
119342
- } else {
119343
- newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
119316
+ } else if (oldTypeResolutions) {
119317
+ (resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, oldTypeResolutions);
119344
119318
  }
119345
119319
  }
119346
119320
  if (structureIsReused !== 2 /* Completely */) {
@@ -119388,6 +119362,8 @@ ${lanes.join("\n")}
119388
119362
  sourceFileToPackageName = oldProgram.sourceFileToPackageName;
119389
119363
  redirectTargetsMap = oldProgram.redirectTargetsMap;
119390
119364
  usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
119365
+ resolvedModules = oldProgram.resolvedModules;
119366
+ resolvedTypeReferenceDirectiveNames = oldProgram.resolvedTypeReferenceDirectiveNames;
119391
119367
  resolvedLibReferences = oldProgram.resolvedLibReferences;
119392
119368
  packageMap = oldProgram.getCurrentPackagesMap();
119393
119369
  return 2 /* Completely */;
@@ -120433,16 +120409,16 @@ ${lanes.join("\n")}
120433
120409
  }
120434
120410
  function processTypeReferenceDirectives(file) {
120435
120411
  const typeDirectives = file.typeReferenceDirectives;
120436
- if (!typeDirectives.length) {
120437
- file.resolvedTypeReferenceDirectiveNames = void 0;
120412
+ if (!typeDirectives.length)
120438
120413
  return;
120439
- }
120440
- 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);
120441
120417
  for (let index = 0; index < typeDirectives.length; index++) {
120442
120418
  const ref = file.typeReferenceDirectives[index];
120443
120419
  const resolvedTypeReferenceDirective = resolutions[index];
120444
120420
  const fileName = toFileNameLowerCase(ref.fileName);
120445
- setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective, getModeForFileReference(ref, file.impliedNodeFormat));
120421
+ resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
120446
120422
  const mode = ref.resolutionMode || file.impliedNodeFormat;
120447
120423
  if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
120448
120424
  (fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({
@@ -120606,14 +120582,16 @@ ${lanes.join("\n")}
120606
120582
  collectExternalModuleReferences(file);
120607
120583
  if (file.imports.length || file.moduleAugmentations.length) {
120608
120584
  const moduleNames = getModuleNames(file);
120609
- const resolutions = resolveModuleNamesReusingOldState(moduleNames, file);
120585
+ const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
120610
120586
  Debug.assert(resolutions.length === moduleNames.length);
120611
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);
120612
120590
  for (let index = 0; index < moduleNames.length; index++) {
120613
120591
  const resolution = resolutions[index].resolvedModule;
120614
120592
  const moduleName = moduleNames[index].text;
120615
120593
  const mode = getModeForUsageLocation(file, moduleNames[index]);
120616
- setResolvedModule(file, moduleName, resolutions[index], mode);
120594
+ resolutionsInFile.set(moduleName, mode, resolutions[index]);
120617
120595
  addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
120618
120596
  if (!resolution) {
120619
120597
  continue;
@@ -120644,8 +120622,6 @@ ${lanes.join("\n")}
120644
120622
  currentNodeModulesDepth--;
120645
120623
  }
120646
120624
  }
120647
- } else {
120648
- file.resolvedModules = void 0;
120649
120625
  }
120650
120626
  }
120651
120627
  function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {
@@ -121160,7 +121136,7 @@ ${lanes.join("\n")}
121160
121136
  processReason(fileProcessingReason);
121161
121137
  if (locationReason && (fileIncludeReasons == null ? void 0 : fileIncludeReasons.length) === 1)
121162
121138
  fileIncludeReasons = void 0;
121163
- const location = locationReason && getReferencedFileLocation(getSourceFileByPath, locationReason);
121139
+ const location = locationReason && getReferencedFileLocation(program, locationReason);
121164
121140
  const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
121165
121141
  const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
121166
121142
  const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
@@ -121196,7 +121172,7 @@ ${lanes.join("\n")}
121196
121172
  }
121197
121173
  function fileIncludeReasonToRelatedInformation(reason) {
121198
121174
  if (isReferencedFile(reason)) {
121199
- const referenceLocation = getReferencedFileLocation(getSourceFileByPath, reason);
121175
+ const referenceLocation = getReferencedFileLocation(program, reason);
121200
121176
  let message2;
121201
121177
  switch (reason.kind) {
121202
121178
  case 3 /* Import */:
@@ -121485,8 +121461,8 @@ ${lanes.join("\n")}
121485
121461
  if (!symlinks) {
121486
121462
  symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
121487
121463
  }
121488
- if (files && automaticTypeDirectiveResolutions && !symlinks.hasProcessedResolutions()) {
121489
- symlinks.setSymlinksFromResolutions(files, automaticTypeDirectiveResolutions);
121464
+ if (files && !symlinks.hasProcessedResolutions()) {
121465
+ symlinks.setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, automaticTypeDirectiveResolutions);
121490
121466
  }
121491
121467
  return symlinks;
121492
121468
  }
@@ -121991,6 +121967,7 @@ ${lanes.join("\n")}
121991
121967
  return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
121992
121968
  }
121993
121969
  function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
121970
+ var _a;
121994
121971
  let referencedFiles;
121995
121972
  if (sourceFile.imports && sourceFile.imports.length > 0) {
121996
121973
  const checker = program.getTypeChecker();
@@ -122006,8 +121983,9 @@ ${lanes.join("\n")}
122006
121983
  addReferencedFile(referencedPath);
122007
121984
  }
122008
121985
  }
122009
- if (sourceFile.resolvedTypeReferenceDirectiveNames) {
122010
- sourceFile.resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
121986
+ const resolvedTypeReferenceDirectiveNames = (_a = program.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(sourceFile.path);
121987
+ if (resolvedTypeReferenceDirectiveNames) {
121988
+ resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
122011
121989
  if (!resolvedTypeReferenceDirective) {
122012
121990
  return;
122013
121991
  }
@@ -123845,10 +123823,10 @@ ${lanes.join("\n")}
123845
123823
  clear: clear2,
123846
123824
  onChangesAffectModuleResolution
123847
123825
  };
123848
- function getResolvedModule2(resolution) {
123826
+ function getResolvedModule(resolution) {
123849
123827
  return resolution.resolvedModule;
123850
123828
  }
123851
- function getResolvedTypeReferenceDirective2(resolution) {
123829
+ function getResolvedTypeReferenceDirective(resolution) {
123852
123830
  return resolution.resolvedTypeReferenceDirective;
123853
123831
  }
123854
123832
  function clear2() {
@@ -123924,7 +123902,7 @@ ${lanes.join("\n")}
123924
123902
  stopWatchFailedLookupLocationOfResolution(
123925
123903
  resolution,
123926
123904
  resolutionHost.toPath(getInferredLibraryNameResolveFrom(newProgram.getCompilerOptions(), getCurrentDirectory(), libFileName)),
123927
- getResolvedModule2
123905
+ getResolvedModule
123928
123906
  );
123929
123907
  resolvedLibraries.delete(libFileName);
123930
123908
  }
@@ -124130,7 +124108,7 @@ ${lanes.join("\n")}
124130
124108
  ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost,
124131
124109
  typeReferenceDirectiveResolutionCache
124132
124110
  ),
124133
- getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective2,
124111
+ getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
124134
124112
  shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
124135
124113
  deferWatchingNonRelativeResolution: false
124136
124114
  });
@@ -124149,7 +124127,7 @@ ${lanes.join("\n")}
124149
124127
  redirectedReference,
124150
124128
  options
124151
124129
  ),
124152
- getResolutionWithResolvedFileName: getResolvedModule2,
124130
+ getResolutionWithResolvedFileName: getResolvedModule,
124153
124131
  shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
124154
124132
  logChanges: logChangesWhenResolvingModule,
124155
124133
  deferWatchingNonRelativeResolution: true
@@ -124168,17 +124146,17 @@ ${lanes.join("\n")}
124168
124146
  libraryName,
124169
124147
  resolution,
124170
124148
  path,
124171
- getResolvedModule2,
124149
+ getResolvedModule,
124172
124150
  /*deferWatchingNonRelativeResolution*/
124173
124151
  false
124174
124152
  );
124175
124153
  resolvedLibraries.set(libFileName, resolution);
124176
124154
  if (existingResolution) {
124177
- stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule2);
124155
+ stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule);
124178
124156
  }
124179
124157
  } else {
124180
124158
  if (isTraceEnabled(options, host)) {
124181
- const resolved = getResolvedModule2(resolution);
124159
+ const resolved = getResolvedModule(resolution);
124182
124160
  trace(
124183
124161
  host,
124184
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,
@@ -124455,8 +124433,8 @@ ${lanes.join("\n")}
124455
124433
  resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
124456
124434
  }
124457
124435
  function removeResolutionsOfFile(filePath) {
124458
- removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule2);
124459
- removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective2);
124436
+ removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
124437
+ removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
124460
124438
  }
124461
124439
  function invalidateResolutions(resolutions, canInvalidate) {
124462
124440
  if (!resolutions)
@@ -124879,7 +124857,7 @@ ${lanes.join("\n")}
124879
124857
  var _a, _b;
124880
124858
  const options = program.getCompilerOptions();
124881
124859
  if (isReferencedFile(reason)) {
124882
- const referenceLocation = getReferencedFileLocation((path) => program.getSourceFileByPath(path), reason);
124860
+ const referenceLocation = getReferencedFileLocation(program, reason);
124883
124861
  const referenceText = isReferenceFileLocation(referenceLocation) ? referenceLocation.file.text.substring(referenceLocation.pos, referenceLocation.end) : `"${referenceLocation.text}"`;
124884
124862
  let message;
124885
124863
  Debug.assert(isReferenceFileLocation(referenceLocation) || reason.kind === 3 /* Import */, "Only synthetic references are imports");
@@ -133764,14 +133742,14 @@ ${lanes.join("\n")}
133764
133742
  return ensurePathIsNonModuleName(combineNormal(pathA, pathB));
133765
133743
  }
133766
133744
  function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) {
133767
- var _a;
133745
+ var _a, _b;
133768
133746
  if (importedModuleSymbol) {
133769
133747
  const oldFileName = find(importedModuleSymbol.declarations, isSourceFile).fileName;
133770
133748
  const newFileName = oldToNew(oldFileName);
133771
133749
  return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true };
133772
133750
  } else {
133773
133751
  const mode = getModeForUsageLocation(importingSourceFile, importLiteral);
133774
- 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);
133775
133753
  return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
133776
133754
  }
133777
133755
  }
@@ -134691,6 +134669,7 @@ ${lanes.join("\n")}
134691
134669
 
134692
134670
  // src/services/suggestionDiagnostics.ts
134693
134671
  function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
134672
+ var _a, _b, _c;
134694
134673
  program.getSemanticDiagnostics(sourceFile, cancellationToken);
134695
134674
  const diags = [];
134696
134675
  const checker = program.getTypeChecker();
@@ -134707,7 +134686,7 @@ ${lanes.join("\n")}
134707
134686
  const name = importNameForConvertToDefaultImport(importNode);
134708
134687
  if (!name)
134709
134688
  continue;
134710
- 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;
134711
134690
  const resolvedFile = module2 && program.getSourceFile(module2.resolvedFileName);
134712
134691
  if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
134713
134692
  diags.push(createDiagnosticForNode(name, Diagnostics.Import_may_be_converted_to_a_default_import));
@@ -137123,10 +137102,10 @@ ${lanes.join("\n")}
137123
137102
  const targetSourceFile = program.getSourceFile(targetFile);
137124
137103
  for (const oldStatement of oldFile.statements) {
137125
137104
  forEachImportInStatement(oldStatement, (i) => {
137126
- var _a, _b;
137105
+ var _a, _b, _c;
137127
137106
  const moduleSpecifier = moduleSpecifierFromImport(i);
137128
- const resolved = (_a = oldFile.resolvedModules) == null ? void 0 : _a.get(moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
137129
- 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;
137130
137109
  if (fileName && targetSourceFile) {
137131
137110
  const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.path, fileName, createModuleSpecifierResolutionHost(program, host));
137132
137111
  append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
@@ -147741,9 +147720,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
147741
147720
  });
147742
147721
 
147743
147722
  // src/services/codefixes/convertToEsModule.ts
147744
- function fixImportOfModuleExports(importingFile, exportingFile, changes, quotePreference) {
147723
+ function fixImportOfModuleExports(importingFile, exportingFile, program, changes, quotePreference) {
147724
+ var _a, _b, _c;
147745
147725
  for (const moduleSpecifier of importingFile.imports) {
147746
- 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;
147747
147727
  if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
147748
147728
  continue;
147749
147729
  }
@@ -148271,7 +148251,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
148271
148251
  const moduleExportsChangedToDefault = convertFileToEsModule(sourceFile, program.getTypeChecker(), changes2, getEmitScriptTarget(program.getCompilerOptions()), getQuotePreference(sourceFile, preferences));
148272
148252
  if (moduleExportsChangedToDefault) {
148273
148253
  for (const importingFile of program.getSourceFiles()) {
148274
- fixImportOfModuleExports(importingFile, sourceFile, changes2, getQuotePreference(importingFile, preferences));
148254
+ fixImportOfModuleExports(importingFile, sourceFile, program, changes2, getQuotePreference(importingFile, preferences));
148275
148255
  }
148276
148256
  }
148277
148257
  });
@@ -149160,7 +149140,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149160
149140
  }
149161
149141
  }
149162
149142
  function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
149163
- const compilerOptions = program.getCompilerOptions();
149164
149143
  let exportInfos;
149165
149144
  if (exportMapKey) {
149166
149145
  exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
@@ -149181,7 +149160,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149181
149160
  fix,
149182
149161
  /*includeSymbolNameInDescription*/
149183
149162
  false,
149184
- compilerOptions,
149163
+ program,
149185
149164
  preferences
149186
149165
  ))
149187
149166
  };
@@ -149191,7 +149170,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149191
149170
  const symbolName2 = single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions));
149192
149171
  const fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName2, program);
149193
149172
  const includeSymbolNameInDescription = symbolName2 !== symbolToken.text;
149194
- 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
+ ));
149195
149182
  }
149196
149183
  function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
149197
149184
  const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
@@ -149761,14 +149748,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149761
149748
  }
149762
149749
  return allowSyntheticDefaults ? 1 /* Default */ : 3 /* CommonJS */;
149763
149750
  }
149764
- function codeActionForFix(context, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences) {
149751
+ function codeActionForFix(context, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences) {
149765
149752
  let diag2;
149766
149753
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
149767
- diag2 = codeActionForFixWorker(tracker, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences);
149754
+ diag2 = codeActionForFixWorker(tracker, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences);
149768
149755
  });
149769
149756
  return createCodeFixAction(importFixName, changes, diag2, importFixId, Diagnostics.Add_all_missing_imports);
149770
149757
  }
149771
- function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences) {
149758
+ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences) {
149772
149759
  const quotePreference = getQuotePreference(sourceFile, preferences);
149773
149760
  switch (fix.kind) {
149774
149761
  case 0 /* UseNamespace */:
@@ -149805,7 +149792,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149805
149792
  defaultImport,
149806
149793
  namedImports,
149807
149794
  namespaceLikeImport,
149808
- compilerOptions
149795
+ program.getCompilerOptions()
149809
149796
  ),
149810
149797
  /*blankLineBetween*/
149811
149798
  true,
@@ -149818,7 +149805,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149818
149805
  }
149819
149806
  case 4 /* PromoteTypeOnly */: {
149820
149807
  const { typeOnlyAliasDeclaration } = fix;
149821
- const promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile, preferences);
149808
+ const promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, program, sourceFile, preferences);
149822
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)];
149823
149810
  }
149824
149811
  default:
@@ -149829,7 +149816,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149829
149816
  var _a, _b;
149830
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;
149831
149818
  }
149832
- function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile, preferences) {
149819
+ function promoteFromTypeOnly(changes, aliasDeclaration, program, sourceFile, preferences) {
149820
+ const compilerOptions = program.getCompilerOptions();
149833
149821
  const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions);
149834
149822
  switch (aliasDeclaration.kind) {
149835
149823
  case 276 /* ImportSpecifier */:
@@ -149871,10 +149859,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149871
149859
  Debug.failBadSyntaxKind(aliasDeclaration);
149872
149860
  }
149873
149861
  function promoteImportClause(importClause) {
149862
+ var _a, _b, _c;
149874
149863
  changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
149875
149864
  if (!compilerOptions.allowImportingTsExtensions) {
149876
149865
  const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
149877
- 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);
149878
149867
  if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
149879
149868
  const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
149880
149869
  changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
@@ -150168,7 +150157,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150168
150157
  fix,
150169
150158
  /*includeSymbolNameInDescription*/
150170
150159
  symbolName2 !== errorIdentifierText,
150171
- program.getCompilerOptions(),
150160
+ program,
150172
150161
  preferences
150173
150162
  )
150174
150163
  );
@@ -150581,7 +150570,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150581
150570
 
150582
150571
  // src/services/codefixes/fixImportNonExportedMember.ts
150583
150572
  function getInfo7(sourceFile, pos, program) {
150584
- var _a;
150573
+ var _a, _b, _c, _d;
150585
150574
  const token = getTokenAtPosition(sourceFile, pos);
150586
150575
  if (isIdentifier(token)) {
150587
150576
  const importDeclaration = findAncestor(token, isImportDeclaration);
@@ -150590,19 +150579,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150590
150579
  const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : void 0;
150591
150580
  if (moduleSpecifier === void 0)
150592
150581
  return void 0;
150593
- const resolvedModule = getResolvedModule(
150594
- sourceFile,
150582
+ const resolvedModule = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(
150595
150583
  moduleSpecifier,
150596
150584
  /*mode*/
150597
150585
  void 0
150598
- );
150586
+ )) == null ? void 0 : _c.resolvedModule;
150599
150587
  if (resolvedModule === void 0)
150600
150588
  return void 0;
150601
150589
  const moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
150602
150590
  if (moduleSourceFile === void 0 || isSourceFileFromLibrary(program, moduleSourceFile))
150603
150591
  return void 0;
150604
150592
  const moduleSymbol = moduleSourceFile.symbol;
150605
- 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;
150606
150594
  if (locals === void 0)
150607
150595
  return void 0;
150608
150596
  const localSymbol = locals.get(token.escapedText);
@@ -150892,9 +150880,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150892
150880
  return flags;
150893
150881
  }
150894
150882
  function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) {
150883
+ var _a, _b, _c;
150895
150884
  if (!importDeclaration || !isStringLiteralLike(importDeclaration.moduleSpecifier))
150896
150885
  return void 0;
150897
- 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;
150898
150887
  if (!resolvedModule)
150899
150888
  return void 0;
150900
150889
  return context.program.getSourceFile(resolvedModule.resolvedFileName);
@@ -162206,7 +162195,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162206
162195
  })(FindReferencesUse || {});
162207
162196
  ((Core2) => {
162208
162197
  function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options = {}, sourceFilesSet = new Set(sourceFiles.map((f) => f.fileName))) {
162209
- var _a, _b, _c;
162198
+ var _a, _b, _c, _d;
162210
162199
  node = getAdjustedNode2(node, options);
162211
162200
  if (isSourceFile(node)) {
162212
162201
  const resolvedRef = ts_GoToDefinition_exports.getReferenceAtPosition(node, position, program);
@@ -162245,7 +162234,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162245
162234
  if (!options.implementations && isStringLiteralLike(node)) {
162246
162235
  if (isModuleSpecifierLike(node)) {
162247
162236
  const fileIncludeReasons = program.getFileIncludeReasons();
162248
- 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;
162249
162238
  const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0;
162250
162239
  if (referencedFile) {
162251
162240
  return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }];
@@ -162308,7 +162297,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162308
162297
  for (const ref of references) {
162309
162298
  if (isReferencedFile(ref)) {
162310
162299
  const referencingFile = program.getSourceFileByPath(ref.file);
162311
- const location = getReferencedFileLocation(program.getSourceFileByPath, ref);
162300
+ const location = getReferencedFileLocation(program, ref);
162312
162301
  if (isReferenceFileLocation(location)) {
162313
162302
  entries = append(entries, {
162314
162303
  kind: 0 /* Span */,
@@ -163675,7 +163664,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163675
163664
 
163676
163665
  // src/services/goToDefinition.ts
163677
163666
  function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
163678
- var _a, _b;
163667
+ var _a, _b, _c;
163679
163668
  const resolvedRef = getReferenceAtPosition(sourceFile, position, program);
163680
163669
  const fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || emptyArray;
163681
163670
  if (resolvedRef == null ? void 0 : resolvedRef.file) {
@@ -163748,7 +163737,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163748
163737
  }
163749
163738
  }
163750
163739
  if (!symbol && isModuleSpecifierLike(fallbackNode)) {
163751
- 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;
163752
163741
  if (ref) {
163753
163742
  return [{
163754
163743
  name: fallbackNode.text,
@@ -163860,10 +163849,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163860
163849
  const file = program.getLibFileFromReference(libReferenceDirective);
163861
163850
  return file && { reference: libReferenceDirective, fileName: file.fileName, file, unverified: false };
163862
163851
  }
163863
- 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()) {
163864
163854
  const node = getTouchingToken(sourceFile, position);
163865
- if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, getModeForUsageLocation(sourceFile, node))) {
163866
- 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;
163867
163857
  const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text);
163868
163858
  return {
163869
163859
  file: program.getSourceFile(fileName),
@@ -164294,9 +164284,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164294
164284
  displayParts
164295
164285
  });
164296
164286
  }
164297
- function addTypeHints(text, position) {
164287
+ function addTypeHints(hintText, position) {
164298
164288
  result.push({
164299
- text: `: ${text.length > maxTypeHintLength ? text.substr(0, maxTypeHintLength - "...".length) + "..." : text}`,
164289
+ text: typeof hintText === "string" ? `: ${hintText}` : "",
164290
+ displayParts: typeof hintText === "string" ? void 0 : [{ text: ": " }, ...hintText],
164300
164291
  position,
164301
164292
  kind: "Type" /* Type */,
164302
164293
  whitespaceBefore: true
@@ -164334,13 +164325,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164334
164325
  if (isModuleReferenceType(declarationType)) {
164335
164326
  return;
164336
164327
  }
164337
- const typeDisplayString = printTypeInSingleLine(declarationType);
164338
- if (typeDisplayString) {
164339
- const isVariableNameMatchesType = preferences.includeInlayVariableTypeHintsWhenTypeMatchesName === false && equateStringsCaseInsensitive(decl.name.getText(), typeDisplayString);
164328
+ const hints = typeToInlayHintParts(declarationType);
164329
+ if (hints) {
164330
+ const hintText = typeof hints === "string" ? hints : hints.map((part) => part.text).join("");
164331
+ const isVariableNameMatchesType = preferences.includeInlayVariableTypeHintsWhenTypeMatchesName === false && equateStringsCaseInsensitive(decl.name.getText(), hintText);
164340
164332
  if (isVariableNameMatchesType) {
164341
164333
  return;
164342
164334
  }
164343
- addTypeHints(typeDisplayString, decl.name.end);
164335
+ addTypeHints(hints, decl.name.end);
164344
164336
  }
164345
164337
  }
164346
164338
  function visitCallOrNewExpression(expr) {
@@ -164448,11 +164440,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164448
164440
  if (isModuleReferenceType(returnType)) {
164449
164441
  return;
164450
164442
  }
164451
- const typeDisplayString = printTypeInSingleLine(returnType);
164452
- if (!typeDisplayString) {
164453
- return;
164443
+ const hint = typeToInlayHintParts(returnType);
164444
+ if (hint) {
164445
+ addTypeHints(hint, getTypeAnnotationPosition(decl));
164454
164446
  }
164455
- addTypeHints(typeDisplayString, getTypeAnnotationPosition(decl));
164456
164447
  }
164457
164448
  function getTypeAnnotationPosition(decl) {
164458
164449
  const closeParenToken = findChildOfKind(decl, 22 /* CloseParenToken */, file);
@@ -164513,6 +164504,303 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164513
164504
  );
164514
164505
  });
164515
164506
  }
164507
+ function typeToInlayHintParts(type) {
164508
+ if (!shouldUseInteractiveInlayHints(preferences)) {
164509
+ return printTypeInSingleLine(type);
164510
+ }
164511
+ const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
164512
+ const typeNode = checker.typeToTypeNode(
164513
+ type,
164514
+ /*enclosingDeclaration*/
164515
+ void 0,
164516
+ flags
164517
+ );
164518
+ Debug.assertIsDefined(typeNode, "should always get typenode");
164519
+ const parts = [];
164520
+ visitForDisplayParts(typeNode);
164521
+ return parts;
164522
+ function visitForDisplayParts(node) {
164523
+ if (!node) {
164524
+ return;
164525
+ }
164526
+ const tokenString = tokenToString(node.kind);
164527
+ if (tokenString) {
164528
+ parts.push({ text: tokenString });
164529
+ return;
164530
+ }
164531
+ switch (node.kind) {
164532
+ case 80 /* Identifier */:
164533
+ const identifier = node;
164534
+ const identifierText = idText(identifier);
164535
+ const name = identifier.symbol && identifier.symbol.declarations && identifier.symbol.declarations.length && getNameOfDeclaration(identifier.symbol.declarations[0]);
164536
+ if (name) {
164537
+ parts.push(getNodeDisplayPart(identifierText, name));
164538
+ } else {
164539
+ parts.push({ text: identifierText });
164540
+ }
164541
+ break;
164542
+ case 9 /* NumericLiteral */:
164543
+ parts.push({ text: node.text });
164544
+ break;
164545
+ case 11 /* StringLiteral */:
164546
+ parts.push({ text: `"${node.text}"` });
164547
+ break;
164548
+ case 166 /* QualifiedName */:
164549
+ const qualifiedName = node;
164550
+ visitForDisplayParts(qualifiedName.left);
164551
+ parts.push({ text: "." });
164552
+ visitForDisplayParts(qualifiedName.right);
164553
+ break;
164554
+ case 182 /* TypePredicate */:
164555
+ const predicate = node;
164556
+ if (predicate.assertsModifier) {
164557
+ parts.push({ text: "asserts " });
164558
+ }
164559
+ visitForDisplayParts(predicate.parameterName);
164560
+ if (predicate.type) {
164561
+ parts.push({ text: " is " });
164562
+ visitForDisplayParts(predicate.type);
164563
+ }
164564
+ break;
164565
+ case 183 /* TypeReference */:
164566
+ const typeReference = node;
164567
+ visitForDisplayParts(typeReference.typeName);
164568
+ if (typeReference.typeArguments) {
164569
+ parts.push({ text: "<" });
164570
+ visitDisplayPartList(typeReference.typeArguments, ", ");
164571
+ parts.push({ text: ">" });
164572
+ }
164573
+ break;
164574
+ case 168 /* TypeParameter */:
164575
+ const typeParameter = node;
164576
+ if (typeParameter.modifiers) {
164577
+ visitDisplayPartList(typeParameter.modifiers, " ");
164578
+ }
164579
+ visitForDisplayParts(typeParameter.name);
164580
+ if (typeParameter.constraint) {
164581
+ parts.push({ text: " extends " });
164582
+ visitForDisplayParts(typeParameter.constraint);
164583
+ }
164584
+ if (typeParameter.default) {
164585
+ parts.push({ text: " = " });
164586
+ visitForDisplayParts(typeParameter.default);
164587
+ }
164588
+ break;
164589
+ case 169 /* Parameter */:
164590
+ const parameter = node;
164591
+ if (parameter.modifiers) {
164592
+ visitDisplayPartList(parameter.modifiers, " ");
164593
+ }
164594
+ if (parameter.dotDotDotToken) {
164595
+ parts.push({ text: "..." });
164596
+ }
164597
+ visitForDisplayParts(parameter.name);
164598
+ if (parameter.questionToken) {
164599
+ parts.push({ text: "?" });
164600
+ }
164601
+ if (parameter.type) {
164602
+ parts.push({ text: ": " });
164603
+ visitForDisplayParts(parameter.type);
164604
+ }
164605
+ break;
164606
+ case 185 /* ConstructorType */:
164607
+ const constructorType = node;
164608
+ parts.push({ text: "new " });
164609
+ if (constructorType.typeParameters) {
164610
+ parts.push({ text: "<" });
164611
+ visitDisplayPartList(constructorType.typeParameters, ", ");
164612
+ parts.push({ text: ">" });
164613
+ }
164614
+ parts.push({ text: "(" });
164615
+ visitDisplayPartList(constructorType.parameters, ", ");
164616
+ parts.push({ text: ")" });
164617
+ parts.push({ text: " => " });
164618
+ visitForDisplayParts(constructorType.type);
164619
+ break;
164620
+ case 186 /* TypeQuery */:
164621
+ const typeQuery = node;
164622
+ parts.push({ text: "typeof " });
164623
+ visitForDisplayParts(typeQuery.exprName);
164624
+ if (typeQuery.typeArguments) {
164625
+ parts.push({ text: "<" });
164626
+ visitDisplayPartList(typeQuery.typeArguments, ", ");
164627
+ parts.push({ text: ">" });
164628
+ }
164629
+ break;
164630
+ case 187 /* TypeLiteral */:
164631
+ const typeLiteral = node;
164632
+ parts.push({ text: "{" });
164633
+ if (typeLiteral.members.length) {
164634
+ parts.push({ text: " " });
164635
+ visitDisplayPartList(typeLiteral.members, "; ");
164636
+ parts.push({ text: " " });
164637
+ }
164638
+ parts.push({ text: "}" });
164639
+ break;
164640
+ case 188 /* ArrayType */:
164641
+ visitForDisplayParts(node.elementType);
164642
+ parts.push({ text: "[]" });
164643
+ break;
164644
+ case 189 /* TupleType */:
164645
+ parts.push({ text: "[" });
164646
+ visitDisplayPartList(node.elements, ", ");
164647
+ parts.push({ text: "]" });
164648
+ break;
164649
+ case 202 /* NamedTupleMember */:
164650
+ const member = node;
164651
+ if (member.dotDotDotToken) {
164652
+ parts.push({ text: "..." });
164653
+ }
164654
+ visitForDisplayParts(member.name);
164655
+ if (member.questionToken) {
164656
+ parts.push({ text: "?" });
164657
+ }
164658
+ parts.push({ text: ": " });
164659
+ visitForDisplayParts(member.type);
164660
+ break;
164661
+ case 190 /* OptionalType */:
164662
+ visitForDisplayParts(node.type);
164663
+ parts.push({ text: "?" });
164664
+ break;
164665
+ case 191 /* RestType */:
164666
+ parts.push({ text: "..." });
164667
+ visitForDisplayParts(node.type);
164668
+ break;
164669
+ case 192 /* UnionType */:
164670
+ visitDisplayPartList(node.types, " | ");
164671
+ break;
164672
+ case 193 /* IntersectionType */:
164673
+ visitDisplayPartList(node.types, " & ");
164674
+ break;
164675
+ case 194 /* ConditionalType */:
164676
+ const conditionalType = node;
164677
+ visitForDisplayParts(conditionalType.checkType);
164678
+ parts.push({ text: " extends " });
164679
+ visitForDisplayParts(conditionalType.extendsType);
164680
+ parts.push({ text: " ? " });
164681
+ visitForDisplayParts(conditionalType.trueType);
164682
+ parts.push({ text: " : " });
164683
+ visitForDisplayParts(conditionalType.falseType);
164684
+ break;
164685
+ case 195 /* InferType */:
164686
+ parts.push({ text: "infer " });
164687
+ visitForDisplayParts(node.typeParameter);
164688
+ break;
164689
+ case 196 /* ParenthesizedType */:
164690
+ parts.push({ text: "(" });
164691
+ visitForDisplayParts(node.type);
164692
+ parts.push({ text: ")" });
164693
+ break;
164694
+ case 198 /* TypeOperator */:
164695
+ const typeOperator = node;
164696
+ parts.push({ text: `${tokenToString(typeOperator.operator)} ` });
164697
+ visitForDisplayParts(typeOperator.type);
164698
+ break;
164699
+ case 199 /* IndexedAccessType */:
164700
+ const indexedAccess = node;
164701
+ visitForDisplayParts(indexedAccess.objectType);
164702
+ parts.push({ text: "[" });
164703
+ visitForDisplayParts(indexedAccess.indexType);
164704
+ parts.push({ text: "]" });
164705
+ break;
164706
+ case 200 /* MappedType */:
164707
+ const mappedType = node;
164708
+ parts.push({ text: "{ " });
164709
+ if (mappedType.readonlyToken) {
164710
+ if (mappedType.readonlyToken.kind === 40 /* PlusToken */) {
164711
+ parts.push({ text: "+" });
164712
+ } else if (mappedType.readonlyToken.kind === 41 /* MinusToken */) {
164713
+ parts.push({ text: "-" });
164714
+ }
164715
+ parts.push({ text: "readonly " });
164716
+ }
164717
+ parts.push({ text: "[" });
164718
+ visitForDisplayParts(mappedType.typeParameter);
164719
+ if (mappedType.nameType) {
164720
+ parts.push({ text: " as " });
164721
+ visitForDisplayParts(mappedType.nameType);
164722
+ }
164723
+ parts.push({ text: "]" });
164724
+ if (mappedType.questionToken) {
164725
+ if (mappedType.questionToken.kind === 40 /* PlusToken */) {
164726
+ parts.push({ text: "+" });
164727
+ } else if (mappedType.questionToken.kind === 41 /* MinusToken */) {
164728
+ parts.push({ text: "-" });
164729
+ }
164730
+ parts.push({ text: "?" });
164731
+ }
164732
+ parts.push({ text: ": " });
164733
+ if (mappedType.type) {
164734
+ visitForDisplayParts(mappedType.type);
164735
+ }
164736
+ parts.push({ text: "; }" });
164737
+ break;
164738
+ case 201 /* LiteralType */:
164739
+ visitForDisplayParts(node.literal);
164740
+ break;
164741
+ case 184 /* FunctionType */:
164742
+ const functionType = node;
164743
+ if (functionType.typeParameters) {
164744
+ parts.push({ text: "<" });
164745
+ visitDisplayPartList(functionType.typeParameters, ", ");
164746
+ parts.push({ text: ">" });
164747
+ }
164748
+ parts.push({ text: "(" });
164749
+ visitDisplayPartList(functionType.parameters, ", ");
164750
+ parts.push({ text: ")" });
164751
+ parts.push({ text: " => " });
164752
+ visitForDisplayParts(functionType.type);
164753
+ break;
164754
+ case 205 /* ImportType */:
164755
+ const importType = node;
164756
+ if (importType.isTypeOf) {
164757
+ parts.push({ text: "typeof " });
164758
+ }
164759
+ parts.push({ text: "import(" });
164760
+ visitForDisplayParts(importType.argument);
164761
+ if (importType.assertions) {
164762
+ parts.push({ text: ", { assert: " });
164763
+ visitDisplayPartList(importType.assertions.assertClause.elements, ", ");
164764
+ parts.push({ text: " }" });
164765
+ }
164766
+ parts.push({ text: ")" });
164767
+ if (importType.qualifier) {
164768
+ parts.push({ text: "." });
164769
+ visitForDisplayParts(importType.qualifier);
164770
+ }
164771
+ if (importType.typeArguments) {
164772
+ parts.push({ text: "<" });
164773
+ visitDisplayPartList(importType.typeArguments, ", ");
164774
+ parts.push({ text: ">" });
164775
+ }
164776
+ break;
164777
+ case 171 /* PropertySignature */:
164778
+ const propertySignature = node;
164779
+ if (propertySignature.modifiers) {
164780
+ visitDisplayPartList(propertySignature.modifiers, " ");
164781
+ }
164782
+ visitForDisplayParts(propertySignature.name);
164783
+ if (propertySignature.questionToken) {
164784
+ parts.push({ text: "?" });
164785
+ }
164786
+ if (propertySignature.type) {
164787
+ parts.push({ text: ": " });
164788
+ visitForDisplayParts(propertySignature.type);
164789
+ }
164790
+ break;
164791
+ default:
164792
+ Debug.failBadSyntaxKind(node);
164793
+ }
164794
+ }
164795
+ function visitDisplayPartList(nodes, separator) {
164796
+ nodes.forEach((node, index) => {
164797
+ if (index > 0) {
164798
+ parts.push({ text: separator });
164799
+ }
164800
+ visitForDisplayParts(node);
164801
+ });
164802
+ }
164803
+ }
164516
164804
  function isUndefined(name) {
164517
164805
  return name === "undefined";
164518
164806
  }
@@ -164532,12 +164820,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164532
164820
  };
164533
164821
  }
164534
164822
  }
164535
- var maxTypeHintLength, leadingParameterNameCommentRegexFactory;
164823
+ var leadingParameterNameCommentRegexFactory;
164536
164824
  var init_inlayHints = __esm({
164537
164825
  "src/services/inlayHints.ts"() {
164538
164826
  "use strict";
164539
164827
  init_ts4();
164540
- maxTypeHintLength = 30;
164541
164828
  leadingParameterNameCommentRegexFactory = (name) => {
164542
164829
  return new RegExp(`^\\s?/\\*\\*?\\s?${name}\\s?\\*\\/\\s?$`);
164543
164830
  };
@@ -164600,6 +164887,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
164600
164887
  }
164601
164888
  for (const tag of tags) {
164602
164889
  infos.push({ name: tag.tagName.text, text: getCommentDisplayParts(tag, checker) });
164890
+ if (isJSDocPropertyLikeTag(tag) && tag.isNameFirst && tag.typeExpression && isJSDocTypeLiteral(tag.typeExpression.type)) {
164891
+ forEach(tag.typeExpression.type.jsDocPropertyTags, (propTag) => {
164892
+ infos.push({ name: propTag.tagName.text, text: getCommentDisplayParts(propTag, checker) });
164893
+ });
164894
+ }
164603
164895
  }
164604
164896
  });
164605
164897
  return infos;
@@ -173482,16 +173774,23 @@ ${options.prefix}` : "\n" : options.prefix
173482
173774
  const sourceFiles = program.getSourceFiles();
173483
173775
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "getUnresolvedImports", { count: sourceFiles.length });
173484
173776
  const ambientModules = program.getTypeChecker().getAmbientModules().map((mod) => stripQuotes(mod.getName()));
173485
- 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
+ )));
173486
173783
  (_b = tracing) == null ? void 0 : _b.pop();
173487
173784
  return result;
173488
173785
  }
173489
- function extractUnresolvedImportsFromSourceFile(file, ambientModules, cachedUnresolvedImportsPerFile) {
173786
+ function extractUnresolvedImportsFromSourceFile(program, file, ambientModules, cachedUnresolvedImportsPerFile) {
173490
173787
  return getOrUpdate(cachedUnresolvedImportsPerFile, file.path, () => {
173491
- if (!file.resolvedModules)
173788
+ var _a;
173789
+ const resolvedModules = (_a = program.resolvedModules) == null ? void 0 : _a.get(file.path);
173790
+ if (!resolvedModules)
173492
173791
  return emptyArray2;
173493
173792
  let unresolvedImports;
173494
- file.resolvedModules.forEach(({ resolvedModule }, name) => {
173793
+ resolvedModules.forEach(({ resolvedModule }, name) => {
173495
173794
  if ((!resolvedModule || !resolutionExtensionIsTSOrJson(resolvedModule.extension)) && !isExternalModuleNameRelative(name) && !ambientModules.some((m) => m === name)) {
173496
173795
  unresolvedImports = append(unresolvedImports, parsePackageName(name).packageName);
173497
173796
  }
@@ -173703,7 +174002,8 @@ ${options.prefix}` : "\n" : options.prefix
173703
174002
  }
173704
174003
  if (this.program && !this.symlinks.hasProcessedResolutions()) {
173705
174004
  this.symlinks.setSymlinksFromResolutions(
173706
- this.program.getSourceFiles(),
174005
+ this.program.resolvedModules,
174006
+ this.program.resolvedTypeReferenceDirectiveNames,
173707
174007
  this.program.getAutomaticTypeDirectiveResolutions()
173708
174008
  );
173709
174009
  }
@@ -184349,8 +184649,6 @@ ${e.message}`;
184349
184649
  getResolvePackageJsonExports: () => getResolvePackageJsonExports,
184350
184650
  getResolvePackageJsonImports: () => getResolvePackageJsonImports,
184351
184651
  getResolvedExternalModuleName: () => getResolvedExternalModuleName,
184352
- getResolvedModule: () => getResolvedModule,
184353
- getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
184354
184652
  getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
184355
184653
  getRestParameterElementType: () => getRestParameterElementType,
184356
184654
  getRightMostAssignedExpression: () => getRightMostAssignedExpression,
@@ -185448,8 +185746,6 @@ ${e.message}`;
185448
185746
  setParent: () => setParent,
185449
185747
  setParentRecursive: () => setParentRecursive,
185450
185748
  setPrivateIdentifier: () => setPrivateIdentifier,
185451
- setResolvedModule: () => setResolvedModule,
185452
- setResolvedTypeReferenceDirective: () => setResolvedTypeReferenceDirective,
185453
185749
  setSnippetElement: () => setSnippetElement,
185454
185750
  setSourceMapRange: () => setSourceMapRange,
185455
185751
  setStackTraceLimit: () => setStackTraceLimit,
@@ -185676,7 +185972,6 @@ ${e.message}`;
185676
185972
  writeCommentRange: () => writeCommentRange,
185677
185973
  writeFile: () => writeFile,
185678
185974
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
185679
- zipToModeAwareCache: () => zipToModeAwareCache,
185680
185975
  zipWith: () => zipWith
185681
185976
  });
185682
185977
  var init_ts7 = __esm({
@@ -186753,8 +187048,6 @@ ${e.message}`;
186753
187048
  getResolvePackageJsonExports: () => getResolvePackageJsonExports,
186754
187049
  getResolvePackageJsonImports: () => getResolvePackageJsonImports,
186755
187050
  getResolvedExternalModuleName: () => getResolvedExternalModuleName,
186756
- getResolvedModule: () => getResolvedModule,
186757
- getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
186758
187051
  getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
186759
187052
  getRestParameterElementType: () => getRestParameterElementType,
186760
187053
  getRightMostAssignedExpression: () => getRightMostAssignedExpression,
@@ -187852,8 +188145,6 @@ ${e.message}`;
187852
188145
  setParent: () => setParent,
187853
188146
  setParentRecursive: () => setParentRecursive,
187854
188147
  setPrivateIdentifier: () => setPrivateIdentifier,
187855
- setResolvedModule: () => setResolvedModule,
187856
- setResolvedTypeReferenceDirective: () => setResolvedTypeReferenceDirective,
187857
188148
  setSnippetElement: () => setSnippetElement,
187858
188149
  setSourceMapRange: () => setSourceMapRange,
187859
188150
  setStackTraceLimit: () => setStackTraceLimit,
@@ -188080,7 +188371,6 @@ ${e.message}`;
188080
188371
  writeCommentRange: () => writeCommentRange,
188081
188372
  writeFile: () => writeFile,
188082
188373
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
188083
- zipToModeAwareCache: () => zipToModeAwareCache,
188084
188374
  zipWith: () => zipWith
188085
188375
  });
188086
188376
  var init_ts8 = __esm({