typescript 5.5.0-dev.20240320 → 5.5.0-dev.20240322

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.5";
21
- var version = `${versionMajorMinor}.0-dev.20240320`;
21
+ var version = `${versionMajorMinor}.0-dev.20240322`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -3880,7 +3880,8 @@ var commentPragmas = {
3880
3880
  { name: "lib", optional: true, captureSpan: true },
3881
3881
  { name: "path", optional: true, captureSpan: true },
3882
3882
  { name: "no-default-lib", optional: true },
3883
- { name: "resolution-mode", optional: true }
3883
+ { name: "resolution-mode", optional: true },
3884
+ { name: "preserve", optional: true }
3884
3885
  ],
3885
3886
  kind: 1 /* TripleSlashXML */
3886
3887
  },
@@ -7792,7 +7793,9 @@ var Diagnostics = {
7792
7793
  The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
7793
7794
  Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
7794
7795
  Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
7795
- await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
7796
+ await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block."),
7797
+ _0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is_enabled: diag(18055, 1 /* Error */, "_0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is__18055", "'{0}' has a string type, but must have syntactically recognizable string syntax when 'isolatedModules' is enabled."),
7798
+ Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled: diag(18056, 1 /* Error */, "Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is__18056", "Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled.")
7796
7799
  };
7797
7800
 
7798
7801
  // src/compiler/scanner.ts
@@ -32546,7 +32549,7 @@ var Parser;
32546
32549
  80 /* Identifier */,
32547
32550
  /*reportAtCurrentPosition*/
32548
32551
  false
32549
- ) : parseIdentifier()), pos);
32552
+ ) : parseIdentifierName()), pos);
32550
32553
  }
32551
32554
  while (token() === 81 /* PrivateIdentifier */) {
32552
32555
  reScanHashToken();
@@ -33494,16 +33497,17 @@ function processPragmasIntoFields(context, reportDiagnostic) {
33494
33497
  const typeReferenceDirectives = context.typeReferenceDirectives;
33495
33498
  const libReferenceDirectives = context.libReferenceDirectives;
33496
33499
  forEach(toArray(entryOrList), (arg) => {
33497
- const { types, lib, path, ["resolution-mode"]: res } = arg.arguments;
33500
+ const { types, lib, path, ["resolution-mode"]: res, preserve: _preserve } = arg.arguments;
33501
+ const preserve = _preserve === "true" ? true : void 0;
33498
33502
  if (arg.arguments["no-default-lib"] === "true") {
33499
33503
  context.hasNoDefaultLib = true;
33500
33504
  } else if (types) {
33501
33505
  const parsed = parseResolutionMode(res, types.pos, types.end, reportDiagnostic);
33502
- typeReferenceDirectives.push({ pos: types.pos, end: types.end, fileName: types.value, ...parsed ? { resolutionMode: parsed } : {} });
33506
+ typeReferenceDirectives.push({ pos: types.pos, end: types.end, fileName: types.value, ...parsed ? { resolutionMode: parsed } : {}, ...preserve ? { preserve } : {} });
33503
33507
  } else if (lib) {
33504
- libReferenceDirectives.push({ pos: lib.pos, end: lib.end, fileName: lib.value });
33508
+ libReferenceDirectives.push({ pos: lib.pos, end: lib.end, fileName: lib.value, ...preserve ? { preserve } : {} });
33505
33509
  } else if (path) {
33506
- referencedFiles.push({ pos: path.pos, end: path.end, fileName: path.value });
33510
+ referencedFiles.push({ pos: path.pos, end: path.end, fileName: path.value, ...preserve ? { preserve } : {} });
33507
33511
  } else {
33508
33512
  reportDiagnostic(arg.range.pos, arg.range.end - arg.range.pos, Diagnostics.Invalid_reference_directive_syntax);
33509
33513
  }
@@ -42308,24 +42312,6 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
42308
42312
  );
42309
42313
  }
42310
42314
  }
42311
- function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
42312
- return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
42313
- }
42314
- function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, preferences, userPreferences, options = {}) {
42315
- const info = getInfo(importingSourceFileName, host);
42316
- const modulePaths = getAllModulePaths(info, toFileName2, host, userPreferences, options);
42317
- return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
42318
- modulePath,
42319
- info,
42320
- importingSourceFile,
42321
- host,
42322
- compilerOptions,
42323
- userPreferences,
42324
- /*packageNameOnly*/
42325
- void 0,
42326
- options.overrideImportMode
42327
- )) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
42328
- }
42329
42315
  function tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
42330
42316
  var _a;
42331
42317
  const moduleSourceFile = getSourceFileOfModule(moduleSymbol);
@@ -42562,22 +42548,6 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
42562
42548
  });
42563
42549
  return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
42564
42550
  }
