@typescript-deploys/pr-build 5.3.0-pr-52972-6 → 5.3.0-pr-55820-7

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-insiders.20230920`;
38
+ version = `${versionMajorMinor}.0-insiders.20230921`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -8991,7 +8991,7 @@ ${lanes.join("\n")}
8991
8991
  Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
8992
8992
  Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
8993
8993
  Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
8994
- Can_only_convert_string_concatenation: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_95154", "Can only convert string concatenation"),
8994
+ Can_only_convert_string_concatenations_and_string_literals: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenations_and_string_literals_95154", "Can only convert string concatenations and string literals"),
8995
8995
  Selection_is_not_a_valid_statement_or_statements: diag(95155, 3 /* Message */, "Selection_is_not_a_valid_statement_or_statements_95155", "Selection is not a valid statement or statements"),
8996
8996
  Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
8997
8997
  Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
@@ -12936,26 +12936,6 @@ ${lanes.join("\n")}
12936
12936
  function getFullWidth(node) {
12937
12937
  return node.end - node.pos;
12938
12938
  }
12939
- function getResolvedModule(sourceFile, moduleNameText, mode) {
12940
- var _a, _b;
12941
- return (_b = (_a = sourceFile == null ? void 0 : sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleNameText, mode)) == null ? void 0 : _b.resolvedModule;
12942
- }
12943
- function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
12944
- if (!sourceFile.resolvedModules) {
12945
- sourceFile.resolvedModules = createModeAwareCache();
12946
- }
12947
- sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
12948
- }
12949
- function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective, mode) {
12950
- if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
12951
- sourceFile.resolvedTypeReferenceDirectiveNames = createModeAwareCache();
12952
- }
12953
- sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
12954
- }
12955
- function getResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, mode) {
12956
- var _a, _b;
12957
- return (_b = (_a = sourceFile == null ? void 0 : sourceFile.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(typeReferenceDirectiveName, mode)) == null ? void 0 : _b.resolvedTypeReferenceDirective;
12958
- }
12959
12939
  function projectReferenceIsEqualTo(oldRef, newRef) {
12960
12940
  return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
12961
12941
  }
@@ -12963,8 +12943,8 @@ ${lanes.join("\n")}
12963
12943
  return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId) && oldResolution.node10Result === newResolution.node10Result;
12964
12944
  }
12965
12945
  function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
12966
- var _a, _b;
12967
- const node10Result = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleReference, mode)) == null ? void 0 : _b.node10Result;
12946
+ var _a, _b, _c;
12947
+ const node10Result = (_c = (_b = (_a = host.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(moduleReference, mode)) == null ? void 0 : _c.node10Result;
12968
12948
  const result = node10Result ? chainDiagnosticMessages(
12969
12949
  /*details*/
12970
12950
  void 0,
@@ -17907,14 +17887,11 @@ ${lanes.join("\n")}
17907
17887
  (symlinkedDirectories || (symlinkedDirectories = /* @__PURE__ */ new Map())).set(symlinkPath, real);
17908
17888
  }
17909
17889
  },
17910
- setSymlinksFromResolutions(files, typeReferenceDirectives) {
17911
- var _a, _b;
17890
+ setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, typeReferenceDirectives) {
17912
17891
  Debug.assert(!hasProcessedResolutions);
17913
17892
  hasProcessedResolutions = true;
17914
- for (const file of files) {
17915
- (_a = file.resolvedModules) == null ? void 0 : _a.forEach((resolution) => processResolution(this, resolution.resolvedModule));
17916
- (_b = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _b.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
17917
- }
17893
+ resolvedModules == null ? void 0 : resolvedModules.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedModule)));
17894
+ resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective)));
17918
17895
  typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
17919
17896
  },
17920
17897
  hasProcessedResolutions: () => hasProcessedResolutions
@@ -23480,7 +23457,6 @@ ${lanes.join("\n")}
23480
23457
  node.imports = void 0;
23481
23458
  node.moduleAugmentations = void 0;
23482
23459
  node.ambientModuleNames = void 0;
23483
- node.resolvedModules = void 0;
23484
23460
  node.classifiableNames = void 0;
23485
23461
  node.impliedNodeFormat = void 0;
23486
23462
  return node;
@@ -37968,6 +37944,7 @@ ${lanes.join("\n")}
37968
37944
  node16: 100 /* Node16 */,
37969
37945
  nodenext: 199 /* NodeNext */
37970
37946
  })),
37947
+ affectsSourceFile: true,
37971
37948
  affectsModuleResolution: true,
37972
37949
  affectsEmit: true,
37973
37950
  affectsBuildInfo: true,
@@ -38404,6 +38381,7 @@ ${lanes.join("\n")}
38404
38381
  bundler: 100 /* Bundler */
38405
38382
  })),
38406
38383
  deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
38384
+ affectsSourceFile: true,
38407
38385
  affectsModuleResolution: true,
38408
38386
  paramType: Diagnostics.STRATEGY,
38409
38387
  category: Diagnostics.Modules,
@@ -38946,6 +38924,7 @@ ${lanes.join("\n")}
38946
38924
  legacy: 1 /* Legacy */,
38947
38925
  force: 3 /* Force */
38948
38926
  })),
38927
+ affectsSourceFile: true,
38949
38928
  affectsModuleResolution: true,
38950
38929
  description: Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
38951
38930
  category: Diagnostics.Language_and_Environment,
@@ -38965,7 +38944,7 @@ ${lanes.join("\n")}
38965
38944
  affectsEmitOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsEmit);
38966
38945
  affectsDeclarationPathOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsDeclarationPath);
38967
38946
  moduleResolutionOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsModuleResolution);
38968
- sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics);
38947
+ sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsBindDiagnostics);
38969
38948
  optionsAffectingProgramStructure = optionDeclarations.filter((option) => !!option.affectsProgramStructure);
38970
38949
  transpileOptionValueCompilerOptions = optionDeclarations.filter((option) => hasProperty(option, "transpileOptionValue"));
38971
38950
  optionsForBuild = [
@@ -39815,15 +39794,6 @@ ${lanes.join("\n")}
39815
39794
  return result;
39816
39795
  }
39817
39796
  }
39818
- function zipToModeAwareCache(file, keys, values, nameAndModeGetter) {
39819
- Debug.assert(keys.length === values.length);
39820
- const map2 = createModeAwareCache();
39821
- for (let i = 0; i < keys.length; ++i) {
39822
- const entry = keys[i];
39823
- map2.set(nameAndModeGetter.getName(entry), nameAndModeGetter.getMode(entry, file), values[i]);
39824
- }
39825
- return map2;
39826
- }
39827
39797
  function getOriginalOrResolvedModuleFileName(result) {
39828
39798
  return result.resolvedModule && (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
39829
39799
  }
@@ -40650,7 +40620,9 @@ ${lanes.join("\n")}
40650
40620
  extensionsToExtensionsArray(extensions),
40651
40621
  /*excludes*/
40652
40622
  void 0,
40653
- [changeAnyExtension(target.replace("*", "**/*"), getDeclarationEmitExtensionForPath(target))]
40623
+ [
40624
+ isDeclarationFileName(target) ? target.replace("*", "**/*") : changeAnyExtension(target.replace("*", "**/*"), getDeclarationEmitExtensionForPath(target))
40625
+ ]
40654
40626
  ).forEach((entry) => {
40655
40627
  entrypoints = appendIfUnique(entrypoints, {
40656
40628
  path: entry,
@@ -48779,7 +48751,7 @@ ${lanes.join("\n")}
48779
48751
  return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
48780
48752
  }
48781
48753
  function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
48782
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
48754
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
48783
48755
  if (startsWith(moduleReference, "@types/")) {
48784
48756
  const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
48785
48757
  const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
@@ -48797,7 +48769,7 @@ ${lanes.join("\n")}
48797
48769
  const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
48798
48770
  const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
48799
48771
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
48800
- const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
48772
+ const resolvedModule = (_i = (_h = (_g = host.resolvedModules) == null ? void 0 : _g.get(currentSourceFile.path)) == null ? void 0 : _h.get(moduleReference, mode)) == null ? void 0 : _i.resolvedModule;
48801
48773
  const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
48802
48774
  const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
48803
48775
  if (sourceFile) {
@@ -48805,7 +48777,7 @@ ${lanes.join("\n")}
48805
48777
  error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
48806
48778
  }
48807
48779
  if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
48808
- const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
48780
+ const importOrExport = ((_j = findAncestor(location, isImportDeclaration)) == null ? void 0 : _j.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
48809
48781
  if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
48810
48782
  error2(
48811
48783
  errorNode,
@@ -48814,7 +48786,7 @@ ${lanes.join("\n")}
48814
48786
  );
48815
48787
  }
48816
48788
  } else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
48817
- const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
48789
+ const importOrExport = ((_k = findAncestor(location, isImportDeclaration)) == null ? void 0 : _k.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
48818
48790
  if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
48819
48791
  const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
48820
48792
  error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
@@ -48835,7 +48807,7 @@ ${lanes.join("\n")}
48835
48807
  if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
48836
48808
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
48837
48809
  const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
48838
- const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_i = overrideClauseHost.assertions) == null ? void 0 : _i.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
48810
+ const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_l = overrideClauseHost.assertions) == null ? void 0 : _l.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
48839
48811
  if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
48840
48812
  if (findAncestor(location, isImportEqualsDeclaration)) {
48841
48813
  error2(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
@@ -48942,7 +48914,7 @@ ${lanes.join("\n")}
48942
48914
  error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
48943
48915
  } else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
48944
48916
  const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
48945
- const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
48917
+ const suggestedExt = (_m = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _m[1];
48946
48918
  if (suggestedExt) {
48947
48919
  error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
48948
48920
  } else {
@@ -50241,7 +50213,7 @@ ${lanes.join("\n")}
50241
50213
  }
50242
50214
  return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode));
50243
50215
  }
50244
- if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
50216
+ if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */) {
50245
50217
  const name2 = typeParameterToName(type, context);
50246
50218
  context.approximateLength += idText(name2).length;
50247
50219
  return factory.createTypeReferenceNode(
@@ -51007,36 +50979,65 @@ ${lanes.join("\n")}
51007
50979
  true
51008
50980
  )[0];
51009
50981
  let cleanup;
51010
- if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
51011
- const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0;
51012
- Debug.assertOptionalNode(existingFakeScope, isBlock);
51013
- const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
51014
- let newLocals;
51015
- for (const param of expandedParams) {
51016
- if (!locals.has(param.escapedName)) {
51017
- newLocals = append(newLocals, param.escapedName);
51018
- locals.set(param.escapedName, param);
51019
- }
51020
- }
51021
- if (newLocals) {
51022
- let removeNewLocals2 = function() {
50982
+ if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && (some(expandedParams) || some(signature.typeParameters))) {
50983
+ let pushFakeScope2 = function(kind2, addAll) {
50984
+ Debug.assert(context.enclosingDeclaration);
50985
+ let existingFakeScope;
50986
+ if (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration === kind2) {
50987
+ existingFakeScope = context.enclosingDeclaration;
50988
+ } else if (context.enclosingDeclaration.parent && getNodeLinks(context.enclosingDeclaration.parent).fakeScopeForSignatureDeclaration === kind2) {
50989
+ existingFakeScope = context.enclosingDeclaration.parent;
50990
+ }
50991
+ Debug.assertOptionalNode(existingFakeScope, isBlock);
50992
+ const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
50993
+ let newLocals;
50994
+ addAll((name, symbol) => {
50995
+ if (!locals.has(name)) {
50996
+ newLocals = append(newLocals, name);
50997
+ locals.set(name, symbol);
50998
+ }
50999
+ });
51000
+ if (!newLocals)
51001
+ return;
51002
+ const oldCleanup = cleanup;
51003
+ function undo() {
51023
51004
  forEach(newLocals, (s) => locals.delete(s));
51024
- };
51025
- var removeNewLocals = removeNewLocals2;
51005
+ oldCleanup == null ? void 0 : oldCleanup();
51006
+ }
51026
51007
  if (existingFakeScope) {
51027
- cleanup = removeNewLocals2;
51008
+ cleanup = undo;
51028
51009
  } else {
51029
51010
  const fakeScope = parseNodeFactory.createBlock(emptyArray);
51030
- getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
51011
+ getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = kind2;
51031
51012
  fakeScope.locals = locals;
51032
51013
  const saveEnclosingDeclaration = context.enclosingDeclaration;
51033
51014
  setParent(fakeScope, saveEnclosingDeclaration);
51034
51015
  context.enclosingDeclaration = fakeScope;
51035
51016
  cleanup = () => {
51036
51017
  context.enclosingDeclaration = saveEnclosingDeclaration;
51037
- removeNewLocals2();
51018
+ undo();
51038
51019
  };
51039
51020
  }
51021
+ };
51022
+ var pushFakeScope = pushFakeScope2;
51023
+ pushFakeScope2(
51024
+ "params",
51025
+ (add) => {
51026
+ for (const param of expandedParams) {
51027
+ add(param.escapedName, param);
51028
+ }
51029
+ }
51030
+ );
51031
+ if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
51032
+ pushFakeScope2(
51033
+ "typeParams",
51034
+ (add) => {
51035
+ for (const typeParam of signature.typeParameters ?? emptyArray) {
51036
+ const typeParamName = typeParameterToName(typeParam, context).escapedText;
51037
+ add(typeParamName, typeParam.symbol);
51038
+ }
51039
+ }
51040
+ );
51040
51041
  }
51041
51042
  }
51042
51043
  const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
@@ -51580,7 +51581,7 @@ ${lanes.join("\n")}
51580
51581
  return identifier;
51581
51582
  }
51582
51583
  }
51583
- function typeParameterShadowsNameInScope(escapedName, context, type) {
51584
+ function typeParameterShadowsOtherTypeParameterInScope(escapedName, context, type) {
51584
51585
  const result = resolveName(
51585
51586
  context.enclosingDeclaration,
51586
51587
  escapedName,
@@ -51591,11 +51592,8 @@ ${lanes.join("\n")}
51591
51592
  /*isUse*/
51592
51593
  false
51593
51594
  );
51594
- if (result) {
51595
- if (result.flags & 262144 /* TypeParameter */ && result === type.symbol) {
51596
- return false;
51597
- }
51598
- return true;
51595
+ if (result && result.flags & 262144 /* TypeParameter */) {
51596
+ return result !== type.symbol;
51599
51597
  }
51600
51598
  return false;
51601
51599
  }
@@ -51621,7 +51619,7 @@ ${lanes.join("\n")}
51621
51619
  const rawtext = result.escapedText;
51622
51620
  let i = ((_a = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _a.get(rawtext)) || 0;
51623
51621
  let text = rawtext;
51624
- while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsNameInScope(text, context, type)) {
51622
+ while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
51625
51623
  i++;
51626
51624
  text = `${rawtext}_${i}`;
51627
51625
  }
@@ -51632,7 +51630,7 @@ ${lanes.join("\n")}
51632
51630
  }
51633
51631
  (context.typeParameterNamesByTextNextNameCount || (context.typeParameterNamesByTextNextNameCount = /* @__PURE__ */ new Map())).set(rawtext, i);
51634
51632
  (context.typeParameterNames || (context.typeParameterNames = /* @__PURE__ */ new Map())).set(getTypeId(type), result);
51635
- (context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(rawtext);
51633
+ (context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(text);
51636
51634
  }
51637
51635
  return result;
51638
51636
  }
@@ -51777,7 +51775,10 @@ ${lanes.join("\n")}
51777
51775
  return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
51778
51776
  }
51779
51777
  function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
51780
- return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
51778
+ while (getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration) {
51779
+ enclosingDeclaration = enclosingDeclaration.parent;
51780
+ }
51781
+ return enclosingDeclaration;
51781
51782
  }
51782
51783
  function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
51783
51784
  if (!isErrorType(type) && enclosingDeclaration) {
@@ -51857,7 +51858,7 @@ ${lanes.join("\n")}
51857
51858
  }
51858
51859
  if (isIdentifier(node)) {
51859
51860
  const type = getDeclaredTypeOfSymbol(sym);
51860
- const name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : factory.cloneNode(node);
51861
+ const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node);
51861
51862
  name.symbol = sym;
51862
51863
  return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
51863
51864
  }
@@ -55700,7 +55701,28 @@ ${lanes.join("\n")}
55700
55701
  }
55701
55702
  }
55702
55703
  }
55703
- links[resolutionKind] = combineSymbolTables(earlySymbols, lateSymbols) || emptySymbols;
55704
+ let resolved = combineSymbolTables(earlySymbols, lateSymbols);
55705
+ if (symbol.flags & 33554432 /* Transient */ && links.cjsExportMerged && symbol.declarations) {
55706
+ for (const decl of symbol.declarations) {
55707
+ const original = getSymbolLinks(decl.symbol)[resolutionKind];
55708
+ if (!resolved) {
55709
+ resolved = original;
55710
+ continue;
55711
+ }
55712
+ if (!original)
55713
+ continue;
55714
+ original.forEach((s, name) => {
55715
+ const existing = resolved.get(name);
55716
+ if (!existing)
55717
+ resolved.set(name, s);
55718
+ else if (existing === s)
55719
+ return;
55720
+ else
55721
+ resolved.set(name, mergeSymbol(existing, s));
55722
+ });
55723
+ }
55724
+ }
55725
+ links[resolutionKind] = resolved || emptySymbols;
55704
55726
  }
55705
55727
  return links[resolutionKind];
55706
55728
  }
@@ -66526,13 +66548,10 @@ ${lanes.join("\n")}
66526
66548
  if (sourceNameType && targetNameType)
66527
66549
  inferFromTypes(sourceNameType, targetNameType);
66528
66550
  }
66529
- if (getObjectFlags(target) & 32 /* Mapped */) {
66530
- const mappedType = target;
66531
- if (!getNameTypeFromMappedType(mappedType) || isFilteringMappedType(mappedType)) {
66532
- const constraintType = getConstraintTypeFromMappedType(mappedType);
66533
- if (inferToMappedType(source, mappedType, constraintType)) {
66534
- return;
66535
- }
66551
+ if (getObjectFlags(target) & 32 /* Mapped */ && !target.declaration.nameType) {
66552
+ const constraintType = getConstraintTypeFromMappedType(target);
66553
+ if (inferToMappedType(source, target, constraintType)) {
66554
+ return;
66536
66555
  }
66537
66556
  }
66538
66557
  if (!typesDefinitelyUnrelated(source, target)) {
@@ -118412,15 +118431,15 @@ ${lanes.join("\n")}
118412
118431
  function isReferenceFileLocation(location) {
118413
118432
  return location.pos !== void 0;
118414
118433
  }
118415
- function getReferencedFileLocation(getSourceFileByPath, ref) {
118416
- var _a, _b, _c, _d, _e, _f;
118417
- const file = Debug.checkDefined(getSourceFileByPath(ref.file));
118434
+ function getReferencedFileLocation(program, ref) {
118435
+ var _a, _b, _c, _d, _e, _f, _g, _h;
118436
+ const file = Debug.checkDefined(program.getSourceFileByPath(ref.file));
118418
118437
  const { kind, index } = ref;
118419
118438
  let pos, end, packageId, resolutionMode;
118420
118439
  switch (kind) {
118421
118440
  case 3 /* Import */:
118422
118441
  const importLiteral = getModuleNameStringLiteralAt(file, index);
118423
- 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;
118442
+ 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;
118424
118443
  if (importLiteral.pos === -1)
118425
118444
  return { file, packageId, text: importLiteral.text };
118426
118445
  pos = skipTrivia(file.text, importLiteral.pos);
@@ -118431,7 +118450,7 @@ ${lanes.join("\n")}
118431
118450
  break;
118432
118451
  case 5 /* TypeReferenceDirective */:
118433
118452
  ({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
118434
- 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;
118453
+ 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;
118435
118454
  break;
118436
118455
  case 7 /* LibReferenceDirective */:
118437
118456
  ({ pos, end } = file.libReferenceDirectives[index]);
@@ -118552,6 +118571,10 @@ ${lanes.join("\n")}
118552
118571
  let automaticTypeDirectiveResolutions;
118553
118572
  let resolvedLibReferences;
118554
118573
  let resolvedLibProcessing;
118574
+ let resolvedModules;
118575
+ let resolvedModulesProcessing;
118576
+ let resolvedTypeReferenceDirectiveNames;
118577
+ let resolvedTypeReferenceDirectiveNamesProcessing;
118555
118578
  let packageMap;
118556
118579
  const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
118557
118580
  let currentNodeModulesDepth = 0;
@@ -118816,6 +118839,8 @@ ${lanes.join("\n")}
118816
118839
  }
118817
118840
  oldProgram = void 0;
118818
118841
  resolvedLibProcessing = void 0;
118842
+ resolvedModulesProcessing = void 0;
118843
+ resolvedTypeReferenceDirectiveNamesProcessing = void 0;
118819
118844
  const program = {
118820
118845
  getRootFileNames: () => rootNames,
118821
118846
  getSourceFile,
@@ -118857,6 +118882,8 @@ ${lanes.join("\n")}
118857
118882
  sourceFileToPackageName,
118858
118883
  redirectTargetsMap,
118859
118884
  usesUriStyleNodeCoreModules,
118885
+ resolvedModules,
118886
+ resolvedTypeReferenceDirectiveNames,
118860
118887
  resolvedLibReferences,
118861
118888
  getCurrentPackagesMap: () => packageMap,
118862
118889
  typesPackageExists,
@@ -118888,7 +118915,7 @@ ${lanes.join("\n")}
118888
118915
  case 1 /* FilePreprocessingFileExplainingDiagnostic */:
118889
118916
  return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray));
118890
118917
  case 0 /* FilePreprocessingReferencedDiagnostic */:
118891
- const { file, pos, end } = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason);
118918
+ const { file, pos, end } = getReferencedFileLocation(program, diagnostic.reason);
118892
118919
  return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
118893
118920
  case 2 /* ResolutionDiagnostics */:
118894
118921
  return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
@@ -118905,14 +118932,15 @@ ${lanes.join("\n")}
118905
118932
  if (packageMap)
118906
118933
  return packageMap;
118907
118934
  packageMap = /* @__PURE__ */ new Map();
118908
- files.forEach((sf) => {
118909
- if (!sf.resolvedModules)
118910
- return;
118911
- sf.resolvedModules.forEach(({ resolvedModule }) => {
118912
- if (resolvedModule == null ? void 0 : resolvedModule.packageId)
118913
- packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
118914
- });
118915
- });
118935
+ files.forEach(
118936
+ (sf) => {
118937
+ var _a2;
118938
+ return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(sf.path)) == null ? void 0 : _a2.forEach(({ resolvedModule }) => {
118939
+ if (resolvedModule == null ? void 0 : resolvedModule.packageId)
118940
+ packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
118941
+ });
118942
+ }
118943
+ );
118916
118944
  return packageMap;
118917
118945
  }
118918
118946
  function typesPackageExists(packageName) {
@@ -119044,7 +119072,7 @@ ${lanes.join("\n")}
119044
119072
  return classifiableNames;
119045
119073
  }
119046
119074
  function resolveModuleNamesReusingOldState(moduleNames, file) {
119047
- var _a2;
119075
+ var _a2, _b2;
119048
119076
  if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
119049
119077
  return resolveModuleNamesWorker(
119050
119078
  moduleNames,
@@ -119053,24 +119081,16 @@ ${lanes.join("\n")}
119053
119081
  void 0
119054
119082
  );
119055
119083
  }
119056
- const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
119057
- if (oldSourceFile !== file && file.resolvedModules) {
119058
- const result2 = [];
119059
- for (const moduleName of moduleNames) {
119060
- const resolvedModule = file.resolvedModules.get(moduleName.text, getModeForUsageLocation(file, moduleName));
119061
- result2.push(resolvedModule);
119062
- }
119063
- return result2;
119064
- }
119065
119084
  let unknownModuleNames;
119066
119085
  let result;
119067
119086
  let reusedNames;
119068
119087
  const predictedToResolveToAmbientModuleMarker = emptyResolution;
119088
+ const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
119069
119089
  for (let i = 0; i < moduleNames.length; i++) {
119070
119090
  const moduleName = moduleNames[i];
119071
- if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) {
119091
+ if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
119072
119092
  const mode = getModeForUsageLocation(file, moduleName);
119073
- const oldResolution = (_a2 = oldSourceFile.resolvedModules) == null ? void 0 : _a2.get(moduleName.text, mode);
119093
+ 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);
119074
119094
  if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
119075
119095
  if (isTraceEnabled(options, host)) {
119076
119096
  trace(
@@ -119117,7 +119137,8 @@ ${lanes.join("\n")}
119117
119137
  Debug.assert(j === resolutions.length);
119118
119138
  return result;
119119
119139
  function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
119120
- const resolutionToFile = getResolvedModule(oldSourceFile, moduleName.text, getModeForUsageLocation(file, moduleName));
119140
+ var _a3, _b3, _c2;
119141
+ 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;
119121
119142
  const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
119122
119143
  if (resolutionToFile && resolvedFile) {
119123
119144
  return false;
@@ -119133,7 +119154,7 @@ ${lanes.join("\n")}
119133
119154
  }
119134
119155
  }
119135
119156
  function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
119136
- var _a2;
119157
+ var _a2, _b2;
119137
119158
  if (structureIsReused === 0 /* Not */) {
119138
119159
  return resolveTypeReferenceDirectiveNamesWorker(
119139
119160
  typeDirectiveNames,
@@ -119142,28 +119163,18 @@ ${lanes.join("\n")}
119142
119163
  void 0
119143
119164
  );
119144
119165
  }
119145
- const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
119146
- if (!isString(containingFile)) {
119147
- if (oldSourceFile !== containingFile && containingFile.resolvedTypeReferenceDirectiveNames) {
119148
- const result2 = [];
119149
- for (const typeDirectiveName of typeDirectiveNames) {
119150
- const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getTypeReferenceResolutionName(typeDirectiveName), getModeForFileReference(typeDirectiveName, containingFile.impliedNodeFormat));
119151
- result2.push(resolvedTypeReferenceDirective);
119152
- }
119153
- return result2;
119154
- }
119155
- }
119156
119166
  let unknownTypeReferenceDirectiveNames;
119157
119167
  let result;
119158
119168
  let reusedNames;
119159
119169
  const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
119160
- const canReuseResolutions = !isString(containingFile) ? containingFile === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path) : !hasInvalidatedResolutions(toPath3(containingFile));
119170
+ const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
119171
+ const canReuseResolutions = !isString(containingFile) ? containingFile === oldSourceFile && !hasInvalidatedResolutions(containingFile.path) : !hasInvalidatedResolutions(toPath3(containingFile));
119161
119172
  for (let i = 0; i < typeDirectiveNames.length; i++) {
119162
119173
  const entry = typeDirectiveNames[i];
119163
119174
  if (canReuseResolutions) {
119164
119175
  const typeDirectiveName = getTypeReferenceResolutionName(entry);
119165
119176
  const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
119166
- const oldResolution = (_a2 = !isString(containingFile) ? oldSourceFile == null ? void 0 : oldSourceFile.resolvedTypeReferenceDirectiveNames : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a2.get(typeDirectiveName, mode);
119177
+ 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);
119167
119178
  if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
119168
119179
  if (isTraceEnabled(options, host)) {
119169
119180
  trace(
@@ -119223,7 +119234,7 @@ ${lanes.join("\n")}
119223
119234
  );
119224
119235
  }
119225
119236
  function tryReuseStructureFromOldProgram() {
119226
- var _a2;
119237
+ var _a2, _b2, _c2;
119227
119238
  if (!oldProgram) {
119228
119239
  return 0 /* Not */;
119229
119240
  }
@@ -119325,42 +119336,37 @@ ${lanes.join("\n")}
119325
119336
  structureIsReused = 1 /* SafeModules */;
119326
119337
  }
119327
119338
  }
119328
- modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
119339
+ modifiedSourceFiles.push(newSourceFile);
119329
119340
  } else if (hasInvalidatedResolutions(oldSourceFile.path)) {
119330
119341
  structureIsReused = 1 /* SafeModules */;
119331
- modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
119342
+ modifiedSourceFiles.push(newSourceFile);
119343
+ } else {
119344
+ for (const moduleName of oldSourceFile.ambientModuleNames) {
119345
+ ambientModuleNameToUnmodifiedFileName.set(moduleName, oldSourceFile.fileName);
119346
+ }
119332
119347
  }
119333
119348
  newSourceFiles.push(newSourceFile);
119334
119349
  }
119335
119350
  if (structureIsReused !== 2 /* Completely */) {
119336
119351
  return structureIsReused;
119337
119352
  }
119338
- const modifiedFiles = modifiedSourceFiles.map((f) => f.oldFile);
119339
- for (const oldFile of oldSourceFiles) {
119340
- if (!contains(modifiedFiles, oldFile)) {
119341
- for (const moduleName of oldFile.ambientModuleNames) {
119342
- ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
119343
- }
119344
- }
119345
- }
119346
- for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
119353
+ for (const newSourceFile of modifiedSourceFiles) {
119347
119354
  const moduleNames = getModuleNames(newSourceFile);
119348
119355
  const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
119349
- const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
119350
- if (resolutionsChanged) {
119356
+ (resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
119357
+ const oldResolutions = (_b2 = oldProgram.resolvedModules) == null ? void 0 : _b2.get(newSourceFile.path);
119358
+ const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldResolutions, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
119359
+ if (resolutionsChanged)
119351
119360
  structureIsReused = 1 /* SafeModules */;
119352
- newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions, moduleResolutionNameAndModeGetter);
119353
- } else {
119354
- newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
119355
- }
119356
119361
  const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
119357
119362
  const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
119358
- const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
119363
+ (resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
119364
+ const oldTypeResolutions = (_c2 = oldProgram.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _c2.get(newSourceFile.path);
119365
+ const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldTypeResolutions, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
119359
119366
  if (typeReferenceResolutionsChanged) {
119360
119367
  structureIsReused = 1 /* SafeModules */;
119361
- newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions, typeReferenceResolutionNameAndModeGetter);
119362
- } else {
119363
- newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
119368
+ } else if (oldTypeResolutions) {
119369
+ (resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, oldTypeResolutions);
119364
119370
  }
119365
119371
  }
119366
119372
  if (structureIsReused !== 2 /* Completely */) {
@@ -119408,6 +119414,8 @@ ${lanes.join("\n")}
119408
119414
  sourceFileToPackageName = oldProgram.sourceFileToPackageName;
119409
119415
  redirectTargetsMap = oldProgram.redirectTargetsMap;
119410
119416
  usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
119417
+ resolvedModules = oldProgram.resolvedModules;
119418
+ resolvedTypeReferenceDirectiveNames = oldProgram.resolvedTypeReferenceDirectiveNames;
119411
119419
  resolvedLibReferences = oldProgram.resolvedLibReferences;
119412
119420
  packageMap = oldProgram.getCurrentPackagesMap();
119413
119421
  return 2 /* Completely */;
@@ -120453,16 +120461,16 @@ ${lanes.join("\n")}
120453
120461
  }
120454
120462
  function processTypeReferenceDirectives(file) {
120455
120463
  const typeDirectives = file.typeReferenceDirectives;
120456
- if (!typeDirectives.length) {
120457
- file.resolvedTypeReferenceDirectiveNames = void 0;
120464
+ if (!typeDirectives.length)
120458
120465
  return;
120459
- }
120460
- const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
120466
+ const resolutions = (resolvedTypeReferenceDirectiveNamesProcessing == null ? void 0 : resolvedTypeReferenceDirectiveNamesProcessing.get(file.path)) || resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
120467
+ const resolutionsInFile = createModeAwareCache();
120468
+ (resolvedTypeReferenceDirectiveNames ?? (resolvedTypeReferenceDirectiveNames = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
120461
120469
  for (let index = 0; index < typeDirectives.length; index++) {
120462
120470
  const ref = file.typeReferenceDirectives[index];
120463
120471
  const resolvedTypeReferenceDirective = resolutions[index];
120464
120472
  const fileName = toFileNameLowerCase(ref.fileName);
120465
- setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective, getModeForFileReference(ref, file.impliedNodeFormat));
120473
+ resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
120466
120474
  const mode = ref.resolutionMode || file.impliedNodeFormat;
120467
120475
  if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
120468
120476
  (fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({
@@ -120626,14 +120634,16 @@ ${lanes.join("\n")}
120626
120634
  collectExternalModuleReferences(file);
120627
120635
  if (file.imports.length || file.moduleAugmentations.length) {
120628
120636
  const moduleNames = getModuleNames(file);
120629
- const resolutions = resolveModuleNamesReusingOldState(moduleNames, file);
120637
+ const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
120630
120638
  Debug.assert(resolutions.length === moduleNames.length);
120631
120639
  const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options : void 0) || options;
120640
+ const resolutionsInFile = createModeAwareCache();
120641
+ (resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
120632
120642
  for (let index = 0; index < moduleNames.length; index++) {
120633
120643
  const resolution = resolutions[index].resolvedModule;
120634
120644
  const moduleName = moduleNames[index].text;
120635
120645
  const mode = getModeForUsageLocation(file, moduleNames[index]);
120636
- setResolvedModule(file, moduleName, resolutions[index], mode);
120646
+ resolutionsInFile.set(moduleName, mode, resolutions[index]);
120637
120647
  addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
120638
120648
  if (!resolution) {
120639
120649
  continue;
@@ -120664,8 +120674,6 @@ ${lanes.join("\n")}
120664
120674
  currentNodeModulesDepth--;
120665
120675
  }
120666
120676
  }
120667
- } else {
120668
- file.resolvedModules = void 0;
120669
120677
  }
120670
120678
  }
120671
120679
  function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {
@@ -121180,7 +121188,7 @@ ${lanes.join("\n")}
121180
121188
  processReason(fileProcessingReason);
121181
121189
  if (locationReason && (fileIncludeReasons == null ? void 0 : fileIncludeReasons.length) === 1)
121182
121190
  fileIncludeReasons = void 0;
121183
- const location = locationReason && getReferencedFileLocation(getSourceFileByPath, locationReason);
121191
+ const location = locationReason && getReferencedFileLocation(program, locationReason);
121184
121192
  const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
121185
121193
  const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
121186
121194
  const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
@@ -121216,7 +121224,7 @@ ${lanes.join("\n")}
121216
121224
  }
121217
121225
  function fileIncludeReasonToRelatedInformation(reason) {
121218
121226
  if (isReferencedFile(reason)) {
121219
- const referenceLocation = getReferencedFileLocation(getSourceFileByPath, reason);
121227
+ const referenceLocation = getReferencedFileLocation(program, reason);
121220
121228
  let message2;
121221
121229
  switch (reason.kind) {
121222
121230
  case 3 /* Import */:
@@ -121505,8 +121513,8 @@ ${lanes.join("\n")}
121505
121513
  if (!symlinks) {
121506
121514
  symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
121507
121515
  }
121508
- if (files && automaticTypeDirectiveResolutions && !symlinks.hasProcessedResolutions()) {
121509
- symlinks.setSymlinksFromResolutions(files, automaticTypeDirectiveResolutions);
121516
+ if (files && !symlinks.hasProcessedResolutions()) {
121517
+ symlinks.setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, automaticTypeDirectiveResolutions);
121510
121518
  }
121511
121519
  return symlinks;
121512
121520
  }
@@ -122011,6 +122019,7 @@ ${lanes.join("\n")}
122011
122019
  return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
122012
122020
  }
122013
122021
  function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
122022
+ var _a;
122014
122023
  let referencedFiles;
122015
122024
  if (sourceFile.imports && sourceFile.imports.length > 0) {
122016
122025
  const checker = program.getTypeChecker();
@@ -122026,8 +122035,9 @@ ${lanes.join("\n")}
122026
122035
  addReferencedFile(referencedPath);
122027
122036
  }
122028
122037
  }
122029
- if (sourceFile.resolvedTypeReferenceDirectiveNames) {
122030
- sourceFile.resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
122038
+ const resolvedTypeReferenceDirectiveNames = (_a = program.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(sourceFile.path);
122039
+ if (resolvedTypeReferenceDirectiveNames) {
122040
+ resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
122031
122041
  if (!resolvedTypeReferenceDirective) {
122032
122042
  return;
122033
122043
  }
@@ -123865,10 +123875,10 @@ ${lanes.join("\n")}
123865
123875
  clear: clear2,
123866
123876
  onChangesAffectModuleResolution
123867
123877
  };
123868
- function getResolvedModule2(resolution) {
123878
+ function getResolvedModule(resolution) {
123869
123879
  return resolution.resolvedModule;
123870
123880
  }
123871
- function getResolvedTypeReferenceDirective2(resolution) {
123881
+ function getResolvedTypeReferenceDirective(resolution) {
123872
123882
  return resolution.resolvedTypeReferenceDirective;
123873
123883
  }
123874
123884
  function clear2() {
@@ -123944,7 +123954,7 @@ ${lanes.join("\n")}
123944
123954
  stopWatchFailedLookupLocationOfResolution(
123945
123955
  resolution,
123946
123956
  resolutionHost.toPath(getInferredLibraryNameResolveFrom(newProgram.getCompilerOptions(), getCurrentDirectory(), libFileName)),
123947
- getResolvedModule2
123957
+ getResolvedModule
123948
123958
  );
123949
123959
  resolvedLibraries.delete(libFileName);
123950
123960
  }
@@ -124150,7 +124160,7 @@ ${lanes.join("\n")}
124150
124160
  ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost,
124151
124161
  typeReferenceDirectiveResolutionCache
124152
124162
  ),
124153
- getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective2,
124163
+ getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
124154
124164
  shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
124155
124165
  deferWatchingNonRelativeResolution: false
124156
124166
  });
@@ -124169,7 +124179,7 @@ ${lanes.join("\n")}
124169
124179
  redirectedReference,
124170
124180
  options
124171
124181
  ),
124172
- getResolutionWithResolvedFileName: getResolvedModule2,
124182
+ getResolutionWithResolvedFileName: getResolvedModule,
124173
124183
  shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
124174
124184
  logChanges: logChangesWhenResolvingModule,
124175
124185
  deferWatchingNonRelativeResolution: true
@@ -124188,17 +124198,17 @@ ${lanes.join("\n")}
124188
124198
  libraryName,
124189
124199
  resolution,
124190
124200
  path,
124191
- getResolvedModule2,
124201
+ getResolvedModule,
124192
124202
  /*deferWatchingNonRelativeResolution*/
124193
124203
  false
124194
124204
  );
124195
124205
  resolvedLibraries.set(libFileName, resolution);
124196
124206
  if (existingResolution) {
124197
- stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule2);
124207
+ stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule);
124198
124208
  }
124199
124209
  } else {
124200
124210
  if (isTraceEnabled(options, host)) {
124201
- const resolved = getResolvedModule2(resolution);
124211
+ const resolved = getResolvedModule(resolution);
124202
124212
  trace(
124203
124213
  host,
124204
124214
  (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,
@@ -124475,8 +124485,8 @@ ${lanes.join("\n")}
124475
124485
  resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
124476
124486
  }
124477
124487
  function removeResolutionsOfFile(filePath) {
124478
- removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule2);
124479
- removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective2);
124488
+ removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
124489
+ removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
124480
124490
  }
124481
124491
  function invalidateResolutions(resolutions, canInvalidate) {
124482
124492
  if (!resolutions)
@@ -124899,7 +124909,7 @@ ${lanes.join("\n")}
124899
124909
  var _a, _b;
124900
124910
  const options = program.getCompilerOptions();
124901
124911
  if (isReferencedFile(reason)) {
124902
- const referenceLocation = getReferencedFileLocation((path) => program.getSourceFileByPath(path), reason);
124912
+ const referenceLocation = getReferencedFileLocation(program, reason);
124903
124913
  const referenceText = isReferenceFileLocation(referenceLocation) ? referenceLocation.file.text.substring(referenceLocation.pos, referenceLocation.end) : `"${referenceLocation.text}"`;
124904
124914
  let message;
124905
124915
  Debug.assert(isReferenceFileLocation(referenceLocation) || reason.kind === 3 /* Import */, "Only synthetic references are imports");
@@ -133784,14 +133794,14 @@ ${lanes.join("\n")}
133784
133794
  return ensurePathIsNonModuleName(combineNormal(pathA, pathB));
133785
133795
  }
133786
133796
  function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) {
133787
- var _a;
133797
+ var _a, _b;
133788
133798
  if (importedModuleSymbol) {
133789
133799
  const oldFileName = find(importedModuleSymbol.declarations, isSourceFile).fileName;
133790
133800
  const newFileName = oldToNew(oldFileName);
133791
133801
  return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true };
133792
133802
  } else {
133793
133803
  const mode = getModeForUsageLocation(importingSourceFile, importLiteral);
133794
- 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);
133804
+ 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);
133795
133805
  return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
133796
133806
  }
133797
133807
  }
@@ -134711,6 +134721,7 @@ ${lanes.join("\n")}
134711
134721
 
134712
134722
  // src/services/suggestionDiagnostics.ts
134713
134723
  function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
134724
+ var _a, _b, _c;
134714
134725
  program.getSemanticDiagnostics(sourceFile, cancellationToken);
134715
134726
  const diags = [];
134716
134727
  const checker = program.getTypeChecker();
@@ -134727,7 +134738,7 @@ ${lanes.join("\n")}
134727
134738
  const name = importNameForConvertToDefaultImport(importNode);
134728
134739
  if (!name)
134729
134740
  continue;
134730
- const module2 = getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier));
134741
+ 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;
134731
134742
  const resolvedFile = module2 && program.getSourceFile(module2.resolvedFileName);
134732
134743
  if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
134733
134744
  diags.push(createDiagnosticForNode(name, Diagnostics.Import_may_be_converted_to_a_default_import));
@@ -137143,10 +137154,10 @@ ${lanes.join("\n")}
137143
137154
  const targetSourceFile = program.getSourceFile(targetFile);
137144
137155
  for (const oldStatement of oldFile.statements) {
137145
137156
  forEachImportInStatement(oldStatement, (i) => {
137146
- var _a, _b;
137157
+ var _a, _b, _c;
137147
137158
  const moduleSpecifier = moduleSpecifierFromImport(i);
137148
- const resolved = (_a = oldFile.resolvedModules) == null ? void 0 : _a.get(moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
137149
- const fileName = (_b = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _b.resolvedFileName;
137159
+ const resolved = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(oldFile.path)) == null ? void 0 : _b.get(moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
137160
+ const fileName = (_c = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _c.resolvedFileName;
137150
137161
  if (fileName && targetSourceFile) {
137151
137162
  const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.path, fileName, createModuleSpecifierResolutionHost(program, host));
137152
137163
  append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
@@ -139154,12 +139165,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139154
139165
  const { file, startPosition } = context;
139155
139166
  const node = getNodeOrParentOfParentheses(file, startPosition);
139156
139167
  const maybeBinary = getParentBinaryExpression(node);
139168
+ const nodeIsStringLiteral = isStringLiteral(maybeBinary);
139157
139169
  const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
139158
- if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
139170
+ if (nodeIsStringLiteral && context.triggerReason !== "invoked") {
139171
+ return emptyArray;
139172
+ }
139173
+ if (isExpressionNode(maybeBinary) && (nodeIsStringLiteral || isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation)) {
139159
139174
  refactorInfo.actions.push(convertStringAction);
139160
139175
  return [refactorInfo];
139161
139176
  } else if (context.preferences.provideRefactorNotApplicableReason) {
139162
- refactorInfo.actions.push({ ...convertStringAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenation) });
139177
+ refactorInfo.actions.push({ ...convertStringAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenations_and_string_literals) });
139163
139178
  return [refactorInfo];
139164
139179
  }
139165
139180
  return emptyArray;
@@ -147761,9 +147776,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
147761
147776
  });
147762
147777
 
147763
147778
  // src/services/codefixes/convertToEsModule.ts
147764
- function fixImportOfModuleExports(importingFile, exportingFile, changes, quotePreference) {
147779
+ function fixImportOfModuleExports(importingFile, exportingFile, program, changes, quotePreference) {
147780
+ var _a, _b, _c;
147765
147781
  for (const moduleSpecifier of importingFile.imports) {
147766
- const imported = getResolvedModule(importingFile, moduleSpecifier.text, getModeForUsageLocation(importingFile, moduleSpecifier));
147782
+ 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;
147767
147783
  if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
147768
147784
  continue;
147769
147785
  }
@@ -148291,7 +148307,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
148291
148307
  const moduleExportsChangedToDefault = convertFileToEsModule(sourceFile, program.getTypeChecker(), changes2, getEmitScriptTarget(program.getCompilerOptions()), getQuotePreference(sourceFile, preferences));
148292
148308
  if (moduleExportsChangedToDefault) {
148293
148309
  for (const importingFile of program.getSourceFiles()) {
148294
- fixImportOfModuleExports(importingFile, sourceFile, changes2, getQuotePreference(importingFile, preferences));
148310
+ fixImportOfModuleExports(importingFile, sourceFile, program, changes2, getQuotePreference(importingFile, preferences));
148295
148311
  }
148296
148312
  }
148297
148313
  });
@@ -149180,7 +149196,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149180
149196
  }
149181
149197
  }
149182
149198
  function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
149183
- const compilerOptions = program.getCompilerOptions();
149184
149199
  let exportInfos;
149185
149200
  if (exportMapKey) {
149186
149201
  exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
@@ -149201,7 +149216,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149201
149216
  fix,
149202
149217
  /*includeSymbolNameInDescription*/
149203
149218
  false,
149204
- compilerOptions,
149219
+ program,
149205
149220
  preferences
149206
149221
  ))
149207
149222
  };
@@ -149211,7 +149226,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149211
149226
  const symbolName2 = single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions));
149212
149227
  const fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName2, program);
149213
149228
  const includeSymbolNameInDescription = symbolName2 !== symbolToken.text;
149214
- return fix && codeFixActionToCodeAction(codeActionForFix({ host, formatContext, preferences }, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences));
149229
+ return fix && codeFixActionToCodeAction(codeActionForFix(
149230
+ { host, formatContext, preferences },
149231
+ sourceFile,
149232
+ symbolName2,
149233
+ fix,
149234
+ includeSymbolNameInDescription,
149235
+ program,
149236
+ preferences
149237
+ ));
149215
149238
  }
149216
149239
  function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
149217
149240
  const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
@@ -149781,14 +149804,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149781
149804
  }
149782
149805
  return allowSyntheticDefaults ? 1 /* Default */ : 3 /* CommonJS */;
149783
149806
  }
149784
- function codeActionForFix(context, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences) {
149807
+ function codeActionForFix(context, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences) {
149785
149808
  let diag2;
149786
149809
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
149787
- diag2 = codeActionForFixWorker(tracker, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences);
149810
+ diag2 = codeActionForFixWorker(tracker, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences);
149788
149811
  });
149789
149812
  return createCodeFixAction(importFixName, changes, diag2, importFixId, Diagnostics.Add_all_missing_imports);
149790
149813
  }
149791
- function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSymbolNameInDescription, compilerOptions, preferences) {
149814
+ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences) {
149792
149815
  const quotePreference = getQuotePreference(sourceFile, preferences);
149793
149816
  switch (fix.kind) {
149794
149817
  case 0 /* UseNamespace */:
@@ -149825,7 +149848,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149825
149848
  defaultImport,
149826
149849
  namedImports,
149827
149850
  namespaceLikeImport,
149828
- compilerOptions
149851
+ program.getCompilerOptions()
149829
149852
  ),
149830
149853
  /*blankLineBetween*/
149831
149854
  true,
@@ -149838,7 +149861,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149838
149861
  }
149839
149862
  case 4 /* PromoteTypeOnly */: {
149840
149863
  const { typeOnlyAliasDeclaration } = fix;
149841
- const promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile, preferences);
149864
+ const promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, program, sourceFile, preferences);
149842
149865
  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)];
149843
149866
  }
149844
149867
  default:
@@ -149849,7 +149872,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149849
149872
  var _a, _b;
149850
149873
  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;
149851
149874
  }
149852
- function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile, preferences) {
149875
+ function promoteFromTypeOnly(changes, aliasDeclaration, program, sourceFile, preferences) {
149876
+ const compilerOptions = program.getCompilerOptions();
149853
149877
  const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions);
149854
149878
  switch (aliasDeclaration.kind) {
149855
149879
  case 276 /* ImportSpecifier */:
@@ -149891,10 +149915,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
149891
149915
  Debug.failBadSyntaxKind(aliasDeclaration);
149892
149916
  }
149893
149917
  function promoteImportClause(importClause) {
149918
+ var _a, _b, _c;
149894
149919
  changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
149895
149920
  if (!compilerOptions.allowImportingTsExtensions) {
149896
149921
  const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
149897
- const resolvedModule = moduleSpecifier && getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier));
149922
+ 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);
149898
149923
  if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
149899
149924
  const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
149900
149925
  changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
@@ -150188,7 +150213,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150188
150213
  fix,
150189
150214
  /*includeSymbolNameInDescription*/
150190
150215
  symbolName2 !== errorIdentifierText,
150191
- program.getCompilerOptions(),
150216
+ program,
150192
150217
  preferences
150193
150218
  )
150194
150219
  );
@@ -150601,7 +150626,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150601
150626
 
150602
150627
  // src/services/codefixes/fixImportNonExportedMember.ts
150603
150628
  function getInfo7(sourceFile, pos, program) {
150604
- var _a;
150629
+ var _a, _b, _c, _d;
150605
150630
  const token = getTokenAtPosition(sourceFile, pos);
150606
150631
  if (isIdentifier(token)) {
150607
150632
  const importDeclaration = findAncestor(token, isImportDeclaration);
@@ -150610,19 +150635,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150610
150635
  const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : void 0;
150611
150636
  if (moduleSpecifier === void 0)
150612
150637
  return void 0;
150613
- const resolvedModule = getResolvedModule(
150614
- sourceFile,
150638
+ const resolvedModule = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(
150615
150639
  moduleSpecifier,
150616
150640
  /*mode*/
150617
150641
  void 0
150618
- );
150642
+ )) == null ? void 0 : _c.resolvedModule;
150619
150643
  if (resolvedModule === void 0)
150620
150644
  return void 0;
150621
150645
  const moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
150622
150646
  if (moduleSourceFile === void 0 || isSourceFileFromLibrary(program, moduleSourceFile))
150623
150647
  return void 0;
150624
150648
  const moduleSymbol = moduleSourceFile.symbol;
150625
- const locals = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals;
150649
+ const locals = (_d = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _d.locals;
150626
150650
  if (locals === void 0)
150627
150651
  return void 0;
150628
150652
  const localSymbol = locals.get(token.escapedText);
@@ -150912,9 +150936,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
150912
150936
  return flags;
150913
150937
  }
150914
150938
  function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) {
150939
+ var _a, _b, _c;
150915
150940
  if (!importDeclaration || !isStringLiteralLike(importDeclaration.moduleSpecifier))
150916
150941
  return void 0;
150917
- const resolvedModule = getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text, getModeForUsageLocation(sourceFile, importDeclaration.moduleSpecifier));
150942
+ 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;
150918
150943
  if (!resolvedModule)
150919
150944
  return void 0;
150920
150945
  return context.program.getSourceFile(resolvedModule.resolvedFileName);
@@ -162226,7 +162251,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162226
162251
  })(FindReferencesUse || {});
162227
162252
  ((Core2) => {
162228
162253
  function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options = {}, sourceFilesSet = new Set(sourceFiles.map((f) => f.fileName))) {
162229
- var _a, _b, _c;
162254
+ var _a, _b, _c, _d;
162230
162255
  node = getAdjustedNode2(node, options);
162231
162256
  if (isSourceFile(node)) {
162232
162257
  const resolvedRef = ts_GoToDefinition_exports.getReferenceAtPosition(node, position, program);
@@ -162265,7 +162290,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162265
162290
  if (!options.implementations && isStringLiteralLike(node)) {
162266
162291
  if (isModuleSpecifierLike(node)) {
162267
162292
  const fileIncludeReasons = program.getFileIncludeReasons();
162268
- 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;
162293
+ 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;
162269
162294
  const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0;
162270
162295
  if (referencedFile) {
162271
162296
  return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }];
@@ -162328,7 +162353,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162328
162353
  for (const ref of references) {
162329
162354
  if (isReferencedFile(ref)) {
162330
162355
  const referencingFile = program.getSourceFileByPath(ref.file);
162331
- const location = getReferencedFileLocation(program.getSourceFileByPath, ref);
162356
+ const location = getReferencedFileLocation(program, ref);
162332
162357
  if (isReferenceFileLocation(location)) {
162333
162358
  entries = append(entries, {
162334
162359
  kind: 0 /* Span */,
@@ -163695,7 +163720,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163695
163720
 
163696
163721
  // src/services/goToDefinition.ts
163697
163722
  function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
163698
- var _a, _b;
163723
+ var _a, _b, _c;
163699
163724
  const resolvedRef = getReferenceAtPosition(sourceFile, position, program);
163700
163725
  const fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || emptyArray;
163701
163726
  if (resolvedRef == null ? void 0 : resolvedRef.file) {
@@ -163768,7 +163793,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163768
163793
  }
163769
163794
  }
163770
163795
  if (!symbol && isModuleSpecifierLike(fallbackNode)) {
163771
- const ref = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode))) == null ? void 0 : _b.resolvedModule;
163796
+ 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;
163772
163797
  if (ref) {
163773
163798
  return [{
163774
163799
  name: fallbackNode.text,
@@ -163880,10 +163905,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
163880
163905
  const file = program.getLibFileFromReference(libReferenceDirective);
163881
163906
  return file && { reference: libReferenceDirective, fileName: file.fileName, file, unverified: false };
163882
163907
  }
163883
- if ((_b = sourceFile.resolvedModules) == null ? void 0 : _b.size()) {
163908
+ const resolvedModules = (_b = program.resolvedModules) == null ? void 0 : _b.get(sourceFile.path);
163909
+ if (resolvedModules == null ? void 0 : resolvedModules.size()) {
163884
163910
  const node = getTouchingToken(sourceFile, position);
163885
- if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, getModeForUsageLocation(sourceFile, node))) {
163886
- const verifiedFileName = (_d = (_c = sourceFile.resolvedModules.get(node.text, getModeForUsageLocation(sourceFile, node))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.resolvedFileName;
163911
+ if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && resolvedModules.has(node.text, getModeForUsageLocation(sourceFile, node))) {
163912
+ const verifiedFileName = (_d = (_c = resolvedModules.get(node.text, getModeForUsageLocation(sourceFile, node))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.resolvedFileName;
163887
163913
  const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text);
163888
163914
  return {
163889
163915
  file: program.getSourceFile(fileName),
@@ -173804,16 +173830,23 @@ ${options.prefix}` : "\n" : options.prefix
173804
173830
  const sourceFiles = program.getSourceFiles();
