@typescript-deploys/pr-build 5.5.0-pr-57847-24 → 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;
@@ -49307,14 +49277,6 @@ function createTypeChecker(host) {
49307
49277
  return file.moduleName;
49308
49278
  }
49309
49279
  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
49280
  if (ambientModuleSymbolRegex.test(symbol.escapedName)) {
49319
49281
  return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
49320
49282
  }
@@ -49407,8 +49369,6 @@ function createTypeChecker(host) {
49407
49369
  }
49408
49370
  }
49409
49371
  const lit = factory.createLiteralTypeNode(factory.createStringLiteral(specifier));
49410
- if (context.tracker.trackExternalModuleSymbolOfImportTypeNode)
49411
- context.tracker.trackExternalModuleSymbolOfImportTypeNode(chain[0]);
49412
49372
  context.approximateLength += specifier.length + 10;
49413
49373
  if (!nonRootParts || isEntityName(nonRootParts)) {
49414
49374
  if (nonRootParts) {
@@ -49967,18 +49927,6 @@ function createTypeChecker(host) {
49967
49927
  return factory.createStringLiteral(newName);
49968
49928
  }
49969
49929
  }
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
49930
  }
49983
49931
  return lit;
49984
49932
  }
@@ -65200,20 +65148,13 @@ function createTypeChecker(host) {
65200
65148
  return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
65201
65149
  case 166 /* QualifiedName */:
65202
65150
  const left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer);
65203
- return left && `${left}.${node.right.escapedText}`;
65151
+ return left && left + "." + node.right.escapedText;
65204
65152
  case 211 /* PropertyAccessExpression */:
65205
65153
  case 212 /* ElementAccessExpression */:
65206
65154
  const propName = getAccessedPropertyName(node);
65207
65155
  if (propName !== void 0) {
65208
65156
  const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
65209
- return key && `${key}.${propName}`;
65210
- }
65211
- if (isElementAccessExpression(node) && isIdentifier(node.argumentExpression)) {
65212
- const symbol = getResolvedSymbol(node.argumentExpression);
65213
- if (isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol)) {
65214
- const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
65215
- return key && `${key}.@${getSymbolId(symbol)}`;
65216
- }
65157
+ return key && key + "." + propName;
65217
65158
  }
65218
65159
  break;
65219
65160
  case 206 /* ObjectBindingPattern */:
@@ -65250,19 +65191,8 @@ function createTypeChecker(host) {
65250
65191
  case 211 /* PropertyAccessExpression */:
65251
65192
  case 212 /* ElementAccessExpression */:
65252
65193
  const sourcePropertyName = getAccessedPropertyName(source);
65253
- if (sourcePropertyName !== void 0) {
65254
- const targetPropertyName = isAccessExpression(target) ? getAccessedPropertyName(target) : void 0;
65255
- if (targetPropertyName !== void 0) {
65256
- return targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression);
65257
- }
65258
- }
65259
- if (isElementAccessExpression(source) && isElementAccessExpression(target) && isIdentifier(source.argumentExpression) && isIdentifier(target.argumentExpression)) {
65260
- const symbol = getResolvedSymbol(source.argumentExpression);
65261
- if (symbol === getResolvedSymbol(target.argumentExpression) && (isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol))) {
65262
- return isMatchingReference(source.expression, target.expression);
65263
- }
65264
- }
65265
- 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);
65266
65196
  case 166 /* QualifiedName */:
65267
65197
  return isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression);
65268
65198
  case 226 /* BinaryExpression */:
@@ -80561,19 +80491,21 @@ function createTypeChecker(host) {
80561
80491
  if (!(nodeLinks2.flags & 1024 /* EnumValuesComputed */)) {
80562
80492
  nodeLinks2.flags |= 1024 /* EnumValuesComputed */;
80563
80493
  let autoValue = 0;
80494
+ let previous;
80564
80495
  for (const member of node.members) {
80565
- const value = computeMemberValue(member, autoValue);
80496
+ const value = computeMemberValue(member, autoValue, previous);
80566
80497
  getNodeLinks(member).enumMemberValue = value;
80567
80498
  autoValue = typeof value === "number" ? value + 1 : void 0;
80499
+ previous = member;
80568
80500
  }
80569
80501
  }
80570
80502
  }
