@typescript-deploys/pr-build 5.3.0-pr-55793-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/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.3";
21
- var version = `${versionMajorMinor}.0-insiders.20230920`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230921`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -7689,7 +7689,7 @@ var Diagnostics = {
7689
7689
  Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
7690
7690
  Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
7691
7691
  Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
7692
- Can_only_convert_string_concatenation: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_95154", "Can only convert string concatenation"),
7692
+ 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"),
7693
7693
  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"),
7694
7694
  Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
7695
7695
  Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
@@ -11431,22 +11431,6 @@ function usingSingleLineStringWriter(action) {
11431
11431
  function getFullWidth(node) {
11432
11432
  return node.end - node.pos;
11433
11433
  }
11434
- function getResolvedModule(sourceFile, moduleNameText, mode) {
11435
- var _a, _b;
11436
- return (_b = (_a = sourceFile == null ? void 0 : sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleNameText, mode)) == null ? void 0 : _b.resolvedModule;
11437
- }
11438
- function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
11439
- if (!sourceFile.resolvedModules) {
11440
- sourceFile.resolvedModules = createModeAwareCache();
11441
- }
11442
- sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
11443
- }
11444
- function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective, mode) {
11445
- if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
11446
- sourceFile.resolvedTypeReferenceDirectiveNames = createModeAwareCache();
11447
- }
11448
- sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
11449
- }
11450
11434
  function projectReferenceIsEqualTo(oldRef, newRef) {
11451
11435
  return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
11452
11436
  }
@@ -11454,8 +11438,8 @@ function moduleResolutionIsEqualTo(oldResolution, newResolution) {
11454
11438
  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;
11455
11439
  }
11456
11440
  function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
11457
- var _a, _b;
11458
- const node10Result = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleReference, mode)) == null ? void 0 : _b.node10Result;
11441
+ var _a, _b, _c;
11442
+ 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;
11459
11443
  const result = node10Result ? chainDiagnosticMessages(
11460
11444
  /*details*/
11461
11445
  void 0,
@@ -16470,14 +16454,11 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
16470
16454
  (symlinkedDirectories || (symlinkedDirectories = /* @__PURE__ */ new Map())).set(symlinkPath, real);
16471
16455
  }
16472
16456
  },
16473
- setSymlinksFromResolutions(files, typeReferenceDirectives) {
16474
- var _a, _b;
16457
+ setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, typeReferenceDirectives) {
16475
16458
  Debug.assert(!hasProcessedResolutions);
16476
16459
  hasProcessedResolutions = true;
16477
- for (const file of files) {
16478
- (_a = file.resolvedModules) == null ? void 0 : _a.forEach((resolution) => processResolution(this, resolution.resolvedModule));
16479
- (_b = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _b.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
16480
- }
16460
+ resolvedModules == null ? void 0 : resolvedModules.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedModule)));
16461
+ resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective)));
16481
16462
  typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
16482
16463
  },
16483
16464
  hasProcessedResolutions: () => hasProcessedResolutions
@@ -21462,7 +21443,6 @@ function createNodeFactory(flags, baseFactory2) {
21462
21443
  node.imports = void 0;
21463
21444
  node.moduleAugmentations = void 0;
21464
21445
  node.ambientModuleNames = void 0;
21465
- node.resolvedModules = void 0;
21466
21446
  node.classifiableNames = void 0;
21467
21447
  node.impliedNodeFormat = void 0;
21468
21448
  return node;
@@ -34091,6 +34071,7 @@ var moduleOptionDeclaration = {
34091
34071
  node16: 100 /* Node16 */,
34092
34072
  nodenext: 199 /* NodeNext */
34093
34073
  })),
34074
+ affectsSourceFile: true,
34094
34075
  affectsModuleResolution: true,
34095
34076
  affectsEmit: true,
34096
34077
  affectsBuildInfo: true,
@@ -34527,6 +34508,7 @@ var commandOptionsWithoutBuild = [
34527
34508
  bundler: 100 /* Bundler */
34528
34509
  })),
34529
34510
  deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
34511
+ affectsSourceFile: true,
34530
34512
  affectsModuleResolution: true,
34531
34513
  paramType: Diagnostics.STRATEGY,
34532
34514
  category: Diagnostics.Modules,
@@ -35069,6 +35051,7 @@ var commandOptionsWithoutBuild = [
35069
35051
  legacy: 1 /* Legacy */,
35070
35052
  force: 3 /* Force */
35071
35053
  })),
35054
+ affectsSourceFile: true,
35072
35055
  affectsModuleResolution: true,
35073
35056
  description: Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
35074
35057
  category: Diagnostics.Language_and_Environment,
@@ -35088,7 +35071,7 @@ var semanticDiagnosticsOptionDeclarations = optionDeclarations.filter((option) =
35088
35071
  var affectsEmitOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsEmit);
35089
35072
  var affectsDeclarationPathOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsDeclarationPath);
35090
35073
  var moduleResolutionOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsModuleResolution);
35091
- var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics);
35074
+ var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsBindDiagnostics);
35092
35075
  var optionsAffectingProgramStructure = optionDeclarations.filter((option) => !!option.affectsProgramStructure);
35093
35076
  var transpileOptionValueCompilerOptions = optionDeclarations.filter((option) => hasProperty(option, "transpileOptionValue"));
35094
35077
  var optionsForBuild = [
@@ -37463,15 +37446,6 @@ function createModeAwareCache() {
37463
37446
  return result;
37464
37447
  }
37465
37448
  }
37466
- function zipToModeAwareCache(file, keys, values, nameAndModeGetter) {
37467
- Debug.assert(keys.length === values.length);
37468
- const map2 = createModeAwareCache();
37469
- for (let i = 0; i < keys.length; ++i) {
37470
- const entry = keys[i];
37471
- map2.set(nameAndModeGetter.getName(entry), nameAndModeGetter.getMode(entry, file), values[i]);
37472
- }
37473
- return map2;
37474
- }
37475
37449
  function getOriginalOrResolvedModuleFileName(result) {
37476
37450
  return result.resolvedModule && (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
37477
37451
  }
@@ -46313,7 +46287,7 @@ function createTypeChecker(host) {
46313
46287
  return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
46314
46288
  }
46315
46289
  function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
46316
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
46290
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
46317
46291
  if (startsWith(moduleReference, "@types/")) {
46318
46292
  const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
46319
46293
  const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
@@ -46331,7 +46305,7 @@ function createTypeChecker(host) {
46331
46305
  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);
46332
46306
  const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
46333
46307
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
46334
- const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
46308
+ 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;
46335
46309
  const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
46336
46310
  const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
46337
46311
  if (sourceFile) {
@@ -46339,7 +46313,7 @@ function createTypeChecker(host) {
46339
46313
  error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
46340
46314
  }
46341
46315
  if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
46342
- const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
46316
+ const importOrExport = ((_j = findAncestor(location, isImportDeclaration)) == null ? void 0 : _j.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
46343
46317
  if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
46344
46318
  error(
46345
46319
  errorNode,
@@ -46348,7 +46322,7 @@ function createTypeChecker(host) {
46348
46322
  );
46349
46323
  }
46350
46324
  } else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
46351
- const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
46325
+ const importOrExport = ((_k = findAncestor(location, isImportDeclaration)) == null ? void 0 : _k.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
46352
46326
  if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
46353
46327
  const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
46354
46328
  error(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
@@ -46369,7 +46343,7 @@ function createTypeChecker(host) {
46369
46343
  if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
46370
46344
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
46371
46345
  const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
46372
- const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_i = overrideClauseHost.assertions) == null ? void 0 : _i.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
46346
+ const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_l = overrideClauseHost.assertions) == null ? void 0 : _l.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
46373
46347
  if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
46374
46348
  if (findAncestor(location, isImportEqualsDeclaration)) {
46375
46349
  error(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);
@@ -46476,7 +46450,7 @@ function createTypeChecker(host) {
46476
46450
  error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
46477
46451
  } else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
46478
46452
  const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
46479
- const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
46453
+ const suggestedExt = (_m = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _m[1];
46480
46454
  if (suggestedExt) {
46481
46455
  error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
46482
46456
  } else {
@@ -47775,7 +47749,7 @@ function createTypeChecker(host) {
47775
47749
  }
47776
47750
  return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode));
47777
47751
  }
47778
- if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
47752
+ if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */) {
47779
47753
  const name2 = typeParameterToName(type, context);
47780
47754
  context.approximateLength += idText(name2).length;
47781
47755
  return factory.createTypeReferenceNode(
@@ -48541,36 +48515,65 @@ function createTypeChecker(host) {
48541
48515
  true
48542
48516
  )[0];
48543
48517
  let cleanup;
48544
- if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
48545
- const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0;
48546
- Debug.assertOptionalNode(existingFakeScope, isBlock);
48547
- const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
48548
- let newLocals;
48549
- for (const param of expandedParams) {
48550
- if (!locals.has(param.escapedName)) {
48551
- newLocals = append(newLocals, param.escapedName);
48552
- locals.set(param.escapedName, param);
48553
- }
48554
- }
48555
- if (newLocals) {
48556
- let removeNewLocals2 = function() {
48518
+ if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && (some(expandedParams) || some(signature.typeParameters))) {
48519
+ let pushFakeScope2 = function(kind2, addAll) {
48520
+ Debug.assert(context.enclosingDeclaration);
48521
+ let existingFakeScope;
48522
+ if (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration === kind2) {
48523
+ existingFakeScope = context.enclosingDeclaration;
48524
+ } else if (context.enclosingDeclaration.parent && getNodeLinks(context.enclosingDeclaration.parent).fakeScopeForSignatureDeclaration === kind2) {
48525
+ existingFakeScope = context.enclosingDeclaration.parent;
48526
+ }
48527
+ Debug.assertOptionalNode(existingFakeScope, isBlock);
48528
+ const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
48529
+ let newLocals;
48530
+ addAll((name, symbol) => {
48531
+ if (!locals.has(name)) {
48532
+ newLocals = append(newLocals, name);
48533
+ locals.set(name, symbol);
48534
+ }
48535
+ });
48536
+ if (!newLocals)
48537
+ return;
48538
+ const oldCleanup = cleanup;
48539
+ function undo() {
48557
48540
  forEach(newLocals, (s) => locals.delete(s));
48558
- };
48559
- var removeNewLocals = removeNewLocals2;
48541
+ oldCleanup == null ? void 0 : oldCleanup();
48542
+ }
48560
48543
  if (existingFakeScope) {
48561
- cleanup = removeNewLocals2;
48544
+ cleanup = undo;
48562
48545
  } else {
48563
48546
  const fakeScope = parseNodeFactory.createBlock(emptyArray);
48564
- getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
48547
+ getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = kind2;
48565
48548
  fakeScope.locals = locals;
48566
48549
  const saveEnclosingDeclaration = context.enclosingDeclaration;
48567
48550
  setParent(fakeScope, saveEnclosingDeclaration);
48568
48551
  context.enclosingDeclaration = fakeScope;
48569
48552
  cleanup = () => {
48570
48553
  context.enclosingDeclaration = saveEnclosingDeclaration;
48571
- removeNewLocals2();
48554
+ undo();
48572
48555
  };
48573
48556
  }
48557
+ };
48558
+ var pushFakeScope = pushFakeScope2;
48559
+ pushFakeScope2(
48560
+ "params",
48561
+ (add) => {
48562
+ for (const param of expandedParams) {
48563
+ add(param.escapedName, param);
48564
+ }
48565
+ }
48566
+ );
48567
+ if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
48568
+ pushFakeScope2(
48569
+ "typeParams",
48570
+ (add) => {
48571
+ for (const typeParam of signature.typeParameters ?? emptyArray) {
48572
+ const typeParamName = typeParameterToName(typeParam, context).escapedText;
48573
+ add(typeParamName, typeParam.symbol);
48574
+ }
48575
+ }
48576
+ );
48574
48577
  }
48575
48578
  }
48576
48579
  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));
@@ -49114,7 +49117,7 @@ function createTypeChecker(host) {
49114
49117
  return identifier;
49115
49118
  }
49116
49119
  }
49117
- function typeParameterShadowsNameInScope(escapedName, context, type) {
49120
+ function typeParameterShadowsOtherTypeParameterInScope(escapedName, context, type) {
49118
49121
  const result = resolveName(
49119
49122
  context.enclosingDeclaration,
49120
49123
  escapedName,
@@ -49125,11 +49128,8 @@ function createTypeChecker(host) {
49125
49128
  /*isUse*/
49126
49129
  false
49127
49130
  );
49128
- if (result) {
49129
- if (result.flags & 262144 /* TypeParameter */ && result === type.symbol) {
49130
- return false;
49131
- }
49132
- return true;
49131
+ if (result && result.flags & 262144 /* TypeParameter */) {
49132
+ return result !== type.symbol;
49133
49133
  }
49134
49134
  return false;
49135
49135
  }
@@ -49155,7 +49155,7 @@ function createTypeChecker(host) {
49155
49155
  const rawtext = result.escapedText;
49156
49156
  let i = ((_a = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _a.get(rawtext)) || 0;
49157
49157
  let text = rawtext;
49158
- while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsNameInScope(text, context, type)) {
49158
+ while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsOtherTypeParameterInScope(text, context, type)) {
49159
49159
  i++;
49160
49160
  text = `${rawtext}_${i}`;
49161
49161
  }
@@ -49166,7 +49166,7 @@ function createTypeChecker(host) {
49166
49166
  }
49167
49167
  (context.typeParameterNamesByTextNextNameCount || (context.typeParameterNamesByTextNextNameCount = /* @__PURE__ */ new Map())).set(rawtext, i);
49168
49168
  (context.typeParameterNames || (context.typeParameterNames = /* @__PURE__ */ new Map())).set(getTypeId(type), result);
49169
- (context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(rawtext);
49169
+ (context.typeParameterNamesByText || (context.typeParameterNamesByText = /* @__PURE__ */ new Set())).add(text);
49170
49170
  }
49171
49171
  return result;
49172
49172
  }
@@ -49311,7 +49311,10 @@ function createTypeChecker(host) {
49311
49311
  return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
49312
49312
  }
49313
49313
  function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
49314
- return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
49314
+ while (getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration) {
49315
+ enclosingDeclaration = enclosingDeclaration.parent;
49316
+ }
49317
+ return enclosingDeclaration;
49315
49318
  }
49316
49319
  function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
49317
49320
  if (!isErrorType(type) && enclosingDeclaration) {
@@ -49391,7 +49394,7 @@ function createTypeChecker(host) {
49391
49394
  }
49392
49395
  if (isIdentifier(node)) {
49393
49396
  const type = getDeclaredTypeOfSymbol(sym);
49394
- const name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : factory.cloneNode(node);
49397
+ const name = sym.flags & 262144 /* TypeParameter */ ? typeParameterToName(type, context) : factory.cloneNode(node);
49395
49398
  name.symbol = sym;
49396
49399
  return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
49397
49400
  }
@@ -53234,7 +53237,28 @@ function createTypeChecker(host) {
53234
53237
  }
53235
53238
  }
53236
53239
  }
53237
- links[resolutionKind] = combineSymbolTables(earlySymbols, lateSymbols) || emptySymbols;
53240
+ let resolved = combineSymbolTables(earlySymbols, lateSymbols);
53241
+ if (symbol.flags & 33554432 /* Transient */ && links.cjsExportMerged && symbol.declarations) {
53242
+ for (const decl of symbol.declarations) {
53243
+ const original = getSymbolLinks(decl.symbol)[resolutionKind];
53244
+ if (!resolved) {
53245
+ resolved = original;
53246
+ continue;
53247
+ }
53248
+ if (!original)
53249
+ continue;
53250
+ original.forEach((s, name) => {
53251
+ const existing = resolved.get(name);
53252
+ if (!existing)
53253
+ resolved.set(name, s);
53254
+ else if (existing === s)
53255
+ return;
53256
+ else
53257
+ resolved.set(name, mergeSymbol(existing, s));
53258
+ });
53259
+ }
53260
+ }
53261
+ links[resolutionKind] = resolved || emptySymbols;
53238
53262
  }
53239
53263
  return links[resolutionKind];
53240
53264
  }
@@ -59704,16 +59728,8 @@ function createTypeChecker(host) {
59704
59728
  const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
59705
59729
  const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
59706
59730
  for (let i = 0; i < paramCount; i++) {
59707
- const sourceType = i === restIndex ? getMutableArrayOrTupleType(
59708
- getRestTypeAtPosition(source, i),
59709
- /*forceVariadic*/
59710
- false
59711
- ) : tryGetTypeAtPosition(source, i);
59712
- const targetType = i === restIndex ? getMutableArrayOrTupleType(
59713
- getRestTypeAtPosition(target, i),
59714
- /*forceVariadic*/
59715
- false
59716
- ) : tryGetTypeAtPosition(target, i);
59731
+ const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
59732
+ const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
59717
59733
  if (sourceType && targetType) {
59718
59734
  const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
59719
59735
  const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
@@ -70233,14 +70249,14 @@ function createTypeChecker(host) {
70233
70249
  }
70234
70250
  return getInferredTypes(context);
70235
70251
  }
70236
- function getMutableArrayOrTupleType(type, forceVariadic) {
70237
- return type.flags & 1048576 /* Union */ ? mapType(type, (t) => getMutableArrayOrTupleType(t, forceVariadic)) : type.flags & 1 /* Any */ || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType(
70252
+ function getMutableArrayOrTupleType(type) {
70253
+ return type.flags & 1048576 /* Union */ ? mapType(type, getMutableArrayOrTupleType) : type.flags & 1 /* Any */ || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType(
70238
70254
  getElementTypes(type),
70239
70255
  type.target.elementFlags,
70240
70256
  /*readonly*/
70241
70257
  false,
70242
70258
  type.target.labeledElementDeclarations
70243
- ) : forceVariadic ? createTupleType([type], [8 /* Variadic */]) : type;
70259
+ ) : createTupleType([type], [8 /* Variadic */]);
70244
70260
  }
70245
70261
  function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) {
70246
70262
  const inConstContext = isConstTypeVariable(restType);
@@ -70249,11 +70265,7 @@ function createTypeChecker(host) {
70249
70265
  if (isSpreadArgument(arg)) {
70250
70266
  const spreadType = arg.kind === 237 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode);
70251
70267
  if (isArrayLikeType(spreadType)) {
70252
- return getMutableArrayOrTupleType(
70253
- spreadType,
70254
- /*forceVariadic*/
70255
- true
70256
- );
70268
+ return getMutableArrayOrTupleType(spreadType);
70257
70269
  }
70258
70270
  return createArrayType(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 230 /* SpreadElement */ ? arg.expression : arg), inConstContext);
70259
70271
  }
@@ -115407,15 +115419,15 @@ function isReferencedFile(reason) {
115407
115419
  function isReferenceFileLocation(location) {
115408
115420
  return location.pos !== void 0;
115409
115421
  }
115410
- function getReferencedFileLocation(getSourceFileByPath, ref) {
115411
- var _a, _b, _c, _d, _e, _f;
115412
- const file = Debug.checkDefined(getSourceFileByPath(ref.file));
115422
+ function getReferencedFileLocation(program, ref) {
115423
+ var _a, _b, _c, _d, _e, _f, _g, _h;
115424
+ const file = Debug.checkDefined(program.getSourceFileByPath(ref.file));
115413
115425
  const { kind, index } = ref;
115414
115426
  let pos, end, packageId, resolutionMode;
115415
115427
  switch (kind) {
115416
115428
  case 3 /* Import */:
115417
115429
  const importLiteral = getModuleNameStringLiteralAt(file, index);
115418
- 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;
115430
+ 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;
115419
115431
  if (importLiteral.pos === -1)
115420
115432
  return { file, packageId, text: importLiteral.text };
115421
115433
  pos = skipTrivia(file.text, importLiteral.pos);
@@ -115426,7 +115438,7 @@ function getReferencedFileLocation(getSourceFileByPath, ref) {
115426
115438
  break;
115427
115439
  case 5 /* TypeReferenceDirective */:
115428
115440
  ({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
115429
- 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;
115441
+ 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;
115430
115442
  break;
115431
115443
  case 7 /* LibReferenceDirective */:
115432
115444
  ({ pos, end } = file.libReferenceDirectives[index]);
@@ -115640,6 +115652,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115640
115652
  let automaticTypeDirectiveResolutions;
115641
115653
  let resolvedLibReferences;
115642
115654
  let resolvedLibProcessing;
115655
+ let resolvedModules;
115656
+ let resolvedModulesProcessing;
115657
+ let resolvedTypeReferenceDirectiveNames;
115658
+ let resolvedTypeReferenceDirectiveNamesProcessing;
115643
115659
  let packageMap;
115644
115660
  const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
115645
115661
  let currentNodeModulesDepth = 0;
@@ -115904,6 +115920,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115904
115920
  }
115905
115921
  oldProgram = void 0;
115906
115922
  resolvedLibProcessing = void 0;
115923
+ resolvedModulesProcessing = void 0;
115924
+ resolvedTypeReferenceDirectiveNamesProcessing = void 0;
115907
115925
  const program = {
115908
115926
  getRootFileNames: () => rootNames,
115909
115927
  getSourceFile,
@@ -115945,6 +115963,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115945
115963
  sourceFileToPackageName,
115946
115964
  redirectTargetsMap,
115947
115965
  usesUriStyleNodeCoreModules,
115966
+ resolvedModules,
115967
+ resolvedTypeReferenceDirectiveNames,
115948
115968
  resolvedLibReferences,
115949
115969
  getCurrentPackagesMap: () => packageMap,
115950
115970
  typesPackageExists,
@@ -115976,7 +115996,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115976
115996
  case 1 /* FilePreprocessingFileExplainingDiagnostic */:
115977
115997
  return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray));
115978
115998
  case 0 /* FilePreprocessingReferencedDiagnostic */:
115979
- const { file, pos, end } = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason);
115999
+ const { file, pos, end } = getReferencedFileLocation(program, diagnostic.reason);
115980
116000
  return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
115981
116001
  case 2 /* ResolutionDiagnostics */:
115982
116002
  return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
@@ -115993,14 +116013,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115993
116013
  if (packageMap)
115994
116014
  return packageMap;
115995
116015
  packageMap = /* @__PURE__ */ new Map();
115996
- files.forEach((sf) => {
115997
- if (!sf.resolvedModules)
115998
- return;
115999
- sf.resolvedModules.forEach(({ resolvedModule }) => {
116000
- if (resolvedModule == null ? void 0 : resolvedModule.packageId)
116001
- packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
116002
- });
116003
- });
116016
+ files.forEach(
116017
+ (sf) => {
116018
+ var _a2;
116019
+ return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(sf.path)) == null ? void 0 : _a2.forEach(({ resolvedModule }) => {
116020
+ if (resolvedModule == null ? void 0 : resolvedModule.packageId)
116021
+ packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
116022
+ });
116023
+ }
116024
+ );
116004
116025
  return packageMap;
116005
116026
  }
116006
116027
  function typesPackageExists(packageName) {
@@ -116132,7 +116153,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116132
116153
  return classifiableNames;
116133
116154
  }
116134
116155
  function resolveModuleNamesReusingOldState(moduleNames, file) {
116135
- var _a2;
116156
+ var _a2, _b2;
116136
116157
  if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
116137
116158
  return resolveModuleNamesWorker(
116138
116159
  moduleNames,
@@ -116141,24 +116162,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116141
116162
  void 0
116142
116163
  );
116143
116164
  }
116144
- const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
116145
- if (oldSourceFile !== file && file.resolvedModules) {
116146
- const result2 = [];
116147
- for (const moduleName of moduleNames) {
116148
- const resolvedModule = file.resolvedModules.get(moduleName.text, getModeForUsageLocation(file, moduleName));
116149
- result2.push(resolvedModule);
116150
- }
116151
- return result2;
116152
- }
116153
116165
  let unknownModuleNames;
116154
116166
  let result;
116155
116167
  let reusedNames;
116156
116168
  const predictedToResolveToAmbientModuleMarker = emptyResolution;
116169
+ const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
116157
116170
  for (let i = 0; i < moduleNames.length; i++) {
116158
116171
  const moduleName = moduleNames[i];
116159
- if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) {
116172
+ if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
116160
116173
  const mode = getModeForUsageLocation(file, moduleName);
116161
- const oldResolution = (_a2 = oldSourceFile.resolvedModules) == null ? void 0 : _a2.get(moduleName.text, mode);
116174
+ 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);
116162
116175
  if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
116163
116176
  if (isTraceEnabled(options, host)) {
116164
116177
  trace(
@@ -116205,7 +116218,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116205
116218
  Debug.assert(j === resolutions.length);
116206
116219
  return result;
116207
116220
  function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
116208
- const resolutionToFile = getResolvedModule(oldSourceFile, moduleName.text, getModeForUsageLocation(file, moduleName));
116221
+ var _a3, _b3, _c2;
116222
+ 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;
116209
116223
  const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
116210
116224
  if (resolutionToFile && resolvedFile) {
116211
116225
  return false;
@@ -116221,7 +116235,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116221
116235
  }
116222
116236
  }
116223
116237
  function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
116224
- var _a2;
116238
+ var _a2, _b2;
116225
116239
  if (structureIsReused === 0 /* Not */) {
116226
116240
  return resolveTypeReferenceDirectiveNamesWorker(
116227
116241
  typeDirectiveNames,
@@ -116230,28 +116244,18 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116230
116244
  void 0
116231
116245
  );
116232
116246
  }
116233
- const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
116234
- if (!isString(containingFile)) {
116235
- if (oldSourceFile !== containingFile && containingFile.resolvedTypeReferenceDirectiveNames) {
116236
- const result2 = [];
116237
- for (const typeDirectiveName of typeDirectiveNames) {
116238
- const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getTypeReferenceResolutionName(typeDirectiveName), getModeForFileReference(typeDirectiveName, containingFile.impliedNodeFormat));
116239
- result2.push(resolvedTypeReferenceDirective);
116240
- }
116241
- return result2;
116242
- }
116243
- }
116244
116247
  let unknownTypeReferenceDirectiveNames;
116245
116248
  let result;
116246
116249
  let reusedNames;
116247
116250
  const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
116248
- const canReuseResolutions = !isString(containingFile) ? containingFile === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path) : !hasInvalidatedResolutions(toPath3(containingFile));
116251
+ const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
116252
+ const canReuseResolutions = !isString(containingFile) ? containingFile === oldSourceFile && !hasInvalidatedResolutions(containingFile.path) : !hasInvalidatedResolutions(toPath3(containingFile));
116249
116253
  for (let i = 0; i < typeDirectiveNames.length; i++) {
116250
116254
  const entry = typeDirectiveNames[i];
116251
116255
  if (canReuseResolutions) {
116252
116256
  const typeDirectiveName = getTypeReferenceResolutionName(entry);
116253
116257
  const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
116254
- const oldResolution = (_a2 = !isString(containingFile) ? oldSourceFile == null ? void 0 : oldSourceFile.resolvedTypeReferenceDirectiveNames : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a2.get(typeDirectiveName, mode);
116258
+ 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);
116255
116259
  if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
116256
116260
  if (isTraceEnabled(options, host)) {
116257
116261
  trace(
@@ -116311,7 +116315,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116311
116315
  );
116312
116316
  }
116313
116317
  function tryReuseStructureFromOldProgram() {
116314
- var _a2;
116318
+ var _a2, _b2, _c2;
116315
116319
  if (!oldProgram) {
116316
116320
  return 0 /* Not */;
116317
116321
  }
@@ -116413,42 +116417,37 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116413
116417
  structureIsReused = 1 /* SafeModules */;
116414
116418
  }
116415
116419
  }
116416
- modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
116420
+ modifiedSourceFiles.push(newSourceFile);
116417
116421
  } else if (hasInvalidatedResolutions(oldSourceFile.path)) {
116418
116422
  structureIsReused = 1 /* SafeModules */;
116419
- modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
116423
+ modifiedSourceFiles.push(newSourceFile);
116424
+ } else {
116425
+ for (const moduleName of oldSourceFile.ambientModuleNames) {
116426
+ ambientModuleNameToUnmodifiedFileName.set(moduleName, oldSourceFile.fileName);
116427
+ }
116420
116428
  }
116421
116429
  newSourceFiles.push(newSourceFile);
116422
116430
  }
116423
116431
  if (structureIsReused !== 2 /* Completely */) {
116424
116432
  return structureIsReused;
116425
116433
  }
116426
- const modifiedFiles = modifiedSourceFiles.map((f) => f.oldFile);
116427
- for (const oldFile of oldSourceFiles) {
116428
- if (!contains(modifiedFiles, oldFile)) {
116429
- for (const moduleName of oldFile.ambientModuleNames) {
116430
- ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
116431
- }
116432
- }
116433
- }
116434
- for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
116434
+ for (const newSourceFile of modifiedSourceFiles) {
116435
116435
  const moduleNames = getModuleNames(newSourceFile);
116436
116436
  const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
116437
- const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
116438
- if (resolutionsChanged) {
116437
+ (resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
116438
+ const oldResolutions = (_b2 = oldProgram.resolvedModules) == null ? void 0 : _b2.get(newSourceFile.path);
116439
+ const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldResolutions, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
116440
+ if (resolutionsChanged)
116439
116441
  structureIsReused = 1 /* SafeModules */;
116440
- newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions, moduleResolutionNameAndModeGetter);
116441
- } else {
116442
- newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
116443
- }
116444
116442
  const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
116445
116443
  const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
116446
- const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
116444
+ (resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
116445
+ const oldTypeResolutions = (_c2 = oldProgram.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _c2.get(newSourceFile.path);
116446
+ const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldTypeResolutions, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
116447
116447
  if (typeReferenceResolutionsChanged) {
116448
116448
  structureIsReused = 1 /* SafeModules */;
116449
- newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions, typeReferenceResolutionNameAndModeGetter);
116450
- } else {
116451
- newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
116449
+ } else if (oldTypeResolutions) {
116450
+ (resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, oldTypeResolutions);
116452
116451
  }
116453
116452
  }
116454
116453
  if (structureIsReused !== 2 /* Completely */) {
@@ -116496,6 +116495,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116496
116495
  sourceFileToPackageName = oldProgram.sourceFileToPackageName;
116497
116496
  redirectTargetsMap = oldProgram.redirectTargetsMap;
116498
116497
  usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
116498
+ resolvedModules = oldProgram.resolvedModules;
116499
+ resolvedTypeReferenceDirectiveNames = oldProgram.resolvedTypeReferenceDirectiveNames;
116499
116500
  resolvedLibReferences = oldProgram.resolvedLibReferences;
116500
116501
  packageMap = oldProgram.getCurrentPackagesMap();
116501
116502
  return 2 /* Completely */;
@@ -117541,16 +117542,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117541
117542
  }
117542
117543
  function processTypeReferenceDirectives(file) {
117543
117544
  const typeDirectives = file.typeReferenceDirectives;
117544
- if (!typeDirectives.length) {
117545
- file.resolvedTypeReferenceDirectiveNames = void 0;
117545
+ if (!typeDirectives.length)
117546
117546
  return;
117547
- }
117548
- const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
117547
+ const resolutions = (resolvedTypeReferenceDirectiveNamesProcessing == null ? void 0 : resolvedTypeReferenceDirectiveNamesProcessing.get(file.path)) || resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
117548
+ const resolutionsInFile = createModeAwareCache();
117549
+ (resolvedTypeReferenceDirectiveNames ?? (resolvedTypeReferenceDirectiveNames = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
117549
117550
  for (let index = 0; index < typeDirectives.length; index++) {
117550
117551
  const ref = file.typeReferenceDirectives[index];
117551
117552
  const resolvedTypeReferenceDirective = resolutions[index];
117552
117553
  const fileName = toFileNameLowerCase(ref.fileName);
117553
- setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective, getModeForFileReference(ref, file.impliedNodeFormat));
117554
+ resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
117554
117555
  const mode = ref.resolutionMode || file.impliedNodeFormat;
117555
117556
  if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
117556
117557
  (fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({
@@ -117714,14 +117715,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117714
117715
  collectExternalModuleReferences(file);
117715
117716
  if (file.imports.length || file.moduleAugmentations.length) {
117716
117717
  const moduleNames = getModuleNames(file);
117717
- const resolutions = resolveModuleNamesReusingOldState(moduleNames, file);
117718
+ const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
117718
117719
  Debug.assert(resolutions.length === moduleNames.length);
117719
117720
  const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options : void 0) || options;
117721
+ const resolutionsInFile = createModeAwareCache();
117722
+ (resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
117720
117723
  for (let index = 0; index < moduleNames.length; index++) {
117721
117724
  const resolution = resolutions[index].resolvedModule;
117722
117725
  const moduleName = moduleNames[index].text;
117723
117726
  const mode = getModeForUsageLocation(file, moduleNames[index]);
117724
- setResolvedModule(file, moduleName, resolutions[index], mode);
117727
+ resolutionsInFile.set(moduleName, mode, resolutions[index]);
117725
117728
  addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
117726
117729
  if (!resolution) {
117727
117730
  continue;
@@ -117752,8 +117755,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117752
117755
  currentNodeModulesDepth--;
117753
117756
  }
117754
117757
  }
117755
- } else {
117756
- file.resolvedModules = void 0;
117757
117758
  }
117758
117759
  }
117759
117760
  function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {
@@ -118268,7 +118269,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118268
118269
  processReason(fileProcessingReason);
118269
118270
  if (locationReason && (fileIncludeReasons == null ? void 0 : fileIncludeReasons.length) === 1)
118270
118271
  fileIncludeReasons = void 0;
118271
- const location = locationReason && getReferencedFileLocation(getSourceFileByPath, locationReason);
118272
+ const location = locationReason && getReferencedFileLocation(program, locationReason);
118272
118273
  const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
118273
118274
  const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
118274
118275
  const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
@@ -118304,7 +118305,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118304
118305
  }
118305
118306
  function fileIncludeReasonToRelatedInformation(reason) {
118306
118307
  if (isReferencedFile(reason)) {
118307
- const referenceLocation = getReferencedFileLocation(getSourceFileByPath, reason);
118308
+ const referenceLocation = getReferencedFileLocation(program, reason);
118308
118309
  let message2;
118309
118310
  switch (reason.kind) {
118310
118311
  case 3 /* Import */:
@@ -118593,8 +118594,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118593
118594
  if (!symlinks) {
118594
118595
  symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
118595
118596
  }
118596
- if (files && automaticTypeDirectiveResolutions && !symlinks.hasProcessedResolutions()) {
118597
- symlinks.setSymlinksFromResolutions(files, automaticTypeDirectiveResolutions);
118597
+ if (files && !symlinks.hasProcessedResolutions()) {
118598
+ symlinks.setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, automaticTypeDirectiveResolutions);
118598
118599
  }
118599
118600
  return symlinks;
118600
118601
  }
@@ -118948,6 +118949,7 @@ var BuilderState;
118948
118949
  return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
118949
118950
  }
118950
118951
  function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
118952
+ var _a;
118951
118953
  let referencedFiles;
118952
118954
  if (sourceFile.imports && sourceFile.imports.length > 0) {
118953
118955
  const checker = program.getTypeChecker();
@@ -118963,8 +118965,9 @@ var BuilderState;
118963
118965
  addReferencedFile(referencedPath);
118964
118966
  }
118965
118967
  }
118966
- if (sourceFile.resolvedTypeReferenceDirectiveNames) {
118967
- sourceFile.resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
118968
+ const resolvedTypeReferenceDirectiveNames = (_a = program.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(sourceFile.path);
118969
+ if (resolvedTypeReferenceDirectiveNames) {
118970
+ resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
118968
118971
  if (!resolvedTypeReferenceDirective) {
118969
118972
  return;
118970
118973
  }
@@ -120760,7 +120763,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
120760
120763
  clear: clear2,
120761
120764
  onChangesAffectModuleResolution
120762
120765
  };
120763
- function getResolvedModule2(resolution) {
120766
+ function getResolvedModule(resolution) {
120764
120767
  return resolution.resolvedModule;
120765
120768
  }
120766
120769
  function getResolvedTypeReferenceDirective(resolution) {
@@ -120839,7 +120842,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
120839
120842
  stopWatchFailedLookupLocationOfResolution(
120840
120843
  resolution,
120841
120844
  resolutionHost.toPath(getInferredLibraryNameResolveFrom(newProgram.getCompilerOptions(), getCurrentDirectory(), libFileName)),
120842
- getResolvedModule2
120845
+ getResolvedModule
120843
120846
  );
120844
120847
  resolvedLibraries.delete(libFileName);
120845
120848
  }
@@ -121064,7 +121067,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
121064
121067
  redirectedReference,
121065
121068
  options
121066
121069
  ),
121067
- getResolutionWithResolvedFileName: getResolvedModule2,
121070
+ getResolutionWithResolvedFileName: getResolvedModule,
121068
121071
  shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
121069
121072
  logChanges: logChangesWhenResolvingModule,
121070
121073
  deferWatchingNonRelativeResolution: true
@@ -121083,17 +121086,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
121083
121086
  libraryName,
121084
121087
  resolution,
121085
121088
  path,
121086
- getResolvedModule2,
121089
+ getResolvedModule,
121087
121090
  /*deferWatchingNonRelativeResolution*/
121088
121091
  false
121089
121092
  );
121090
121093
  resolvedLibraries.set(libFileName, resolution);
121091
121094
  if (existingResolution) {
121092
- stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule2);
121095
+ stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule);
121093
121096
  }
121094
121097
  } else {
121095
121098
  if (isTraceEnabled(options, host)) {
121096
- const resolved = getResolvedModule2(resolution);
121099
+ const resolved = getResolvedModule(resolution);
121097
121100
  trace(
121098
121101
  host,
121099
121102
  (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,
@@ -121370,7 +121373,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
121370
121373
  resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
121371
121374
  }
121372
121375
  function removeResolutionsOfFile(filePath) {
121373
- removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule2);
121376
+ removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
121374
121377
  removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
121375
121378
  }
121376
121379
  function invalidateResolutions(resolutions, canInvalidate) {
@@ -121797,7 +121800,7 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
121797
121800
  var _a, _b;
121798
121801
  const options = program.getCompilerOptions();
121799
121802
  if (isReferencedFile(reason)) {
121800
- const referenceLocation = getReferencedFileLocation((path) => program.getSourceFileByPath(path), reason);
121803
+ const referenceLocation = getReferencedFileLocation(program, reason);
121801
121804
  const referenceText = isReferenceFileLocation(referenceLocation) ? referenceLocation.file.text.substring(referenceLocation.pos, referenceLocation.end) : `"${referenceLocation.text}"`;
121802
121805
  let message;
121803
121806
  Debug.assert(isReferenceFileLocation(referenceLocation) || reason.kind === 3 /* Import */, "Only synthetic references are imports");