173805
173831
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "getUnresolvedImports", { count: sourceFiles.length });
173806
173832
  const ambientModules = program.getTypeChecker().getAmbientModules().map((mod) => stripQuotes(mod.getName()));
173807
- const result = sortAndDeduplicate(flatMap(sourceFiles, (sourceFile) => extractUnresolvedImportsFromSourceFile(sourceFile, ambientModules, cachedUnresolvedImportsPerFile)));
173833
+ const result = sortAndDeduplicate(flatMap(sourceFiles, (sourceFile) => extractUnresolvedImportsFromSourceFile(
173834
+ program,
173835
+ sourceFile,
173836
+ ambientModules,
173837
+ cachedUnresolvedImportsPerFile
173838
+ )));
173808
173839
  (_b = tracing) == null ? void 0 : _b.pop();
173809
173840
  return result;
173810
173841
  }
173811
- function extractUnresolvedImportsFromSourceFile(file, ambientModules, cachedUnresolvedImportsPerFile) {
173842
+ function extractUnresolvedImportsFromSourceFile(program, file, ambientModules, cachedUnresolvedImportsPerFile) {
173812
173843
  return getOrUpdate(cachedUnresolvedImportsPerFile, file.path, () => {
173813
- if (!file.resolvedModules)
173844
+ var _a;
173845
+ const resolvedModules = (_a = program.resolvedModules) == null ? void 0 : _a.get(file.path);
173846
+ if (!resolvedModules)
173814
173847
  return emptyArray2;
173815
173848
  let unresolvedImports;
173816
- file.resolvedModules.forEach(({ resolvedModule }, name) => {
173849
+ resolvedModules.forEach(({ resolvedModule }, name) => {
173817
173850
  if ((!resolvedModule || !resolutionExtensionIsTSOrJson(resolvedModule.extension)) && !isExternalModuleNameRelative(name) && !ambientModules.some((m) => m === name)) {
173818
173851
  unresolvedImports = append(unresolvedImports, parsePackageName(name).packageName);
173819
173852
  }
@@ -174025,7 +174058,8 @@ ${options.prefix}` : "\n" : options.prefix
174025
174058
  }
174026
174059
  if (this.program && !this.symlinks.hasProcessedResolutions()) {
174027
174060
  this.symlinks.setSymlinksFromResolutions(
174028
- this.program.getSourceFiles(),
174061
+ this.program.resolvedModules,
174062
+ this.program.resolvedTypeReferenceDirectiveNames,
174029
174063
  this.program.getAutomaticTypeDirectiveResolutions()
174030
174064
  );
174031
174065
  }
@@ -184671,8 +184705,6 @@ ${e.message}`;
184671
184705
  getResolvePackageJsonExports: () => getResolvePackageJsonExports,
184672
184706
  getResolvePackageJsonImports: () => getResolvePackageJsonImports,
184673
184707
  getResolvedExternalModuleName: () => getResolvedExternalModuleName,
184674
- getResolvedModule: () => getResolvedModule,
184675
- getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
184676
184708
  getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
184677
184709
  getRestParameterElementType: () => getRestParameterElementType,
184678
184710
  getRightMostAssignedExpression: () => getRightMostAssignedExpression,
@@ -185770,8 +185802,6 @@ ${e.message}`;
185770
185802
  setParent: () => setParent,
185771
185803
  setParentRecursive: () => setParentRecursive,
185772
185804
  setPrivateIdentifier: () => setPrivateIdentifier,
185773
- setResolvedModule: () => setResolvedModule,
185774
- setResolvedTypeReferenceDirective: () => setResolvedTypeReferenceDirective,
185775
185805
  setSnippetElement: () => setSnippetElement,
185776
185806
  setSourceMapRange: () => setSourceMapRange,
185777
185807
  setStackTraceLimit: () => setStackTraceLimit,
@@ -185998,7 +186028,6 @@ ${e.message}`;
185998
186028
  writeCommentRange: () => writeCommentRange,
185999
186029
  writeFile: () => writeFile,
186000
186030
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
186001
- zipToModeAwareCache: () => zipToModeAwareCache,
186002
186031
  zipWith: () => zipWith
186003
186032
  });
186004
186033
  var init_ts7 = __esm({
@@ -187075,8 +187104,6 @@ ${e.message}`;
187075
187104
  getResolvePackageJsonExports: () => getResolvePackageJsonExports,
187076
187105
  getResolvePackageJsonImports: () => getResolvePackageJsonImports,
187077
187106
  getResolvedExternalModuleName: () => getResolvedExternalModuleName,
187078
- getResolvedModule: () => getResolvedModule,
187079
- getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
187080
187107
  getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
187081
187108
  getRestParameterElementType: () => getRestParameterElementType,
187082
187109
  getRightMostAssignedExpression: () => getRightMostAssignedExpression,
@@ -188174,8 +188201,6 @@ ${e.message}`;
188174
188201
  setParent: () => setParent,
188175
188202
  setParentRecursive: () => setParentRecursive,
188176
188203
  setPrivateIdentifier: () => setPrivateIdentifier,
188177
- setResolvedModule: () => setResolvedModule,
188178
- setResolvedTypeReferenceDirective: () => setResolvedTypeReferenceDirective,
188179
188204
  setSnippetElement: () => setSnippetElement,
188180
188205
  setSourceMapRange: () => setSourceMapRange,
188181
188206
  setStackTraceLimit: () => setStackTraceLimit,
@@ -188402,7 +188427,6 @@ ${e.message}`;
188402
188427
  writeCommentRange: () => writeCommentRange,
188403
188428
  writeFile: () => writeFile,
188404
188429
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
188405
- zipToModeAwareCache: () => zipToModeAwareCache,
188406
188430
  zipWith: () => zipWith
188407
188431
  });
188408
188432
  var init_ts8 = __esm({