80571
- function computeMemberValue(member, autoValue) {
80503
+ function computeMemberValue(member, autoValue, previous) {
80572
80504
  if (isComputedNonLiteralName(member.name)) {
80573
80505
  error(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
80574
80506
  } else {
80575
80507
  const text = getTextOfPropertyName(member.name);
80576
- if (isNumericLiteralName(text)) {
80508
+ if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
80577
80509
  error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
80578
80510
  }
80579
80511
  }
@@ -80583,11 +80515,17 @@ function createTypeChecker(host) {
80583
80515
  if (member.parent.flags & 33554432 /* Ambient */ && !isEnumConst(member.parent)) {
80584
80516
  return void 0;
80585
80517
  }
80586
- if (autoValue !== void 0) {
80587
- return autoValue;
80518
+ if (autoValue === void 0) {
80519
+ error(member.name, Diagnostics.Enum_member_must_have_initializer);
80520
+ return void 0;
80588
80521
  }
80589
- error(member.name, Diagnostics.Enum_member_must_have_initializer);
80590
- 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;
80591
80529
  }
80592
80530
  function computeConstantValue(member) {
80593
80531
  const isConstEnum = isEnumConst(member.parent);
@@ -80599,6 +80537,12 @@ function createTypeChecker(host) {
80599
80537
  initializer,
80600
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
80601
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
+ );
80602
80546
  }
80603
80547
  } else if (isConstEnum) {
80604
80548
  error(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
@@ -80609,6 +80553,18 @@ function createTypeChecker(host) {
80609
80553
  }
80610
80554
  return value;
80611
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
+ }
80612
80568
  function evaluate(expr, location) {
80613
80569
  switch (expr.kind) {
80614
80570
  case 224 /* PrefixUnaryExpression */:
@@ -82638,23 +82594,6 @@ function createTypeChecker(host) {
82638
82594
  const isPropertyName2 = (isPropertyAccessExpression(parent) || isPropertyAssignment(parent)) && parent.name === node;
82639
82595
  return !isPropertyName2 && getReferencedValueSymbol(node) === argumentsSymbol;
82640
82596
  }
82641
- function moduleExportsSomeValue(moduleReferenceExpression) {
82642
- let moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
82643
- if (!moduleSymbol || isShorthandAmbientModuleSymbol(moduleSymbol)) {
82644
- return true;
82645
- }
82646
- const hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);
82647
- moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
82648
- const symbolLinks2 = getSymbolLinks(moduleSymbol);
82649
- if (symbolLinks2.exportsSomeValue === void 0) {
82650
- symbolLinks2.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 111551 /* Value */) : forEachEntry(getExportsOfModule(moduleSymbol), isValue);
82651
- }
82652
- return symbolLinks2.exportsSomeValue;
82653
- function isValue(s) {
82654
- s = resolveSymbol(s);
82655
- return s && !!(getSymbolFlags(s) & 111551 /* Value */);
82656
- }
82657
- }
82658
82597
  function isNameOfModuleOrEnumDeclaration(node) {
82659
82598
  return isModuleOrEnumDeclaration(node.parent) && node === node.parent.name;
82660
82599
  }
@@ -83231,20 +83170,6 @@ function createTypeChecker(host) {
83231
83170
  }
83232
83171
  }
83233
83172
  function createResolver() {
83234
- const resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives();
83235
- let fileToDirective;
83236
- if (resolvedTypeReferenceDirectives) {
83237
- fileToDirective = /* @__PURE__ */ new Map();
83238
- resolvedTypeReferenceDirectives.forEach(({ resolvedTypeReferenceDirective }, key, mode) => {
83239
- if (!(resolvedTypeReferenceDirective == null ? void 0 : resolvedTypeReferenceDirective.resolvedFileName)) {
83240
- return;
83241
- }
83242
- const file = host.getSourceFile(resolvedTypeReferenceDirective.resolvedFileName);
83243
- if (file) {
83244
- addReferencedFilesToTypeDirective(file, key, mode);
83245
- }
83246
- });
83247
- }
83248
83173
  return {
83249
83174
  getReferencedExportContainer,
83250
83175
  getReferencedImportDeclaration,
@@ -83284,14 +83209,11 @@ function createTypeChecker(host) {
83284
83209
  getReferencedValueDeclarations,
83285
83210
  getTypeReferenceSerializationKind,
83286
83211
  isOptionalParameter,
83287
- moduleExportsSomeValue,
83288
83212
  isArgumentsLocalBinding,
83289
83213
  getExternalModuleFileFromDeclaration: (nodeIn) => {
83290
83214
  const node = getParseTreeNode(nodeIn, hasPossibleExternalModuleReference);
83291
83215
  return node && getExternalModuleFileFromDeclaration(node);
83292
83216
  },
83293
- getTypeReferenceDirectivesForEntityName,
83294
- getTypeReferenceDirectivesForSymbol,
83295
83217
  isLiteralConstDeclaration,
83296
83218
  isLateBound: (nodeIn) => {
83297
83219
  const node = getParseTreeNode(nodeIn, isDeclaration);
@@ -83315,12 +83237,6 @@ function createTypeChecker(host) {
83315
83237
  getAccessor
83316
83238
  };
83317
83239
  },
83318
- getSymbolOfExternalModuleSpecifier: (moduleName) => resolveExternalModuleNameWorker(
83319
- moduleName,
83320
- moduleName,
83321
- /*moduleNotFoundError*/
83322
- void 0
83323
- ),
83324
83240
  isBindingCapturedByNode: (node, decl) => {
83325
83241
  const parseNode = getParseTreeNode(node);
83326
83242
  const parseDecl = getParseTreeNode(decl);
@@ -83335,16 +83251,7 @@ function createTypeChecker(host) {
83335
83251
  }
83336
83252
  return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker, bundled);
83337
83253
  },
83338
- isImportRequiredByAugmentation,
83339
- tryFindAmbientModule: (moduleReferenceExpression) => {
83340
- const node = getParseTreeNode(moduleReferenceExpression);
83341
- const moduleSpecifier = node && isStringLiteralLike(node) ? node.text : void 0;
83342
- return moduleSpecifier !== void 0 ? tryFindAmbientModule(
83343
- moduleSpecifier,
83344
- /*withAugmentations*/
83345
- true
83346
- ) : void 0;
83347
- }
83254
+ isImportRequiredByAugmentation
83348
83255
  };
83349
83256
  function isImportRequiredByAugmentation(node) {
83350
83257
  const file = getSourceFileOfNode(node);
@@ -83371,84 +83278,6 @@ function createTypeChecker(host) {
83371
83278
  }
83372
83279
  return false;
83373
83280
  }
83374
- function isInHeritageClause(node) {
83375
- return node.parent && node.parent.kind === 233 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 298 /* HeritageClause */;
83376
- }
83377
- function getTypeReferenceDirectivesForEntityName(node) {
83378
- if (!fileToDirective) {
83379
- return void 0;
83380
- }
83381
- let meaning;
83382
- if (node.parent.kind === 167 /* ComputedPropertyName */) {
83383
- meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
83384
- } else {
83385
- meaning = 788968 /* Type */ | 1920 /* Namespace */;
83386
- if (node.kind === 80 /* Identifier */ && isInTypeQuery(node) || node.kind === 211 /* PropertyAccessExpression */ && !isInHeritageClause(node)) {
83387
- meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
83388
- }
83389
- }
83390
- const symbol = resolveEntityName(
83391
- node,
83392
- meaning,
83393
- /*ignoreErrors*/
83394
- true
83395
- );
83396
- return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : void 0;
83397
- }
83398
- function getTypeReferenceDirectivesForSymbol(symbol, meaning) {
83399
- if (!fileToDirective || !isSymbolFromTypeDeclarationFile(symbol)) {
83400
- return void 0;
83401
- }
83402
- let typeReferenceDirectives;
83403
- for (const decl of symbol.declarations) {
83404
- if (decl.symbol && decl.symbol.flags & meaning) {
83405
- const file = getSourceFileOfNode(decl);
83406
- const typeReferenceDirective = fileToDirective.get(file.path);
83407
- if (typeReferenceDirective) {
83408
- (typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective);
83409
- } else {
83410
- return void 0;
83411
- }
83412
- }
83413
- }
83414
- return typeReferenceDirectives;
83415
- }
83416
- function isSymbolFromTypeDeclarationFile(symbol) {
83417
- if (!symbol.declarations) {
83418
- return false;
83419
- }
83420
- let current = symbol;
83421
- while (true) {
83422
- const parent = getParentOfSymbol(current);
83423
- if (parent) {
83424
- current = parent;
83425
- } else {
83426
- break;
83427
- }
83428
- }
83429
- if (current.valueDeclaration && current.valueDeclaration.kind === 307 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
83430
- return false;
83431
- }
83432
- for (const decl of symbol.declarations) {
83433
- const file = getSourceFileOfNode(decl);
83434
- if (fileToDirective.has(file.path)) {
83435
- return true;
83436
- }
83437
- }
83438
- return false;
83439
- }
83440
- function addReferencedFilesToTypeDirective(file, key, mode) {
83441
- if (fileToDirective.has(file.path))
83442
- return;
83443
- fileToDirective.set(file.path, [key, mode]);
83444
- for (const { fileName } of file.referencedFiles) {
83445
- const resolvedFile = resolveTripleslashReference(fileName, file.fileName);
83446
- const referencedFile = host.getSourceFile(resolvedFile);
83447
- if (referencedFile) {
83448
- addReferencedFilesToTypeDirective(referencedFile, key, mode || file.impliedNodeFormat);
83449
- }
83450
- }
83451
- }
83452
83281
  }
83453
83282
  function getExternalModuleFileFromDeclaration(declaration) {
83454
83283
  const specifier = declaration.kind === 267 /* ModuleDeclaration */ ? tryCast(declaration.name, isStringLiteral) : getExternalModuleName(declaration);
@@ -85372,20 +85201,6 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
85372
85201
  this.inner.reportTruncationError();
85373
85202
  }
85374
85203
  }
85375
- trackReferencedAmbientModule(decl, symbol) {
85376
- var _a;
85377
- if ((_a = this.inner) == null ? void 0 : _a.trackReferencedAmbientModule) {
85378
- this.onDiagnosticReported();
85379
- this.inner.trackReferencedAmbientModule(decl, symbol);
85380
- }
85381
- }
85382
- trackExternalModuleSymbolOfImportTypeNode(symbol) {
85383
- var _a;
85384
- if ((_a = this.inner) == null ? void 0 : _a.trackExternalModuleSymbolOfImportTypeNode) {
85385
- this.onDiagnosticReported();
85386
- this.inner.trackExternalModuleSymbolOfImportTypeNode(symbol);
85387
- }
85388
- }
85389
85204
  reportNonlocalAugmentation(containingFile, parentSymbol, augmentingSymbol) {
85390
85205
  var _a;
85391
85206
  if ((_a = this.inner) == null ? void 0 : _a.reportNonlocalAugmentation) {
@@ -108390,11 +108205,9 @@ function transformDeclarations(context) {
108390
108205
  let needsScopeFixMarker = false;
108391
108206
  let resultHasScopeMarker = false;
108392
108207
  let enclosingDeclaration;
108393
- let necessaryTypeReferences;
108394
108208
  let lateMarkedStatements;
108395
108209
  let lateStatementReplacementMap;
108396
108210
  let suppressNewDiagnosticContexts;
108397
- let exportedModulesFromDeclarationEmit;
108398
108211
  const { factory: factory2 } = context;
108399
108212
  const host = context.getEmitHost();
108400
108213
  const symbolTracker = {
@@ -108406,49 +108219,19 @@ function transformDeclarations(context) {
108406
108219
  reportLikelyUnsafeImportRequiredError,
108407
108220
  reportTruncationError,
108408
108221
  moduleResolverHost: host,
108409
- trackReferencedAmbientModule,
108410
- trackExternalModuleSymbolOfImportTypeNode,
108411
108222
  reportNonlocalAugmentation,
108412
108223
  reportNonSerializableProperty
108413
108224
  };
108414
108225
  let errorNameNode;
108415
108226
  let errorFallbackNode;
108416
108227
  let currentSourceFile;
108417
- let refs;
108418
- let libs2;
108419
- let emittedImports;
108228
+ let rawReferencedFiles;
108229
+ let rawTypeReferenceDirectives;
108230
+ let rawLibReferenceDirectives;
108420
108231
  const resolver = context.getEmitResolver();
108421
108232
  const options = context.getCompilerOptions();
108422
- const { noResolve, stripInternal } = options;
108233
+ const { stripInternal } = options;
108423
108234
  return transformRoot;
108424
- function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) {
108425
- if (!typeReferenceDirectives) {
108426
- return;
108427
- }
108428
- necessaryTypeReferences = necessaryTypeReferences || /* @__PURE__ */ new Set();
108429
- for (const ref of typeReferenceDirectives) {
108430
- necessaryTypeReferences.add(ref);
108431
- }
108432
- }
108433
- function trackReferencedAmbientModule(node, symbol) {
108434
- const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol, -1 /* All */);
108435
- if (length(directives)) {
108436
- return recordTypeReferenceDirectivesIfNecessary(directives);
108437
- }
108438
- const container = getSourceFileOfNode(node);
108439
- refs.set(getOriginalNodeId(container), container);
108440
- }
108441
- function trackReferencedAmbientModuleFromImport(node) {
108442
- const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(node);
108443
- const symbol = moduleSpecifier && resolver.tryFindAmbientModule(moduleSpecifier);
108444
- if (symbol == null ? void 0 : symbol.declarations) {
108445
- for (const decl of symbol.declarations) {
108446
- if (isAmbientModule(decl) && getSourceFileOfNode(decl) !== currentSourceFile) {
108447
- trackReferencedAmbientModule(decl, symbol);
108448
- }
108449
- }
108450
- }
108451
- }
108452
108235
  function handleSymbolAccessibilityError(symbolAccessibilityResult) {
108453
108236
  if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {
108454
108237
  if (symbolAccessibilityResult.aliasesToMakeVisible) {
@@ -108473,11 +108256,6 @@ function transformDeclarations(context) {
108473
108256
  }
108474
108257
  return false;
108475
108258
  }
108476
- function trackExternalModuleSymbolOfImportTypeNode(symbol) {
108477
- if (!isBundledEmit) {
108478
- (exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
108479
- }
108480
- }
108481
108259
  function trackSymbol(symbol, enclosingDeclaration2, meaning) {
108482
108260
  if (symbol.flags & 262144 /* TypeParameter */)
108483
108261
  return false;
@@ -108488,7 +108266,6 @@ function transformDeclarations(context) {
108488
108266
  /*shouldComputeAliasToMarkVisible*/
108489
108267
  true
108490
108268
  ));
108491
- recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
108492
108269
  return issuedDiagnostic;
108493
108270
  }
108494
108271
  function reportPrivateInBaseOfClassExpression(propertyName) {
@@ -108560,8 +108337,9 @@ function transformDeclarations(context) {
108560
108337
  }
108561
108338
  if (node.kind === 308 /* Bundle */) {
108562
108339
  isBundledEmit = true;
108563
- refs = /* @__PURE__ */ new Map();
108564
- libs2 = /* @__PURE__ */ new Map();
108340
+ rawReferencedFiles = [];
108341
+ rawTypeReferenceDirectives = [];
108342
+ rawLibReferenceDirectives = [];
108565
108343
  let hasNoDefaultLib = false;
108566
108344
  const bundle = factory2.createBundle(
108567
108345
  map(node.sourceFiles, (sourceFile) => {
@@ -108576,8 +108354,7 @@ function transformDeclarations(context) {
108576
108354
  getSymbolAccessibilityDiagnostic = throwDiagnostic;
108577
108355
  needsScopeFixMarker = false;
108578
108356
  resultHasScopeMarker = false;
108579
- collectReferences(sourceFile, refs);
108580
- collectLibs(sourceFile, libs2);
108357
+ collectFileReferences(sourceFile);
108581
108358
  if (isExternalOrCommonJsModule(sourceFile) || isJsonSourceFile(sourceFile)) {
108582
108359
  resultHasExternalModuleIndicator = false;
108583
108360
  needsDeclare = false;
@@ -108624,18 +108401,16 @@ function transformDeclarations(context) {
108624
108401
  );
108625
108402
  })
108626
108403
  );
108627
- bundle.syntheticFileReferences = [];
108628
- bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences();
108629
- bundle.syntheticLibReferences = getLibReferences();
108630
- bundle.hasNoDefaultLib = hasNoDefaultLib;
108631
108404
  const outputFilePath2 = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
108632
108405
  node,
108633
108406
  host,
108634
108407
  /*forceDtsPaths*/
108635
108408
  true
108636
108409
  ).declarationFilePath));
108637
- const referenceVisitor2 = mapReferencesIntoArray(bundle.syntheticFileReferences, outputFilePath2);
108638
- refs.forEach(referenceVisitor2);
108410
+ bundle.syntheticFileReferences = getReferencedFiles(outputFilePath2);
108411
+ bundle.syntheticTypeReferences = getTypeReferences();
108412
+ bundle.syntheticLibReferences = getLibReferences();
108413
+ bundle.hasNoDefaultLib = hasNoDefaultLib;
108639
108414
  return bundle;
108640
108415
  }
108641
108416
  needsDeclare = true;
@@ -108649,66 +108424,68 @@ function transformDeclarations(context) {
108649
108424
  suppressNewDiagnosticContexts = false;
108650
108425
  lateMarkedStatements = void 0;
108651
108426
  lateStatementReplacementMap = /* @__PURE__ */ new Map();
108652
- necessaryTypeReferences = void 0;
108653
- refs = collectReferences(currentSourceFile, /* @__PURE__ */ new Map());
108654
- libs2 = collectLibs(currentSourceFile, /* @__PURE__ */ new Map());
108655
- const references = [];
108656
- const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
108657
- node,
108658
- host,
108659
- /*forceDtsPaths*/
108660
- true
108661
- ).declarationFilePath));
108662
- const referenceVisitor = mapReferencesIntoArray(references, outputFilePath);
108427
+ rawReferencedFiles = [];
108428
+ rawTypeReferenceDirectives = [];
108429
+ rawLibReferenceDirectives = [];
108430
+ collectFileReferences(currentSourceFile);
108663
108431
  let combinedStatements;
108664
108432
  if (isSourceFileJS(currentSourceFile)) {
108665
108433
  combinedStatements = factory2.createNodeArray(transformDeclarationsForJS(node));
108666
- refs.forEach(referenceVisitor);
108667
- emittedImports = filter(combinedStatements, isAnyImportSyntax);
108668
108434
  } else {
108669
108435
  const statements = visitNodes2(node.statements, visitDeclarationStatements, isStatement);
108670
108436
  combinedStatements = setTextRange(factory2.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
108671
- refs.forEach(referenceVisitor);
108672
- emittedImports = filter(combinedStatements, isAnyImportSyntax);
108673
108437
  if (isExternalModule(node) && (!resultHasExternalModuleIndicator || needsScopeFixMarker && !resultHasScopeMarker)) {
108674
108438
  combinedStatements = setTextRange(factory2.createNodeArray([...combinedStatements, createEmptyExports(factory2)]), combinedStatements);
108675
108439
  }
108676
108440
  }
108441
+ const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
108442
+ node,
108443
+ host,
108444
+ /*forceDtsPaths*/
108445
+ true
108446
+ ).declarationFilePath));
108677
108447
  return factory2.updateSourceFile(
108678
108448
  node,
108679
108449
  combinedStatements,
108680
108450
  /*isDeclarationFile*/
108681
108451
  true,
108682
- references,
108683
- getFileReferencesForUsedTypeReferences(),
108452
+ getReferencedFiles(outputFilePath),
108453
+ getTypeReferences(),
108684
108454
  node.hasNoDefaultLib,
108685
108455
  getLibReferences()
108686
108456
  );
108687
- function getLibReferences() {
108688
- 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);
108689
108461
  }
108690
- function getFileReferencesForUsedTypeReferences() {
108691
- 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;
108692
108467
  }
108693
- function getFileReferenceForSpecifierModeTuple([typeName, mode]) {
108694
- if (emittedImports) {
108695
- for (const importStatement of emittedImports) {
108696
- if (isImportEqualsDeclaration(importStatement) && isExternalModuleReference(importStatement.moduleReference)) {
108697
- const expr = importStatement.moduleReference.expression;
108698
- if (isStringLiteralLike(expr) && expr.text === typeName) {
108699
- return void 0;
108700
- }
108701
- } else if (isImportDeclaration(importStatement) && isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) {
108702
- return void 0;
108703
- }
108704
- }
108705
- }
108706
- 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
+ });
108707
108474
  }