42565
- function getAllModulePaths(info, importedFileName, host, preferences, options = {}) {
42566
- var _a;
42567
- const importingFilePath = toPath(info.importingSourceFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
42568
- const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
42569
- const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
42570
- if (cache) {
42571
- const cached = cache.get(importingFilePath, importedFilePath, preferences, options);
42572
- if (cached == null ? void 0 : cached.modulePaths)
42573
- return cached.modulePaths;
42574
- }
42575
- const modulePaths = getAllModulePathsWorker(info, importedFileName, host);
42576
- if (cache) {
42577
- cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
42578
- }
42579
- return modulePaths;
42580
- }
42581
42551
  function getAllModulePathsWorker(info, importedFileName, host) {
42582
42552
  const allFileNames = /* @__PURE__ */ new Map();
42583
42553
  let importedFileFromNodeModules = false;
@@ -43591,12 +43561,9 @@ function createTypeChecker(host) {
43591
43561
  getExactOptionalProperties,
43592
43562
  getAllPossiblePropertiesOfTypes,
43593
43563
  getSuggestedSymbolForNonexistentProperty,
43594
- getSuggestionForNonexistentProperty,
43595
43564
  getSuggestedSymbolForNonexistentJSXAttribute,
43596
43565
  getSuggestedSymbolForNonexistentSymbol: (location, name, meaning) => getSuggestedSymbolForNonexistentSymbol(location, escapeLeadingUnderscores(name), meaning),
43597
- getSuggestionForNonexistentSymbol: (location, name, meaning) => getSuggestionForNonexistentSymbol(location, escapeLeadingUnderscores(name), meaning),
43598
43566
  getSuggestedSymbolForNonexistentModule,
43599
- getSuggestionForNonexistentExport,
43600
43567
  getSuggestedSymbolForNonexistentClassMember,
43601
43568
  getBaseConstraintOfType,
43602
43569
  getDefaultFromTypeParameter: (type) => type && type.flags & 262144 /* TypeParameter */ ? getDefaultFromTypeParameter(type) : void 0,
@@ -47624,15 +47591,19 @@ function createTypeChecker(host) {
47624
47591
  return true;
47625
47592
  }
47626
47593
  }
47627
- function isEntityNameVisible(entityName, enclosingDeclaration) {
47594
+ function getMeaningOfEntityNameReference(entityName) {
47628
47595
  let meaning;
47629
47596
  if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */) {
47630
47597
  meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
47631
- } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */) {
47598
+ } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */ || entityName.parent.kind === 166 /* QualifiedName */ && entityName.parent.left === entityName || entityName.parent.kind === 211 /* PropertyAccessExpression */ && entityName.parent.expression === entityName || entityName.parent.kind === 212 /* ElementAccessExpression */ && entityName.parent.expression === entityName) {
47632
47599
  meaning = 1920 /* Namespace */;
47633
47600
  } else {
47634
47601
  meaning = 788968 /* Type */;
47635
47602
  }
47603
+ return meaning;
47604
+ }
47605
+ function isEntityNameVisible(entityName, enclosingDeclaration) {
47606
+ const meaning = getMeaningOfEntityNameReference(entityName);
47636
47607
  const firstIdentifier = getFirstIdentifier(entityName);
47637
47608
  const symbol = resolveName(
47638
47609
  enclosingDeclaration,
@@ -49307,14 +49278,6 @@ function createTypeChecker(host) {
49307
49278
  return file.moduleName;
49308
49279
  }
49309
49280
  if (!file) {
49310
- if (context.tracker.trackReferencedAmbientModule) {
49311
- const ambientDecls = filter(symbol.declarations, isAmbientModule);
49312
- if (length(ambientDecls)) {
49313
- for (const decl of ambientDecls) {
49314
- context.tracker.trackReferencedAmbientModule(decl, symbol);
49315
- }
49316
- }
49317
- }
49318
49281
  if (ambientModuleSymbolRegex.test(symbol.escapedName)) {
49319
49282
  return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
49320
49283
  }
@@ -49407,8 +49370,6 @@ function createTypeChecker(host) {
49407
49370
  }
49408
49371
  }
49409
49372
  const lit = factory.createLiteralTypeNode(factory.createStringLiteral(specifier));
49410
- if (context.tracker.trackExternalModuleSymbolOfImportTypeNode)
49411
- context.tracker.trackExternalModuleSymbolOfImportTypeNode(chain[0]);
49412
49373
  context.approximateLength += specifier.length + 10;
49413
49374
  if (!nonRootParts || isEntityName(nonRootParts)) {
49414
49375
  if (nonRootParts) {
@@ -49749,9 +49710,10 @@ function createTypeChecker(host) {
49749
49710
  introducesError = true;
49750
49711
  return { introducesError, node };
49751
49712
  }
49713
+ const meaning = getMeaningOfEntityNameReference(node);
49752
49714
  const sym = resolveEntityName(
49753
49715
  leftmost,
49754
- -1 /* All */,
49716
+ meaning,
49755
49717
  /*ignoreErrors*/
49756
49718
  true,
49757
49719
  /*dontResolveAlias*/
@@ -49761,7 +49723,7 @@ function createTypeChecker(host) {
49761
49723
  if (isSymbolAccessible(
49762
49724
  sym,
49763
49725
  context.enclosingDeclaration,
49764
- -1 /* All */,
49726
+ meaning,
49765
49727
  /*shouldComputeAliasesToMakeVisible*/
49766
49728
  false
49767
49729
  ).accessibility !== 0 /* Accessible */) {
@@ -49769,7 +49731,7 @@ function createTypeChecker(host) {
49769
49731
  introducesError = true;
49770
49732
  }
49771
49733
  } else {
49772
- context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
49734
+ context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
49773
49735
  includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
49774
49736
  }
49775
49737
  if (isIdentifier(node)) {
@@ -49967,18 +49929,6 @@ function createTypeChecker(host) {
49967
49929
  return factory.createStringLiteral(newName);
49968
49930
  }
49969
49931
  }
49970
- } else {
49971
- if (context.tracker && context.tracker.trackExternalModuleSymbolOfImportTypeNode) {
49972
- const moduleSym = resolveExternalModuleNameWorker(
49973
- lit,
49974
- lit,
49975
- /*moduleNotFoundError*/
49976
- void 0
49977
- );
49978
- if (moduleSym) {
49979
- context.tracker.trackExternalModuleSymbolOfImportTypeNode(moduleSym);
49980
- }
49981
- }
49982
49932
  }
49983
49933
  return lit;
49984
49934
  }
@@ -57736,6 +57686,9 @@ function createTypeChecker(host) {
57736
57686
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
57737
57687
  removeFromEach(typeSet, 65536 /* Null */);
57738
57688
  result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
57689
+ } else if (typeSet.length >= 4) {
57690
+ const middle = Math.floor(typeSet.length / 2);
57691
+ result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle)), getIntersectionType(typeSet.slice(middle))], aliasSymbol, aliasTypeArguments);
57739
57692
  } else {
57740
57693
  if (!checkCrossProductUnion(typeSet)) {
57741
57694
  return errorType;
@@ -70812,17 +70765,9 @@ function createTypeChecker(host) {
70812
70765
  );
70813
70766
  return result;
70814
70767
  }
70815
- function getSuggestionForNonexistentSymbol(location, outerName, meaning) {
70816
- const symbolResult = getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning);
70817
- return symbolResult && symbolName(symbolResult);
70818
- }
70819
70768
  function getSuggestedSymbolForNonexistentModule(name, targetModule) {
70820
70769
  return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule), 2623475 /* ModuleMember */);
