@typescript-deploys/pr-build 5.5.0-pr-57847-18 → 5.5.0-pr-57681-18

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-insiders.20240319`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240320`;
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;
@@ -47145,13 +47115,6 @@ function createTypeChecker(host) {
47145
47115
  });
47146
47116
  }
47147
47117
  function getSymbolIfSameReference(s1, s2) {
47148
- var _a, _b;
47149
- if (s1.flags & 524288 /* TypeAlias */ && ((_a = s2.declarations) == null ? void 0 : _a.find(isTypeAlias))) {
47150
- s2 = getDeclaredTypeOfTypeAlias(s2).aliasSymbol || s2;
47151
- }
47152
- if (s2.flags & 524288 /* TypeAlias */ && ((_b = s1.declarations) == null ? void 0 : _b.find(isTypeAlias))) {
47153
- s1 = getDeclaredTypeOfTypeAlias(s1).aliasSymbol || s1;
47154
- }
47155
47118
  if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
47156
47119
  return s1;
47157
47120
  }
@@ -49314,14 +49277,6 @@ function createTypeChecker(host) {
49314
49277
  return file.moduleName;
49315
49278
  }
49316
49279
  if (!file) {
49317
- if (context.tracker.trackReferencedAmbientModule) {
49318
- const ambientDecls = filter(symbol.declarations, isAmbientModule);
49319
- if (length(ambientDecls)) {
49320
- for (const decl of ambientDecls) {
49321
- context.tracker.trackReferencedAmbientModule(decl, symbol);
49322
- }
49323
- }
49324
- }
49325
49280
  if (ambientModuleSymbolRegex.test(symbol.escapedName)) {
49326
49281
  return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
49327
49282
  }
@@ -49414,8 +49369,6 @@ function createTypeChecker(host) {
49414
49369
  }
49415
49370
  }
49416
49371
  const lit = factory.createLiteralTypeNode(factory.createStringLiteral(specifier));
49417
- if (context.tracker.trackExternalModuleSymbolOfImportTypeNode)
49418
- context.tracker.trackExternalModuleSymbolOfImportTypeNode(chain[0]);
49419
49372
  context.approximateLength += specifier.length + 10;
49420
49373
  if (!nonRootParts || isEntityName(nonRootParts)) {
49421
49374
  if (nonRootParts) {
@@ -49974,18 +49927,6 @@ function createTypeChecker(host) {
49974
49927
  return factory.createStringLiteral(newName);
49975
49928
  }
49976
49929
  }
49977
- } else {
49978
- if (context.tracker && context.tracker.trackExternalModuleSymbolOfImportTypeNode) {
49979
- const moduleSym = resolveExternalModuleNameWorker(
49980
- lit,
49981
- lit,
49982
- /*moduleNotFoundError*/
49983
- void 0
49984
- );
49985
- if (moduleSym) {
49986
- context.tracker.trackExternalModuleSymbolOfImportTypeNode(moduleSym);
49987
- }
49988
- }
49989
49930
  }
49990
49931
  return lit;
49991
49932
  }
@@ -65207,20 +65148,13 @@ function createTypeChecker(host) {
65207
65148
  return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
65208
65149
  case 166 /* QualifiedName */:
65209
65150
  const left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer);
65210
- return left && `${left}.${node.right.escapedText}`;
65151
+ return left && left + "." + node.right.escapedText;
65211
65152
  case 211 /* PropertyAccessExpression */:
65212
65153
  case 212 /* ElementAccessExpression */:
65213
65154
  const propName = getAccessedPropertyName(node);
65214
65155
  if (propName !== void 0) {
65215
65156
  const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
65216
- return key && `${key}.${propName}`;
65217
- }
65218
- if (isElementAccessExpression(node) && isIdentifier(node.argumentExpression)) {
65219
- const symbol = getResolvedSymbol(node.argumentExpression);
65220
- if (isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol)) {
65221
- const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
65222
- return key && `${key}.@${getSymbolId(symbol)}`;
65223
- }
65157
+ return key && key + "." + propName;
65224
65158
  }
65225
65159
  break;
65226
65160
  case 206 /* ObjectBindingPattern */:
@@ -65257,19 +65191,8 @@ function createTypeChecker(host) {
65257
65191
  case 211 /* PropertyAccessExpression */:
65258
65192
  case 212 /* ElementAccessExpression */:
65259
65193
  const sourcePropertyName = getAccessedPropertyName(source);
65260
- if (sourcePropertyName !== void 0) {
65261
- const targetPropertyName = isAccessExpression(target) ? getAccessedPropertyName(target) : void 0;
65262
- if (targetPropertyName !== void 0) {
65263
- return targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression);
65264
- }
65265
- }
65266
- if (isElementAccessExpression(source) && isElementAccessExpression(target) && isIdentifier(source.argumentExpression) && isIdentifier(target.argumentExpression)) {
65267
- const symbol = getResolvedSymbol(source.argumentExpression);
65268
- if (symbol === getResolvedSymbol(target.argumentExpression) && (isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol))) {
65269
- return isMatchingReference(source.expression, target.expression);
65270
- }
65271
- }
65272
- break;
65194
+ const targetPropertyName = isAccessExpression(target) ? getAccessedPropertyName(target) : void 0;
65195
+ return sourcePropertyName !== void 0 && targetPropertyName !== void 0 && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression);
65273
65196
  case 166 /* QualifiedName */:
65274
65197
  return isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression);
65275
65198
  case 226 /* BinaryExpression */:
@@ -65300,7 +65223,7 @@ function createTypeChecker(host) {
65300
65223
  return isStringOrNumericLiteralLike(node.argumentExpression) ? escapeLeadingUnderscores(node.argumentExpression.text) : isEntityNameExpression(node.argumentExpression) ? tryGetNameFromEntityNameExpression(node.argumentExpression) : void 0;
65301
65224
  }
65302
65225
  function tryGetNameFromEntityNameExpression(node) {
65303
- const symbol = isIdentifier(node) ? getResolvedSymbol(node) : resolveEntityName(
65226
+ const symbol = resolveEntityName(
65304
65227
  node,
65305
65228
  111551 /* Value */,
65306
65229
  /*ignoreErrors*/
@@ -80568,19 +80491,21 @@ function createTypeChecker(host) {
80568
80491
  if (!(nodeLinks2.flags & 1024 /* EnumValuesComputed */)) {
80569
80492
  nodeLinks2.flags |= 1024 /* EnumValuesComputed */;
80570
80493
  let autoValue = 0;
80494
+ let previous;
80571
80495
  for (const member of node.members) {
80572
- const value = computeMemberValue(member, autoValue);
80496
+ const value = computeMemberValue(member, autoValue, previous);
80573
80497
  getNodeLinks(member).enumMemberValue = value;
80574
80498
  autoValue = typeof value === "number" ? value + 1 : void 0;
80499
+ previous = member;
80575
80500
  }
80576
80501
  }
80577
80502
  }
80578
- function computeMemberValue(member, autoValue) {
80503
+ function computeMemberValue(member, autoValue, previous) {
80579
80504
  if (isComputedNonLiteralName(member.name)) {
80580
80505
  error(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
80581
80506
  } else {
80582
80507
  const text = getTextOfPropertyName(member.name);
80583
- if (isNumericLiteralName(text)) {
80508
+ if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
80584
80509
  error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
80585
80510
  }
80586
80511
  }
@@ -80590,11 +80515,17 @@ function createTypeChecker(host) {
80590
80515
  if (member.parent.flags & 33554432 /* Ambient */ && !isEnumConst(member.parent)) {
80591
80516
  return void 0;
80592
80517
  }
80593
- if (autoValue !== void 0) {
80594
- return autoValue;
80518
+ if (autoValue === void 0) {
80519
+ error(member.name, Diagnostics.Enum_member_must_have_initializer);
80520
+ return void 0;
80595
80521
  }
80596
- error(member.name, Diagnostics.Enum_member_must_have_initializer);
80597
- return void 0;
80522
+ if (getIsolatedModules(compilerOptions) && (previous == null ? void 0 : previous.initializer) && !isSyntacticallyNumericConstant(previous.initializer)) {
80523
+ error(
80524
+ member.name,
80525
+ Diagnostics.Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled
80526
+ );
80527
+ }
80528
+ return autoValue;
80598
80529
  }
80599
80530
  function computeConstantValue(member) {
80600
80531
  const isConstEnum = isEnumConst(member.parent);
@@ -80606,6 +80537,12 @@ function createTypeChecker(host) {
80606
80537
  initializer,
80607
80538
  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
80608
80539
  );
80540
+ } else if (getIsolatedModules(compilerOptions) && typeof value === "string" && !isSyntacticallyString(initializer)) {
80541
+ error(
80542
+ initializer,
80543
+ Diagnostics._0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is_enabled,
80544
+ `${idText(member.parent.name)}.${getTextOfPropertyName(member.name)}`
80545
+ );
80609
80546
  }
80610
80547
  } else if (isConstEnum) {
80611
80548
  error(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
@@ -80616,6 +80553,18 @@ function createTypeChecker(host) {
80616
80553
  }
80617
80554
  return value;
80618
80555
  }
80556
+ function isSyntacticallyNumericConstant(expr) {
80557
+ expr = skipOuterExpressions(expr);
80558
+ switch (expr.kind) {
80559
+ case 224 /* PrefixUnaryExpression */:
80560
+ return isSyntacticallyNumericConstant(expr.operand);
80561
+ case 226 /* BinaryExpression */:
80562
+ return isSyntacticallyNumericConstant(expr.left) && isSyntacticallyNumericConstant(expr.right);
80563
+ case 9 /* NumericLiteral */:
80564
+ return true;
80565
+ }
80566
+ return false;
80567
+ }
80619
80568
  function evaluate(expr, location) {
80620
80569
  switch (expr.kind) {
80621
80570
  case 224 /* PrefixUnaryExpression */:
@@ -82645,23 +82594,6 @@ function createTypeChecker(host) {
82645
82594
  const isPropertyName2 = (isPropertyAccessExpression(parent) || isPropertyAssignment(parent)) && parent.name === node;
82646
82595
  return !isPropertyName2 && getReferencedValueSymbol(node) === argumentsSymbol;
82647
82596
  }
82648
- function moduleExportsSomeValue(moduleReferenceExpression) {
82649
- let moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
82650
- if (!moduleSymbol || isShorthandAmbientModuleSymbol(moduleSymbol)) {
82651
- return true;
82652
- }
82653
- const hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);
82654
- moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
82655
- const symbolLinks2 = getSymbolLinks(moduleSymbol);
82656
- if (symbolLinks2.exportsSomeValue === void 0) {
82657
- symbolLinks2.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 111551 /* Value */) : forEachEntry(getExportsOfModule(moduleSymbol), isValue);
82658
- }
82659
- return symbolLinks2.exportsSomeValue;
82660
- function isValue(s) {
82661
- s = resolveSymbol(s);
82662
- return s && !!(getSymbolFlags(s) & 111551 /* Value */);
82663
- }
82664
- }
82665
82597
  function isNameOfModuleOrEnumDeclaration(node) {
82666
82598
  return isModuleOrEnumDeclaration(node.parent) && node === node.parent.name;
82667
82599
  }
@@ -83238,20 +83170,6 @@ function createTypeChecker(host) {
83238
83170
  }
83239
83171
  }
83240
83172
  function createResolver() {
83241
- const resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives();
83242
- let fileToDirective;
83243
- if (resolvedTypeReferenceDirectives) {
83244
- fileToDirective = /* @__PURE__ */ new Map();
83245
- resolvedTypeReferenceDirectives.forEach(({ resolvedTypeReferenceDirective }, key, mode) => {
83246
- if (!(resolvedTypeReferenceDirective == null ? void 0 : resolvedTypeReferenceDirective.resolvedFileName)) {
83247
- return;
83248
- }
83249
- const file = host.getSourceFile(resolvedTypeReferenceDirective.resolvedFileName);
83250
- if (file) {
83251
- addReferencedFilesToTypeDirective(file, key, mode);
83252
- }
83253
- });
83254
- }
83255
83173
  return {
83256
83174
  getReferencedExportContainer,
83257
83175
  getReferencedImportDeclaration,
@@ -83291,14 +83209,11 @@ function createTypeChecker(host) {
83291
83209
  getReferencedValueDeclarations,
83292
83210
  getTypeReferenceSerializationKind,
83293
83211
  isOptionalParameter,
83294
- moduleExportsSomeValue,
83295
83212
  isArgumentsLocalBinding,
83296
83213
  getExternalModuleFileFromDeclaration: (nodeIn) => {
83297
83214
  const node = getParseTreeNode(nodeIn, hasPossibleExternalModuleReference);
83298
83215
  return node && getExternalModuleFileFromDeclaration(node);
83299
83216
  },
83300
- getTypeReferenceDirectivesForEntityName,
83301
- getTypeReferenceDirectivesForSymbol,
83302
83217
  isLiteralConstDeclaration,
83303
83218
  isLateBound: (nodeIn) => {
83304
83219
  const node = getParseTreeNode(nodeIn, isDeclaration);
@@ -83322,12 +83237,6 @@ function createTypeChecker(host) {
83322
83237
  getAccessor
83323
83238
  };
83324
83239
  },
83325
- getSymbolOfExternalModuleSpecifier: (moduleName) => resolveExternalModuleNameWorker(
83326
- moduleName,
83327
- moduleName,
83328
- /*moduleNotFoundError*/
83329
- void 0
83330
- ),
83331
83240
  isBindingCapturedByNode: (node, decl) => {
83332
83241
  const parseNode = getParseTreeNode(node);
83333
83242
  const parseDecl = getParseTreeNode(decl);
@@ -83342,16 +83251,7 @@ function createTypeChecker(host) {
83342
83251
  }
83343
83252
  return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker, bundled);
83344
83253
  },
83345
- isImportRequiredByAugmentation,
83346
- tryFindAmbientModule: (moduleReferenceExpression) => {
83347
- const node = getParseTreeNode(moduleReferenceExpression);
83348
- const moduleSpecifier = node && isStringLiteralLike(node) ? node.text : void 0;
83349
- return moduleSpecifier !== void 0 ? tryFindAmbientModule(
83350
- moduleSpecifier,
83351
- /*withAugmentations*/
83352
- true
83353
- ) : void 0;
83354
- }
83254
+ isImportRequiredByAugmentation
83355
83255
  };
83356
83256
  function isImportRequiredByAugmentation(node) {
83357
83257
  const file = getSourceFileOfNode(node);
@@ -83378,84 +83278,6 @@ function createTypeChecker(host) {
83378
83278
  }
83379
83279
  return false;
83380
83280
  }
83381
- function isInHeritageClause(node) {
83382
- return node.parent && node.parent.kind === 233 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 298 /* HeritageClause */;
83383
- }
83384
- function getTypeReferenceDirectivesForEntityName(node) {
83385
- if (!fileToDirective) {
83386
- return void 0;
83387
- }
83388
- let meaning;
83389
- if (node.parent.kind === 167 /* ComputedPropertyName */) {
83390
- meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
83391
- } else {
83392
- meaning = 788968 /* Type */ | 1920 /* Namespace */;
83393
- if (node.kind === 80 /* Identifier */ && isInTypeQuery(node) || node.kind === 211 /* PropertyAccessExpression */ && !isInHeritageClause(node)) {
83394
- meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
83395
- }
83396
- }
83397
- const symbol = resolveEntityName(
83398
- node,
83399
- meaning,
83400
- /*ignoreErrors*/
83401
- true
83402
- );
83403
- return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : void 0;
83404
- }
83405
- function getTypeReferenceDirectivesForSymbol(symbol, meaning) {
83406
- if (!fileToDirective || !isSymbolFromTypeDeclarationFile(symbol)) {
83407
- return void 0;
83408
- }
83409
- let typeReferenceDirectives;
83410
- for (const decl of symbol.declarations) {
83411
- if (decl.symbol && decl.symbol.flags & meaning) {
83412
- const file = getSourceFileOfNode(decl);
83413
- const typeReferenceDirective = fileToDirective.get(file.path);
83414
- if (typeReferenceDirective) {
83415
- (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective);
83416
- } else {
83417
- return void 0;
83418
- }
83419
- }
83420
- }
83421
- return typeReferenceDirectives;
83422
- }
83423
- function isSymbolFromTypeDeclarationFile(symbol) {
83424
- if (!symbol.declarations) {
83425
- return false;
83426
- }
83427
- let current = symbol;
83428
- while (true) {
83429
- const parent = getParentOfSymbol(current);
83430
- if (parent) {
83431
- current = parent;
83432
- } else {
83433
- break;
83434
- }
83435
- }
83436
- if (current.valueDeclaration && current.valueDeclaration.kind === 307 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
83437
- return false;
83438
- }
83439
- for (const decl of symbol.declarations) {
83440
- const file = getSourceFileOfNode(decl);
83441
- if (fileToDirective.has(file.path)) {
83442
- return true;
83443
- }
83444
- }
83445
- return false;
83446
- }
83447
- function addReferencedFilesToTypeDirective(file, key, mode) {
83448
- if (fileToDirective.has(file.path))
83449
- return;
83450
- fileToDirective.set(file.path, [key, mode]);
83451
- for (const { fileName } of file.referencedFiles) {
83452
- const resolvedFile = resolveTripleslashReference(fileName, file.fileName);
83453
- const referencedFile = host.getSourceFile(resolvedFile);
83454
- if (referencedFile) {
83455
- addReferencedFilesToTypeDirective(referencedFile, key, mode || file.impliedNodeFormat);
83456
- }
83457
- }
83458
- }
83459
83281
  }
83460
83282
  function getExternalModuleFileFromDeclaration(declaration) {
83461
83283
  const specifier = declaration.kind === 267 /* ModuleDeclaration */ ? tryCast(declaration.name, isStringLiteral) : getExternalModuleName(declaration);
@@ -85379,20 +85201,6 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
85379
85201
  this.inner.reportTruncationError();
85380
85202
  }
85381
85203
  }
85382
- trackReferencedAmbientModule(decl, symbol) {
85383
- var _a;
85384
- if ((_a = this.inner) == null ? void 0 : _a.trackReferencedAmbientModule) {
85385
- this.onDiagnosticReported();
85386
- this.inner.trackReferencedAmbientModule(decl, symbol);
85387
- }
85388
- }
85389
- trackExternalModuleSymbolOfImportTypeNode(symbol) {
85390
- var _a;
85391
- if ((_a = this.inner) == null ? void 0 : _a.trackExternalModuleSymbolOfImportTypeNode) {
85392
- this.onDiagnosticReported();
85393
- this.inner.trackExternalModuleSymbolOfImportTypeNode(symbol);
85394
- }
85395
- }
85396
85204
  reportNonlocalAugmentation(containingFile, parentSymbol, augmentingSymbol) {
85397
85205
  var _a;
85398
85206
  if ((_a = this.inner) == null ? void 0 : _a.reportNonlocalAugmentation) {
@@ -108397,11 +108205,9 @@ function transformDeclarations(context) {
108397
108205
  let needsScopeFixMarker = false;
108398
108206
  let resultHasScopeMarker = false;
108399
108207
  let enclosingDeclaration;
108400
- let necessaryTypeReferences;
108401
108208
  let lateMarkedStatements;
108402
108209
  let lateStatementReplacementMap;
108403
108210
  let suppressNewDiagnosticContexts;
108404
- let exportedModulesFromDeclarationEmit;
108405
108211
  const { factory: factory2 } = context;
108406
108212
  const host = context.getEmitHost();
108407
108213
  const symbolTracker = {
@@ -108413,49 +108219,19 @@ function transformDeclarations(context) {
108413
108219
  reportLikelyUnsafeImportRequiredError,
108414
108220
  reportTruncationError,
108415
108221
  moduleResolverHost: host,
108416
- trackReferencedAmbientModule,
108417
- trackExternalModuleSymbolOfImportTypeNode,
108418
108222
  reportNonlocalAugmentation,
108419
108223
  reportNonSerializableProperty
108420
108224
  };
108421
108225
  let errorNameNode;
108422
108226
  let errorFallbackNode;
108423
108227
  let currentSourceFile;
108424
- let refs;
108425
- let libs2;
108426
- let emittedImports;
108228
+ let rawReferencedFiles;
108229
+ let rawTypeReferenceDirectives;
108230
+ let rawLibReferenceDirectives;
108427
108231
  const resolver = context.getEmitResolver();
108428
108232
  const options = context.getCompilerOptions();
108429
- const { noResolve, stripInternal } = options;
108233
+ const { stripInternal } = options;
108430
108234
  return transformRoot;
108431
- function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) {
108432
- if (!typeReferenceDirectives) {
108433
- return;
108434
- }
108435
- necessaryTypeReferences = necessaryTypeReferences || /* @__PURE__ */ new Set();
108436
- for (const ref of typeReferenceDirectives) {
108437
- necessaryTypeReferences.add(ref);
108438
- }
108439
- }
108440
- function trackReferencedAmbientModule(node, symbol) {
108441
- const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol, -1 /* All */);
108442
- if (length(directives)) {
108443
- return recordTypeReferenceDirectivesIfNecessary(directives);
108444
- }
108445
- const container = getSourceFileOfNode(node);
108446
- refs.set(getOriginalNodeId(container), container);
108447
- }
108448
- function trackReferencedAmbientModuleFromImport(node) {
108449
- const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(node);
108450
- const symbol = moduleSpecifier && resolver.tryFindAmbientModule(moduleSpecifier);
108451
- if (symbol == null ? void 0 : symbol.declarations) {
108452
- for (const decl of symbol.declarations) {
108453
- if (isAmbientModule(decl) && getSourceFileOfNode(decl) !== currentSourceFile) {
108454
- trackReferencedAmbientModule(decl, symbol);
108455
- }
108456
- }
108457
- }
108458
- }
108459
108235
  function handleSymbolAccessibilityError(symbolAccessibilityResult) {
108460
108236
  if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {
108461
108237
  if (symbolAccessibilityResult.aliasesToMakeVisible) {
@@ -108480,11 +108256,6 @@ function transformDeclarations(context) {
108480
108256
  }
108481
108257
  return false;
108482
108258
  }
108483
- function trackExternalModuleSymbolOfImportTypeNode(symbol) {
108484
- if (!isBundledEmit) {
108485
- (exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
108486
- }
108487
- }
108488
108259
  function trackSymbol(symbol, enclosingDeclaration2, meaning) {
108489
108260
  if (symbol.flags & 262144 /* TypeParameter */)
108490
108261
  return false;
@@ -108495,7 +108266,6 @@ function transformDeclarations(context) {
108495
108266
  /*shouldComputeAliasToMarkVisible*/
108496
108267
  true
108497
108268
  ));
108498
- recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
108499
108269
  return issuedDiagnostic;
108500
108270
  }
108501
108271
  function reportPrivateInBaseOfClassExpression(propertyName) {
@@ -108567,8 +108337,9 @@ function transformDeclarations(context) {
108567
108337
  }
108568
108338
  if (node.kind === 308 /* Bundle */) {
108569
108339
  isBundledEmit = true;
108570
- refs = /* @__PURE__ */ new Map();
108571
- libs2 = /* @__PURE__ */ new Map();
108340
+ rawReferencedFiles = [];
108341
+ rawTypeReferenceDirectives = [];
108342
+ rawLibReferenceDirectives = [];
108572
108343
  let hasNoDefaultLib = false;
108573
108344
  const bundle = factory2.createBundle(
108574
108345
  map(node.sourceFiles, (sourceFile) => {
@@ -108583,8 +108354,7 @@ function transformDeclarations(context) {
108583
108354
  getSymbolAccessibilityDiagnostic = throwDiagnostic;
108584
108355
  needsScopeFixMarker = false;
108585
108356
  resultHasScopeMarker = false;
108586
- collectReferences(sourceFile, refs);
108587
- collectLibs(sourceFile, libs2);
108357
+ collectFileReferences(sourceFile);
108588
108358
  if (isExternalOrCommonJsModule(sourceFile) || isJsonSourceFile(sourceFile)) {
108589
108359
  resultHasExternalModuleIndicator = false;
108590
108360
  needsDeclare = false;
@@ -108631,18 +108401,16 @@ function transformDeclarations(context) {
108631
108401
  );
108632
108402
  })
108633
108403
  );
108634
- bundle.syntheticFileReferences = [];
108635
- bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences();
108636
- bundle.syntheticLibReferences = getLibReferences();
108637
- bundle.hasNoDefaultLib = hasNoDefaultLib;
108638
108404
  const outputFilePath2 = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
108639
108405
  node,
108640
108406
  host,
108641
108407
  /*forceDtsPaths*/
108642
108408
  true
108643
108409
  ).declarationFilePath));
108644
- const referenceVisitor2 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath2);
108645
- refs.forEach(referenceVisitor2);
108410
+ bundle.syntheticFileReferences = getReferencedFiles(outputFilePath2);
108411
+ bundle.syntheticTypeReferences = getTypeReferences();
108412
+ bundle.syntheticLibReferences = getLibReferences();
108413
+ bundle.hasNoDefaultLib = hasNoDefaultLib;
108646
108414
  return bundle;
108647
108415
  }
108648
108416
  needsDeclare = true;
@@ -108656,66 +108424,68 @@ function transformDeclarations(context) {
108656
108424
  suppressNewDiagnosticContexts = false;
108657
108425
  lateMarkedStatements = void 0;
108658
108426
  lateStatementReplacementMap = /* @__PURE__ */ new Map();
108659
- necessaryTypeReferences = void 0;
108660
- refs = collectReferences(currentSourceFile, /* @__PURE__ */ new Map());
108661
- libs2 = collectLibs(currentSourceFile, /* @__PURE__ */ new Map());
108662
- const references = [];
108663
- const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
108664
- node,
108665
- host,
108666
- /*forceDtsPaths*/
108667
- true
108668
- ).declarationFilePath));
108669
- const referenceVisitor = mapReferencesIntoArray(references, outputFilePath);
108427
+ rawReferencedFiles = [];
108428
+ rawTypeReferenceDirectives = [];
108429
+ rawLibReferenceDirectives = [];
108430
+ collectFileReferences(currentSourceFile);
108670
108431
  let combinedStatements;
108671
108432
  if (isSourceFileJS(currentSourceFile)) {
108672
108433
  combinedStatements = factory2.createNodeArray(transformDeclarationsForJS(node));
108673
- refs.forEach(referenceVisitor);
108674
- emittedImports = filter(combinedStatements, isAnyImportSyntax);
108675
108434
  } else {
108676
108435
  const statements = visitNodes2(node.statements, visitDeclarationStatements, isStatement);
108677
108436
  combinedStatements = setTextRange(factory2.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
108678
- refs.forEach(referenceVisitor);
108679
- emittedImports = filter(combinedStatements, isAnyImportSyntax);
108680
108437
  if (isExternalModule(node) && (!resultHasExternalModuleIndicator || needsScopeFixMarker && !resultHasScopeMarker)) {
108681
108438
  combinedStatements = setTextRange(factory2.createNodeArray([...combinedStatements, createEmptyExports(factory2)]), combinedStatements);
108682
108439
  }
108683
108440
  }
108441
+ const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
108442
+ node,
108443
+ host,
108444
+ /*forceDtsPaths*/
108445
+ true
108446
+ ).declarationFilePath));
108684
108447
  return factory2.updateSourceFile(
108685
108448
  node,
108686
108449
  combinedStatements,
108687
108450
  /*isDeclarationFile*/
108688
108451
  true,
108689
- references,
108690
- getFileReferencesForUsedTypeReferences(),
108452
+ getReferencedFiles(outputFilePath),
108453
+ getTypeReferences(),
108691
108454
  node.hasNoDefaultLib,
108692
108455
  getLibReferences()
108693
108456
  );
108694
- function getLibReferences() {
108695
- return arrayFrom(libs2.keys(), (lib) => ({ fileName: lib, pos: -1, end: -1 }));
108457
+ function collectFileReferences(sourceFile) {
108458
+ rawReferencedFiles = concatenate(rawReferencedFiles, map(sourceFile.referencedFiles, (f) => [sourceFile, f]));
108459
+ rawTypeReferenceDirectives = concatenate(rawTypeReferenceDirectives, sourceFile.typeReferenceDirectives);
108460
+ rawLibReferenceDirectives = concatenate(rawLibReferenceDirectives, sourceFile.libReferenceDirectives);
108696
108461
  }
108697
- function getFileReferencesForUsedTypeReferences() {
108698
- return necessaryTypeReferences ? mapDefined(arrayFrom(necessaryTypeReferences.keys()), getFileReferenceForSpecifierModeTuple) : [];
108462
+ function copyFileReferenceAsSynthetic(ref) {
108463
+ const newRef = { ...ref };
108464
+ newRef.pos = -1;
108465
+ newRef.end = -1;
108466
+ return newRef;
108699
108467
  }
108700
- function getFileReferenceForSpecifierModeTuple([typeName, mode]) {
108701
- if (emittedImports) {
108702
- for (const importStatement of emittedImports) {
108703
- if (isImportEqualsDeclaration(importStatement) && isExternalModuleReference(importStatement.moduleReference)) {
108704
- const expr = importStatement.moduleReference.expression;
108705
- if (isStringLiteralLike(expr) && expr.text === typeName) {
108706
- return void 0;
108707
- }
108708
- } else if (isImportDeclaration(importStatement) && isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) {
108709
- return void 0;
108710
- }
108711
- }
108712
- }
108713
- return { fileName: typeName, pos: -1, end: -1, ...mode ? { resolutionMode: mode } : void 0 };
108468
+ function getTypeReferences() {
108469
+ return mapDefined(rawTypeReferenceDirectives, (ref) => {
108470
+ if (!ref.preserve)
108471
+ return void 0;
108472
+ return copyFileReferenceAsSynthetic(ref);
108473
+ });
108714
108474
  }
108715
- function mapReferencesIntoArray(references2, outputFilePath2) {
108716
- return (file) => {
108717
- if (exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.includes(file.symbol)) {
108718
- return;
108475
+ function getLibReferences() {
108476
+ return mapDefined(rawLibReferenceDirectives, (ref) => {
108477
+ if (!ref.preserve)
108478
+ return void 0;
108479
+ return copyFileReferenceAsSynthetic(ref);
108480
+ });
108481
+ }
108482
+ function getReferencedFiles(outputFilePath2) {
108483
+ return mapDefined(rawReferencedFiles, ([sourceFile, ref]) => {
108484
+ if (!ref.preserve)
108485
+ return void 0;
108486
+ const file = host.getSourceFileFromReference(sourceFile, ref);
108487
+ if (!file) {
108488
+ return void 0;
108719
108489
  }
108720
108490
  let declFileName;
108721
108491
  if (file.isDeclarationFile) {
@@ -108731,61 +108501,22 @@ function transformDeclarations(context) {
108731
108501
  );
108732
108502
  declFileName = paths.declarationFilePath || paths.jsFilePath || file.fileName;
108733
108503
  }
108734
- if (declFileName) {
108735
- const specifier = getModuleSpecifier(
108736
- options,
108737
- currentSourceFile,
108738
- getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
108739
- getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
108740
- host
108741
- );
108742
- if (!pathIsRelative(specifier)) {
108743
- recordTypeReferenceDirectivesIfNecessary([[
108744
- specifier,
108745
- /*mode*/
108746
- void 0
108747
- ]]);
108748
- return;
108749
- }
108750
- let fileName = getRelativePathToDirectoryOrUrl(
108751
- outputFilePath2,
108752
- declFileName,
108753
- host.getCurrentDirectory(),
108754
- host.getCanonicalFileName,
108755
- /*isAbsolutePathAnUrl*/
108756
- false
108757
- );
108758
- if (startsWith(fileName, "./") && hasExtension(fileName)) {
108759
- fileName = fileName.substring(2);
108760
- }
108761
- if (startsWith(fileName, "node_modules/") || pathContainsNodeModules(fileName)) {
108762
- return;
108763
- }
108764
- references2.push({ pos: -1, end: -1, fileName });
108765
- }
108766
- };
108504
+ if (!declFileName)
108505
+ return void 0;
108506
+ const fileName = getRelativePathToDirectoryOrUrl(
108507
+ outputFilePath2,
108508
+ declFileName,
108509
+ host.getCurrentDirectory(),
108510
+ host.getCanonicalFileName,
108511
+ /*isAbsolutePathAnUrl*/
108512
+ false
108513
+ );
108514
+ const newRef = copyFileReferenceAsSynthetic(ref);
108515
+ newRef.fileName = fileName;
108516
+ return newRef;
108517
+ });
108767
108518
  }
108768
108519
  }
108769
- function collectReferences(sourceFile, ret) {
108770
- if (noResolve || isSourceFileJS(sourceFile))
108771
- return ret;
108772
- forEach(sourceFile.referencedFiles, (f) => {
108773
- const elem = host.getSourceFileFromReference(sourceFile, f);
108774
- if (elem) {
108775
- ret.set(getOriginalNodeId(elem), elem);
108776
- }
108777
- });
108778
- return ret;
108779
- }
108780
- function collectLibs(sourceFile, ret) {
108781
- forEach(sourceFile.libReferenceDirectives, (ref) => {
108782
- const lib = host.getLibFileFromReference(ref);
108783
- if (lib) {
108784
- ret.set(toFileNameLowerCase(ref.fileName), true);
108785
- }
108786
- });
108787
- return ret;
108788
- }
108789
108520
  function filterBindingPatternInitializers(name) {
108790
108521
  if (name.kind === 80 /* Identifier */) {
108791
108522
  return name;
@@ -108984,7 +108715,6 @@ function transformDeclarations(context) {
108984
108715
  function checkEntityNameVisibility(entityName, enclosingDeclaration2) {
108985
108716
  const visibilityResult = resolver.isEntityNameVisible(entityName, enclosingDeclaration2);
108986
108717
  handleSymbolAccessibilityError(visibilityResult);
108987
- recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName));
108988
108718
  }
108989
108719
  function preserveJsDoc(updated, original) {
108990
108720
  if (hasJSDocNodes(updated) && hasJSDocNodes(original)) {
@@ -109002,11 +108732,6 @@ function transformDeclarations(context) {
109002
108732
  if (newName) {
109003
108733
  return factory2.createStringLiteral(newName);
109004
108734
  }
109005
- } else {
109006
- const symbol = resolver.getSymbolOfExternalModuleSpecifier(input);
109007
- if (symbol) {
109008
- (exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
109009
- }
109010
108735
  }
109011
108736
  }
109012
108737
  return input;
@@ -109399,7 +109124,6 @@ function transformDeclarations(context) {
109399
109124
  case 205 /* ImportType */: {
109400
109125
  if (!isLiteralImportTypeNode(input))
109401
109126
  return cleanup(input);
109402
- trackReferencedAmbientModuleFromImport(input);
109403
109127
  return cleanup(factory2.updateImportTypeNode(
109404
109128
  input,
109405
109129
  factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)),
@@ -109451,7 +109175,6 @@ function transformDeclarations(context) {
109451
109175
  resultHasExternalModuleIndicator = true;
109452
109176
  }
109453
109177
  resultHasScopeMarker = true;
109454
- trackReferencedAmbientModuleFromImport(input);
109455
109178
  return factory2.updateExportDeclaration(
109456
109179
  input,
109457
109180
  input.modifiers,
@@ -109526,18 +109249,10 @@ function transformDeclarations(context) {
109526
109249
  return;
109527
109250
  switch (input.kind) {
109528
109251
  case 271 /* ImportEqualsDeclaration */: {
109529
- const transformed = transformImportEqualsDeclaration(input);
109530
- if (transformed) {
109531
- trackReferencedAmbientModuleFromImport(input);
109532
- }
109533
- return transformed;
109252
+ return transformImportEqualsDeclaration(input);
109534
109253
  }
109535
109254
  case 272 /* ImportDeclaration */: {
109536
- const transformed = transformImportDeclaration(input);
109537
- if (transformed) {
109538
- trackReferencedAmbientModuleFromImport(input);
109539
- }
109540
- return transformed;
109255
+ return transformImportDeclaration(input);
109541
109256
  }
109542
109257
  }
109543
109258
  if (isDeclaration(input) && isDeclarationAndNotVisible(input))
@@ -111096,20 +110811,15 @@ var notImplementedResolver = {
111096
110811
  getReferencedValueDeclarations: notImplemented,
111097
110812
  getTypeReferenceSerializationKind: notImplemented,
111098
110813
  isOptionalParameter: notImplemented,
111099
- moduleExportsSomeValue: notImplemented,
111100
110814
  isArgumentsLocalBinding: notImplemented,
111101
110815
  getExternalModuleFileFromDeclaration: notImplemented,
111102
- getTypeReferenceDirectivesForEntityName: notImplemented,
111103
- getTypeReferenceDirectivesForSymbol: notImplemented,
111104
110816
  isLiteralConstDeclaration: notImplemented,
111105
110817
  getJsxFactoryEntity: notImplemented,
111106
110818
  getJsxFragmentFactoryEntity: notImplemented,
111107
110819
  getAllAccessorDeclarations: notImplemented,
111108
- getSymbolOfExternalModuleSpecifier: notImplemented,
111109
110820
  isBindingCapturedByNode: notImplemented,
111110
110821
  getDeclarationStatementsForSourceFile: notImplemented,
111111
- isImportRequiredByAugmentation: notImplemented,
111112
- tryFindAmbientModule: notImplemented
110822
+ isImportRequiredByAugmentation: notImplemented
111113
110823
  };
111114
110824
  var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
111115
110825
  var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@@ -113864,19 +113574,17 @@ function createPrinter(printerOptions = {}, handlers = {}) {
113864
113574
  writeLine();
113865
113575
  }
113866
113576
  }
113867
- for (const directive of files) {
113868
- writeComment(`/// <reference path="${directive.fileName}" />`);
113869
- writeLine();
113870
- }
113871
- for (const directive of types) {
113872
- const resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile == null ? void 0 : currentSourceFile.impliedNodeFormat) ? `resolution-mode="${directive.resolutionMode === 99 /* ESNext */ ? "import" : "require"}"` : "";
113873
- writeComment(`/// <reference types="${directive.fileName}" ${resolutionMode}/>`);
113874
- writeLine();
113875
- }
113876
- for (const directive of libs2) {
113877
- writeComment(`/// <reference lib="${directive.fileName}" />`);
113878
- writeLine();
113577
+ function writeDirectives(kind, directives) {
113578
+ for (const directive of directives) {
113579
+ const preserve = directive.preserve ? `preserve="true" ` : "";
113580
+ const resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile == null ? void 0 : currentSourceFile.impliedNodeFormat) ? `resolution-mode="${directive.resolutionMode === 99 /* ESNext */ ? "import" : "require"}" ` : "";
113581
+ writeComment(`/// <reference ${kind}="${directive.fileName}" ${resolutionMode}${preserve}/>`);
113582
+ writeLine();
113583
+ }
113879
113584
  }
113585
+ writeDirectives("path", files);
113586
+ writeDirectives("types", types);
113587
+ writeDirectives("lib", libs2);
113880
113588
  }
113881
113589
  function emitSourceFileWorker(node) {
113882
113590
  const statements = node.statements;
@@ -117713,7 +117421,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117713
117421
  getSourceFile: program.getSourceFile,
117714
117422
  getSourceFileByPath: program.getSourceFileByPath,
117715
117423
  getSourceFiles: program.getSourceFiles,
117716
- getLibFileFromReference: program.getLibFileFromReference,
117717
117424
  isSourceFileFromExternalLibrary,
117718
117425
  getResolvedProjectReferenceToRedirect,
117719
117426
  getProjectReferenceRedirect,