108708
- function mapReferencesIntoArray(references2, outputFilePath2) {
108709
- return (file) => {
108710
- if (exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.includes(file.symbol)) {
108711
- 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;
108712
108489
  }
108713
108490
  let declFileName;
108714
108491
  if (file.isDeclarationFile) {
@@ -108724,61 +108501,22 @@ function transformDeclarations(context) {
108724
108501
  );
108725
108502
  declFileName = paths.declarationFilePath || paths.jsFilePath || file.fileName;
108726
108503
  }
108727
- if (declFileName) {
108728
- const specifier = getModuleSpecifier(
108729
- options,
108730
- currentSourceFile,
108731
- getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
108732
- getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
108733
- host
108734
- );
108735
- if (!pathIsRelative(specifier)) {
108736
- recordTypeReferenceDirectivesIfNecessary([[
108737
- specifier,
108738
- /*mode*/
108739
- void 0
108740
- ]]);
108741
- return;
108742
- }
108743
- let fileName = getRelativePathToDirectoryOrUrl(
108744
- outputFilePath2,
108745
- declFileName,
108746
- host.getCurrentDirectory(),
108747
- host.getCanonicalFileName,
108748
- /*isAbsolutePathAnUrl*/
108749
- false
108750
- );
108751
- if (startsWith(fileName, "./") && hasExtension(fileName)) {
108752
- fileName = fileName.substring(2);
108753
- }
108754
- if (startsWith(fileName, "node_modules/") || pathContainsNodeModules(fileName)) {
108755
- return;
108756
- }
108757
- references2.push({ pos: -1, end: -1, fileName });
108758
- }
108759
- };
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
+ });
108760
108518
  }