70821
70770
  }
70822
- function getSuggestionForNonexistentExport(name, targetModule) {
70823
- const suggestion = getSuggestedSymbolForNonexistentModule(name, targetModule);
70824
- return suggestion && symbolName(suggestion);
70825
- }
70826
70771
  function getSuggestionForNonexistentIndexSignature(objectType, expr, keyedType) {
70827
70772
  function hasProp(name) {
70828
70773
  const prop = getPropertyOfObjectType(objectType, name);
@@ -80543,14 +80488,16 @@ function createTypeChecker(host) {
80543
80488
  if (!(nodeLinks2.flags & 1024 /* EnumValuesComputed */)) {
80544
80489
  nodeLinks2.flags |= 1024 /* EnumValuesComputed */;
80545
80490
  let autoValue = 0;
80491
+ let previous;
80546
80492
  for (const member of node.members) {
80547
- const value = computeMemberValue(member, autoValue);
80493
+ const value = computeMemberValue(member, autoValue, previous);
80548
80494
  getNodeLinks(member).enumMemberValue = value;
80549
80495
  autoValue = typeof value === "number" ? value + 1 : void 0;
80496
+ previous = member;
80550
80497
  }
80551
80498
  }
80552
80499
  }
80553
- function computeMemberValue(member, autoValue) {
80500
+ function computeMemberValue(member, autoValue, previous) {
80554
80501
  if (isComputedNonLiteralName(member.name)) {
80555
80502
  error(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
80556
80503
  } else {
@@ -80565,11 +80512,17 @@ function createTypeChecker(host) {
80565
80512
  if (member.parent.flags & 33554432 /* Ambient */ && !isEnumConst(member.parent)) {
80566
80513
  return void 0;
80567
80514
  }
80568
- if (autoValue !== void 0) {
80569
- return autoValue;
80515
+ if (autoValue === void 0) {
80516
+ error(member.name, Diagnostics.Enum_member_must_have_initializer);
80517
+ return void 0;
80570
80518
  }
80571
- error(member.name, Diagnostics.Enum_member_must_have_initializer);
80572
- return void 0;
80519
+ if (getIsolatedModules(compilerOptions) && (previous == null ? void 0 : previous.initializer) && !isSyntacticallyNumericConstant(previous.initializer)) {
80520
+ error(
80521
+ member.name,
80522
+ Diagnostics.Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled
80523
+ );
80524
+ }
80525
+ return autoValue;
80573
80526
  }
80574
80527
  function computeConstantValue(member) {
80575
80528
  const isConstEnum = isEnumConst(member.parent);
@@ -80581,6 +80534,12 @@ function createTypeChecker(host) {
80581
80534
  initializer,
80582
80535
  isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value
80583
80536
  );
80537
+ } else if (getIsolatedModules(compilerOptions) && typeof value === "string" && !isSyntacticallyString(initializer)) {
80538
+ error(
80539
+ initializer,
80540
+ Diagnostics._0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is_enabled,
80541
+ `${idText(member.parent.name)}.${getTextOfPropertyName(member.name)}`
80542
+ );
80584
80543
  }
80585
80544
  } else if (isConstEnum) {
80586
80545
  error(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
@@ -80591,6 +80550,18 @@ function createTypeChecker(host) {
80591
80550
  }
80592
80551
  return value;
80593
80552
  }
80553
+ function isSyntacticallyNumericConstant(expr) {
80554
+ expr = skipOuterExpressions(expr);
80555
+ switch (expr.kind) {
80556
+ case 224 /* PrefixUnaryExpression */:
80557
+ return isSyntacticallyNumericConstant(expr.operand);
80558
+ case 226 /* BinaryExpression */:
80559
+ return isSyntacticallyNumericConstant(expr.left) && isSyntacticallyNumericConstant(expr.right);
80560
+ case 9 /* NumericLiteral */:
80561
+ return true;
80562
+ }
80563
+ return false;
80564
+ }
80594
80565
  function evaluate(expr, location) {
80595
80566
  switch (expr.kind) {
80596
80567
  case 224 /* PrefixUnaryExpression */:
@@ -82620,23 +82591,6 @@ function createTypeChecker(host) {
82620
82591
  const isPropertyName2 = (isPropertyAccessExpression(parent) || isPropertyAssignment(parent)) && parent.name === node;
82621
82592
  return !isPropertyName2 && getReferencedValueSymbol(node) === argumentsSymbol;
82622
82593
  }
82623
- function moduleExportsSomeValue(moduleReferenceExpression) {
82624
- let moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
82625
- if (!moduleSymbol || isShorthandAmbientModuleSymbol(moduleSymbol)) {
82626
- return true;
82627
- }
82628
- const hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);
82629
- moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
82630
- const symbolLinks2 = getSymbolLinks(moduleSymbol);
82631
- if (symbolLinks2.exportsSomeValue === void 0) {
82632
- symbolLinks2.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 111551 /* Value */) : forEachEntry(getExportsOfModule(moduleSymbol), isValue);
82633
- }
82634
- return symbolLinks2.exportsSomeValue;
82635
- function isValue(s) {
82636
- s = resolveSymbol(s);
82637
- return s && !!(getSymbolFlags(s) & 111551 /* Value */);
82638
- }
82639
- }
82640
82594
  function isNameOfModuleOrEnumDeclaration(node) {
82641
82595
  return isModuleOrEnumDeclaration(node.parent) && node === node.parent.name;
82642
82596
  }
@@ -83213,20 +83167,6 @@ function createTypeChecker(host) {
83213
83167
  }
83214
83168
  }
83215
83169
  function createResolver() {
83216
- const resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives();
83217
- let fileToDirective;
83218
- if (resolvedTypeReferenceDirectives) {
83219
- fileToDirective = /* @__PURE__ */ new Map();
83220
- resolvedTypeReferenceDirectives.forEach(({ resolvedTypeReferenceDirective }, key, mode) => {
83221
- if (!(resolvedTypeReferenceDirective == null ? void 0 : resolvedTypeReferenceDirective.resolvedFileName)) {
83222
- return;
83223
- }
83224
- const file = host.getSourceFile(resolvedTypeReferenceDirective.resolvedFileName);
83225
- if (file) {
83226
- addReferencedFilesToTypeDirective(file, key, mode);
83227
- }
83228
- });
83229
- }
83230
83170
  return {
83231
83171
  getReferencedExportContainer,
83232
83172
  getReferencedImportDeclaration,
@@ -83266,14 +83206,11 @@ function createTypeChecker(host) {
83266
83206
  getReferencedValueDeclarations,
83267
83207
  getTypeReferenceSerializationKind,
83268
83208
  isOptionalParameter,
83269
- moduleExportsSomeValue,
83270
83209
  isArgumentsLocalBinding,
83271
83210
  getExternalModuleFileFromDeclaration: (nodeIn) => {
83272
83211
  const node = getParseTreeNode(nodeIn, hasPossibleExternalModuleReference);
83273
83212
  return node && getExternalModuleFileFromDeclaration(node);
83274
83213
  },
83275
- getTypeReferenceDirectivesForEntityName,
83276
- getTypeReferenceDirectivesForSymbol,
83277
83214
  isLiteralConstDeclaration,
83278
83215
  isLateBound: (nodeIn) => {
83279
83216
  const node = getParseTreeNode(nodeIn, isDeclaration);
@@ -83297,12 +83234,6 @@ function createTypeChecker(host) {
83297
83234
  getAccessor
83298
83235
  };
83299
83236
  },
83300
- getSymbolOfExternalModuleSpecifier: (moduleName) => resolveExternalModuleNameWorker(
83301
- moduleName,
83302
- moduleName,
83303
- /*moduleNotFoundError*/
83304
- void 0
83305
- ),
83306
83237
  isBindingCapturedByNode: (node, decl) => {
83307
83238
  const parseNode = getParseTreeNode(node);
83308
83239
  const parseDecl = getParseTreeNode(decl);
@@ -83317,16 +83248,7 @@ function createTypeChecker(host) {
83317
83248
  }
83318
83249
  return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker, bundled);
83319
83250
  },
83320
- isImportRequiredByAugmentation,
83321
- tryFindAmbientModule: (moduleReferenceExpression) => {
83322
- const node = getParseTreeNode(moduleReferenceExpression);
83323
- const moduleSpecifier = node && isStringLiteralLike(node) ? node.text : void 0;
83324
- return moduleSpecifier !== void 0 ? tryFindAmbientModule(
83325
- moduleSpecifier,
83326
- /*withAugmentations*/
83327
- true
83328
- ) : void 0;
83329
- }
83251
+ isImportRequiredByAugmentation
83330
83252
  };
83331
83253
  function isImportRequiredByAugmentation(node) {
83332
83254
  const file = getSourceFileOfNode(node);
@@ -83353,84 +83275,6 @@ function createTypeChecker(host) {
83353
83275
  }
83354
83276
  return false;
83355
83277
  }
83356
- function isInHeritageClause(node) {
83357
- return node.parent && node.parent.kind === 233 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 298 /* HeritageClause */;
83358
- }
83359
- function getTypeReferenceDirectivesForEntityName(node) {
83360
- if (!fileToDirective) {
83361
- return void 0;
83362
- }
83363
- let meaning;
83364
- if (node.parent.kind === 167 /* ComputedPropertyName */) {
83365
- meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
83366
- } else {
83367
- meaning = 788968 /* Type */ | 1920 /* Namespace */;
83368
- if (node.kind === 80 /* Identifier */ && isInTypeQuery(node) || node.kind === 211 /* PropertyAccessExpression */ && !isInHeritageClause(node)) {
83369
- meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
83370
- }
83371
- }
83372
- const symbol = resolveEntityName(
83373
- node,
83374
- meaning,
83375
- /*ignoreErrors*/
83376
- true
83377
- );
83378
- return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : void 0;
83379
- }
83380
- function getTypeReferenceDirectivesForSymbol(symbol, meaning) {
83381
- if (!fileToDirective || !isSymbolFromTypeDeclarationFile(symbol)) {
83382
- return void 0;
83383
- }
83384
- let typeReferenceDirectives;
83385
- for (const decl of symbol.declarations) {
83386
- if (decl.symbol && decl.symbol.flags & meaning) {
83387
- const file = getSourceFileOfNode(decl);
83388
- const typeReferenceDirective = fileToDirective.get(file.path);
83389
- if (typeReferenceDirective) {
83390
- (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective);
83391
- } else {
83392
- return void 0;
83393
- }
83394
- }
83395
- }
83396
- return typeReferenceDirectives;
83397
- }
83398
- function isSymbolFromTypeDeclarationFile(symbol) {
83399
- if (!symbol.declarations) {
83400
- return false;
83401
- }
83402
- let current = symbol;
83403
- while (true) {
83404
- const parent = getParentOfSymbol(current);
83405
- if (parent) {
83406
- current = parent;
83407
- } else {
83408
- break;
83409
- }
83410
- }
83411
- if (current.valueDeclaration && current.valueDeclaration.kind === 307 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
83412
- return false;
83413
- }
83414
- for (const decl of symbol.declarations) {
83415
- const file = getSourceFileOfNode(decl);
83416
- if (fileToDirective.has(file.path)) {
83417
- return true;
83418
- }
83419
- }
83420
- return false;
83421
- }
83422
- function addReferencedFilesToTypeDirective(file, key, mode) {
83423
- if (fileToDirective.has(file.path))
83424
- return;
83425
- fileToDirective.set(file.path, [key, mode]);
83426
- for (const { fileName } of file.referencedFiles) {
83427
- const resolvedFile = resolveTripleslashReference(fileName, file.fileName);
83428
- const referencedFile = host.getSourceFile(resolvedFile);
83429
- if (referencedFile) {
83430
- addReferencedFilesToTypeDirective(referencedFile, key, mode || file.impliedNodeFormat);
83431
- }
83432
- }
83433
- }
83434
83278
  }
83435
83279
  function getExternalModuleFileFromDeclaration(declaration) {
83436
83280
  const specifier = declaration.kind === 267 /* ModuleDeclaration */ ? tryCast(declaration.name, isStringLiteral) : getExternalModuleName(declaration);
@@ -85354,20 +85198,6 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
85354
85198
  this.inner.reportTruncationError();
85355
85199
  }
85356
85200
  }
85357
- trackReferencedAmbientModule(decl, symbol) {
85358
- var _a;
85359
- if ((_a = this.inner) == null ? void 0 : _a.trackReferencedAmbientModule) {
85360
- this.onDiagnosticReported();
85361
- this.inner.trackReferencedAmbientModule(decl, symbol);
85362
- }
85363
- }
85364
- trackExternalModuleSymbolOfImportTypeNode(symbol) {
85365
- var _a;
85366
- if ((_a = this.inner) == null ? void 0 : _a.trackExternalModuleSymbolOfImportTypeNode) {
85367
- this.onDiagnosticReported();
85368
- this.inner.trackExternalModuleSymbolOfImportTypeNode(symbol);
85369
- }
85370
- }
85371
85201
  reportNonlocalAugmentation(containingFile, parentSymbol, augmentingSymbol) {
85372
85202
  var _a;
85373
85203
  if ((_a = this.inner) == null ? void 0 : _a.reportNonlocalAugmentation) {
@@ -108372,11 +108202,9 @@ function transformDeclarations(context) {
108372
108202
  let needsScopeFixMarker = false;
108373
108203
  let resultHasScopeMarker = false;
108374
108204
  let enclosingDeclaration;
108375
- let necessaryTypeReferences;
108376
108205
  let lateMarkedStatements;
108377
108206
  let lateStatementReplacementMap;
108378
108207
  let suppressNewDiagnosticContexts;
108379
- let exportedModulesFromDeclarationEmit;
108380
108208
  const { factory: factory2 } = context;
108381
108209
  const host = context.getEmitHost();
108382
108210
  const symbolTracker = {
@@ -108388,49 +108216,19 @@ function transformDeclarations(context) {
108388
108216
  reportLikelyUnsafeImportRequiredError,
108389
108217
  reportTruncationError,
108390
108218
  moduleResolverHost: host,
108391
- trackReferencedAmbientModule,
108392
- trackExternalModuleSymbolOfImportTypeNode,
108393
108219
  reportNonlocalAugmentation,
108394
108220
  reportNonSerializableProperty
108395
108221
  };
108396
108222
  let errorNameNode;
108397
108223
  let errorFallbackNode;
108398
108224
  let currentSourceFile;
108399
- let refs;
108400
- let libs2;
108401
- let emittedImports;
108225
+ let rawReferencedFiles;
108226
+ let rawTypeReferenceDirectives;
108227
+ let rawLibReferenceDirectives;
108402
108228
  const resolver = context.getEmitResolver();
108403
108229
  const options = context.getCompilerOptions();
108404
- const { noResolve, stripInternal } = options;
108230
+ const { stripInternal } = options;
108405
108231
  return transformRoot;
108406
- function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) {
108407
- if (!typeReferenceDirectives) {
108408
- return;
108409
- }
108410
- necessaryTypeReferences = necessaryTypeReferences || /* @__PURE__ */ new Set();
108411
- for (const ref of typeReferenceDirectives) {
108412
- necessaryTypeReferences.add(ref);
108413
- }
108414
- }
108415
- function trackReferencedAmbientModule(node, symbol) {
108416
- const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol, -1 /* All */);
108417
- if (length(directives)) {
108418
- return recordTypeReferenceDirectivesIfNecessary(directives);
108419
- }
108420
- const container = getSourceFileOfNode(node);
108421
- refs.set(getOriginalNodeId(container), container);
108422
- }
108423
- function trackReferencedAmbientModuleFromImport(node) {
108424
- const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(node);
108425
- const symbol = moduleSpecifier && resolver.tryFindAmbientModule(moduleSpecifier);
108426
- if (symbol == null ? void 0 : symbol.declarations) {
108427
- for (const decl of symbol.declarations) {
108428
- if (isAmbientModule(decl) && getSourceFileOfNode(decl) !== currentSourceFile) {
108429
- trackReferencedAmbientModule(decl, symbol);
108430
- }
108431
- }
108432
- }
108433
- }
108434
108232
  function handleSymbolAccessibilityError(symbolAccessibilityResult) {
108435
108233
  if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {
108436
108234
  if (symbolAccessibilityResult.aliasesToMakeVisible) {
@@ -108455,11 +108253,6 @@ function transformDeclarations(context) {
108455
108253
  }
108456
108254
  return false;
108457
108255
  }
108458
- function trackExternalModuleSymbolOfImportTypeNode(symbol) {
108459
- if (!isBundledEmit) {
108460
- (exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
108461
- }
108462
- }
108463
108256
  function trackSymbol(symbol, enclosingDeclaration2, meaning) {
108464
108257
  if (symbol.flags & 262144 /* TypeParameter */)
108465
108258
  return false;
@@ -108470,7 +108263,6 @@ function transformDeclarations(context) {
108470
108263
  /*shouldComputeAliasToMarkVisible*/
108471
108264
  true
108472
108265
  ));
108473
- recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
108474
108266
  return issuedDiagnostic;
108475
108267
  }
108476
108268
  function reportPrivateInBaseOfClassExpression(propertyName) {
@@ -108542,8 +108334,9 @@ function transformDeclarations(context) {
108542
108334
  }
108543
108335
  if (node.kind === 308 /* Bundle */) {
108544
108336
  isBundledEmit = true;
108545
- refs = /* @__PURE__ */ new Map();
108546
- libs2 = /* @__PURE__ */ new Map();
108337
+ rawReferencedFiles = [];
108338
+ rawTypeReferenceDirectives = [];
108339
+ rawLibReferenceDirectives = [];
108547
108340
  let hasNoDefaultLib = false;
108548
108341
  const bundle = factory2.createBundle(
108549
108342
  map(node.sourceFiles, (sourceFile) => {
@@ -108558,8 +108351,7 @@ function transformDeclarations(context) {
108558
108351
  getSymbolAccessibilityDiagnostic = throwDiagnostic;
108559
108352
  needsScopeFixMarker = false;
108560
108353
  resultHasScopeMarker = false;
108561
- collectReferences(sourceFile, refs);
108562
- collectLibs(sourceFile, libs2);
108354
+ collectFileReferences(sourceFile);
108563
108355
  if (isExternalOrCommonJsModule(sourceFile) || isJsonSourceFile(sourceFile)) {
108564
108356
  resultHasExternalModuleIndicator = false;
108565
108357
  needsDeclare = false;
@@ -108606,18 +108398,16 @@ function transformDeclarations(context) {
108606
108398
  );
108607
108399
  })
108608
108400
  );
108609
- bundle.syntheticFileReferences = [];
108610
- bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences();
108611
- bundle.syntheticLibReferences = getLibReferences();
108612
- bundle.hasNoDefaultLib = hasNoDefaultLib;
108613
108401
  const outputFilePath2 = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
108614
108402
  node,
108615
108403
  host,
108616
108404
  /*forceDtsPaths*/
108617
108405
  true
108618
108406
  ).declarationFilePath));
108619
- const referenceVisitor2 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath2);
108620
- refs.forEach(referenceVisitor2);
108407
+ bundle.syntheticFileReferences = getReferencedFiles(outputFilePath2);
108408
+ bundle.syntheticTypeReferences = getTypeReferences();
108409
+ bundle.syntheticLibReferences = getLibReferences();
108410
+ bundle.hasNoDefaultLib = hasNoDefaultLib;
108621
108411
  return bundle;
108622
108412
  }
108623
108413
  needsDeclare = true;
@@ -108631,66 +108421,68 @@ function transformDeclarations(context) {
108631
108421
  suppressNewDiagnosticContexts = false;
108632
108422
  lateMarkedStatements = void 0;
108633
108423
  lateStatementReplacementMap = /* @__PURE__ */ new Map();
108634
- necessaryTypeReferences = void 0;
108635
- refs = collectReferences(currentSourceFile, /* @__PURE__ */ new Map());
108636
- libs2 = collectLibs(currentSourceFile, /* @__PURE__ */ new Map());
108637
- const references = [];
108638
- const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
108639
- node,
108640
- host,
108641
- /*forceDtsPaths*/
108642
- true
108643
- ).declarationFilePath));
108644
- const referenceVisitor = mapReferencesIntoArray(references, outputFilePath);
108424
+ rawReferencedFiles = [];
108425
+ rawTypeReferenceDirectives = [];
108426
+ rawLibReferenceDirectives = [];
108427
+ collectFileReferences(currentSourceFile);
108645
108428
  let combinedStatements;
108646
108429
  if (isSourceFileJS(currentSourceFile)) {
108647
108430
  combinedStatements = factory2.createNodeArray(transformDeclarationsForJS(node));
108648
- refs.forEach(referenceVisitor);
108649
- emittedImports = filter(combinedStatements, isAnyImportSyntax);
108650
108431
  } else {
108651
108432
  const statements = visitNodes2(node.statements, visitDeclarationStatements, isStatement);
108652
108433
  combinedStatements = setTextRange(factory2.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
108653
- refs.forEach(referenceVisitor);
108654
- emittedImports = filter(combinedStatements, isAnyImportSyntax);
108655
108434
  if (isExternalModule(node) && (!resultHasExternalModuleIndicator || needsScopeFixMarker && !resultHasScopeMarker)) {
108656
108435
  combinedStatements = setTextRange(factory2.createNodeArray([...combinedStatements, createEmptyExports(factory2)]), combinedStatements);
108657
108436
  }
108658
108437
  }
108438
+ const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
108439
+ node,
108440
+ host,
108441
+ /*forceDtsPaths*/
108442
+ true
108443
+ ).declarationFilePath));
108659
108444
  return factory2.updateSourceFile(
108660
108445
  node,
108661
108446
  combinedStatements,
108662
108447
  /*isDeclarationFile*/
108663
108448
  true,
108664
- references,
108665
- getFileReferencesForUsedTypeReferences(),
108449
+ getReferencedFiles(outputFilePath),
108450
+ getTypeReferences(),
108666
108451
  node.hasNoDefaultLib,
108667
108452
  getLibReferences()
108668
108453
  );
108669
- function getLibReferences() {
108670
- return arrayFrom(libs2.keys(), (lib) => ({ fileName: lib, pos: -1, end: -1 }));
108454
+ function collectFileReferences(sourceFile) {
108455
+ rawReferencedFiles = concatenate(rawReferencedFiles, map(sourceFile.referencedFiles, (f) => [sourceFile, f]));
108456
+ rawTypeReferenceDirectives = concatenate(rawTypeReferenceDirectives, sourceFile.typeReferenceDirectives);
108457
+ rawLibReferenceDirectives = concatenate(rawLibReferenceDirectives, sourceFile.libReferenceDirectives);
108671
108458
  }
108672
- function getFileReferencesForUsedTypeReferences() {
108673
- return necessaryTypeReferences ? mapDefined(arrayFrom(necessaryTypeReferences.keys()), getFileReferenceForSpecifierModeTuple) : [];
108459
+ function copyFileReferenceAsSynthetic(ref) {
108460
+ const newRef = { ...ref };
108461
+ newRef.pos = -1;
108462
+ newRef.end = -1;
108463
+ return newRef;
108674
108464
  }
108675
- function getFileReferenceForSpecifierModeTuple([typeName, mode]) {
108676
- if (emittedImports) {
108677
- for (const importStatement of emittedImports) {
108678
- if (isImportEqualsDeclaration(importStatement) && isExternalModuleReference(importStatement.moduleReference)) {
108679
- const expr = importStatement.moduleReference.expression;
108680
- if (isStringLiteralLike(expr) && expr.text === typeName) {
108681
- return void 0;
108682
- }
108683
- } else if (isImportDeclaration(importStatement) && isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) {
108684
- return void 0;
108685
- }
108686
- }
108687
- }
108688
- return { fileName: typeName, pos: -1, end: -1, ...mode ? { resolutionMode: mode } : void 0 };
108465
+ function getTypeReferences() {
108466
+ return mapDefined(rawTypeReferenceDirectives, (ref) => {
108467
+ if (!ref.preserve)
108468
+ return void 0;
108469
+ return copyFileReferenceAsSynthetic(ref);
108470
+ });
108689
108471
  }
108690
- function mapReferencesIntoArray(references2, outputFilePath2) {
108691
- return (file) => {
108692
- if (exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.includes(file.symbol)) {
108693
- return;
108472
+ function getLibReferences() {
108473
+ return mapDefined(rawLibReferenceDirectives, (ref) => {
108474
+ if (!ref.preserve)
108475
+ return void 0;
108476
+ return copyFileReferenceAsSynthetic(ref);
108477
+ });
108478
+ }
108479
+ function getReferencedFiles(outputFilePath2) {
108480
+ return mapDefined(rawReferencedFiles, ([sourceFile, ref]) => {
108481
+ if (!ref.preserve)
108482
+ return void 0;
108483
+ const file = host.getSourceFileFromReference(sourceFile, ref);
108484
+ if (!file) {
108485
+ return void 0;
108694
108486
  }
108695
108487
  let declFileName;
108696
108488
  if (file.isDeclarationFile) {
@@ -108706,61 +108498,22 @@ function transformDeclarations(context) {
108706
108498
  );
108707
108499
  declFileName = paths.declarationFilePath || paths.jsFilePath || file.fileName;
108708
108500
  }
108709
- if (declFileName) {
108710
- const specifier = getModuleSpecifier(
108711
- options,
108712
- currentSourceFile,
108713
- getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
108714
- getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
108715
- host
108716
- );
108717
- if (!pathIsRelative(specifier)) {
108718
- recordTypeReferenceDirectivesIfNecessary([[
108719
- specifier,
108720
- /*mode*/
108721
- void 0
108722
- ]]);
108723
- return;
108724
- }
108725
- let fileName = getRelativePathToDirectoryOrUrl(
108726
- outputFilePath2,
108727
- declFileName,
108728
- host.getCurrentDirectory(),
108729
- host.getCanonicalFileName,
108730
- /*isAbsolutePathAnUrl*/
108731
- false
108732
- );
108733
- if (startsWith(fileName, "./") && hasExtension(fileName)) {
108734
- fileName = fileName.substring(2);
108735
- }
108736
- if (startsWith(fileName, "node_modules/") || pathContainsNodeModules(fileName)) {
108737
- return;
108738
- }
108739
- references2.push({ pos: -1, end: -1, fileName });
108740
- }
108741
- };
108501
+ if (!declFileName)
108502
+ return void 0;
108503
+ const fileName = getRelativePathToDirectoryOrUrl(
108504
+ outputFilePath2,
108505
+ declFileName,
108506
+ host.getCurrentDirectory(),
108507
+ host.getCanonicalFileName,
108508
+ /*isAbsolutePathAnUrl*/
108509
+ false
108510
+ );
108511
+ const newRef = copyFileReferenceAsSynthetic(ref);
108512
+ newRef.fileName = fileName;
108513
+ return newRef;
108514
+ });
108742
108515
  }
108743
108516
  }
108744
- function collectReferences(sourceFile, ret) {
108745
- if (noResolve || isSourceFileJS(sourceFile))
108746
- return ret;
108747
- forEach(sourceFile.referencedFiles, (f) => {
108748
- const elem = host.getSourceFileFromReference(sourceFile, f);
108749
- if (elem) {
108750
- ret.set(getOriginalNodeId(elem), elem);
108751
- }
108752
- });
108753
- return ret;
108754
- }
108755
- function collectLibs(sourceFile, ret) {
108756
- forEach(sourceFile.libReferenceDirectives, (ref) => {
108757
- const lib = host.getLibFileFromReference(ref);
108758
- if (lib) {
108759
- ret.set(toFileNameLowerCase(ref.fileName), true);
108760
- }
108761
- });
108762
- return ret;
108763
- }
108764
108517
  function filterBindingPatternInitializers(name) {
108765
108518
  if (name.kind === 80 /* Identifier */) {
108766
108519
  return name;
@@ -108959,7 +108712,6 @@ function transformDeclarations(context) {
108959
108712
  function checkEntityNameVisibility(entityName, enclosingDeclaration2) {
108960
108713
  const visibilityResult = resolver.isEntityNameVisible(entityName, enclosingDeclaration2);
108961
108714
  handleSymbolAccessibilityError(visibilityResult);
108962
- recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName));
108963
108715
  }
108964
108716
  function preserveJsDoc(updated, original) {
108965
108717
  if (hasJSDocNodes(updated) && hasJSDocNodes(original)) {
@@ -108977,11 +108729,6 @@ function transformDeclarations(context) {
108977
108729
  if (newName) {
108978
108730
  return factory2.createStringLiteral(newName);
108979
108731
  }
108980
- } else {
108981
- const symbol = resolver.getSymbolOfExternalModuleSpecifier(input);
108982
- if (symbol) {
108983
- (exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
108984
- }
108985
108732
  }
108986
108733
  }
108987
108734
  return input;
@@ -109374,7 +109121,6 @@ function transformDeclarations(context) {
109374
109121
  case 205 /* ImportType */: {
109375
109122
  if (!isLiteralImportTypeNode(input))
109376
109123
  return cleanup(input);
109377
- trackReferencedAmbientModuleFromImport(input);
109378
109124
  return cleanup(factory2.updateImportTypeNode(
109379
109125
  input,
109380
109126
  factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)),
@@ -109426,7 +109172,6 @@ function transformDeclarations(context) {
109426
109172
  resultHasExternalModuleIndicator = true;
109427
109173
  }
109428
109174
  resultHasScopeMarker = true;
109429
- trackReferencedAmbientModuleFromImport(input);
109430
109175
  return factory2.updateExportDeclaration(
109431
109176
  input,
109432
109177
  input.modifiers,
@@ -109501,18 +109246,10 @@ function transformDeclarations(context) {
109501
109246
  return;
109502
109247
  switch (input.kind) {
109503
109248
  case 271 /* ImportEqualsDeclaration */: {
109504
- const transformed = transformImportEqualsDeclaration(input);
109505
- if (transformed) {
109506
- trackReferencedAmbientModuleFromImport(input);
109507
- }
109508
- return transformed;
109249
+ return transformImportEqualsDeclaration(input);
109509
109250
  }
109510
109251
  case 272 /* ImportDeclaration */: {
109511
- const transformed = transformImportDeclaration(input);
109512
- if (transformed) {
109513
- trackReferencedAmbientModuleFromImport(input);
109514
- }
109515
- return transformed;
109252
+ return transformImportDeclaration(input);
109516
109253
  }
109517
109254
  }
109518
109255
  if (isDeclaration(input) && isDeclarationAndNotVisible(input))
@@ -111071,20 +110808,15 @@ var notImplementedResolver = {
111071
110808
  getReferencedValueDeclarations: notImplemented,
111072
110809
  getTypeReferenceSerializationKind: notImplemented,
111073
110810
  isOptionalParameter: notImplemented,
111074
- moduleExportsSomeValue: notImplemented,
111075
110811
  isArgumentsLocalBinding: notImplemented,
111076
110812
  getExternalModuleFileFromDeclaration: notImplemented,
111077
- getTypeReferenceDirectivesForEntityName: notImplemented,
111078
- getTypeReferenceDirectivesForSymbol: notImplemented,
111079
110813
  isLiteralConstDeclaration: notImplemented,
111080
110814
  getJsxFactoryEntity: notImplemented,
111081
110815
  getJsxFragmentFactoryEntity: notImplemented,
111082
110816
  getAllAccessorDeclarations: notImplemented,
111083
- getSymbolOfExternalModuleSpecifier: notImplemented,
111084
110817
  isBindingCapturedByNode: notImplemented,
111085
110818
  getDeclarationStatementsForSourceFile: notImplemented,
111086
- isImportRequiredByAugmentation: notImplemented,
111087
- tryFindAmbientModule: notImplemented
110819
+ isImportRequiredByAugmentation: notImplemented
111088
110820
  };
111089
110821
  var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
111090
110822
  var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@@ -113839,19 +113571,17 @@ function createPrinter(printerOptions = {}, handlers = {}) {
113839
113571
  writeLine();
113840
113572
  }
113841
113573
  }
113842
- for (const directive of files) {
113843
- writeComment(`/// <reference path="${directive.fileName}" />`);
113844
- writeLine();
113845
- }
113846
- for (const directive of types) {
113847
- const resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile == null ? void 0 : currentSourceFile.impliedNodeFormat) ? `resolution-mode="${directive.resolutionMode === 99 /* ESNext */ ? "import" : "require"}"` : "";
113848
- writeComment(`/// <reference types="${directive.fileName}" ${resolutionMode}/>`);
113849
- writeLine();
113850
- }
113851
- for (const directive of libs2) {
113852
- writeComment(`/// <reference lib="${directive.fileName}" />`);
113853
- writeLine();
113574
+ function writeDirectives(kind, directives) {
113575
+ for (const directive of directives) {
113576
+ const resolutionMode = directive.resolutionMode ? `resolution-mode="${directive.resolutionMode === 99 /* ESNext */ ? "import" : "require"}" ` : "";
113577
+ const preserve = directive.preserve ? `preserve="true" ` : "";
113578
+ writeComment(`/// <reference ${kind}="${directive.fileName}" ${resolutionMode}${preserve}/>`);
113579
+ writeLine();
113580
+ }
113854
113581
  }
113582
+ writeDirectives("path", files);
113583
+ writeDirectives("types", types);
113584
+ writeDirectives("lib", libs2);
113855
113585
  }
113856
113586
  function emitSourceFileWorker(node) {
113857
113587
  const statements = node.statements;
@@ -117688,7 +117418,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117688
117418
  getSourceFile: program.getSourceFile,
117689
117419
  getSourceFileByPath: program.getSourceFileByPath,
117690
117420
  getSourceFiles: program.getSourceFiles,
117691
- getLibFileFromReference: program.getLibFileFromReference,
117692
117421
  isSourceFileFromExternalLibrary,
117693
117422
  getResolvedProjectReferenceToRedirect,
117694
117423
  getProjectReferenceRedirect,