108761
108519
  }
108762
- function collectReferences(sourceFile, ret) {
108763
- if (noResolve || isSourceFileJS(sourceFile))
108764
- return ret;
108765
- forEach(sourceFile.referencedFiles, (f) => {
108766
- const elem = host.getSourceFileFromReference(sourceFile, f);
108767
- if (elem) {
108768
- ret.set(getOriginalNodeId(elem), elem);
108769
- }
108770
- });
108771
- return ret;
108772
- }
108773
- function collectLibs(sourceFile, ret) {
108774
- forEach(sourceFile.libReferenceDirectives, (ref) => {
108775
- const lib = host.getLibFileFromReference(ref);
108776
- if (lib) {
108777
- ret.set(toFileNameLowerCase(ref.fileName), true);
108778
- }
108779
- });
108780
- return ret;
108781
- }
108782
108520
  function filterBindingPatternInitializers(name) {
108783
108521
  if (name.kind === 80 /* Identifier */) {
108784
108522
  return name;
@@ -108977,7 +108715,6 @@ function transformDeclarations(context) {
108977
108715
  function checkEntityNameVisibility(entityName, enclosingDeclaration2) {
108978
108716
  const visibilityResult = resolver.isEntityNameVisible(entityName, enclosingDeclaration2);
108979
108717
  handleSymbolAccessibilityError(visibilityResult);
108980
- recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName));
108981
108718
  }
108982
108719
  function preserveJsDoc(updated, original) {
108983
108720
  if (hasJSDocNodes(updated) && hasJSDocNodes(original)) {
@@ -108995,11 +108732,6 @@ function transformDeclarations(context) {
108995
108732
  if (newName) {
108996
108733
  return factory2.createStringLiteral(newName);
108997
108734
  }
108998
- } else {
108999
- const symbol = resolver.getSymbolOfExternalModuleSpecifier(input);
109000
- if (symbol) {
109001
- (exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
109002
- }
109003
108735
  }
109004
108736
  }
109005
108737
  return input;
@@ -109392,7 +109124,6 @@ function transformDeclarations(context) {
109392
109124
  case 205 /* ImportType */: {
109393
109125
  if (!isLiteralImportTypeNode(input))
109394
109126
  return cleanup(input);
109395
- trackReferencedAmbientModuleFromImport(input);
109396
109127
  return cleanup(factory2.updateImportTypeNode(
109397
109128
  input,
109398
109129
  factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)),
@@ -109444,7 +109175,6 @@ function transformDeclarations(context) {
109444
109175
  resultHasExternalModuleIndicator = true;
109445
109176
  }
109446
109177
  resultHasScopeMarker = true;
109447
- trackReferencedAmbientModuleFromImport(input);
109448
109178
  return factory2.updateExportDeclaration(
109449
109179
  input,
109450
109180
  input.modifiers,
@@ -109519,18 +109249,10 @@ function transformDeclarations(context) {
109519
109249
  return;
109520
109250
  switch (input.kind) {
109521
109251
  case 271 /* ImportEqualsDeclaration */: {
109522
- const transformed = transformImportEqualsDeclaration(input);
109523
- if (transformed) {
109524
- trackReferencedAmbientModuleFromImport(input);
109525
- }
109526
- return transformed;
109252
+ return transformImportEqualsDeclaration(input);
109527
109253
  }
109528
109254
  case 272 /* ImportDeclaration */: {
109529
- const transformed = transformImportDeclaration(input);
109530
- if (transformed) {
109531
- trackReferencedAmbientModuleFromImport(input);
109532
- }
109533
- return transformed;
109255
+ return transformImportDeclaration(input);
109534
109256
  }
109535
109257
  }
109536
109258
  if (isDeclaration(input) && isDeclarationAndNotVisible(input))
@@ -111089,20 +110811,15 @@ var notImplementedResolver = {
111089
110811
  getReferencedValueDeclarations: notImplemented,
111090
110812
  getTypeReferenceSerializationKind: notImplemented,
111091
110813
  isOptionalParameter: notImplemented,
111092
- moduleExportsSomeValue: notImplemented,
111093
110814
  isArgumentsLocalBinding: notImplemented,
111094
110815
  getExternalModuleFileFromDeclaration: notImplemented,
111095
- getTypeReferenceDirectivesForEntityName: notImplemented,
111096
- getTypeReferenceDirectivesForSymbol: notImplemented,
111097
110816
  isLiteralConstDeclaration: notImplemented,
111098
110817
  getJsxFactoryEntity: notImplemented,
111099
110818
  getJsxFragmentFactoryEntity: notImplemented,
111100
110819
  getAllAccessorDeclarations: notImplemented,
111101
- getSymbolOfExternalModuleSpecifier: notImplemented,
111102
110820
  isBindingCapturedByNode: notImplemented,
111103
110821
  getDeclarationStatementsForSourceFile: notImplemented,
111104
- isImportRequiredByAugmentation: notImplemented,
111105
- tryFindAmbientModule: notImplemented
110822
+ isImportRequiredByAugmentation: notImplemented
111106
110823
  };
111107
110824
  var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
111108
110825
  var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@@ -113857,19 +113574,17 @@ function createPrinter(printerOptions = {}, handlers = {}) {
113857
113574
  writeLine();
113858
113575
  }
113859
113576
  }
113860
- for (const directive of files) {
113861
- writeComment(`/// <reference path="${directive.fileName}" />`);
113862
- writeLine();
113863
- }
113864
- for (const directive of types) {
113865
- const resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile == null ? void 0 : currentSourceFile.impliedNodeFormat) ? `resolution-mode="${directive.resolutionMode === 99 /* ESNext */ ? "import" : "require"}"` : "";
113866
- writeComment(`/// <reference types="${directive.fileName}" ${resolutionMode}/>`);
113867
- writeLine();
113868
- }
113869
- for (const directive of libs2) {
113870
- writeComment(`/// <reference lib="${directive.fileName}" />`);
113871
- 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
+ }
113872
113584
  }
113585
+ writeDirectives("path", files);
113586
+ writeDirectives("types", types);
113587
+ writeDirectives("lib", libs2);
113873
113588
  }
113874
113589
  function emitSourceFileWorker(node) {
113875
113590
  const statements = node.statements;
@@ -117706,7 +117421,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117706
117421
  getSourceFile: program.getSourceFile,
117707
117422
  getSourceFileByPath: program.getSourceFileByPath,
117708
117423
  getSourceFiles: program.getSourceFiles,
117709
- getLibFileFromReference: program.getLibFileFromReference,
117710
117424
  isSourceFileFromExternalLibrary,
117711
117425
  getResolvedProjectReferenceToRedirect,
117712
117426
  getProjectReferenceRedirect,