typescript 5.6.0-dev.20240613 → 5.6.0-dev.20240614

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/typescript.js CHANGED
@@ -259,7 +259,6 @@ __export(typescript_exports, {
259
259
  canHaveJSDoc: () => canHaveJSDoc,
260
260
  canHaveLocals: () => canHaveLocals,
261
261
  canHaveModifiers: () => canHaveModifiers,
262
- canHaveModuleSpecifier: () => canHaveModuleSpecifier,
263
262
  canHaveSymbol: () => canHaveSymbol,
264
263
  canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics,
265
264
  canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
@@ -736,7 +735,6 @@ __export(typescript_exports, {
736
735
  getDefaultLibFilePath: () => getDefaultLibFilePath,
737
736
  getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
738
737
  getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
739
- getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
740
738
  getDiagnosticText: () => getDiagnosticText,
741
739
  getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
742
740
  getDirectoryPath: () => getDirectoryPath,
@@ -767,7 +765,6 @@ __export(typescript_exports, {
767
765
  getEmitFlags: () => getEmitFlags,
768
766
  getEmitHelpers: () => getEmitHelpers,
769
767
  getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
770
- getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
771
768
  getEmitModuleKind: () => getEmitModuleKind,
772
769
  getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
773
770
  getEmitScriptTarget: () => getEmitScriptTarget,
@@ -818,7 +815,6 @@ __export(typescript_exports, {
818
815
  getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
819
816
  getIdentifierTypeArguments: () => getIdentifierTypeArguments,
820
817
  getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
821
- getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
822
818
  getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
823
819
  getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
824
820
  getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
@@ -926,6 +922,7 @@ __export(typescript_exports, {
926
922
  getNameOfScriptTarget: () => getNameOfScriptTarget,
927
923
  getNameOrArgument: () => getNameOrArgument,
928
924
  getNameTable: () => getNameTable,
925
+ getNamesForExportedSymbol: () => getNamesForExportedSymbol,
929
926
  getNamespaceDeclarationNode: () => getNamespaceDeclarationNode,
930
927
  getNewLineCharacter: () => getNewLineCharacter,
931
928
  getNewLineKind: () => getNewLineKind,
@@ -942,6 +939,7 @@ __export(typescript_exports, {
942
939
  getNonAssignmentOperatorForCompoundAssignment: () => getNonAssignmentOperatorForCompoundAssignment,
943
940
  getNonAugmentationDeclaration: () => getNonAugmentationDeclaration,
944
941
  getNonDecoratorTokenPosOfNode: () => getNonDecoratorTokenPosOfNode,
942
+ getNonIncrementalBuildInfoRoots: () => getNonIncrementalBuildInfoRoots,
945
943
  getNormalizedAbsolutePath: () => getNormalizedAbsolutePath,
946
944
  getNormalizedAbsolutePathWithoutRoot: () => getNormalizedAbsolutePathWithoutRoot,
947
945
  getNormalizedPathComponents: () => getNormalizedPathComponents,
@@ -1177,7 +1175,6 @@ __export(typescript_exports, {
1177
1175
  importDefaultHelper: () => importDefaultHelper,
1178
1176
  importFromModuleSpecifier: () => importFromModuleSpecifier,
1179
1177
  importStarHelper: () => importStarHelper,
1180
- importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
1181
1178
  indexOfAnyCharCode: () => indexOfAnyCharCode,
1182
1179
  indexOfNode: () => indexOfNode,
1183
1180
  indicesOf: () => indicesOf,
@@ -1653,6 +1650,7 @@ __export(typescript_exports, {
1653
1650
  isNonExportDefaultModifier: () => isNonExportDefaultModifier,
1654
1651
  isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
1655
1652
  isNonGlobalDeclaration: () => isNonGlobalDeclaration,
1653
+ isNonIncrementalBuildInfo: () => isNonIncrementalBuildInfo,
1656
1654
  isNonNullAccess: () => isNonNullAccess,
1657
1655
  isNonNullChain: () => isNonNullChain,
1658
1656
  isNonNullExpression: () => isNonNullExpression,
@@ -1765,6 +1763,7 @@ __export(typescript_exports, {
1765
1763
  isSimpleParameter: () => isSimpleParameter,
1766
1764
  isSimpleParameterList: () => isSimpleParameterList,
1767
1765
  isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
1766
+ isSourceElement: () => isSourceElement,
1768
1767
  isSourceFile: () => isSourceFile,
1769
1768
  isSourceFileFromLibrary: () => isSourceFileFromLibrary,
1770
1769
  isSourceFileJS: () => isSourceFileJS,
@@ -1898,7 +1897,6 @@ __export(typescript_exports, {
1898
1897
  linkNamePart: () => linkNamePart,
1899
1898
  linkPart: () => linkPart,
1900
1899
  linkTextPart: () => linkTextPart,
1901
- listFiles: () => listFiles,
1902
1900
  loadModuleFromGlobalCache: () => loadModuleFromGlobalCache,
1903
1901
  loadWithModeAwareCache: () => loadWithModeAwareCache,
1904
1902
  makeIdentifierFromModuleName: () => makeIdentifierFromModuleName,
@@ -1977,6 +1975,7 @@ __export(typescript_exports, {
1977
1975
  noopFileWatcher: () => noopFileWatcher,
1978
1976
  normalizePath: () => normalizePath,
1979
1977
  normalizeSlashes: () => normalizeSlashes,
1978
+ normalizeSpans: () => normalizeSpans,
1980
1979
  not: () => not,
1981
1980
  notImplemented: () => notImplemented,
1982
1981
  notImplementedResolver: () => notImplementedResolver,
@@ -2028,7 +2027,6 @@ __export(typescript_exports, {
2028
2027
  pathIsBareSpecifier: () => pathIsBareSpecifier,
2029
2028
  pathIsRelative: () => pathIsRelative,
2030
2029
  patternText: () => patternText,
2031
- perfLogger: () => perfLogger,
2032
2030
  performIncrementalCompilation: () => performIncrementalCompilation,
2033
2031
  performance: () => ts_performance_exports,
2034
2032
  plainJSErrors: () => plainJSErrors,
@@ -2236,7 +2234,10 @@ __export(typescript_exports, {
2236
2234
  textOrKeywordPart: () => textOrKeywordPart,
2237
2235
  textPart: () => textPart,
2238
2236
  textRangeContainsPositionInclusive: () => textRangeContainsPositionInclusive,
2237
+ textRangeContainsTextSpan: () => textRangeContainsTextSpan,
2238
+ textRangeIntersectsWithTextSpan: () => textRangeIntersectsWithTextSpan,
2239
2239
  textSpanContainsPosition: () => textSpanContainsPosition,
2240
+ textSpanContainsTextRange: () => textSpanContainsTextRange,
2240
2241
  textSpanContainsTextSpan: () => textSpanContainsTextSpan,
2241
2242
  textSpanEnd: () => textSpanEnd,
2242
2243
  textSpanIntersection: () => textSpanIntersection,
@@ -2277,11 +2278,11 @@ __export(typescript_exports, {
2277
2278
  transformESDecorators: () => transformESDecorators,
2278
2279
  transformESNext: () => transformESNext,
2279
2280
  transformGenerators: () => transformGenerators,
2280
- transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
2281
2281
  transformJsx: () => transformJsx,
2282
2282
  transformLegacyDecorators: () => transformLegacyDecorators,
2283
2283
  transformModule: () => transformModule,
2284
2284
  transformNamedEvaluation: () => transformNamedEvaluation,
2285
+ transformNodeModule: () => transformNodeModule,
2285
2286
  transformNodes: () => transformNodes,
2286
2287
  transformSystemModule: () => transformSystemModule,
2287
2288
  transformTypeScript: () => transformTypeScript,
@@ -2375,7 +2376,7 @@ module.exports = __toCommonJS(typescript_exports);
2375
2376
 
2376
2377
  // src/compiler/corePublic.ts
2377
2378
  var versionMajorMinor = "5.6";
2378
- var version = `${versionMajorMinor}.0-dev.20240613`;
2379
+ var version = `${versionMajorMinor}.0-dev.20240614`;
2379
2380
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2380
2381
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2381
2382
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -5287,16 +5288,6 @@ function tryGetNativePerformanceHooks() {
5287
5288
  }
5288
5289
  var timestamp = nativePerformanceTime ? () => nativePerformanceTime.now() : Date.now;
5289
5290
 
5290
- // src/compiler/perfLogger.ts
5291
- var etwModule;
5292
- try {
5293
- const etwModulePath = process.env.TS_ETW_MODULE_PATH ?? "./node_modules/@microsoft/typescript-etw";
5294
- etwModule = require(etwModulePath);
5295
- } catch (e) {
5296
- etwModule = void 0;
5297
- }
5298
- var perfLogger = (etwModule == null ? void 0 : etwModule.logEvent) ? etwModule : void 0;
5299
-
5300
5291
  // src/compiler/_namespaces/ts.performance.ts
5301
5292
  var ts_performance_exports = {};
5302
5293
  __export(ts_performance_exports, {
@@ -6583,6 +6574,7 @@ var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags3) => {
6583
6574
  NodeCheckFlags3[NodeCheckFlags3["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
6584
6575
  NodeCheckFlags3[NodeCheckFlags3["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
6585
6576
  NodeCheckFlags3[NodeCheckFlags3["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
6577
+ NodeCheckFlags3[NodeCheckFlags3["PartiallyTypeChecked"] = 8388608] = "PartiallyTypeChecked";
6586
6578
  NodeCheckFlags3[NodeCheckFlags3["LazyFlags"] = 539358128] = "LazyFlags";
6587
6579
  return NodeCheckFlags3;
6588
6580
  })(NodeCheckFlags || {});
@@ -6930,22 +6922,22 @@ var ScriptKind = /* @__PURE__ */ ((ScriptKind7) => {
6930
6922
  ScriptKind7[ScriptKind7["Deferred"] = 7] = "Deferred";
6931
6923
  return ScriptKind7;
6932
6924
  })(ScriptKind || {});
6933
- var ScriptTarget = /* @__PURE__ */ ((ScriptTarget12) => {
6934
- ScriptTarget12[ScriptTarget12["ES3"] = 0] = "ES3";
6935
- ScriptTarget12[ScriptTarget12["ES5"] = 1] = "ES5";
6936
- ScriptTarget12[ScriptTarget12["ES2015"] = 2] = "ES2015";
6937
- ScriptTarget12[ScriptTarget12["ES2016"] = 3] = "ES2016";
6938
- ScriptTarget12[ScriptTarget12["ES2017"] = 4] = "ES2017";
6939
- ScriptTarget12[ScriptTarget12["ES2018"] = 5] = "ES2018";
6940
- ScriptTarget12[ScriptTarget12["ES2019"] = 6] = "ES2019";
6941
- ScriptTarget12[ScriptTarget12["ES2020"] = 7] = "ES2020";
6942
- ScriptTarget12[ScriptTarget12["ES2021"] = 8] = "ES2021";
6943
- ScriptTarget12[ScriptTarget12["ES2022"] = 9] = "ES2022";
6944
- ScriptTarget12[ScriptTarget12["ES2023"] = 10] = "ES2023";
6945
- ScriptTarget12[ScriptTarget12["ESNext"] = 99] = "ESNext";
6946
- ScriptTarget12[ScriptTarget12["JSON"] = 100] = "JSON";
6947
- ScriptTarget12[ScriptTarget12["Latest"] = 99 /* ESNext */] = "Latest";
6948
- return ScriptTarget12;
6925
+ var ScriptTarget = /* @__PURE__ */ ((ScriptTarget11) => {
6926
+ ScriptTarget11[ScriptTarget11["ES3"] = 0] = "ES3";
6927
+ ScriptTarget11[ScriptTarget11["ES5"] = 1] = "ES5";
6928
+ ScriptTarget11[ScriptTarget11["ES2015"] = 2] = "ES2015";
6929
+ ScriptTarget11[ScriptTarget11["ES2016"] = 3] = "ES2016";
6930
+ ScriptTarget11[ScriptTarget11["ES2017"] = 4] = "ES2017";
6931
+ ScriptTarget11[ScriptTarget11["ES2018"] = 5] = "ES2018";
6932
+ ScriptTarget11[ScriptTarget11["ES2019"] = 6] = "ES2019";
6933
+ ScriptTarget11[ScriptTarget11["ES2020"] = 7] = "ES2020";
6934
+ ScriptTarget11[ScriptTarget11["ES2021"] = 8] = "ES2021";
6935
+ ScriptTarget11[ScriptTarget11["ES2022"] = 9] = "ES2022";
6936
+ ScriptTarget11[ScriptTarget11["ES2023"] = 10] = "ES2023";
6937
+ ScriptTarget11[ScriptTarget11["ESNext"] = 99] = "ESNext";
6938
+ ScriptTarget11[ScriptTarget11["JSON"] = 100] = "JSON";
6939
+ ScriptTarget11[ScriptTarget11["Latest"] = 99 /* ESNext */] = "Latest";
6940
+ return ScriptTarget11;
6949
6941
  })(ScriptTarget || {});
6950
6942
  var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => {
6951
6943
  LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard";
@@ -8676,7 +8668,7 @@ var sys = (() => {
8676
8668
  callback
8677
8669
  );
8678
8670
  }
8679
- function readFileWorker(fileName, _encoding) {
8671
+ function readFile(fileName, _encoding) {
8680
8672
  let buffer;
8681
8673
  try {
8682
8674
  buffer = _fs.readFileSync(fileName);
@@ -8701,16 +8693,7 @@ var sys = (() => {
8701
8693
  }
8702
8694
  return buffer.toString("utf8");
8703
8695
  }
8704
- function readFile(fileName, _encoding) {
8705
- var _a, _b;
8706
- (_a = perfLogger) == null ? void 0 : _a.logStartReadFile(fileName);
8707
- const file = readFileWorker(fileName, _encoding);
8708
- (_b = perfLogger) == null ? void 0 : _b.logStopReadFile();
8709
- return file;
8710
- }
8711
8696
  function writeFile2(fileName, data, writeByteOrderMark) {
8712
- var _a;
8713
- (_a = perfLogger) == null ? void 0 : _a.logEvent("WriteFile: " + fileName);
8714
8697
  if (writeByteOrderMark) {
8715
8698
  data = byteOrderMarkIndicator + data;
8716
8699
  }
@@ -8731,8 +8714,6 @@ var sys = (() => {
8731
8714
  }
8732
8715
  }
8733
8716
  function getAccessibleFileSystemEntries(path) {
8734
- var _a;
8735
- (_a = perfLogger) == null ? void 0 : _a.logEvent("ReadDir: " + (path || "."));
8736
8717
  try {
8737
8718
  const entries = _fs.readdirSync(path || ".", { withFileTypes: true });
8738
8719
  const files = [];
@@ -9510,7 +9491,6 @@ var Diagnostics = {
9510
9491
  _0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1290, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1290", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
9511
9492
  _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
9512
9493
  _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
9513
- ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
9514
9494
  with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
9515
9495
  await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
9516
9496
  The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
@@ -10399,7 +10379,6 @@ var Diagnostics = {
10399
10379
  Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
10400
10380
  File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
10401
10381
  Cannot_read_file_0_Colon_1: diag(5012, 1 /* Error */, "Cannot_read_file_0_Colon_1_5012", "Cannot read file '{0}': {1}."),
10402
- Failed_to_parse_file_0_Colon_1: diag(5014, 1 /* Error */, "Failed_to_parse_file_0_Colon_1_5014", "Failed to parse file '{0}': {1}."),
10403
10382
  Unknown_compiler_option_0: diag(5023, 1 /* Error */, "Unknown_compiler_option_0_5023", "Unknown compiler option '{0}'."),
10404
10383
  Compiler_option_0_requires_a_value_of_type_1: diag(5024, 1 /* Error */, "Compiler_option_0_requires_a_value_of_type_1_5024", "Compiler option '{0}' requires a value of type {1}."),
10405
10384
  Unknown_compiler_option_0_Did_you_mean_1: diag(5025, 1 /* Error */, "Unknown_compiler_option_0_Did_you_mean_1_5025", "Unknown compiler option '{0}'. Did you mean '{1}'?"),
@@ -10843,6 +10822,8 @@ var Diagnostics = {
10843
10822
  Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
10844
10823
  Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0: diag(6417, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0_6417", "Searching all ancestor node_modules directories for preferred extensions: {0}."),
10845
10824
  Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
10825
+ Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors: diag(6419, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors_6419", "Project '{0}' is out of date because buildinfo file '{1}' indicates that program needs to report errors."),
10826
+ Project_0_is_out_of_date_because_1: diag(6420, 3 /* Message */, "Project_0_is_out_of_date_because_1_6420", "Project '{0}' is out of date because {1}."),
10846
10827
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
10847
10828
  The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
10848
10829
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -14714,12 +14695,18 @@ function textSpanIsEmpty(span) {
14714
14695
  function textSpanContainsPosition(span, position) {
14715
14696
  return position >= span.start && position < textSpanEnd(span);
14716
14697
  }
14717
- function textRangeContainsPositionInclusive(span, position) {
14718
- return position >= span.pos && position <= span.end;
14698
+ function textRangeContainsPositionInclusive(range, position) {
14699
+ return position >= range.pos && position <= range.end;
14719
14700
  }
14720
14701
  function textSpanContainsTextSpan(span, other) {
14721
14702
  return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span);
14722
14703
  }
14704
+ function textSpanContainsTextRange(span, range) {
14705
+ return range.pos >= span.start && range.end <= textSpanEnd(span);
14706
+ }
14707
+ function textRangeContainsTextSpan(range, span) {
14708
+ return span.start >= range.pos && textSpanEnd(span) <= range.end;
14709
+ }
14723
14710
  function textSpanOverlapsWith(span, other) {
14724
14711
  return textSpanOverlap(span, other) !== void 0;
14725
14712
  }
@@ -14741,11 +14728,34 @@ function decodedTextSpanIntersectsWith(start1, length1, start2, length2) {
14741
14728
  function textSpanIntersectsWithPosition(span, position) {
14742
14729
  return position <= textSpanEnd(span) && position >= span.start;
14743
14730
  }
14731
+ function textRangeIntersectsWithTextSpan(range, span) {
14732
+ return textSpanIntersectsWith(span, range.pos, range.end - range.pos);
14733
+ }
14744
14734
  function textSpanIntersection(span1, span2) {
14745
14735
  const start = Math.max(span1.start, span2.start);
14746
14736
  const end = Math.min(textSpanEnd(span1), textSpanEnd(span2));
14747
14737
  return start <= end ? createTextSpanFromBounds(start, end) : void 0;
14748
14738
  }
14739
+ function normalizeSpans(spans) {
14740
+ spans = spans.filter((span) => span.length > 0).sort((a, b) => {
14741
+ return a.start !== b.start ? a.start - b.start : a.length - b.length;
14742
+ });
14743
+ const result = [];
14744
+ let i = 0;
14745
+ while (i < spans.length) {
14746
+ let span = spans[i];
14747
+ let j = i + 1;
14748
+ while (j < spans.length && textSpanIntersectsWithTextSpan(span, spans[j])) {
14749
+ const start = Math.min(span.start, spans[j].start);
14750
+ const end = Math.max(textSpanEnd(span), textSpanEnd(spans[j]));
14751
+ span = createTextSpanFromBounds(start, end);
14752
+ j++;
14753
+ }
14754
+ i = j;
14755
+ result.push(span);
14756
+ }
14757
+ return result;
14758
+ }
14749
14759
  function createTextSpan(start, length2) {
14750
14760
  if (start < 0) {
14751
14761
  throw new Error("start < 0");
@@ -18653,23 +18663,6 @@ function isFunctionSymbol(symbol) {
18653
18663
  const decl = symbol.valueDeclaration;
18654
18664
  return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
18655
18665
  }
18656
- function canHaveModuleSpecifier(node) {
18657
- switch (node == null ? void 0 : node.kind) {
18658
- case 260 /* VariableDeclaration */:
18659
- case 208 /* BindingElement */:
18660
- case 272 /* ImportDeclaration */:
18661
- case 278 /* ExportDeclaration */:
18662
- case 271 /* ImportEqualsDeclaration */:
18663
- case 273 /* ImportClause */:
18664
- case 280 /* NamespaceExport */:
18665
- case 274 /* NamespaceImport */:
18666
- case 281 /* ExportSpecifier */:
18667
- case 276 /* ImportSpecifier */:
18668
- case 205 /* ImportType */:
18669
- return true;
18670
- }
18671
- return false;
18672
- }
18673
18666
  function tryGetModuleSpecifierFromDeclaration(node) {
18674
18667
  var _a, _b;
18675
18668
  switch (node.kind) {
@@ -21684,8 +21677,8 @@ function walkTreeForJSXTags(node) {
21684
21677
  function isFileModuleFromUsingJSXTag(file) {
21685
21678
  return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0;
21686
21679
  }
21687
- function isFileForcedToBeModuleByFormat(file, options) {
21688
- return (getImpliedNodeFormatForEmitWorker(file, options) === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
21680
+ function isFileForcedToBeModuleByFormat(file) {
21681
+ return (file.impliedNodeFormat === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
21689
21682
  }
21690
21683
  function getSetExternalModuleIndicator(options) {
21691
21684
  switch (getEmitModuleDetectionKind(options)) {
@@ -21704,14 +21697,10 @@ function getSetExternalModuleIndicator(options) {
21704
21697
  }
21705
21698
  checks.push(isFileForcedToBeModuleByFormat);
21706
21699
  const combined = or(...checks);
21707
- const callback = (file) => void (file.externalModuleIndicator = combined(file, options));
21700
+ const callback = (file) => void (file.externalModuleIndicator = combined(file));
21708
21701
  return callback;
21709
21702
  }
21710
21703
  }
21711
- function importSyntaxAffectsModuleResolution(options) {
21712
- const moduleResolution = getEmitModuleResolutionKind(options);
21713
- return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options);
21714
- }
21715
21704
  function createComputedCompilerOptions(options) {
21716
21705
  return options;
21717
21706
  }
@@ -23065,6 +23054,105 @@ function replaceFirstStar(s, replacement) {
23065
23054
  function getNameFromImportAttribute(node) {
23066
23055
  return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
23067
23056
  }
23057
+ function isSourceElement(node) {
23058
+ switch (node.kind) {
23059
+ case 168 /* TypeParameter */:
23060
+ case 169 /* Parameter */:
23061
+ case 172 /* PropertyDeclaration */:
23062
+ case 171 /* PropertySignature */:
23063
+ case 185 /* ConstructorType */:
23064
+ case 184 /* FunctionType */:
23065
+ case 179 /* CallSignature */:
23066
+ case 180 /* ConstructSignature */:
23067
+ case 181 /* IndexSignature */:
23068
+ case 174 /* MethodDeclaration */:
23069
+ case 173 /* MethodSignature */:
23070
+ case 175 /* ClassStaticBlockDeclaration */:
23071
+ case 176 /* Constructor */:
23072
+ case 177 /* GetAccessor */:
23073
+ case 178 /* SetAccessor */:
23074
+ case 183 /* TypeReference */:
23075
+ case 182 /* TypePredicate */:
23076
+ case 186 /* TypeQuery */:
23077
+ case 187 /* TypeLiteral */:
23078
+ case 188 /* ArrayType */:
23079
+ case 189 /* TupleType */:
23080
+ case 192 /* UnionType */:
23081
+ case 193 /* IntersectionType */:
23082
+ case 196 /* ParenthesizedType */:
23083
+ case 190 /* OptionalType */:
23084
+ case 191 /* RestType */:
23085
+ case 197 /* ThisType */:
23086
+ case 198 /* TypeOperator */:
23087
+ case 194 /* ConditionalType */:
23088
+ case 195 /* InferType */:
23089
+ case 203 /* TemplateLiteralType */:
23090
+ case 205 /* ImportType */:
23091
+ case 202 /* NamedTupleMember */:
23092
+ case 328 /* JSDocAugmentsTag */:
23093
+ case 329 /* JSDocImplementsTag */:
23094
+ case 346 /* JSDocTypedefTag */:
23095
+ case 338 /* JSDocCallbackTag */:
23096
+ case 340 /* JSDocEnumTag */:
23097
+ case 345 /* JSDocTemplateTag */:
23098
+ case 344 /* JSDocTypeTag */:
23099
+ case 324 /* JSDocLink */:
23100
+ case 325 /* JSDocLinkCode */:
23101
+ case 326 /* JSDocLinkPlain */:
23102
+ case 341 /* JSDocParameterTag */:
23103
+ case 348 /* JSDocPropertyTag */:
23104
+ case 317 /* JSDocFunctionType */:
23105
+ case 315 /* JSDocNonNullableType */:
23106
+ case 314 /* JSDocNullableType */:
23107
+ case 312 /* JSDocAllType */:
23108
+ case 313 /* JSDocUnknownType */:
23109
+ case 322 /* JSDocTypeLiteral */:
23110
+ case 318 /* JSDocVariadicType */:
23111
+ case 309 /* JSDocTypeExpression */:
23112
+ case 333 /* JSDocPublicTag */:
23113
+ case 335 /* JSDocProtectedTag */:
23114
+ case 334 /* JSDocPrivateTag */:
23115
+ case 350 /* JSDocSatisfiesTag */:
23116
+ case 343 /* JSDocThisTag */:
23117
+ case 199 /* IndexedAccessType */:
23118
+ case 200 /* MappedType */:
23119
+ case 262 /* FunctionDeclaration */:
23120
+ case 241 /* Block */:
23121
+ case 268 /* ModuleBlock */:
23122
+ case 243 /* VariableStatement */:
23123
+ case 244 /* ExpressionStatement */:
23124
+ case 245 /* IfStatement */:
23125
+ case 246 /* DoStatement */:
23126
+ case 247 /* WhileStatement */:
23127
+ case 248 /* ForStatement */:
23128
+ case 249 /* ForInStatement */:
23129
+ case 250 /* ForOfStatement */:
23130
+ case 251 /* ContinueStatement */:
23131
+ case 252 /* BreakStatement */:
23132
+ case 253 /* ReturnStatement */:
23133
+ case 254 /* WithStatement */:
23134
+ case 255 /* SwitchStatement */:
23135
+ case 256 /* LabeledStatement */:
23136
+ case 257 /* ThrowStatement */:
23137
+ case 258 /* TryStatement */:
23138
+ case 260 /* VariableDeclaration */:
23139
+ case 208 /* BindingElement */:
23140
+ case 263 /* ClassDeclaration */:
23141
+ case 264 /* InterfaceDeclaration */:
23142
+ case 265 /* TypeAliasDeclaration */:
23143
+ case 266 /* EnumDeclaration */:
23144
+ case 267 /* ModuleDeclaration */:
23145
+ case 272 /* ImportDeclaration */:
23146
+ case 271 /* ImportEqualsDeclaration */:
23147
+ case 278 /* ExportDeclaration */:
23148
+ case 277 /* ExportAssignment */:
23149
+ case 242 /* EmptyStatement */:
23150
+ case 259 /* DebuggerStatement */:
23151
+ case 282 /* MissingDeclaration */:
23152
+ return true;
23153
+ }
23154
+ return false;
23155
+ }
23068
23156
  function evaluatorResult(value, isSyntacticallyString = false, resolvedOtherFiles = false, hasExternalReferences = false) {
23069
23157
  return { value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences };
23070
23158
  }
@@ -31076,7 +31164,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
31076
31164
  if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
31077
31165
  let namedBindings;
31078
31166
  const moduleKind = getEmitModuleKind(compilerOptions);
31079
- if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions) === 99 /* ESNext */) {
31167
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || sourceFile.impliedNodeFormat === 99 /* ESNext */) {
31080
31168
  const helpers = getEmitHelpers(sourceFile);
31081
31169
  if (helpers) {
31082
31170
  const helperNames = [];
@@ -31141,7 +31229,8 @@ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOp
31141
31229
  if (externalHelpersModuleName) {
31142
31230
  return externalHelpersModuleName;
31143
31231
  }
31144
- let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && getEmitModuleFormatOfFileWorker(node, compilerOptions) < 4 /* System */;
31232
+ const moduleKind = getEmitModuleKind(compilerOptions);
31233
+ let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || node.impliedNodeFormat === 1 /* CommonJS */);
31145
31234
  if (!create) {
31146
31235
  const helpers = getEmitHelpers(node);
31147
31236
  if (helpers) {
@@ -32327,7 +32416,7 @@ function setExternalModuleIndicator(sourceFile) {
32327
32416
  sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile);
32328
32417
  }
32329
32418
  function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind) {
32330
- var _a, _b, _c, _d;
32419
+ var _a, _b;
32331
32420
  (_a = tracing) == null ? void 0 : _a.push(
32332
32421
  tracing.Phase.Parse,
32333
32422
  "createSourceFile",
@@ -32337,7 +32426,6 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
32337
32426
  );
32338
32427
  mark("beforeParse");
32339
32428
  let result;
32340
- (_b = perfLogger) == null ? void 0 : _b.logStartParseSourceFile(fileName);
32341
32429
  const {
32342
32430
  languageVersion,
32343
32431
  setExternalModuleIndicator: overrideSetExternalModuleIndicator,
@@ -32373,10 +32461,9 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
32373
32461
  jsDocParsingMode
32374
32462
  );
32375
32463
  }
32376
- (_c = perfLogger) == null ? void 0 : _c.logStopParseSourceFile();
32377
32464
  mark("afterParse");
32378
32465
  measure("Parse", "beforeParse", "afterParse");
32379
- (_d = tracing) == null ? void 0 : _d.pop();
32466
+ (_b = tracing) == null ? void 0 : _b.pop();
32380
32467
  return result;
32381
32468
  }
32382
32469
  function parseIsolatedEntityName(text, languageVersion) {
@@ -43980,7 +44067,6 @@ function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
43980
44067
  );
43981
44068
  }
43982
44069
  function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43983
- var _a, _b, _c;
43984
44070
  const traceEnabled = isTraceEnabled(compilerOptions, host);
43985
44071
  if (redirectedReference) {
43986
44072
  compilerOptions = redirectedReference.commandLine.options;
@@ -44009,7 +44095,6 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
44009
44095
  trace(host, Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ModuleResolutionKind[moduleResolution]);
44010
44096
  }
44011
44097
  }
44012
- (_a = perfLogger) == null ? void 0 : _a.logStartResolveModule(moduleName);
44013
44098
  switch (moduleResolution) {
44014
44099
  case 3 /* Node16 */:
44015
44100
  result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
@@ -44029,8 +44114,6 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
44029
44114
  default:
44030
44115
  return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`);
44031
44116
  }
44032
- if (result && result.resolvedModule) (_b = perfLogger) == null ? void 0 : _b.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
44033
- (_c = perfLogger) == null ? void 0 : _c.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
44034
44117
  if (cache && !cache.isReadonly) {
44035
44118
  cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
44036
44119
  if (!isExternalModuleNameRelative(moduleName)) {
@@ -45878,11 +45961,8 @@ function createFlowNode(flags, node, antecedent) {
45878
45961
  }
45879
45962
  var binder = /* @__PURE__ */ createBinder();
45880
45963
  function bindSourceFile(file, options) {
45881
- var _a, _b;
45882
45964
  mark("beforeBind");
45883
- (_a = perfLogger) == null ? void 0 : _a.logStartBindFile("" + file.fileName);
45884
45965
  binder(file, options);
45885
- (_b = perfLogger) == null ? void 0 : _b.logStopBindFile();
45886
45966
  mark("afterBind");
45887
45967
  measure("Bind", "beforeBind", "afterBind");
45888
45968
  }
@@ -48875,15 +48955,13 @@ var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
48875
48955
  RelativePreference2[RelativePreference2["ExternalNonRelative"] = 3] = "ExternalNonRelative";
48876
48956
  return RelativePreference2;
48877
48957
  })(RelativePreference || {});
48878
- function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
48958
+ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
48879
48959
  const filePreferredEnding = getPreferredEnding();
48880
48960
  return {
48881
48961
  relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
48882
48962
  getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
48883
- const impliedNodeFormat = getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions);
48884
- const preferredEnding = syntaxImpliedNodeFormat !== impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
48885
- const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
48886
- if ((syntaxImpliedNodeFormat ?? impliedNodeFormat) === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
48963
+ const preferredEnding = syntaxImpliedNodeFormat !== importingSourceFile.impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
48964
+ if ((syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === 99 /* ESNext */) {
48887
48965
  if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
48888
48966
  return [3 /* TsExtension */, 2 /* JsExtension */];
48889
48967
  }
@@ -48914,19 +48992,19 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
48914
48992
  }
48915
48993
  return getModuleSpecifierEndingPreference(
48916
48994
  importModuleSpecifierEnding,
48917
- resolutionMode ?? getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions),
48995
+ resolutionMode ?? importingSourceFile.impliedNodeFormat,
48918
48996
  compilerOptions,
48919
48997
  isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
48920
48998
  );
48921
48999
  }
48922
49000
  }
48923
49001
  function updateModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, oldImportSpecifier, options = {}) {
48924
- const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
49002
+ const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
48925
49003
  if (res === oldImportSpecifier) return void 0;
48926
49004
  return res;
48927
49005
  }
48928
49006
  function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
48929
- return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile), {}, options);
49007
+ return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
48930
49008
  }
48931
49009
  function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
48932
49010
  const info = getInfo(importingSourceFile.fileName, host);
@@ -48956,7 +49034,7 @@ function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importin
48956
49034
  /*packageNameOnly*/
48957
49035
  void 0,
48958
49036
  options.overrideImportMode
48959
- )) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions), preferences);
49037
+ )) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
48960
49038
  }
48961
49039
  function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
48962
49040
  const result = tryGetModuleSpecifiersFromCacheWorker(
@@ -49027,21 +49105,17 @@ function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName,
49027
49105
  compilerOptions,
49028
49106
  host,
49029
49107
  importMode,
49030
- getModuleSpecifierPreferences({}, host, compilerOptions, importingFile)
49108
+ getModuleSpecifierPreferences({}, compilerOptions, importingFile)
49031
49109
  );
49032
49110
  }
49033
49111
  function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
49034
49112
  const info = getInfo(importingSourceFile.fileName, host);
49035
- const preferences = getModuleSpecifierPreferences(userPreferences, host, compilerOptions, importingSourceFile);
49113
+ const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
49036
49114
  const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
49037
49115
  host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
49038
49116
  (reason) => {
49039
49117
  if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path) return void 0;
49040
- const existingMode = host.getModeForResolutionAtIndex(importingSourceFile, reason.index);
49041
- const targetMode = options.overrideImportMode ?? host.getDefaultResolutionModeForFile(importingSourceFile);
49042
- if (existingMode !== targetMode && existingMode !== void 0 && targetMode !== void 0) {
49043
- return void 0;
49044
- }
49118
+ if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions)) return void 0;
49045
49119
  const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
49046
49120
  return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
49047
49121
  }
@@ -49571,7 +49645,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
49571
49645
  if (!parts) {
49572
49646
  return void 0;
49573
49647
  }
49574
- const preferences = getModuleSpecifierPreferences(userPreferences, host, options, importingSourceFile);
49648
+ const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
49575
49649
  const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
49576
49650
  let moduleSpecifier = path;
49577
49651
  let isPackageRootPath = false;
@@ -49621,7 +49695,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
49621
49695
  const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
49622
49696
  if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
49623
49697
  const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
49624
- const importMode = overrideMode || getDefaultResolutionModeForFile(importingSourceFile, host, options);
49698
+ const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
49625
49699
  if (getResolvePackageJsonExports(options)) {
49626
49700
  const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
49627
49701
  const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
@@ -49771,9 +49845,6 @@ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName
49771
49845
  function isPathRelativeToParent(path) {
49772
49846
  return startsWith(path, "..");
49773
49847
  }
49774
- function getDefaultResolutionModeForFile(file, host, compilerOptions) {
49775
- return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
49776
- }
49777
49848
 
49778
49849
  // src/compiler/checker.ts
49779
49850
  var ambientModuleSymbolRegex = /^".+"$/;
@@ -51996,28 +52067,22 @@ function createTypeChecker(host) {
51996
52067
  function isSyntacticDefault(node) {
51997
52068
  return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
51998
52069
  }
51999
- function getEmitSyntaxForModuleSpecifierExpression(usage) {
52000
- return isStringLiteralLike(usage) ? host.getEmitSyntaxForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
52070
+ function getUsageModeForExpression(usage) {
52071
+ return isStringLiteralLike(usage) ? host.getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
52001
52072
  }
52002
52073
  function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
52003
52074
  return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
52004
52075
  }
52005
- function isOnlyImportableAsDefault(usage) {
52006
- if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
52007
- const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage);
52008
- return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
52009
- }
52010
- return false;
52076
+ function isOnlyImportedAsDefault(usage) {
52077
+ const usageMode = getUsageModeForExpression(usage);
52078
+ return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
52011
52079
  }
52012
52080
  function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
52013
- const usageMode = file && getEmitSyntaxForModuleSpecifierExpression(usage);
52014
- if (file && usageMode !== void 0) {
52015
- const targetMode = host.getImpliedNodeFormatForEmit(file);
52016
- if (usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */ && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
52017
- return true;
52018
- }
52019
- if (usageMode === 99 /* ESNext */ && targetMode === 99 /* ESNext */) {
52020
- return false;
52081
+ const usageMode = file && getUsageModeForExpression(usage);
52082
+ if (file && usageMode !== void 0 && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
52083
+ const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
52084
+ if (usageMode === 99 /* ESNext */ || result) {
52085
+ return result;
52021
52086
  }
52022
52087
  }
52023
52088
  if (!allowSyntheticDefaultImports) {
@@ -52076,7 +52141,7 @@ function createTypeChecker(host) {
52076
52141
  if (!specifier) {
52077
52142
  return exportDefaultSymbol;
52078
52143
  }
52079
- const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
52144
+ const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
52080
52145
  const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
52081
52146
  if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
52082
52147
  if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
@@ -52278,7 +52343,7 @@ function createTypeChecker(host) {
52278
52343
  let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
52279
52344
  if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
52280
52345
  const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
52281
- if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
52346
+ if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
52282
52347
  symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
52283
52348
  }
52284
52349
  }
@@ -52882,7 +52947,7 @@ function createTypeChecker(host) {
52882
52947
  /*requireStringLiteralLikeArgument*/
52883
52948
  true
52884
52949
  ) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, isImportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression) || ((_f = findAncestor(location, isExportDeclaration)) == null ? void 0 : _f.moduleSpecifier);
52885
- const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
52950
+ const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
52886
52951
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
52887
52952
  const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
52888
52953
  const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
@@ -53126,7 +53191,7 @@ function createTypeChecker(host) {
53126
53191
  return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
53127
53192
  }
53128
53193
  const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
53129
- const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile));
53194
+ const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getUsageModeForExpression(reference), targetFile.impliedNodeFormat);
53130
53195
  if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
53131
53196
  let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
53132
53197
  if (!sigs || !sigs.length) {
@@ -55732,10 +55797,8 @@ function createTypeChecker(host) {
55732
55797
  }
55733
55798
  return getSourceFileOfNode(getNonAugmentationDeclaration(symbol)).fileName;
55734
55799
  }
55735
- const enclosingDeclaration = getOriginalNode(context.enclosingDeclaration);
55736
- const originalModuleSpecifier = canHaveModuleSpecifier(enclosingDeclaration) ? tryGetModuleSpecifierFromDeclaration(enclosingDeclaration) : void 0;
55737
55800
  const contextFile = context.enclosingFile;
55738
- const resolutionMode = overrideImportMode || originalModuleSpecifier && host.getModeForUsageLocation(contextFile, originalModuleSpecifier) || contextFile && host.getDefaultResolutionModeForFile(contextFile);
55801
+ const resolutionMode = overrideImportMode || (contextFile == null ? void 0 : contextFile.impliedNodeFormat);
55739
55802
  const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
55740
55803
  const links = getSymbolLinks(symbol);
55741
55804
  let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
@@ -56704,8 +56767,28 @@ function createTypeChecker(host) {
56704
56767
  } else {
56705
56768
  const type = getWidenedType(getRegularTypeOfExpression(node.expression));
56706
56769
  const computedPropertyNameType = typeToTypeNodeHelper(type, context);
56707
- Debug.assertNode(computedPropertyNameType, isLiteralTypeNode);
56708
- const literal = computedPropertyNameType.literal;
56770
+ let literal;
56771
+ if (isLiteralTypeNode(computedPropertyNameType)) {
56772
+ literal = computedPropertyNameType.literal;
56773
+ } else {
56774
+ const evaluated = evaluateEntityNameExpression(node.expression);
56775
+ const literalNode = typeof evaluated.value === "string" ? factory.createStringLiteral(
56776
+ evaluated.value,
56777
+ /*isSingleQuote*/
56778
+ void 0
56779
+ ) : typeof evaluated.value === "number" ? factory.createNumericLiteral(
56780
+ evaluated.value,
56781
+ /*numericLiteralFlags*/
56782
+ 0
56783
+ ) : void 0;
56784
+ if (!literalNode) {
56785
+ if (isImportTypeNode(computedPropertyNameType)) {
56786
+ trackComputedName(node.expression, context.enclosingDeclaration, context);
56787
+ }
56788
+ return node;
56789
+ }
56790
+ literal = literalNode;
56791
+ }
56709
56792
  if (literal.kind === 11 /* StringLiteral */ && isIdentifierText(literal.text, getEmitScriptTarget(compilerOptions))) {
56710
56793
  return factory.createIdentifier(literal.text);
56711
56794
  }
@@ -80207,7 +80290,7 @@ function createTypeChecker(host) {
80207
80290
  return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
80208
80291
  }
80209
80292
  function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
80210
- const hasDefaultOnly = isOnlyImportableAsDefault(moduleSpecifier);
80293
+ const hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
80211
80294
  if (hasDefaultOnly && type && !isErrorType(type)) {
80212
80295
  const synthType = type;
80213
80296
  if (!synthType.defaultOnlyType) {
@@ -85434,7 +85517,7 @@ function createTypeChecker(host) {
85434
85517
  });
85435
85518
  }
85436
85519
  function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
85437
- if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) >= 5 /* ES2015 */) {
85520
+ if (moduleKind >= 5 /* ES2015 */ && !(moduleKind >= 100 /* Node16 */ && getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
85438
85521
  return;
85439
85522
  }
85440
85523
  if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
@@ -86855,7 +86938,7 @@ function createTypeChecker(host) {
86855
86938
  }
86856
86939
  }
86857
86940
  function checkClassNameCollisionWithObject(name) {
86858
- if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) {
86941
+ if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(name).impliedNodeFormat === 1 /* CommonJS */)) {
86859
86942
  error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
86860
86943
  }
86861
86944
  }
@@ -87935,7 +88018,7 @@ function createTypeChecker(host) {
87935
88018
  getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
87936
88019
  }
87937
88020
  }
87938
- if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(node.parent) === 1 /* CommonJS */) {
88021
+ if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
87939
88022
  const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
87940
88023
  if (exportModifier) {
87941
88024
  error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
@@ -88155,10 +88238,8 @@ function createTypeChecker(host) {
88155
88238
  }
88156
88239
  }
88157
88240
  }
88158
- if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
88241
+ if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
88159
88242
  error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
88160
- } else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
88161
- error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
88162
88243
  }
88163
88244
  }
88164
88245
  if (isImportSpecifier(node)) {
@@ -88199,7 +88280,7 @@ function createTypeChecker(host) {
88199
88280
  checkAliasSymbol(node);
88200
88281
  if (node.kind === 276 /* ImportSpecifier */) {
88201
88282
  checkModuleExportName(node.propertyName);
88202
- if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88283
+ if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
88203
88284
  checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88204
88285
  }
88205
88286
  }
@@ -88221,7 +88302,7 @@ function createTypeChecker(host) {
88221
88302
  if (validForTypeAttributes && override) {
88222
88303
  return;
88223
88304
  }
88224
- const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier);
88305
+ const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
88225
88306
  if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
88226
88307
  const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
88227
88308
  return grammarErrorOnNode(node, message);
@@ -88254,7 +88335,7 @@ function createTypeChecker(host) {
88254
88335
  if (importClause.namedBindings) {
88255
88336
  if (importClause.namedBindings.kind === 274 /* NamespaceImport */) {
88256
88337
  checkImportBinding(importClause.namedBindings);
88257
- if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && getESModuleInterop(compilerOptions)) {
88338
+ if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && getESModuleInterop(compilerOptions)) {
88258
88339
  checkExternalEmitHelpers(node, 65536 /* ImportStar */);
88259
88340
  }
88260
88341
  } else {
@@ -88294,7 +88375,7 @@ function createTypeChecker(host) {
88294
88375
  grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
88295
88376
  }
88296
88377
  } else {
88297
- if (5 /* ES2015 */ <= moduleKind && moduleKind <= 99 /* ESNext */ && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
88378
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
88298
88379
  grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
88299
88380
  }
88300
88381
  }
@@ -88324,7 +88405,7 @@ function createTypeChecker(host) {
88324
88405
  checkAliasSymbol(node.exportClause);
88325
88406
  checkModuleExportName(node.exportClause.name);
88326
88407
  }
88327
- if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88408
+ if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
88328
88409
  if (node.exportClause) {
88329
88410
  if (getESModuleInterop(compilerOptions)) {
88330
88411
  checkExternalEmitHelpers(node, 65536 /* ImportStar */);
@@ -88383,7 +88464,7 @@ function createTypeChecker(host) {
88383
88464
  markLinkedReferences(node, 7 /* ExportSpecifier */);
88384
88465
  }
88385
88466
  } else {
88386
- if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && moduleExportNameIsDefault(node.propertyName || node.name)) {
88467
+ if (getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleExportNameIsDefault(node.propertyName || node.name)) {
88387
88468
  checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88388
88469
  }
88389
88470
  }
@@ -88409,7 +88490,7 @@ function createTypeChecker(host) {
88409
88490
  if (typeAnnotationNode) {
88410
88491
  checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
88411
88492
  }
88412
- const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */;
88493
+ const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
88413
88494
  if (node.expression.kind === 80 /* Identifier */) {
88414
88495
  const id = node.expression;
88415
88496
  const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
@@ -88489,7 +88570,7 @@ function createTypeChecker(host) {
88489
88570
  grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
88490
88571
  }
88491
88572
  if (node.isExportEquals) {
88492
- if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) !== 1 /* CommonJS */)) {
88573
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
88493
88574
  grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
88494
88575
  } else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
88495
88576
  grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
@@ -88550,6 +88631,9 @@ function createTypeChecker(host) {
88550
88631
  }
88551
88632
  }
88552
88633
  function checkSourceElementWorker(node) {
88634
+ if (getNodeCheckFlags(node) & 8388608 /* PartiallyTypeChecked */) {
88635
+ return;
88636
+ }
88553
88637
  if (canHaveJSDoc(node)) {
88554
88638
  forEach(node.jsDoc, ({ comment, tags }) => {
88555
88639
  checkJSDocCommentWorker(comment);
@@ -88893,19 +88977,21 @@ function createTypeChecker(host) {
88893
88977
  currentNode = saveCurrentNode;
88894
88978
  (_b = tracing) == null ? void 0 : _b.pop();
88895
88979
  }
88896
- function checkSourceFile(node) {
88980
+ function checkSourceFile(node, nodesToCheck) {
88897
88981
  var _a, _b;
88898
88982
  (_a = tracing) == null ? void 0 : _a.push(
88899
88983
  tracing.Phase.Check,
88900
- "checkSourceFile",
88984
+ nodesToCheck ? "checkSourceFileNodes" : "checkSourceFile",
88901
88985
  { path: node.path },
88902
88986
  /*separateBeginAndEnd*/
88903
88987
  true
88904
88988
  );
88905
- mark("beforeCheck");
88906
- checkSourceFileWorker(node);
88907
- mark("afterCheck");
88908
- measure("Check", "beforeCheck", "afterCheck");
88989
+ const beforeMark = nodesToCheck ? "beforeCheckNodes" : "beforeCheck";
88990
+ const afterMark = nodesToCheck ? "afterCheckNodes" : "afterCheck";
88991
+ mark(beforeMark);
88992
+ nodesToCheck ? checkSourceFileNodesWorker(node, nodesToCheck) : checkSourceFileWorker(node);
88993
+ mark(afterMark);
88994
+ measure("Check", beforeMark, afterMark);
88909
88995
  (_b = tracing) == null ? void 0 : _b.pop();
88910
88996
  }
88911
88997
  function unusedIsError(kind, isAmbient) {
@@ -88936,6 +89022,13 @@ function createTypeChecker(host) {
88936
89022
  clear(potentialWeakMapSetCollisions);
88937
89023
  clear(potentialReflectCollisions);
88938
89024
  clear(potentialUnusedRenamedBindingElementsInTypes);
89025
+ if (links.flags & 8388608 /* PartiallyTypeChecked */) {
89026
+ potentialThisCollisions = links.potentialThisCollisions;
89027
+ potentialNewTargetCollisions = links.potentialNewTargetCollisions;
89028
+ potentialWeakMapSetCollisions = links.potentialWeakMapSetCollisions;
89029
+ potentialReflectCollisions = links.potentialReflectCollisions;
89030
+ potentialUnusedRenamedBindingElementsInTypes = links.potentialUnusedRenamedBindingElementsInTypes;
89031
+ }
88939
89032
  forEach(node.statements, checkSourceElement);
88940
89033
  checkSourceElement(node.endOfFileToken);
88941
89034
  checkDeferredNodes(node);
@@ -88976,10 +89069,38 @@ function createTypeChecker(host) {
88976
89069
  links.flags |= 1 /* TypeChecked */;
88977
89070
  }
88978
89071
  }
88979
- function getDiagnostics2(sourceFile, ct) {
89072
+ function checkSourceFileNodesWorker(file, nodes) {
89073
+ const links = getNodeLinks(file);
89074
+ if (!(links.flags & 1 /* TypeChecked */)) {
89075
+ if (skipTypeChecking(file, compilerOptions, host)) {
89076
+ return;
89077
+ }
89078
+ checkGrammarSourceFile(file);
89079
+ clear(potentialThisCollisions);
89080
+ clear(potentialNewTargetCollisions);
89081
+ clear(potentialWeakMapSetCollisions);
89082
+ clear(potentialReflectCollisions);
89083
+ clear(potentialUnusedRenamedBindingElementsInTypes);
89084
+ forEach(nodes, checkSourceElement);
89085
+ checkDeferredNodes(file);
89086
+ (links.potentialThisCollisions || (links.potentialThisCollisions = [])).push(...potentialThisCollisions);
89087
+ (links.potentialNewTargetCollisions || (links.potentialNewTargetCollisions = [])).push(...potentialNewTargetCollisions);
89088
+ (links.potentialWeakMapSetCollisions || (links.potentialWeakMapSetCollisions = [])).push(...potentialWeakMapSetCollisions);
89089
+ (links.potentialReflectCollisions || (links.potentialReflectCollisions = [])).push(...potentialReflectCollisions);
89090
+ (links.potentialUnusedRenamedBindingElementsInTypes || (links.potentialUnusedRenamedBindingElementsInTypes = [])).push(
89091
+ ...potentialUnusedRenamedBindingElementsInTypes
89092
+ );
89093
+ links.flags |= 8388608 /* PartiallyTypeChecked */;
89094
+ for (const node of nodes) {
89095
+ const nodeLinks2 = getNodeLinks(node);
89096
+ nodeLinks2.flags |= 8388608 /* PartiallyTypeChecked */;
89097
+ }
89098
+ }
89099
+ }
89100
+ function getDiagnostics2(sourceFile, ct, nodesToCheck) {
88980
89101
  try {
88981
89102
  cancellationToken = ct;
88982
- return getDiagnosticsWorker(sourceFile);
89103
+ return getDiagnosticsWorker(sourceFile, nodesToCheck);
88983
89104
  } finally {
88984
89105
  cancellationToken = void 0;
88985
89106
  }
@@ -88990,20 +89111,23 @@ function createTypeChecker(host) {
88990
89111
  }
88991
89112
  deferredDiagnosticsCallbacks = [];
88992
89113
  }
88993
- function checkSourceFileWithEagerDiagnostics(sourceFile) {
89114
+ function checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck) {
88994
89115
  ensurePendingDiagnosticWorkComplete();
88995
89116
  const oldAddLazyDiagnostics = addLazyDiagnostic;
88996
89117
  addLazyDiagnostic = (cb) => cb();
88997
- checkSourceFile(sourceFile);
89118
+ checkSourceFile(sourceFile, nodesToCheck);
88998
89119
  addLazyDiagnostic = oldAddLazyDiagnostics;
88999
89120
  }
89000
- function getDiagnosticsWorker(sourceFile) {
89121
+ function getDiagnosticsWorker(sourceFile, nodesToCheck) {
89001
89122
  if (sourceFile) {
89002
89123
  ensurePendingDiagnosticWorkComplete();
89003
89124
  const previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
89004
89125
  const previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;
89005
- checkSourceFileWithEagerDiagnostics(sourceFile);
89126
+ checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck);
89006
89127
  const semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
89128
+ if (nodesToCheck) {
89129
+ return semanticDiagnostics;
89130
+ }
89007
89131
  const currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
89008
89132
  if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {
89009
89133
  const deferredGlobalDiagnostics = relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, compareDiagnostics);
@@ -89013,7 +89137,7 @@ function createTypeChecker(host) {
89013
89137
  }
89014
89138
  return semanticDiagnostics;
89015
89139
  }
89016
- forEach(host.getSourceFiles(), checkSourceFileWithEagerDiagnostics);
89140
+ forEach(host.getSourceFiles(), (file) => checkSourceFileWithEagerDiagnostics(file));
89017
89141
  return diagnostics.getDiagnostics();
89018
89142
  }
89019
89143
  function getGlobalDiagnostics() {
@@ -90992,7 +91116,7 @@ function createTypeChecker(host) {
90992
91116
  break;
90993
91117
  case 95 /* ExportKeyword */:
90994
91118
  if (compilerOptions.verbatimModuleSyntax && !(node.flags & 33554432 /* Ambient */) && node.kind !== 265 /* TypeAliasDeclaration */ && node.kind !== 264 /* InterfaceDeclaration */ && // ModuleDeclaration needs to be checked that it is uninstantiated later
90995
- node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
91119
+ node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
90996
91120
  return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
90997
91121
  }
90998
91122
  if (flags & 32 /* Export */) {
@@ -91901,7 +92025,7 @@ function createTypeChecker(host) {
91901
92025
  const message = node.initializer ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
91902
92026
  return grammarErrorOnNode(node.exclamationToken, message);
91903
92027
  }
91904
- if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
92028
+ if ((moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleKind !== 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
91905
92029
  checkESModuleMarker(node.name);
91906
92030
  }
91907
92031
  return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
@@ -92402,9 +92526,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
92402
92526
  isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
92403
92527
  fileExists: (fileName) => host.fileExists(fileName),
92404
92528
  getFileIncludeReasons: () => host.getFileIncludeReasons(),
92405
- readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0,
92406
- getDefaultResolutionModeForFile: (file) => host.getDefaultResolutionModeForFile(file),
92407
- getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index)
92529
+ readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
92408
92530
  };
92409
92531
  }
92410
92532
  var SymbolTrackerImpl = class _SymbolTrackerImpl {
@@ -112259,7 +112381,7 @@ function transformModule(context) {
112259
112381
  case 354 /* PartiallyEmittedExpression */:
112260
112382
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
112261
112383
  case 213 /* CallExpression */:
112262
- if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
112384
+ if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) {
112263
112385
  return visitImportCallExpression(node);
112264
112386
  }
112265
112387
  break;
@@ -115255,8 +115377,8 @@ function transformECMAScriptModule(context) {
115255
115377
  }
115256
115378
  }
115257
115379
 
115258
- // src/compiler/transformers/module/impliedNodeFormatDependent.ts
115259
- function transformImpliedNodeFormatDependentModule(context) {
115380
+ // src/compiler/transformers/module/node.ts
115381
+ function transformNodeModule(context) {
115260
115382
  const previousOnSubstituteNode = context.onSubstituteNode;
115261
115383
  const previousOnEmitNode = context.onEmitNode;
115262
115384
  const esmTransform = transformECMAScriptModule(context);
@@ -115267,7 +115389,6 @@ function transformImpliedNodeFormatDependentModule(context) {
115267
115389
  const cjsTransform = transformModule(context);
115268
115390
  const cjsOnSubstituteNode = context.onSubstituteNode;
115269
115391
  const cjsOnEmitNode = context.onEmitNode;
115270
- const getEmitModuleFormatOfFile2 = (file) => context.getEmitHost().getEmitModuleFormatOfFile(file);
115271
115392
  context.onSubstituteNode = onSubstituteNode;
115272
115393
  context.onEmitNode = onEmitNode;
115273
115394
  context.enableSubstitution(307 /* SourceFile */);
@@ -115282,7 +115403,7 @@ function transformImpliedNodeFormatDependentModule(context) {
115282
115403
  if (!currentSourceFile) {
115283
115404
  return previousOnSubstituteNode(hint, node);
115284
115405
  }
115285
- if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
115406
+ if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
115286
115407
  return esmOnSubstituteNode(hint, node);
115287
115408
  }
115288
115409
  return cjsOnSubstituteNode(hint, node);
@@ -115295,13 +115416,13 @@ function transformImpliedNodeFormatDependentModule(context) {
115295
115416
  if (!currentSourceFile) {
115296
115417
  return previousOnEmitNode(hint, node, emitCallback);
115297
115418
  }
115298
- if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
115419
+ if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
115299
115420
  return esmOnEmitNode(hint, node, emitCallback);
115300
115421
  }
115301
115422
  return cjsOnEmitNode(hint, node, emitCallback);
115302
115423
  }
115303
115424
  function getModuleTransformForFile(file) {
115304
- return getEmitModuleFormatOfFile2(file) >= 5 /* ES2015 */ ? esmTransform : cjsTransform;
115425
+ return file.impliedNodeFormat === 99 /* ESNext */ ? esmTransform : cjsTransform;
115305
115426
  }
115306
115427
  function transformSourceFile(node) {
115307
115428
  if (node.isDeclarationFile) {
@@ -117423,18 +117544,17 @@ function isProcessedComponent(node) {
117423
117544
  // src/compiler/transformer.ts
117424
117545
  function getModuleTransformer(moduleKind) {
117425
117546
  switch (moduleKind) {
117426
- case 200 /* Preserve */:
117427
- return transformECMAScriptModule;
117428
117547
  case 99 /* ESNext */:
117429
117548
  case 7 /* ES2022 */:
117430
117549
  case 6 /* ES2020 */:
117431
117550
  case 5 /* ES2015 */:
117432
- case 100 /* Node16 */:
117433
- case 199 /* NodeNext */:
117434
- case 1 /* CommonJS */:
117435
- return transformImpliedNodeFormatDependentModule;
117551
+ case 200 /* Preserve */:
117552
+ return transformECMAScriptModule;
117436
117553
  case 4 /* System */:
117437
117554
  return transformSystemModule;
117555
+ case 100 /* Node16 */:
117556
+ case 199 /* NodeNext */:
117557
+ return transformNodeModule;
117438
117558
  default:
117439
117559
  return transformModule;
117440
117560
  }
@@ -118162,7 +118282,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118162
118282
  newLine: compilerOptions.newLine,
118163
118283
  noEmitHelpers: compilerOptions.noEmitHelpers,
118164
118284
  module: getEmitModuleKind(compilerOptions),
118165
- moduleResolution: getEmitModuleResolutionKind(compilerOptions),
118166
118285
  target: getEmitScriptTarget(compilerOptions),
118167
118286
  sourceMap: compilerOptions.sourceMap,
118168
118287
  inlineSourceMap: compilerOptions.inlineSourceMap,
@@ -118225,7 +118344,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118225
118344
  newLine: compilerOptions.newLine,
118226
118345
  noEmitHelpers: true,
118227
118346
  module: compilerOptions.module,
118228
- moduleResolution: compilerOptions.moduleResolution,
118229
118347
  target: compilerOptions.target,
118230
118348
  sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
118231
118349
  inlineSourceMap: compilerOptions.inlineSourceMap,
@@ -118241,7 +118359,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118241
118359
  isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
118242
118360
  substituteNode: declarationTransform.substituteNode
118243
118361
  });
118244
- printSourceFileOrBundle(
118362
+ const dtsWritten = printSourceFileOrBundle(
118245
118363
  declarationFilePath,
118246
118364
  declarationMapPath,
118247
118365
  declarationTransform,
@@ -118255,7 +118373,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118255
118373
  }
118256
118374
  );
118257
118375
  if (emittedFilesList) {
118258
- emittedFilesList.push(declarationFilePath);
118376
+ if (dtsWritten) emittedFilesList.push(declarationFilePath);
118259
118377
  if (declarationMapPath) {
118260
118378
  emittedFilesList.push(declarationMapPath);
118261
118379
  }
@@ -118346,8 +118464,10 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118346
118464
  writer.writeLine();
118347
118465
  }
118348
118466
  const text = writer.getText();
118349
- writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos, diagnostics: transform2.diagnostics });
118467
+ const data = { sourceMapUrlPos, diagnostics: transform2.diagnostics };
118468
+ writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
118350
118469
  writer.clear();
118470
+ return !data.skippedDtsWrite;
118351
118471
  }
118352
118472
  function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
118353
118473
  return (mapOptions.sourceMap || mapOptions.inlineSourceMap) && (sourceFileOrBundle.kind !== 307 /* SourceFile */ || !fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
@@ -123734,6 +123854,7 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
123734
123854
  return getModeForUsageLocationWorker(file, usage, compilerOptions);
123735
123855
  }
123736
123856
  function getModeForUsageLocationWorker(file, usage, compilerOptions) {
123857
+ var _a;
123737
123858
  if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
123738
123859
  const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
123739
123860
  if (isTypeOnly) {
@@ -123749,28 +123870,19 @@ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
123749
123870
  return override;
123750
123871
  }
123751
123872
  }
123752
- if (compilerOptions && importSyntaxAffectsModuleResolution(compilerOptions)) {
123753
- return getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions);
123873
+ if (compilerOptions && getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
123874
+ return usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(
123875
+ usage.parent,
123876
+ /*requireStringLiteralLikeArgument*/
123877
+ false
123878
+ ) ? 1 /* CommonJS */ : 99 /* ESNext */;
123754
123879
  }
123755
- }
123756
- function getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions) {
123757
- var _a;
123758
- if (!compilerOptions) {
123759
- return void 0;
123880
+ if (file.impliedNodeFormat === void 0) return void 0;
123881
+ if (file.impliedNodeFormat !== 99 /* ESNext */) {
123882
+ return isImportCall(walkUpParenthesizedExpressions(usage.parent)) ? 99 /* ESNext */ : 1 /* CommonJS */;
123760
123883
  }
123761
123884
  const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
123762
- if (exprParentParent && isImportEqualsDeclaration(exprParentParent) || isRequireCall(
123763
- usage.parent,
123764
- /*requireStringLiteralLikeArgument*/
123765
- false
123766
- )) {
123767
- return 1 /* CommonJS */;
123768
- }
123769
- if (isImportCall(walkUpParenthesizedExpressions(usage.parent))) {
123770
- return shouldTransformImportCallWorker(file, compilerOptions) ? 1 /* CommonJS */ : 99 /* ESNext */;
123771
- }
123772
- const fileEmitMode = getEmitModuleFormatOfFileWorker(file, compilerOptions);
123773
- return fileEmitMode === 1 /* CommonJS */ ? 1 /* CommonJS */ : emitModuleKindIsNonNodeESM(fileEmitMode) || fileEmitMode === 200 /* Preserve */ ? 99 /* ESNext */ : void 0;
123885
+ return exprParentParent && isImportEqualsDeclaration(exprParentParent) ? 1 /* CommonJS */ : 99 /* ESNext */;
123774
123886
  }
123775
123887
  function getResolutionModeOverride(node, grammarErrorOnNode) {
123776
123888
  if (!node) return void 0;
@@ -123827,7 +123939,7 @@ function getTypeReferenceResolutionName(entry) {
123827
123939
  }
123828
123940
  var typeReferenceResolutionNameAndModeGetter = {
123829
123941
  getName: getTypeReferenceResolutionName,
123830
- getMode: (entry, file, compilerOptions) => getModeForFileReference(entry, file && getDefaultResolutionModeForFileWorker(file, compilerOptions))
123942
+ getMode: (entry, file) => getModeForFileReference(entry, file == null ? void 0 : file.impliedNodeFormat)
123831
123943
  };
123832
123944
  function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
123833
123945
  return {
@@ -124466,7 +124578,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124466
124578
  isSourceFileFromExternalLibrary,
124467
124579
  isSourceFileDefaultLibrary,
124468
124580
  getModeForUsageLocation: getModeForUsageLocation2,
124469
- getEmitSyntaxForUsageLocation,
124470
124581
  getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
124471
124582
  getSourceFileFromReference,
124472
124583
  getLibFileFromReference,
@@ -124495,11 +124606,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124495
124606
  forEachResolvedProjectReference: forEachResolvedProjectReference2,
124496
124607
  isSourceOfProjectReferenceRedirect,
124497
124608
  getRedirectReferenceForResolutionFromSourceOfProject,
124498
- getCompilerOptionsForFile,
124499
- getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
124500
- getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
124501
- getImpliedNodeFormatForEmit: getImpliedNodeFormatForEmit2,
124502
- shouldTransformImportCall,
124503
124609
  emitBuildInfo,
124504
124610
  fileExists,
124505
124611
  readFile,
@@ -125082,10 +125188,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125082
125188
  getSymlinkCache,
125083
125189
  writeFile: writeFileCallback || writeFile2,
125084
125190
  isEmitBlocked,
125085
- shouldTransformImportCall,
125086
- getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
125087
- getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
125088
- getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
125089
125191
  readFile: (f) => host.readFile(f),
125090
125192
  fileExists: (f) => {
125091
125193
  const path = toPath3(f);
@@ -125243,15 +125345,24 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125243
125345
  function getSyntacticDiagnostics(sourceFile, cancellationToken) {
125244
125346
  return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken);
125245
125347
  }
125246
- function getSemanticDiagnostics(sourceFile, cancellationToken) {
125247
- return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken);
125348
+ function getSemanticDiagnostics(sourceFile, cancellationToken, nodesToCheck) {
125349
+ return getDiagnosticsHelper(
125350
+ sourceFile,
125351
+ (sourceFile2, cancellationToken2) => getSemanticDiagnosticsForFile(sourceFile2, cancellationToken2, nodesToCheck),
125352
+ cancellationToken
125353
+ );
125248
125354
  }
125249
125355
  function getCachedSemanticDiagnostics(sourceFile) {
125250
125356
  var _a2;
125251
125357
  return sourceFile ? (_a2 = cachedBindAndCheckDiagnosticsForFile.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics;
125252
125358
  }
125253
125359
  function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
125254
- return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken);
125360
+ return getBindAndCheckDiagnosticsForFile(
125361
+ sourceFile,
125362
+ cancellationToken,
125363
+ /*nodesToCheck*/
125364
+ void 0
125365
+ );
125255
125366
  }
125256
125367
  function getProgramDiagnostics(sourceFile) {
125257
125368
  var _a2;
@@ -125291,16 +125402,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125291
125402
  throw e;
125292
125403
  }
125293
125404
  }
125294
- function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) {
125405
+ function getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
125295
125406
  return concatenate(
125296
- filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken), options),
125407
+ filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), options),
125297
125408
  getProgramDiagnostics(sourceFile)
125298
125409
  );
125299
125410
  }
125300
- function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken) {
125411
+ function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
125412
+ if (nodesToCheck) {
125413
+ return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck);
125414
+ }
125301
125415
  return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache);
125302
125416
  }
125303
- function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
125417
+ function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck) {
125304
125418
  return runWithCancellationToken(() => {
125305
125419
  if (skipTypeChecking(sourceFile, options, program)) {
125306
125420
  return emptyArray;
@@ -125308,24 +125422,34 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125308
125422
  const typeChecker2 = getTypeChecker();
125309
125423
  Debug.assert(!!sourceFile.bindDiagnostics);
125310
125424
  const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
125311
- const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
125312
125425
  const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
125426
+ const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
125313
125427
  let bindDiagnostics = sourceFile.bindDiagnostics;
125314
- let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken);
125428
+ let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken, nodesToCheck);
125315
125429
  if (isPlainJs) {
125316
125430
  bindDiagnostics = filter(bindDiagnostics, (d) => plainJSErrors.has(d.code));
125317
125431
  checkDiagnostics = filter(checkDiagnostics, (d) => plainJSErrors.has(d.code));
125318
125432
  }
125319
- return getMergedBindAndCheckDiagnostics(sourceFile, !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : void 0);
125433
+ return getMergedBindAndCheckDiagnostics(
125434
+ sourceFile,
125435
+ !isPlainJs,
125436
+ !!nodesToCheck,
125437
+ bindDiagnostics,
125438
+ checkDiagnostics,
125439
+ isCheckJs ? sourceFile.jsDocDiagnostics : void 0
125440
+ );
125320
125441
  });
125321
125442
  }
125322
- function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, ...allDiagnostics) {
125443
+ function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, partialCheck, ...allDiagnostics) {
125323
125444
  var _a2;
125324
125445
  const flatDiagnostics = flatten(allDiagnostics);
125325
125446
  if (!includeBindAndCheckDiagnostics || !((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
125326
125447
  return flatDiagnostics;
125327
125448
  }
125328
125449
  const { diagnostics, directives } = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics);
125450
+ if (partialCheck) {
125451
+ return diagnostics;
125452
+ }
125329
125453
  for (const errorExpectation of directives.getUnusedExpectations()) {
125330
125454
  diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive));
125331
125455
  }
@@ -126146,14 +126270,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126146
126270
  const resolvedTypeReferenceDirective = resolutions[index];
126147
126271
  const fileName = ref.fileName;
126148
126272
  resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
126149
- const mode = ref.resolutionMode || getDefaultResolutionModeForFile2(file);
126273
+ const mode = ref.resolutionMode || file.impliedNodeFormat;
126150
126274
  processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
126151
126275
  }
126152
126276
  }
126153
- function getCompilerOptionsForFile(file) {
126154
- var _a2;
126155
- return ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
126156
- }
126157
126277
  function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
126158
126278
  var _a2, _b2;
126159
126279
  (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 });
@@ -126254,12 +126374,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126254
126374
  return host.getCanonicalFileName(fileName);
126255
126375
  }
126256
126376
  function processImportedModules(file) {
126377
+ var _a2;
126257
126378
  collectExternalModuleReferences(file);
126258
126379
  if (file.imports.length || file.moduleAugmentations.length) {
126259
126380
  const moduleNames = getModuleNames(file);
126260
126381
  const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
126261
126382
  Debug.assert(resolutions.length === moduleNames.length);
126262
- const optionsForFile = getCompilerOptionsForFile(file);
126383
+ const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
126263
126384
  const resolutionsInFile = createModeAwareCache();
126264
126385
  (resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
126265
126386
  for (let index = 0; index < moduleNames.length; index++) {
@@ -126815,7 +126936,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126815
126936
  redirectInfo = cachedChain.redirectInfo;
126816
126937
  } else {
126817
126938
  reasons == null ? void 0 : reasons.forEach(processReason);
126818
- redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
126939
+ redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
126819
126940
  }
126820
126941
  if (fileProcessingReason) processReason(fileProcessingReason);
126821
126942
  const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
@@ -127173,53 +127294,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127173
127294
  return symlinks;
127174
127295
  }
127175
127296
  function getModeForUsageLocation2(file, usage) {
127176
- return getModeForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
127177
- }
127178
- function getEmitSyntaxForUsageLocation(file, usage) {
127179
- return getEmitSyntaxForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
127297
+ var _a2;
127298
+ const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
127299
+ return getModeForUsageLocationWorker(file, usage, optionsForFile);
127180
127300
  }
127181
127301
  function getModeForResolutionAtIndex2(file, index) {
127182
127302
  return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
127183
127303
  }
127184
- function getDefaultResolutionModeForFile2(sourceFile) {
127185
- return getDefaultResolutionModeForFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
127186
- }
127187
- function getImpliedNodeFormatForEmit2(sourceFile) {
127188
- return getImpliedNodeFormatForEmitWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
127189
- }
127190
- function getEmitModuleFormatOfFile2(sourceFile) {
127191
- return getEmitModuleFormatOfFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
127192
- }
127193
- function shouldTransformImportCall(sourceFile) {
127194
- return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
127195
- }
127196
- }
127197
- function shouldTransformImportCallWorker(sourceFile, options) {
127198
- const moduleKind = getEmitModuleKind(options);
127199
- if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */) {
127200
- return false;
127201
- }
127202
- return getEmitModuleFormatOfFileWorker(sourceFile, options) < 5 /* ES2015 */;
127203
- }
127204
- function getEmitModuleFormatOfFileWorker(sourceFile, options) {
127205
- return getImpliedNodeFormatForEmitWorker(sourceFile, options) ?? getEmitModuleKind(options);
127206
- }
127207
- function getImpliedNodeFormatForEmitWorker(sourceFile, options) {
127208
- var _a, _b;
127209
- const moduleKind = getEmitModuleKind(options);
127210
- if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
127211
- return sourceFile.impliedNodeFormat;
127212
- }
127213
- if (sourceFile.impliedNodeFormat === 1 /* CommonJS */ && (((_a = sourceFile.packageJsonScope) == null ? void 0 : _a.contents.packageJsonContent.type) === "commonjs" || fileExtensionIsOneOf(sourceFile.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) {
127214
- return 1 /* CommonJS */;
127215
- }
127216
- if (sourceFile.impliedNodeFormat === 99 /* ESNext */ && (((_b = sourceFile.packageJsonScope) == null ? void 0 : _b.contents.packageJsonContent.type) === "module" || fileExtensionIsOneOf(sourceFile.fileName, [".mjs" /* Mjs */, ".mts" /* Mts */]))) {
127217
- return 99 /* ESNext */;
127218
- }
127219
- return void 0;
127220
- }
127221
- function getDefaultResolutionModeForFileWorker(sourceFile, options) {
127222
- return importSyntaxAffectsModuleResolution(options) ? getImpliedNodeFormatForEmitWorker(sourceFile, options) : void 0;
127223
127304
  }
127224
127305
  function updateHostForUseSourceOfProjectReferenceRedirect(host) {
127225
127306
  let setOfDeclarationDirectories;
@@ -127903,6 +127984,7 @@ function createBuilderProgramState(newProgram, oldState) {
127903
127984
  canCopySemanticDiagnostics = false;
127904
127985
  canCopyEmitDiagnostics = false;
127905
127986
  }
127987
+ state.hasErrorsFromOldState = oldState.hasErrors;
127906
127988
  } else {
127907
127989
  state.buildInfoEmitPending = isIncrementalCompilation(compilerOptions);
127908
127990
  }
@@ -128062,40 +128144,6 @@ function releaseCache(state) {
128062
128144
  BuilderState.releaseCache(state);
128063
128145
  state.program = void 0;
128064
128146
  }
128065
- function backupBuilderProgramEmitState(state) {
128066
- const outFilePath = state.compilerOptions.outFile;
128067
- Debug.assert(!state.changedFilesSet.size || outFilePath);
128068
- return {
128069
- affectedFilesPendingEmit: state.affectedFilesPendingEmit && new Map(state.affectedFilesPendingEmit),
128070
- seenEmittedFiles: state.seenEmittedFiles && new Map(state.seenEmittedFiles),
128071
- seenProgramEmit: state.seenProgramEmit,
128072
- programEmitPending: state.programEmitPending,
128073
- emitSignatures: state.emitSignatures && new Map(state.emitSignatures),
128074
- outSignature: state.outSignature,
128075
- latestChangedDtsFile: state.latestChangedDtsFile,
128076
- hasChangedEmitSignature: state.hasChangedEmitSignature,
128077
- changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0,
128078
- buildInfoEmitPending: state.buildInfoEmitPending,
128079
- emitDiagnosticsPerFile: state.emitDiagnosticsPerFile && new Map(state.emitDiagnosticsPerFile)
128080
- };
128081
- }
128082
- function restoreBuilderProgramEmitState(state, savedEmitState) {
128083
- state.affectedFilesPendingEmit = savedEmitState.affectedFilesPendingEmit;
128084
- state.seenEmittedFiles = savedEmitState.seenEmittedFiles;
128085
- state.seenProgramEmit = savedEmitState.seenProgramEmit;
128086
- state.programEmitPending = savedEmitState.programEmitPending;
128087
- state.emitSignatures = savedEmitState.emitSignatures;
128088
- state.outSignature = savedEmitState.outSignature;
128089
- state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
128090
- state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
128091
- state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
128092
- state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
128093
- if (savedEmitState.changedFilesSet) state.changedFilesSet = savedEmitState.changedFilesSet;
128094
- if (state.compilerOptions.outFile && state.changedFilesSet.size) {
128095
- state.semanticDiagnosticsPerFile.clear();
128096
- state.emitDiagnosticsPerFile = void 0;
128097
- }
128098
- }
128099
128147
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
128100
128148
  Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
128101
128149
  }
@@ -128377,6 +128425,7 @@ function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationTok
128377
128425
  }
128378
128426
  const diagnostics = state.program.getBindAndCheckDiagnostics(sourceFile, cancellationToken);
128379
128427
  semanticDiagnosticsPerFile.set(path, diagnostics);
128428
+ state.buildInfoEmitPending = true;
128380
128429
  return filterSemanticDiagnostics(diagnostics, state.compilerOptions);
128381
128430
  }
128382
128431
  function isIncrementalBundleEmitBuildInfo(info) {
@@ -128386,6 +128435,35 @@ function isIncrementalBundleEmitBuildInfo(info) {
128386
128435
  function isIncrementalBuildInfo(info) {
128387
128436
  return !!info.fileNames;
128388
128437
  }
128438
+ function isNonIncrementalBuildInfo(info) {
128439
+ return !isIncrementalBuildInfo(info) && !!info.root;
128440
+ }
128441
+ function ensureHasErrorsForState(state) {
128442
+ if (state.hasErrors !== void 0) return;
128443
+ if (isIncrementalCompilation(state.compilerOptions)) {
128444
+ state.hasErrors = !some(state.program.getSourceFiles(), (f) => {
128445
+ var _a, _b;
128446
+ const bindAndCheckDiagnostics = state.semanticDiagnosticsPerFile.get(f.resolvedPath);
128447
+ return bindAndCheckDiagnostics === void 0 || // Missing semantic diagnostics in cache will be encoded in buildInfo
128448
+ !!bindAndCheckDiagnostics.length || // cached semantic diagnostics will be encoded in buildInfo
128449
+ !!((_b = (_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.get(f.resolvedPath)) == null ? void 0 : _b.length);
128450
+ }) && (hasSyntaxOrGlobalErrors(state) || some(state.program.getSourceFiles(), (f) => !!state.program.getProgramDiagnostics(f).length));
128451
+ } else {
128452
+ state.hasErrors = some(state.program.getSourceFiles(), (f) => {
128453
+ var _a, _b;
128454
+ const bindAndCheckDiagnostics = state.semanticDiagnosticsPerFile.get(f.resolvedPath);
128455
+ return !!(bindAndCheckDiagnostics == null ? void 0 : bindAndCheckDiagnostics.length) || // If has semantic diagnostics
128456
+ !!((_b = (_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.get(f.resolvedPath)) == null ? void 0 : _b.length);
128457
+ }) || hasSyntaxOrGlobalErrors(state);
128458
+ }
128459
+ }
128460
+ function hasSyntaxOrGlobalErrors(state) {
128461
+ return !!state.program.getConfigFileParsingDiagnostics().length || !!state.program.getSyntacticDiagnostics().length || !!state.program.getOptionsDiagnostics().length || !!state.program.getGlobalDiagnostics().length;
128462
+ }
128463
+ function getBuildInfoEmitPending(state) {
128464
+ ensureHasErrorsForState(state);
128465
+ return state.buildInfoEmitPending ?? (state.buildInfoEmitPending = !!state.hasErrorsFromOldState !== !!state.hasErrors);
128466
+ }
128389
128467
  function getBuildInfo2(state) {
128390
128468
  var _a, _b;
128391
128469
  const currentDirectory = state.program.getCurrentDirectory();
@@ -128394,7 +128472,15 @@ function getBuildInfo2(state) {
128394
128472
  const fileNames = [];
128395
128473
  const fileNameToFileId = /* @__PURE__ */ new Map();
128396
128474
  const rootFileNames = new Set(state.program.getRootFileNames().map((f) => toPath(f, currentDirectory, state.program.getCanonicalFileName)));
128397
- if (!isIncrementalCompilation(state.compilerOptions)) return { version };
128475
+ ensureHasErrorsForState(state);
128476
+ if (!isIncrementalCompilation(state.compilerOptions)) {
128477
+ const buildInfo2 = {
128478
+ root: arrayFrom(rootFileNames, (r) => relativeToBuildInfo(r)),
128479
+ errors: state.hasErrors ? true : void 0,
128480
+ version
128481
+ };
128482
+ return buildInfo2;
128483
+ }
128398
128484
  const root = [];
128399
128485
  if (state.compilerOptions.outFile) {
128400
128486
  const fileInfos2 = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
@@ -128410,7 +128496,6 @@ function getBuildInfo2(state) {
128410
128496
  options: toIncrementalBuildInfoCompilerOptions(state.compilerOptions),
128411
128497
  semanticDiagnosticsPerFile: toIncrementalBuildInfoDiagnostics(),
128412
128498
  emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
128413
- changeFileSet: toChangeFileSet(),
128414
128499
  outSignature: state.outSignature,
128415
128500
  latestChangedDtsFile,
128416
128501
  pendingEmit: !state.programEmitPending ? void 0 : (
@@ -128421,6 +128506,7 @@ function getBuildInfo2(state) {
128421
128506
  )
128422
128507
  ),
128423
128508
  // Actual value
128509
+ errors: state.hasErrors ? true : void 0,
128424
128510
  version
128425
128511
  };
128426
128512
  return buildInfo2;
@@ -128513,9 +128599,9 @@ function getBuildInfo2(state) {
128513
128599
  semanticDiagnosticsPerFile,
128514
128600
  emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
128515
128601
  affectedFilesPendingEmit,
128516
- changeFileSet: toChangeFileSet(),
128517
128602
  emitSignatures,
128518
128603
  latestChangedDtsFile,
128604
+ errors: state.hasErrors ? true : void 0,
128519
128605
  version
128520
128606
  };
128521
128607
  return buildInfo;
@@ -128599,7 +128685,7 @@ function getBuildInfo2(state) {
128599
128685
  state.fileInfos.forEach((_value, key) => {
128600
128686
  const value = state.semanticDiagnosticsPerFile.get(key);
128601
128687
  if (!value) {
128602
- if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
128688
+ result = append(result, toFileId(key));
128603
128689
  } else if (value.length) {
128604
128690
  result = append(result, [
128605
128691
  toFileId(key),
@@ -128666,15 +128752,6 @@ function getBuildInfo2(state) {
128666
128752
  return result;
128667
128753
  }) || array;
128668
128754
  }
128669
- function toChangeFileSet() {
128670
- let changeFileSet;
128671
- if (state.changedFilesSet.size) {
128672
- for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
128673
- changeFileSet = append(changeFileSet, toFileId(path));
128674
- }
128675
- }
128676
- return changeFileSet;
128677
- }
128678
128755
  }
128679
128756
  var BuilderProgramKind = /* @__PURE__ */ ((BuilderProgramKind2) => {
128680
128757
  BuilderProgramKind2[BuilderProgramKind2["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram";
@@ -128751,8 +128828,6 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128751
128828
  oldState = void 0;
128752
128829
  const builderProgram = createRedirectedBuilderProgram(state, configFileParsingDiagnostics);
128753
128830
  builderProgram.state = state;
128754
- builderProgram.saveEmitState = () => backupBuilderProgramEmitState(state);
128755
- builderProgram.restoreEmitState = (saved) => restoreBuilderProgramEmitState(state, saved);
128756
128831
  builderProgram.hasChangedEmitSignature = () => !!state.hasChangedEmitSignature;
128757
128832
  builderProgram.getAllDependencies = (sourceFile) => BuilderState.getAllDependencies(
128758
128833
  state,
@@ -128774,7 +128849,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128774
128849
  return builderProgram;
128775
128850
  function emitBuildInfo(writeFile2, cancellationToken) {
128776
128851
  Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
128777
- if (state.buildInfoEmitPending) {
128852
+ if (getBuildInfoEmitPending(state)) {
128778
128853
  const result = state.program.emitBuildInfo(
128779
128854
  writeFile2 || maybeBind(host, host.writeFile),
128780
128855
  cancellationToken
@@ -128825,7 +128900,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128825
128900
  }
128826
128901
  }
128827
128902
  if (!affected) {
128828
- if (!state.buildInfoEmitPending) return void 0;
128903
+ if (!getBuildInfoEmitPending(state)) return void 0;
128829
128904
  const affected2 = state.program;
128830
128905
  const result2 = affected2.emitBuildInfo(
128831
128906
  writeFile2 || maybeBind(host, host.writeFile),
@@ -128913,7 +128988,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128913
128988
  if (state.compilerOptions.composite) {
128914
128989
  const filePath = sourceFiles[0].resolvedPath;
128915
128990
  emitSignature = handleNewSignature((_c = state.emitSignatures) == null ? void 0 : _c.get(filePath), emitSignature);
128916
- if (!emitSignature) return;
128991
+ if (!emitSignature) return data.skippedDtsWrite = true;
128917
128992
  (state.emitSignatures ?? (state.emitSignatures = /* @__PURE__ */ new Map())).set(filePath, emitSignature);
128918
128993
  }
128919
128994
  } else if (state.compilerOptions.composite) {
@@ -128922,7 +128997,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128922
128997
  /*newSignature*/
128923
128998
  void 0
128924
128999
  );
128925
- if (!newSignature) return;
129000
+ if (!newSignature) return data.skippedDtsWrite = true;
128926
129001
  state.outSignature = newSignature;
128927
129002
  }
128928
129003
  }
@@ -129067,7 +129142,6 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
129067
129142
  let filePathsSetList;
129068
129143
  const latestChangedDtsFile = buildInfo.latestChangedDtsFile ? toAbsolutePath(buildInfo.latestChangedDtsFile) : void 0;
129069
129144
  const fileInfos = /* @__PURE__ */ new Map();
129070
- const changedFilesSet = new Set(map(buildInfo.changeFileSet, toFilePath));
129071
129145
  if (isIncrementalBundleEmitBuildInfo(buildInfo)) {
129072
129146
  buildInfo.fileInfos.forEach((fileInfo, index) => {
129073
129147
  const path = toFilePath(index + 1);
@@ -129079,10 +129153,10 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
129079
129153
  semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
129080
129154
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
129081
129155
  hasReusableDiagnostic: true,
129082
- changedFilesSet,
129083
129156
  latestChangedDtsFile,
129084
129157
  outSignature: buildInfo.outSignature,
129085
- programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options)
129158
+ programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options),
129159
+ hasErrors: buildInfo.errors
129086
129160
  };
129087
129161
  } else {
129088
129162
  filePathsSetList = (_b = buildInfo.fileIdsList) == null ? void 0 : _b.map((fileIds) => new Set(fileIds.map(toFilePath)));
@@ -129115,15 +129189,13 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
129115
129189
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
129116
129190
  hasReusableDiagnostic: true,
129117
129191
  affectedFilesPendingEmit: buildInfo.affectedFilesPendingEmit && arrayToMap(buildInfo.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
129118
- changedFilesSet,
129119
129192
  latestChangedDtsFile,
129120
- emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0
129193
+ emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0,
129194
+ hasErrors: buildInfo.errors
129121
129195
  };
129122
129196
  }
129123
129197
  return {
129124
129198
  state,
129125
- saveEmitState: noop,
129126
- restoreEmitState: noop,
129127
129199
  getProgram: notImplemented,
129128
129200
  getProgramOrUndefined: returnUndefined,
129129
129201
  releaseProgram: noop,
@@ -129167,7 +129239,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
129167
129239
  const semanticDiagnostics = new Map(
129168
129240
  mapDefinedIterator(
129169
129241
  fileInfos.keys(),
129170
- (key) => !changedFilesSet.has(key) ? [key, emptyArray] : void 0
129242
+ (key) => [key, emptyArray]
129171
129243
  )
129172
129244
  );
129173
129245
  diagnostics == null ? void 0 : diagnostics.forEach((value) => {
@@ -129215,11 +129287,15 @@ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
129215
129287
  }
129216
129288
  }
129217
129289
  }
129290
+ function getNonIncrementalBuildInfoRoots(buildInfo, buildInfoPath, host) {
129291
+ if (!isNonIncrementalBuildInfo(buildInfo)) return void 0;
129292
+ const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
129293
+ const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
129294
+ return buildInfo.root.map((r) => toPath(r, buildInfoDirectory, getCanonicalFileName));
129295
+ }
129218
129296
  function createRedirectedBuilderProgram(state, configFileParsingDiagnostics) {
129219
129297
  return {
129220
129298
  state: void 0,
129221
- saveEmitState: noop,
129222
- restoreEmitState: noop,
129223
129299
  getProgram,
129224
129300
  getProgramOrUndefined: () => state.program,
129225
129301
  releaseProgram: () => state.program = void 0,
@@ -130577,10 +130653,10 @@ function explainFiles(program, write) {
130577
130653
  for (const file of program.getSourceFiles()) {
130578
130654
  write(`${toFileName(file, relativeFileName)}`);
130579
130655
  (_a = reasons.get(file.path)) == null ? void 0 : _a.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`));
130580
- (_b = explainIfFileIsRedirectAndImpliedFormat(file, program.getCompilerOptionsForFile(file), relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
130656
+ (_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
130581
130657
  }
130582
130658
  }
130583
- function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConvertor) {
130659
+ function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
130584
130660
  var _a;
130585
130661
  let result;
130586
130662
  if (file.path !== file.resolvedPath) {
@@ -130600,7 +130676,7 @@ function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConverto
130600
130676
  ));
130601
130677
  }
130602
130678
  if (isExternalOrCommonJsModule(file)) {
130603
- switch (getImpliedNodeFormatForEmitWorker(file, options)) {
130679
+ switch (file.impliedNodeFormat) {
130604
130680
  case 99 /* ESNext */:
130605
130681
  if (file.packageJsonScope) {
130606
130682
  (result ?? (result = [])).push(chainDiagnosticMessages(
@@ -130797,13 +130873,12 @@ function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummar
130797
130873
  emitOnlyDtsFiles,
130798
130874
  customTransformers
130799
130875
  );
130800
- const { emittedFiles, diagnostics: emitDiagnostics } = emitResult;
130801
- addRange(allDiagnostics, emitDiagnostics);
130876
+ addRange(allDiagnostics, emitResult.diagnostics);
130802
130877
  const diagnostics = sortAndDeduplicateDiagnostics(allDiagnostics);
130803
130878
  diagnostics.forEach(reportDiagnostic);
130804
130879
  if (write) {
130805
130880
  const currentDir = program.getCurrentDirectory();
130806
- forEach(emittedFiles, (file) => {
130881
+ forEach(emitResult.emittedFiles, (file) => {
130807
130882
  const filepath = getNormalizedAbsolutePath(file, currentDir);
130808
130883
  write(`TSFILE: ${filepath}`);
130809
130884
  });
@@ -131486,22 +131561,17 @@ function createWatchProgram(host) {
131486
131561
  updateProgram();
131487
131562
  }
131488
131563
  function updateProgram() {
131489
- var _a, _b, _c, _d;
131490
131564
  switch (updateLevel) {
131491
131565
  case 1 /* RootNamesAndUpdate */:
131492
- (_a = perfLogger) == null ? void 0 : _a.logStartUpdateProgram("PartialConfigReload");
131493
131566
  reloadFileNamesFromConfigFile();
131494
131567
  break;
131495
131568
  case 2 /* Full */:
131496
- (_b = perfLogger) == null ? void 0 : _b.logStartUpdateProgram("FullConfigReload");
131497
131569
  reloadConfigFile();
131498
131570
  break;
131499
131571
  default:
131500
- (_c = perfLogger) == null ? void 0 : _c.logStartUpdateProgram("SynchronizeProgram");
131501
131572
  synchronizeProgram();
131502
131573
  break;
131503
131574
  }
131504
- (_d = perfLogger) == null ? void 0 : _d.logStopUpdateProgram("Done");
131505
131575
  return getCurrentBuilderProgram();
131506
131576
  }
131507
131577
  function reloadFileNamesFromConfigFile() {
@@ -131783,16 +131853,17 @@ var UpToDateStatusType = /* @__PURE__ */ ((UpToDateStatusType2) => {
131783
131853
  UpToDateStatusType2[UpToDateStatusType2["ErrorReadingFile"] = 4] = "ErrorReadingFile";
131784
131854
  UpToDateStatusType2[UpToDateStatusType2["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
131785
131855
  UpToDateStatusType2[UpToDateStatusType2["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
131786
- UpToDateStatusType2[UpToDateStatusType2["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
131787
- UpToDateStatusType2[UpToDateStatusType2["OutOfDateOptions"] = 8] = "OutOfDateOptions";
131788
- UpToDateStatusType2[UpToDateStatusType2["OutOfDateRoots"] = 9] = "OutOfDateRoots";
131789
- UpToDateStatusType2[UpToDateStatusType2["UpstreamOutOfDate"] = 10] = "UpstreamOutOfDate";
131790
- UpToDateStatusType2[UpToDateStatusType2["UpstreamBlocked"] = 11] = "UpstreamBlocked";
131791
- UpToDateStatusType2[UpToDateStatusType2["ComputingUpstream"] = 12] = "ComputingUpstream";
131792
- UpToDateStatusType2[UpToDateStatusType2["TsVersionOutputOfDate"] = 13] = "TsVersionOutputOfDate";
131793
- UpToDateStatusType2[UpToDateStatusType2["UpToDateWithInputFileText"] = 14] = "UpToDateWithInputFileText";
131794
- UpToDateStatusType2[UpToDateStatusType2["ContainerOnly"] = 15] = "ContainerOnly";
131795
- UpToDateStatusType2[UpToDateStatusType2["ForceBuild"] = 16] = "ForceBuild";
131856
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateBuildInfoWithPendingEmit"] = 7] = "OutOfDateBuildInfoWithPendingEmit";
131857
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateBuildInfoWithErrors"] = 8] = "OutOfDateBuildInfoWithErrors";
131858
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateOptions"] = 9] = "OutOfDateOptions";
131859
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateRoots"] = 10] = "OutOfDateRoots";
131860
+ UpToDateStatusType2[UpToDateStatusType2["UpstreamOutOfDate"] = 11] = "UpstreamOutOfDate";
131861
+ UpToDateStatusType2[UpToDateStatusType2["UpstreamBlocked"] = 12] = "UpstreamBlocked";
131862
+ UpToDateStatusType2[UpToDateStatusType2["ComputingUpstream"] = 13] = "ComputingUpstream";
131863
+ UpToDateStatusType2[UpToDateStatusType2["TsVersionOutputOfDate"] = 14] = "TsVersionOutputOfDate";
131864
+ UpToDateStatusType2[UpToDateStatusType2["UpToDateWithInputFileText"] = 15] = "UpToDateWithInputFileText";
131865
+ UpToDateStatusType2[UpToDateStatusType2["ContainerOnly"] = 16] = "ContainerOnly";
131866
+ UpToDateStatusType2[UpToDateStatusType2["ForceBuild"] = 17] = "ForceBuild";
131796
131867
  return UpToDateStatusType2;
131797
131868
  })(UpToDateStatusType || {});
131798
131869
  function resolveConfigFileProjectName(project) {
@@ -132262,7 +132333,7 @@ function createUpdateOutputFileStampsProject(state, project, projectPath, config
132262
132333
  }
132263
132334
  };
132264
132335
  }
132265
- function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex, config, buildOrder) {
132336
+ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex, config, status, buildOrder) {
132266
132337
  let step = 0 /* CreateProgram */;
132267
132338
  let program;
132268
132339
  let buildResult;
@@ -132313,17 +132384,13 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
132313
132384
  }
132314
132385
  );
132315
132386
  }
132316
- executeSteps(2 /* SemanticDiagnostics */, cancellationToken);
132317
- if (step === 4 /* EmitBuildInfo */) {
132318
- return emitBuildInfo(writeFile2, cancellationToken);
132319
- }
132320
- if (step !== 3 /* Emit */) return void 0;
132387
+ executeSteps(0 /* CreateProgram */, cancellationToken);
132321
132388
  return emit(writeFile2, cancellationToken, customTransformers);
132322
132389
  },
132323
132390
  done
132324
132391
  };
132325
132392
  function done(cancellationToken, writeFile2, customTransformers) {
132326
- executeSteps(6 /* Done */, cancellationToken, writeFile2, customTransformers);
132393
+ executeSteps(3 /* Done */, cancellationToken, writeFile2, customTransformers);
132327
132394
  mark("SolutionBuilder::Projects built");
132328
132395
  return doneInvalidatedProject(state, projectPath);
132329
132396
  }
@@ -132340,14 +132407,14 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
132340
132407
  if (state.options.dry) {
132341
132408
  reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
132342
132409
  buildResult = 1 /* Success */;
132343
- step = 5 /* QueueReferencingProjects */;
132410
+ step = 2 /* QueueReferencingProjects */;
132344
132411
  return;
132345
132412
  }
132346
132413
  if (state.options.verbose) reportStatus(state, Diagnostics.Building_project_0, project);
132347
132414
  if (config.fileNames.length === 0) {
132348
132415
  reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
132349
132416
  buildResult = 0 /* None */;
132350
- step = 5 /* QueueReferencingProjects */;
132417
+ step = 2 /* QueueReferencingProjects */;
132351
132418
  return;
132352
132419
  }
132353
132420
  const { host, compilerHost } = state;
@@ -132375,179 +132442,97 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
132375
132442
  }
132376
132443
  step++;
132377
132444
  }
132378
- function handleDiagnostics(diagnostics, errorFlags, errorType) {
132379
- if (diagnostics.length) {
132380
- ({ buildResult, step } = buildErrors(
132381
- state,
132382
- projectPath,
132383
- diagnostics,
132384
- errorFlags,
132385
- errorType
132386
- ));
132387
- } else {
132388
- step++;
132389
- }
132390
- }
132391
- function getSyntaxDiagnostics(cancellationToken) {
132392
- Debug.assertIsDefined(program);
132393
- handleDiagnostics(
132394
- [
132395
- ...program.getConfigFileParsingDiagnostics(),
132396
- ...program.getOptionsDiagnostics(cancellationToken),
132397
- ...program.getGlobalDiagnostics(cancellationToken),
132398
- ...program.getSyntacticDiagnostics(
132399
- /*sourceFile*/
132400
- void 0,
132401
- cancellationToken
132402
- )
132403
- ],
132404
- 8 /* SyntaxErrors */,
132405
- "Syntactic"
132406
- );
132407
- }
132408
- function getSemanticDiagnostics(cancellationToken) {
132409
- handleDiagnostics(
132410
- Debug.checkDefined(program).getSemanticDiagnostics(
132411
- /*sourceFile*/
132412
- void 0,
132413
- cancellationToken
132414
- ),
132415
- 16 /* TypeErrors */,
132416
- "Semantic"
132417
- );
132418
- }
132419
132445
  function emit(writeFileCallback, cancellationToken, customTransformers) {
132420
132446
  var _a, _b, _c;
132421
132447
  Debug.assertIsDefined(program);
132422
- Debug.assert(step === 3 /* Emit */);
132423
- const saved = program.saveEmitState();
132424
- let declDiagnostics;
132425
- const reportDeclarationDiagnostics = (d) => (declDiagnostics || (declDiagnostics = [])).push(d);
132426
- const outputFiles = [];
132427
- const { emitResult } = emitFilesAndReportErrors(
132448
+ Debug.assert(step === 1 /* Emit */);
132449
+ const { host, compilerHost } = state;
132450
+ const emittedOutputs = /* @__PURE__ */ new Map();
132451
+ const options = program.getCompilerOptions();
132452
+ const isIncremental = isIncrementalCompilation(options);
132453
+ let outputTimeStampMap;
132454
+ let now;
132455
+ const { emitResult, diagnostics } = emitFilesAndReportErrors(
132428
132456
  program,
132429
- reportDeclarationDiagnostics,
132430
- /*write*/
132431
- void 0,
132457
+ (d) => host.reportDiagnostic(d),
132458
+ state.write,
132432
132459
  /*reportSummary*/
132433
132460
  void 0,
132434
- (name, text, writeByteOrderMark, _onError, _sourceFiles, data) => outputFiles.push({ name, text, writeByteOrderMark, data }),
132461
+ (name, text, writeByteOrderMark, onError, sourceFiles, data) => {
132462
+ var _a2;
132463
+ const path = toPath2(state, name);
132464
+ emittedOutputs.set(toPath2(state, name), name);
132465
+ if (data == null ? void 0 : data.buildInfo) {
132466
+ now || (now = getCurrentTime(state.host));
132467
+ const isChangedSignature2 = (_a2 = program.hasChangedEmitSignature) == null ? void 0 : _a2.call(program);
132468
+ const existing = getBuildInfoCacheEntry(state, name, projectPath);
132469
+ if (existing) {
132470
+ existing.buildInfo = data.buildInfo;
132471
+ existing.modifiedTime = now;
132472
+ if (isChangedSignature2) existing.latestChangedDtsTime = now;
132473
+ } else {
132474
+ state.buildInfoCache.set(projectPath, {
132475
+ path: toPath2(state, name),
132476
+ buildInfo: data.buildInfo,
132477
+ modifiedTime: now,
132478
+ latestChangedDtsTime: isChangedSignature2 ? now : void 0
132479
+ });
132480
+ }
132481
+ }
132482
+ const modifiedTime = (data == null ? void 0 : data.differsOnlyInMap) ? getModifiedTime(state.host, name) : void 0;
132483
+ (writeFileCallback || compilerHost.writeFile)(
132484
+ name,
132485
+ text,
132486
+ writeByteOrderMark,
132487
+ onError,
132488
+ sourceFiles,
132489
+ data
132490
+ );
132491
+ if (data == null ? void 0 : data.differsOnlyInMap) state.host.setModifiedTime(name, modifiedTime);
132492
+ else if (!isIncremental && state.watch) {
132493
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
132494
+ }
132495
+ },
132435
132496
  cancellationToken,
132436
132497
  /*emitOnlyDtsFiles*/
132437
- false,
132498
+ void 0,
132438
132499
  customTransformers || ((_b = (_a = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a, project))
132439
132500
  );
132440
- if (declDiagnostics) {
132441
- program.restoreEmitState(saved);
132442
- ({ buildResult, step } = buildErrors(
132443
- state,
132444
- projectPath,
132445
- declDiagnostics,
132446
- 32 /* DeclarationEmitErrors */,
132447
- "Declaration file"
132448
- ));
132449
- return {
132450
- emitSkipped: true,
132451
- diagnostics: emitResult.diagnostics
132452
- };
132501
+ if ((!options.noEmitOnError || !diagnostics.length) && (emittedOutputs.size || status.type !== 8 /* OutOfDateBuildInfoWithErrors */)) {
132502
+ updateOutputTimestampsWorker(state, config, projectPath, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
132453
132503
  }
132454
- const { host, compilerHost } = state;
132455
- const resultFlags = ((_c = program.hasChangedEmitSignature) == null ? void 0 : _c.call(program)) ? 0 /* None */ : 2 /* DeclarationOutputUnchanged */;
132456
- const emitterDiagnostics = createDiagnosticCollection();
132457
- const emittedOutputs = /* @__PURE__ */ new Map();
132458
- const options = program.getCompilerOptions();
132459
- const isIncremental = isIncrementalCompilation(options);
132460
- let outputTimeStampMap;
132461
- let now;
132462
- outputFiles.forEach(({ name, text, writeByteOrderMark, data }) => {
132463
- const path = toPath2(state, name);
132464
- emittedOutputs.set(toPath2(state, name), name);
132465
- if (data == null ? void 0 : data.buildInfo) setBuildInfo(state, data.buildInfo, projectPath, options, resultFlags);
132466
- const modifiedTime = (data == null ? void 0 : data.differsOnlyInMap) ? getModifiedTime(state.host, name) : void 0;
132467
- writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
132468
- if (data == null ? void 0 : data.differsOnlyInMap) state.host.setModifiedTime(name, modifiedTime);
132469
- else if (!isIncremental && state.watch) {
132470
- (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
132471
- }
132472
- });
132473
- finishEmit(
132474
- emitterDiagnostics,
132475
- emittedOutputs,
132476
- outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()),
132477
- resultFlags
132478
- );
132479
- return emitResult;
132480
- }
132481
- function emitBuildInfo(writeFileCallback, cancellationToken) {
132482
- Debug.assertIsDefined(program);
132483
- Debug.assert(step === 4 /* EmitBuildInfo */);
132484
- const emitResult = program.emitBuildInfo((name, text, writeByteOrderMark, onError, sourceFiles, data) => {
132485
- if (data == null ? void 0 : data.buildInfo) setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), 2 /* DeclarationOutputUnchanged */);
132486
- if (writeFileCallback) writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
132487
- else state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
132488
- }, cancellationToken);
132489
- if (emitResult.diagnostics.length) {
132490
- reportErrors(state, emitResult.diagnostics);
132491
- state.diagnostics.set(projectPath, [...state.diagnostics.get(projectPath), ...emitResult.diagnostics]);
132492
- buildResult = 64 /* EmitErrors */ & buildResult;
132493
- }
132494
- if (emitResult.emittedFiles && state.write) {
132495
- emitResult.emittedFiles.forEach((name) => listEmittedFile(state, config, name));
132504
+ state.projectErrorsReported.set(projectPath, true);
132505
+ if (!diagnostics.length) {
132506
+ state.diagnostics.delete(projectPath);
132507
+ state.projectStatus.set(projectPath, {
132508
+ type: 1 /* UpToDate */,
132509
+ oldestOutputFileName: firstOrUndefinedIterator(emittedOutputs.values()) ?? getFirstProjectOutput(config, !host.useCaseSensitiveFileNames())
132510
+ });
132511
+ buildResult = ((_c = program.hasChangedEmitSignature) == null ? void 0 : _c.call(program)) ? 0 /* None */ : 2 /* DeclarationOutputUnchanged */;
132512
+ } else {
132513
+ state.diagnostics.set(projectPath, diagnostics);
132514
+ state.projectStatus.set(projectPath, { type: 0 /* Unbuildable */, reason: `it had errors` });
132515
+ buildResult = 4 /* AnyErrors */;
132496
132516
  }
132497
132517
  afterProgramDone(state, program);
132498
- step = 5 /* QueueReferencingProjects */;
132518
+ step = 2 /* QueueReferencingProjects */;
132499
132519
  return emitResult;
132500
132520
  }
132501
- function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
132502
- const emitDiagnostics = emitterDiagnostics.getDiagnostics();
132503
- if (emitDiagnostics.length) {
132504
- ({ buildResult, step } = buildErrors(
132505
- state,
132506
- projectPath,
132507
- emitDiagnostics,
132508
- 64 /* EmitErrors */,
132509
- "Emit"
132510
- ));
132511
- return emitDiagnostics;
132512
- }
132513
- if (state.write) {
132514
- emittedOutputs.forEach((name) => listEmittedFile(state, config, name));
132515
- }
132516
- updateOutputTimestampsWorker(state, config, projectPath, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
132517
- state.diagnostics.delete(projectPath);
132518
- state.projectStatus.set(projectPath, {
132519
- type: 1 /* UpToDate */,
132520
- oldestOutputFileName
132521
- });
132522
- afterProgramDone(state, program);
132523
- step = 5 /* QueueReferencingProjects */;
132524
- buildResult = resultFlags;
132525
- return emitDiagnostics;
132526
- }
132527
132521
  function executeSteps(till, cancellationToken, writeFile2, customTransformers) {
132528
- while (step <= till && step < 6 /* Done */) {
132522
+ while (step <= till && step < 3 /* Done */) {
132529
132523
  const currentStep = step;
132530
132524
  switch (step) {
132531
132525
  case 0 /* CreateProgram */:
132532
132526
  createProgram2();
132533
132527
  break;
132534
- case 1 /* SyntaxDiagnostics */:
132535
- getSyntaxDiagnostics(cancellationToken);
132536
- break;
132537
- case 2 /* SemanticDiagnostics */:
132538
- getSemanticDiagnostics(cancellationToken);
132539
- break;
132540
- case 3 /* Emit */:
132528
+ case 1 /* Emit */:
132541
132529
  emit(writeFile2, cancellationToken, customTransformers);
132542
132530
  break;
132543
- case 4 /* EmitBuildInfo */:
132544
- emitBuildInfo(writeFile2, cancellationToken);
132545
- break;
132546
- case 5 /* QueueReferencingProjects */:
132531
+ case 2 /* QueueReferencingProjects */:
132547
132532
  queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult));
132548
132533
  step++;
132549
132534
  break;
132550
- case 6 /* Done */:
132535
+ case 3 /* Done */:
132551
132536
  default:
132552
132537
  assertType(step);
132553
132538
  }
@@ -132597,7 +132582,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
132597
132582
  }
132598
132583
  continue;
132599
132584
  }
132600
- if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type === 14 /* UpToDateWithInputFileText */) {
132585
+ if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type === 15 /* UpToDateWithInputFileText */) {
132601
132586
  reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
132602
132587
  return {
132603
132588
  kind: 1 /* UpdateOutputFileStamps */,
@@ -132609,7 +132594,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
132609
132594
  };
132610
132595
  }
132611
132596
  }
132612
- if (status.type === 11 /* UpstreamBlocked */) {
132597
+ if (status.type === 12 /* UpstreamBlocked */) {
132613
132598
  verboseReportProjectStatus(state, project, status);
132614
132599
  reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
132615
132600
  projectPendingBuild.delete(projectPath);
@@ -132623,7 +132608,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
132623
132608
  }
132624
132609
  continue;
132625
132610
  }
132626
- if (status.type === 15 /* ContainerOnly */) {
132611
+ if (status.type === 16 /* ContainerOnly */) {
132627
132612
  verboseReportProjectStatus(state, project, status);
132628
132613
  reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
132629
132614
  projectPendingBuild.delete(projectPath);
@@ -132648,6 +132633,7 @@ function createInvalidatedProjectWithInfo(state, info, buildOrder) {
132648
132633
  info.projectPath,
132649
132634
  info.projectIndex,
132650
132635
  info.config,
132636
+ info.status,
132651
132637
  buildOrder
132652
132638
  ) : createUpdateOutputFileStampsProject(
132653
132639
  state,
@@ -132662,11 +132648,6 @@ function getNextInvalidatedProject(state, buildOrder, reportQueue) {
132662
132648
  if (!info) return info;
132663
132649
  return createInvalidatedProjectWithInfo(state, info, buildOrder);
132664
132650
  }
132665
- function listEmittedFile({ write }, proj, file) {
132666
- if (write && proj.options.listEmittedFiles) {
132667
- write(`TSFILE: ${file}`);
132668
- }
132669
- }
132670
132651
  function getOldProgram({ options, builderPrograms, compilerHost }, proj, parsed) {
132671
132652
  if (options.force) return void 0;
132672
132653
  const value = builderPrograms.get(proj);
@@ -132675,7 +132656,6 @@ function getOldProgram({ options, builderPrograms, compilerHost }, proj, parsed)
132675
132656
  }
132676
132657
  function afterProgramDone(state, program) {
132677
132658
  if (program) {
132678
- if (state.write) listFiles(program, state.write);
132679
132659
  if (state.host.afterProgramEmitAndDiagnostics) {
132680
132660
  state.host.afterProgramEmitAndDiagnostics(program);
132681
132661
  }
@@ -132683,11 +132663,6 @@ function afterProgramDone(state, program) {
132683
132663
  }
132684
132664
  state.projectCompilerOptions = state.baseCompilerOptions;
132685
132665
  }
132686
- function buildErrors(state, resolvedPath, diagnostics, buildResult, errorType) {
132687
- reportAndStoreErrors(state, resolvedPath, diagnostics);
132688
- state.projectStatus.set(resolvedPath, { type: 0 /* Unbuildable */, reason: `${errorType} errors` });
132689
- return { buildResult, step: 4 /* EmitBuildInfo */ };
132690
- }
132691
132666
  function isFileWatcherWithModifiedTime(value) {
132692
132667
  return !!value.watcher;
132693
132668
  }
@@ -132745,23 +132720,6 @@ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
132745
132720
  if (!result) state.outputTimeStamps.set(resolvedConfigFilePath, result = /* @__PURE__ */ new Map());
132746
132721
  return result;
132747
132722
  }
132748
- function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
132749
- const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
132750
- const existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
132751
- const modifiedTime = getCurrentTime(state.host);
132752
- if (existing) {
132753
- existing.buildInfo = buildInfo;
132754
- existing.modifiedTime = modifiedTime;
132755
- if (!(resultFlags & 2 /* DeclarationOutputUnchanged */)) existing.latestChangedDtsTime = modifiedTime;
132756
- } else {
132757
- state.buildInfoCache.set(resolvedConfigPath, {
132758
- path: toPath2(state, buildInfoPath),
132759
- buildInfo,
132760
- modifiedTime,
132761
- latestChangedDtsTime: resultFlags & 2 /* DeclarationOutputUnchanged */ ? void 0 : modifiedTime
132762
- });
132763
- }
132764
- }
132765
132723
  function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
132766
132724
  const path = toPath2(state, buildInfoPath);
132767
132725
  const existing = state.buildInfoCache.get(resolvedConfigPath);
@@ -132789,41 +132747,41 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
132789
132747
  }
132790
132748
  }
132791
132749
  function getUpToDateStatusWorker(state, project, resolvedPath) {
132792
- var _a, _b, _c, _d;
132750
+ var _a, _b, _c;
132793
132751
  if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
132794
132752
  return {
132795
- type: 15 /* ContainerOnly */
132753
+ type: 16 /* ContainerOnly */
132796
132754
  };
132797
132755
  }
132798
132756
  let referenceStatuses;
132799
132757
  const force = !!state.options.force;
132800
132758
  if (project.projectReferences) {
132801
- state.projectStatus.set(resolvedPath, { type: 12 /* ComputingUpstream */ });
132759
+ state.projectStatus.set(resolvedPath, { type: 13 /* ComputingUpstream */ });
132802
132760
  for (const ref of project.projectReferences) {
132803
132761
  const resolvedRef = resolveProjectReferencePath(ref);
132804
132762
  const resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
132805
132763
  const resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
132806
132764
  const refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
132807
- if (refStatus.type === 12 /* ComputingUpstream */ || refStatus.type === 15 /* ContainerOnly */) {
132765
+ if (refStatus.type === 13 /* ComputingUpstream */ || refStatus.type === 16 /* ContainerOnly */) {
132808
132766
  continue;
132809
132767
  }
132810
- if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 11 /* UpstreamBlocked */) {
132768
+ if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 12 /* UpstreamBlocked */) {
132811
132769
  return {
132812
- type: 11 /* UpstreamBlocked */,
132770
+ type: 12 /* UpstreamBlocked */,
132813
132771
  upstreamProjectName: ref.path,
132814
- upstreamProjectBlocked: refStatus.type === 11 /* UpstreamBlocked */
132772
+ upstreamProjectBlocked: refStatus.type === 12 /* UpstreamBlocked */
132815
132773
  };
132816
132774
  }
132817
132775
  if (refStatus.type !== 1 /* UpToDate */) {
132818
132776
  return {
132819
- type: 10 /* UpstreamOutOfDate */,
132777
+ type: 11 /* UpstreamOutOfDate */,
132820
132778
  upstreamProjectName: ref.path
132821
132779
  };
132822
132780
  }
132823
132781
  if (!force) (referenceStatuses || (referenceStatuses = [])).push({ ref, refStatus, resolvedRefPath, resolvedConfig });
132824
132782
  }
132825
132783
  }
132826
- if (force) return { type: 16 /* ForceBuild */ };
132784
+ if (force) return { type: 17 /* ForceBuild */ };
132827
132785
  const { host } = state;
132828
132786
  const buildInfoPath = getTsBuildInfoEmitOutputFilePath(project.options);
132829
132787
  const isIncremental = isIncrementalCompilation(project.options);
@@ -132852,20 +132810,32 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132852
132810
  const incrementalBuildInfo = isIncremental && isIncrementalBuildInfo(buildInfo) ? buildInfo : void 0;
132853
132811
  if ((incrementalBuildInfo || !isIncremental) && buildInfo.version !== version) {
132854
132812
  return {
132855
- type: 13 /* TsVersionOutputOfDate */,
132813
+ type: 14 /* TsVersionOutputOfDate */,
132856
132814
  version: buildInfo.version
132857
132815
  };
132858
132816
  }
132817
+ if (buildInfo.errors) {
132818
+ return {
132819
+ type: 8 /* OutOfDateBuildInfoWithErrors */,
132820
+ buildInfoFile: buildInfoPath
132821
+ };
132822
+ }
132859
132823
  if (incrementalBuildInfo) {
132860
- if (((_a = incrementalBuildInfo.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = incrementalBuildInfo.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = incrementalBuildInfo.emitDiagnosticsPerFile) == null ? void 0 : _c.length) || incrementalBuildInfo.pendingEmit !== void 0 : (_d = incrementalBuildInfo.semanticDiagnosticsPerFile) == null ? void 0 : _d.length)) {
132824
+ if (((_a = incrementalBuildInfo.semanticDiagnosticsPerFile) == null ? void 0 : _a.length) || !project.options.noEmit && getEmitDeclarations(project.options) && ((_b = incrementalBuildInfo.emitDiagnosticsPerFile) == null ? void 0 : _b.length)) {
132825
+ return {
132826
+ type: 8 /* OutOfDateBuildInfoWithErrors */,
132827
+ buildInfoFile: buildInfoPath
132828
+ };
132829
+ }
132830
+ if (!project.options.noEmit && (((_c = incrementalBuildInfo.affectedFilesPendingEmit) == null ? void 0 : _c.length) || incrementalBuildInfo.pendingEmit !== void 0)) {
132861
132831
  return {
132862
- type: 7 /* OutOfDateBuildInfo */,
132832
+ type: 7 /* OutOfDateBuildInfoWithPendingEmit */,
132863
132833
  buildInfoFile: buildInfoPath
132864
132834
  };
132865
132835
  }
132866
132836
  if (!project.options.noEmit && getPendingEmitKind(project.options, incrementalBuildInfo.options || {})) {
132867
132837
  return {
132868
- type: 8 /* OutOfDateOptions */,
132838
+ type: 9 /* OutOfDateOptions */,
132869
132839
  buildInfoFile: buildInfoPath
132870
132840
  };
132871
132841
  }
@@ -132885,7 +132855,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132885
132855
  reason: `${inputFile} does not exist`
132886
132856
  };
132887
132857
  }
132888
- const inputPath = incrementalBuildInfo ? toPath2(state, inputFile) : void 0;
132858
+ const inputPath = toPath2(state, inputFile);
132889
132859
  if (buildInfoTime < inputTime) {
132890
132860
  let version2;
132891
132861
  let currentVersion;
@@ -132909,22 +132879,28 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132909
132879
  newestInputFileName = inputFile;
132910
132880
  newestInputFileTime = inputTime;
132911
132881
  }
132912
- if (incrementalBuildInfo) seenRoots.add(inputPath);
132882
+ seenRoots.add(inputPath);
132913
132883
  }
132884
+ let existingRoot;
132914
132885
  if (incrementalBuildInfo) {
132915
132886
  if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(incrementalBuildInfo, buildInfoPath, host);
132916
- const existingRoot = forEachEntry(
132887
+ existingRoot = forEachEntry(
132917
132888
  buildInfoVersionMap.roots,
132918
132889
  // File was root file when project was built but its not any more
132919
132890
  (_resolved, existingRoot2) => !seenRoots.has(existingRoot2) ? existingRoot2 : void 0
132920
132891
  );
132921
- if (existingRoot) {
132922
- return {
132923
- type: 9 /* OutOfDateRoots */,
132924
- buildInfoFile: buildInfoPath,
132925
- inputFile: existingRoot
132926
- };
132927
- }
132892
+ } else {
132893
+ existingRoot = forEach(
132894
+ getNonIncrementalBuildInfoRoots(buildInfo, buildInfoPath, host),
132895
+ (root) => !seenRoots.has(root) ? root : void 0
132896
+ );
132897
+ }
132898
+ if (existingRoot) {
132899
+ return {
132900
+ type: 10 /* OutOfDateRoots */,
132901
+ buildInfoFile: buildInfoPath,
132902
+ inputFile: existingRoot
132903
+ };
132928
132904
  }
132929
132905
  if (!isIncremental) {
132930
132906
  const outputs = getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
@@ -132993,7 +132969,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132993
132969
  );
132994
132970
  if (dependentPackageFileStatus) return dependentPackageFileStatus;
132995
132971
  return {
132996
- type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ? 14 /* UpToDateWithInputFileText */ : 1 /* UpToDate */,
132972
+ type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ? 15 /* UpToDateWithInputFileText */ : 1 /* UpToDate */,
132997
132973
  newestInputFileTime,
132998
132974
  newestInputFileName,
132999
132975
  oldestOutputFileName
@@ -133005,7 +132981,7 @@ function hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath) {
133005
132981
  }
133006
132982
  function getUpToDateStatus(state, project, resolvedPath) {
133007
132983
  if (project === void 0) {
133008
- return { type: 0 /* Unbuildable */, reason: "File deleted mid-build" };
132984
+ return { type: 0 /* Unbuildable */, reason: "config file deleted mid-build" };
133009
132985
  }
133010
132986
  const prior = state.projectStatus.get(resolvedPath);
133011
132987
  if (prior !== void 0) {
@@ -133076,7 +133052,7 @@ function updateOutputTimestamps(state, proj, resolvedPath) {
133076
133052
  });
133077
133053
  }
133078
133054
  function queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, buildResult) {
133079
- if (buildResult & 124 /* AnyErrors */) return;
133055
+ if (buildResult & 4 /* AnyErrors */) return;
133080
133056
  if (!config.options.composite) return;
133081
133057
  for (let index = projectIndex + 1; index < buildOrder.length; index++) {
133082
133058
  const nextProject = buildOrder[index];
@@ -133095,7 +133071,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
133095
133071
  status.type = 2 /* UpToDateWithUpstreamTypes */;
133096
133072
  break;
133097
133073
  }
133098
- case 14 /* UpToDateWithInputFileText */:
133074
+ case 15 /* UpToDateWithInputFileText */:
133099
133075
  case 2 /* UpToDateWithUpstreamTypes */:
133100
133076
  if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
133101
133077
  state.projectStatus.set(nextProjectPath, {
@@ -133105,7 +133081,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
133105
133081
  });
133106
133082
  }
133107
133083
  break;
133108
- case 11 /* UpstreamBlocked */:
133084
+ case 12 /* UpstreamBlocked */:
133109
133085
  if (toResolvedConfigFilePath(state, resolveProjectName(state, status.upstreamProjectName)) === projectPath) {
133110
133086
  clearProjectStatus(state, nextProjectPath);
133111
133087
  }
@@ -133524,21 +133500,28 @@ function reportUpToDateStatus(state, configFileName, status) {
133524
133500
  relName(state, configFileName),
133525
133501
  relName(state, status.fileName)
133526
133502
  );
133527
- case 7 /* OutOfDateBuildInfo */:
133503
+ case 7 /* OutOfDateBuildInfoWithPendingEmit */:
133528
133504
  return reportStatus(
133529
133505
  state,
133530
133506
  Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted,
133531
133507
  relName(state, configFileName),
133532
133508
  relName(state, status.buildInfoFile)
133533
133509
  );
133534
- case 8 /* OutOfDateOptions */:
133510
+ case 8 /* OutOfDateBuildInfoWithErrors */:
133511
+ return reportStatus(
133512
+ state,
133513
+ Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors,
133514
+ relName(state, configFileName),
133515
+ relName(state, status.buildInfoFile)
133516
+ );
133517
+ case 9 /* OutOfDateOptions */:
133535
133518
  return reportStatus(
133536
133519
  state,
133537
133520
  Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_there_is_change_in_compilerOptions,
133538
133521
  relName(state, configFileName),
133539
133522
  relName(state, status.buildInfoFile)
133540
133523
  );
133541
- case 9 /* OutOfDateRoots */:
133524
+ case 10 /* OutOfDateRoots */:
133542
133525
  return reportStatus(
133543
133526
  state,
133544
133527
  Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more,
@@ -133563,20 +133546,20 @@ function reportUpToDateStatus(state, configFileName, status) {
133563
133546
  Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies,
133564
133547
  relName(state, configFileName)
133565
133548
  );
133566
- case 14 /* UpToDateWithInputFileText */:
133549
+ case 15 /* UpToDateWithInputFileText */:
133567
133550
  return reportStatus(
133568
133551
  state,
133569
133552
  Diagnostics.Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files,
133570
133553
  relName(state, configFileName)
133571
133554
  );
133572
- case 10 /* UpstreamOutOfDate */:
133555
+ case 11 /* UpstreamOutOfDate */:
133573
133556
  return reportStatus(
133574
133557
  state,
133575
133558
  Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date,
133576
133559
  relName(state, configFileName),
133577
133560
  relName(state, status.upstreamProjectName)
133578
133561
  );
133579
- case 11 /* UpstreamBlocked */:
133562
+ case 12 /* UpstreamBlocked */:
133580
133563
  return reportStatus(
133581
133564
  state,
133582
133565
  status.upstreamProjectBlocked ? Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built : Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,
@@ -133586,11 +133569,11 @@ function reportUpToDateStatus(state, configFileName, status) {
133586
133569
  case 0 /* Unbuildable */:
133587
133570
  return reportStatus(
133588
133571
  state,
133589
- Diagnostics.Failed_to_parse_file_0_Colon_1,
133572
+ Diagnostics.Project_0_is_out_of_date_because_1,
133590
133573
  relName(state, configFileName),
133591
133574
  status.reason
133592
133575
  );
133593
- case 13 /* TsVersionOutputOfDate */:
133576
+ case 14 /* TsVersionOutputOfDate */:
133594
133577
  return reportStatus(
133595
133578
  state,
133596
133579
  Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2,
@@ -133598,14 +133581,14 @@ function reportUpToDateStatus(state, configFileName, status) {
133598
133581
  status.version,
133599
133582
  version
133600
133583
  );
133601
- case 16 /* ForceBuild */:
133584
+ case 17 /* ForceBuild */:
133602
133585
  return reportStatus(
133603
133586
  state,
133604
133587
  Diagnostics.Project_0_is_being_forcibly_rebuilt,
133605
133588
  relName(state, configFileName)
133606
133589
  );
133607
- case 15 /* ContainerOnly */:
133608
- case 12 /* ComputingUpstream */:
133590
+ case 16 /* ContainerOnly */:
133591
+ case 13 /* ComputingUpstream */:
133609
133592
  break;
133610
133593
  default:
133611
133594
  assertType(status);
@@ -137259,9 +137242,7 @@ function createModuleSpecifierResolutionHost(program, host) {
137259
137242
  isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
137260
137243
  getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
137261
137244
  getFileIncludeReasons: () => program.getFileIncludeReasons(),
137262
- getCommonSourceDirectory: () => program.getCommonSourceDirectory(),
137263
- getDefaultResolutionModeForFile: (file) => program.getDefaultResolutionModeForFile(file),
137264
- getModeForResolutionAtIndex: (file, index) => program.getModeForResolutionAtIndex(file, index)
137245
+ getCommonSourceDirectory: () => program.getCommonSourceDirectory()
137265
137246
  };
137266
137247
  }
137267
137248
  function getModuleSpecifierResolverHost(program, host) {
@@ -138365,12 +138346,36 @@ function mapOneOrMany(valueOrArray, f, resultSelector = identity) {
138365
138346
  function firstOrOnly(valueOrArray) {
138366
138347
  return isArray(valueOrArray) ? first(valueOrArray) : valueOrArray;
138367
138348
  }
138349
+ function getNamesForExportedSymbol(symbol, scriptTarget) {
138350
+ if (needsNameFromDeclaration(symbol)) {
138351
+ const fromDeclaration = getDefaultLikeExportNameFromDeclaration(symbol);
138352
+ if (fromDeclaration) return fromDeclaration;
138353
+ const fileNameCase = moduleSymbolToValidIdentifier(
138354
+ getSymbolParentOrFail(symbol),
138355
+ scriptTarget,
138356
+ /*forceCapitalize*/
138357
+ false
138358
+ );
138359
+ const capitalized = moduleSymbolToValidIdentifier(
138360
+ getSymbolParentOrFail(symbol),
138361
+ scriptTarget,
138362
+ /*forceCapitalize*/
138363
+ true
138364
+ );
138365
+ if (fileNameCase === capitalized) return fileNameCase;
138366
+ return [fileNameCase, capitalized];
138367
+ }
138368
+ return symbol.name;
138369
+ }
138368
138370
  function getNameForExportedSymbol(symbol, scriptTarget, preferCapitalized) {
138369
- if (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */) {
138371
+ if (needsNameFromDeclaration(symbol)) {
138370
138372
  return getDefaultLikeExportNameFromDeclaration(symbol) || moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
138371
138373
  }
138372
138374
  return symbol.name;
138373
138375
  }
138376
+ function needsNameFromDeclaration(symbol) {
138377
+ return !(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */);
138378
+ }
138374
138379
  function getDefaultLikeExportNameFromDeclaration(symbol) {
138375
138380
  return firstDefined(symbol.declarations, (d) => {
138376
138381
  var _a, _b, _c;
@@ -138543,13 +138548,9 @@ function fileShouldUseJavaScriptRequire(file, program, host, preferRequire) {
138543
138548
  if (!hasJSFileExtension(fileName)) {
138544
138549
  return false;
138545
138550
  }
138546
- const compilerOptions = typeof file === "string" ? program.getCompilerOptions() : program.getCompilerOptionsForFile(file);
138551
+ const compilerOptions = program.getCompilerOptions();
138547
138552
  const moduleKind = getEmitModuleKind(compilerOptions);
138548
- const sourceFileLike = typeof file === "string" ? {
138549
- fileName: file,
138550
- impliedNodeFormat: getImpliedNodeFormatForFile(toPath(file, host.getCurrentDirectory(), hostGetCanonicalFileName(host)), (_a = program.getPackageJsonInfoCache) == null ? void 0 : _a.call(program), host, compilerOptions)
138551
- } : file;
138552
- const impliedNodeFormat = getImpliedNodeFormatForEmitWorker(sourceFileLike, compilerOptions);
138553
+ const impliedNodeFormat = typeof file === "string" ? getImpliedNodeFormatForFile(toPath(file, host.getCurrentDirectory(), hostGetCanonicalFileName(host)), (_a = program.getPackageJsonInfoCache) == null ? void 0 : _a.call(program), host, compilerOptions) : file.impliedNodeFormat;
138553
138554
  if (impliedNodeFormat === 99 /* ESNext */) {
138554
138555
  return false;
138555
138556
  }
@@ -138661,7 +138662,6 @@ function createCacheableExportInfoMap(host) {
138661
138662
  const namedSymbol = isDefault && getLocalSymbolForExportDefault(symbol) || symbol;
138662
138663
  const names = exportKind === 0 /* Named */ || isExternalModuleSymbol(namedSymbol) ? unescapeLeadingUnderscores(symbolTableKey) : getNamesForExportedSymbol(
138663
138664
  namedSymbol,
138664
- checker,
138665
138665
  /*scriptTarget*/
138666
138666
  void 0
138667
138667
  );
@@ -138986,15 +138986,7 @@ function getDefaultLikeExportInfo(moduleSymbol, checker) {
138986
138986
  function isImportableSymbol(symbol, checker) {
138987
138987
  return !checker.isUndefinedSymbol(symbol) && !checker.isUnknownSymbol(symbol) && !isKnownSymbol(symbol) && !isPrivateIdentifierSymbol(symbol);
138988
138988
  }
138989
- function getNamesForExportedSymbol(defaultExport, checker, scriptTarget) {
138990
- let names;
138991
- forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, (name, capitalizedName) => {
138992
- names = capitalizedName ? [name, capitalizedName] : name;
138993
- return true;
138994
- });
138995
- return Debug.checkDefined(names);
138996
- }
138997
- function forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, cb) {
138989
+ function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, preferCapitalizedNames, cb) {
138998
138990
  let chain;
138999
138991
  let current = defaultExport;
139000
138992
  while (current) {
@@ -139012,20 +139004,7 @@ function forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, cb) {
139012
139004
  }
139013
139005
  for (const symbol of chain ?? emptyArray) {
139014
139006
  if (symbol.parent && isExternalModuleSymbol(symbol.parent)) {
139015
- const final = cb(
139016
- moduleSymbolToValidIdentifier(
139017
- symbol.parent,
139018
- scriptTarget,
139019
- /*forceCapitalize*/
139020
- false
139021
- ),
139022
- moduleSymbolToValidIdentifier(
139023
- symbol.parent,
139024
- scriptTarget,
139025
- /*forceCapitalize*/
139026
- true
139027
- )
139028
- );
139007
+ const final = cb(moduleSymbolToValidIdentifier(symbol.parent, getEmitScriptTarget(compilerOptions), preferCapitalizedNames));
139029
139008
  if (final) return final;
139030
139009
  }
139031
139010
  }
@@ -141551,7 +141530,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
141551
141530
  program.getSemanticDiagnostics(sourceFile, cancellationToken);
141552
141531
  const diags = [];
141553
141532
  const checker = program.getTypeChecker();
141554
- const isCommonJSFile = program.getImpliedNodeFormatForEmit(sourceFile) === 1 /* CommonJS */ || fileExtensionIsOneOf(sourceFile.fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]);
141533
+ const isCommonJSFile = sourceFile.impliedNodeFormat === 1 /* CommonJS */ || fileExtensionIsOneOf(sourceFile.fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]);
141555
141534
  if (!isCommonJSFile && sourceFile.commonJsModuleIndicator && (programContainsEsModules(program) || compilerOptionsIndicateEsModules(program.getCompilerOptions())) && containsTopLevelCommonjs(sourceFile)) {
141556
141535
  diags.push(createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module));
141557
141536
  }
@@ -149406,6 +149385,108 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
149406
149385
  const declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken);
149407
149386
  return [...semanticDiagnostics, ...declarationDiagnostics];
149408
149387
  }
149388
+ function getRegionSemanticDiagnostics(fileName, ranges) {
149389
+ synchronizeHostData();
149390
+ const sourceFile = getValidSourceFile(fileName);
149391
+ const options = program.getCompilerOptions();
149392
+ if (skipTypeChecking(sourceFile, options, program) || !canIncludeBindAndCheckDiagnostics(sourceFile, options) || program.getCachedSemanticDiagnostics(sourceFile)) {
149393
+ return void 0;
149394
+ }
149395
+ const nodes = getNodesForRanges(sourceFile, ranges);
149396
+ if (!nodes) {
149397
+ return void 0;
149398
+ }
149399
+ const checkedSpans = normalizeSpans(nodes.map((node) => createTextSpanFromBounds(node.getFullStart(), node.getEnd())));
149400
+ const semanticDiagnostics = program.getSemanticDiagnostics(sourceFile, cancellationToken, nodes);
149401
+ return {
149402
+ diagnostics: semanticDiagnostics.slice(),
149403
+ spans: checkedSpans
149404
+ };
149405
+ }
149406
+ function getNodesForRanges(file, ranges) {
149407
+ const nodes = [];
149408
+ const spans = normalizeSpans(ranges.map((range) => createTextSpanFromRange(range)));
149409
+ for (const span of spans) {
149410
+ const nodesForSpan = getNodesForSpan(file, span);
149411
+ if (!nodesForSpan) {
149412
+ return void 0;
149413
+ }
149414
+ nodes.push(...nodesForSpan);
149415
+ }
149416
+ if (!nodes.length) {
149417
+ return void 0;
149418
+ }
149419
+ return nodes;
149420
+ }
149421
+ function getNodesForSpan(file, span) {
149422
+ if (textSpanContainsTextRange(span, file)) {
149423
+ return void 0;
149424
+ }
149425
+ const endToken = findTokenOnLeftOfPosition(file, textSpanEnd(span)) || file;
149426
+ const enclosingNode = findAncestor(endToken, (node) => textRangeContainsTextSpan(node, span));
149427
+ const nodes = [];
149428
+ chooseOverlappingNodes(span, enclosingNode, nodes);
149429
+ if (file.end === span.start + span.length) {
149430
+ nodes.push(file.endOfFileToken);
149431
+ }
149432
+ if (some(nodes, isSourceFile)) {
149433
+ return void 0;
149434
+ }
149435
+ return nodes;
149436
+ }
149437
+ function chooseOverlappingNodes(span, node, result) {
149438
+ if (!nodeOverlapsWithSpan(node, span)) {
149439
+ return false;
149440
+ }
149441
+ if (textSpanContainsTextRange(span, node)) {
149442
+ addSourceElement(node, result);
149443
+ return true;
149444
+ }
149445
+ if (isBlockLike(node)) {
149446
+ return chooseOverlappingBlockLike(span, node, result);
149447
+ }
149448
+ if (isClassLike(node)) {
149449
+ return chooseOverlappingClassLike(span, node, result);
149450
+ }
149451
+ addSourceElement(node, result);
149452
+ return true;
149453
+ }
149454
+ function nodeOverlapsWithSpan(node, span) {
149455
+ const spanEnd = span.start + span.length;
149456
+ return node.pos < spanEnd && node.end > span.start;
149457
+ }
149458
+ function addSourceElement(node, result) {
149459
+ while (node.parent && !isSourceElement(node)) {
149460
+ node = node.parent;
149461
+ }
149462
+ result.push(node);
149463
+ }
149464
+ function chooseOverlappingBlockLike(span, node, result) {
149465
+ const childResult = [];
149466
+ const stmts = node.statements.filter((stmt) => chooseOverlappingNodes(span, stmt, childResult));
149467
+ if (stmts.length === node.statements.length) {
149468
+ addSourceElement(node, result);
149469
+ return true;
149470
+ }
149471
+ result.push(...childResult);
149472
+ return false;
149473
+ }
149474
+ function chooseOverlappingClassLike(span, node, result) {
149475
+ var _a2, _b, _c;
149476
+ const overlaps = (n) => textRangeIntersectsWithTextSpan(n, span);
149477
+ if (((_a2 = node.modifiers) == null ? void 0 : _a2.some(overlaps)) || node.name && overlaps(node.name) || ((_b = node.typeParameters) == null ? void 0 : _b.some(overlaps)) || ((_c = node.heritageClauses) == null ? void 0 : _c.some(overlaps))) {
149478
+ addSourceElement(node, result);
149479
+ return true;
149480
+ }
149481
+ const childResult = [];
149482
+ const members = node.members.filter((member) => chooseOverlappingNodes(span, member, childResult));
149483
+ if (members.length === node.members.length) {
149484
+ addSourceElement(node, result);
149485
+ return true;
149486
+ }
149487
+ result.push(...childResult);
149488
+ return false;
149489
+ }
149409
149490
  function getSuggestionDiagnostics(fileName) {
149410
149491
  synchronizeHostData();
149411
149492
  return computeSuggestionDiagnostics(getValidSourceFile(fileName), program, cancellationToken);
@@ -150220,6 +150301,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
150220
150301
  cleanupSemanticCache,
150221
150302
  getSyntacticDiagnostics,
150222
150303
  getSemanticDiagnostics,
150304
+ getRegionSemanticDiagnostics,
150223
150305
  getSuggestionDiagnostics,
150224
150306
  getCompilerOptionsDiagnostics,
150225
150307
  getSyntacticClassifications: getSyntacticClassifications2,
@@ -154547,7 +154629,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
154547
154629
  compilerOptions,
154548
154630
  createModuleSpecifierResolutionHost(program, host)
154549
154631
  );
154550
- const importKind = getImportKind(futureExportingSourceFile, exportKind, program);
154632
+ const importKind = getImportKind(futureExportingSourceFile, exportKind, compilerOptions);
154551
154633
  const addAsTypeOnly = getAddAsTypeOnly(
154552
154634
  isImportUsageValidAsTypeOnly,
154553
154635
  /*isForNewImportDeclaration*/
@@ -154887,7 +154969,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
154887
154969
  }
154888
154970
  function createImportSpecifierResolver(importingFile, program, host, preferences) {
154889
154971
  const packageJsonImportFilter = createPackageJsonImportFilter(importingFile, preferences, host);
154890
- const importMap = createExistingImportMap(importingFile, program);
154972
+ const importMap = createExistingImportMap(program.getTypeChecker(), importingFile, program.getCompilerOptions());
154891
154973
  return { getModuleSpecifierForBestExportInfo };
154892
154974
  function getModuleSpecifierForBestExportInfo(exportInfo, position, isValidTypeOnlyUseSite, fromCacheOnly) {
154893
154975
  const { fixes, computedWithoutCacheCount } = getImportFixes(
@@ -154990,7 +155072,7 @@ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program
154990
155072
  }
154991
155073
  }
154992
155074
  }
154993
- function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(sourceFile, program) : void 0, fromCacheOnly) {
155075
+ function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(program.getTypeChecker(), sourceFile, program.getCompilerOptions()) : void 0, fromCacheOnly) {
154994
155076
  const checker = program.getTypeChecker();
154995
155077
  const existingImports = importMap ? flatMap(exportInfos, importMap.getImportsForExportInfo) : emptyArray;
154996
155078
  const useNamespace = usagePosition !== void 0 && tryUseExistingNamespaceImport(existingImports, usagePosition);
@@ -155105,8 +155187,7 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
155105
155187
  };
155106
155188
  }
155107
155189
  }
155108
- function createExistingImportMap(importingFile, program) {
155109
- const checker = program.getTypeChecker();
155190
+ function createExistingImportMap(checker, importingFile, compilerOptions) {
155110
155191
  let importMap;
155111
155192
  for (const moduleSpecifier of importingFile.imports) {
155112
155193
  const i = importFromModuleSpecifier(moduleSpecifier);
@@ -155127,7 +155208,7 @@ function createExistingImportMap(importingFile, program) {
155127
155208
  const matchingDeclarations = importMap == null ? void 0 : importMap.get(getSymbolId(moduleSymbol));
155128
155209
  if (!matchingDeclarations) return emptyArray;
155129
155210
  if (isSourceFileJS(importingFile) && !(targetFlags & 111551 /* Value */) && !every(matchingDeclarations, isJSDocImportTag)) return emptyArray;
155130
- const importKind = getImportKind(importingFile, exportKind, program);
155211
+ const importKind = getImportKind(importingFile, exportKind, compilerOptions);
155131
155212
  return matchingDeclarations.map((declaration) => ({ declaration, importKind, symbol, targetFlags }));
155132
155213
  }
155133
155214
  };
@@ -155142,8 +155223,8 @@ function shouldUseRequire(sourceFile, program) {
155142
155223
  if (compilerOptions.configFile) {
155143
155224
  return getEmitModuleKind(compilerOptions) < 5 /* ES2015 */;
155144
155225
  }
155145
- if (getImpliedNodeFormatForEmit(sourceFile, program) === 1 /* CommonJS */) return true;
155146
- if (getImpliedNodeFormatForEmit(sourceFile, program) === 99 /* ESNext */) return false;
155226
+ if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) return true;
155227
+ if (sourceFile.impliedNodeFormat === 99 /* ESNext */) return false;
155147
155228
  for (const otherFile of program.getSourceFiles()) {
155148
155229
  if (otherFile === sourceFile || !isSourceFileJS(otherFile) || program.isSourceFileFromExternalLibrary(otherFile)) continue;
155149
155230
  if (otherFile.commonJsModuleIndicator && !otherFile.externalModuleIndicator) return true;
@@ -155195,13 +155276,20 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
155195
155276
  if (!importedSymbolHasValueMeaning && isJs && usagePosition !== void 0) {
155196
155277
  return { kind: 1 /* JsdocTypeImport */, moduleSpecifierKind, moduleSpecifier, usagePosition, exportInfo: exportInfo2, isReExport: i > 0 };
155197
155278
  }
155198
- const importKind = getImportKind(sourceFile, exportInfo2.exportKind, program);
155279
+ const importKind = getImportKind(sourceFile, exportInfo2.exportKind, compilerOptions);
155199
155280
  let qualification;
155200
155281
  if (usagePosition !== void 0 && importKind === 3 /* CommonJS */ && exportInfo2.exportKind === 0 /* Named */) {
155201
155282
  const exportEquals = checker.resolveExternalModuleSymbol(exportInfo2.moduleSymbol);
155202
155283
  let namespacePrefix;
155203
155284
  if (exportEquals !== exportInfo2.moduleSymbol) {
155204
- namespacePrefix = forEachNameOfDefaultExport(exportEquals, checker, getEmitScriptTarget(compilerOptions), identity);
155285
+ namespacePrefix = forEachNameOfDefaultExport(
155286
+ exportEquals,
155287
+ checker,
155288
+ compilerOptions,
155289
+ /*preferCapitalizedNames*/
155290
+ false,
155291
+ identity
155292
+ );
155205
155293
  }
155206
155294
  namespacePrefix || (namespacePrefix = moduleSymbolToValidIdentifier(
155207
155295
  exportInfo2.moduleSymbol,
@@ -155374,8 +155462,8 @@ function getUmdSymbol(token, checker) {
155374
155462
  }
155375
155463
  return void 0;
155376
155464
  }
155377
- function getImportKind(importingFile, exportKind, program, forceImportKeyword) {
155378
- if (program.getCompilerOptions().verbatimModuleSyntax && getEmitModuleFormatOfFile(importingFile, program) === 1 /* CommonJS */) {
155465
+ function getImportKind(importingFile, exportKind, compilerOptions, forceImportKeyword) {
155466
+ if (compilerOptions.verbatimModuleSyntax && (getEmitModuleKind(compilerOptions) === 1 /* CommonJS */ || importingFile.impliedNodeFormat === 1 /* CommonJS */)) {
155379
155467
  return 3 /* CommonJS */;
155380
155468
  }
155381
155469
  switch (exportKind) {
@@ -155384,18 +155472,18 @@ function getImportKind(importingFile, exportKind, program, forceImportKeyword) {
155384
155472
  case 1 /* Default */:
155385
155473
  return 1 /* Default */;
155386
155474
  case 2 /* ExportEquals */:
155387
- return getExportEqualsImportKind(importingFile, program.getCompilerOptions(), !!forceImportKeyword);
155475
+ return getExportEqualsImportKind(importingFile, compilerOptions, !!forceImportKeyword);
155388
155476
  case 3 /* UMD */:
155389
- return getUmdImportKind(importingFile, program, !!forceImportKeyword);
155477
+ return getUmdImportKind(importingFile, compilerOptions, !!forceImportKeyword);
155390
155478
  default:
155391
155479
  return Debug.assertNever(exportKind);
155392
155480
  }
155393
155481
  }
155394
- function getUmdImportKind(importingFile, program, forceImportKeyword) {
155395
- if (getAllowSyntheticDefaultImports(program.getCompilerOptions())) {
155482
+ function getUmdImportKind(importingFile, compilerOptions, forceImportKeyword) {
155483
+ if (getAllowSyntheticDefaultImports(compilerOptions)) {
155396
155484
  return 1 /* Default */;
155397
155485
  }
155398
- const moduleKind = getEmitModuleKind(program.getCompilerOptions());
155486
+ const moduleKind = getEmitModuleKind(compilerOptions);
155399
155487
  switch (moduleKind) {
155400
155488
  case 2 /* AMD */:
155401
155489
  case 1 /* CommonJS */:
@@ -155414,7 +155502,7 @@ function getUmdImportKind(importingFile, program, forceImportKeyword) {
155414
155502
  return 2 /* Namespace */;
155415
155503
  case 100 /* Node16 */:
155416
155504
  case 199 /* NodeNext */:
155417
- return getImpliedNodeFormatForEmit(importingFile, program) === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
155505
+ return importingFile.impliedNodeFormat === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
155418
155506
  default:
155419
155507
  return Debug.assertNever(moduleKind, `Unexpected moduleKind ${moduleKind}`);
155420
155508
  }
@@ -155497,7 +155585,7 @@ function getExportInfos(symbolName2, isJsxTagName, currentTokenMeaning, cancella
155497
155585
  cancellationToken.throwIfCancellationRequested();
155498
155586
  const compilerOptions = program2.getCompilerOptions();
155499
155587
  const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker);
155500
- if (defaultInfo && symbolFlagsHaveMeaning(checker.getSymbolFlags(defaultInfo.symbol), currentTokenMeaning) && forEachNameOfDefaultExport(defaultInfo.symbol, checker, getEmitScriptTarget(compilerOptions), (name, capitalizedName) => (isJsxTagName ? capitalizedName ?? name : name) === symbolName2)) {
155588
+ if (defaultInfo && symbolFlagsHaveMeaning(checker.getSymbolFlags(defaultInfo.symbol), currentTokenMeaning) && forEachNameOfDefaultExport(defaultInfo.symbol, checker, compilerOptions, isJsxTagName, (name) => name === symbolName2)) {
155501
155589
  addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program2, isFromPackageJson);
155502
155590
  }
155503
155591
  const exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
@@ -155898,12 +155986,6 @@ function createConstEqualsRequireDeclaration(name, quotedModuleSpecifier) {
155898
155986
  function symbolFlagsHaveMeaning(flags, meaning) {
155899
155987
  return meaning === 7 /* All */ ? true : meaning & 1 /* Value */ ? !!(flags & 111551 /* Value */) : meaning & 2 /* Type */ ? !!(flags & 788968 /* Type */) : meaning & 4 /* Namespace */ ? !!(flags & 1920 /* Namespace */) : false;
155900
155988
  }
155901
- function getImpliedNodeFormatForEmit(file, program) {
155902
- return isFullSourceFile(file) ? program.getImpliedNodeFormatForEmit(file) : getImpliedNodeFormatForEmitWorker(file, program.getCompilerOptions());
155903
- }
155904
- function getEmitModuleFormatOfFile(file, program) {
155905
- return isFullSourceFile(file) ? program.getEmitModuleFormatOfFile(file) : getEmitModuleFormatOfFileWorker(file, program.getCompilerOptions());
155906
- }
155907
155989
 
155908
155990
  // src/services/codefixes/fixAddMissingConstraint.ts
155909
155991
  var fixId17 = "addMissingConstraint";
@@ -163176,12 +163258,10 @@ function getJSDocParamAnnotation(paramName, initializer, dotDotDotToken, isJs, i
163176
163258
  const printer = isSnippet ? createSnippetPrinter({
163177
163259
  removeComments: true,
163178
163260
  module: options.module,
163179
- moduleResolution: options.moduleResolution,
163180
163261
  target: options.target
163181
163262
  }) : createPrinter({
163182
163263
  removeComments: true,
163183
163264
  module: options.module,
163184
- moduleResolution: options.moduleResolution,
163185
163265
  target: options.target
163186
163266
  });
163187
163267
  setEmitFlags(typeNode, 1 /* SingleLine */);
@@ -163437,7 +163517,6 @@ function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options,
163437
163517
  const printer = createSnippetPrinter({
163438
163518
  removeComments: true,
163439
163519
  module: options.module,
163440
- moduleResolution: options.moduleResolution,
163441
163520
  target: options.target,
163442
163521
  newLine: getNewLineKind(newLineChar)
163443
163522
  });
@@ -163624,7 +163703,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
163624
163703
  if (originIsResolvedExport(origin)) {
163625
163704
  sourceDisplay = [textPart(origin.moduleSpecifier)];
163626
163705
  if (importStatementCompletion) {
163627
- ({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences));
163706
+ ({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences));
163628
163707
  isSnippet = preferences.includeCompletionsWithSnippetText ? true : void 0;
163629
163708
  }
163630
163709
  }
@@ -163765,7 +163844,6 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
163765
163844
  const printer = createSnippetPrinter({
163766
163845
  removeComments: true,
163767
163846
  module: options.module,
163768
- moduleResolution: options.moduleResolution,
163769
163847
  target: options.target,
163770
163848
  omitTrailingSemicolon: false,
163771
163849
  newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
@@ -163916,7 +163994,6 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
163916
163994
  const printer = createSnippetPrinter({
163917
163995
  removeComments: true,
163918
163996
  module: options.module,
163919
- moduleResolution: options.moduleResolution,
163920
163997
  target: options.target,
163921
163998
  omitTrailingSemicolon: false,
163922
163999
  newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
@@ -163937,7 +164014,6 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
163937
164014
  const signaturePrinter = createPrinter({
163938
164015
  removeComments: true,
163939
164016
  module: options.module,
163940
- moduleResolution: options.moduleResolution,
163941
164017
  target: options.target,
163942
164018
  omitTrailingSemicolon: true
163943
164019
  });
@@ -164199,7 +164275,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
164199
164275
  };
164200
164276
  return unresolvedOrigin;
164201
164277
  }
164202
- function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences) {
164278
+ function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
164203
164279
  const replacementSpan = importStatementCompletion.replacementSpan;
164204
164280
  const quotedModuleSpecifier = escapeSnippetText(quote(sourceFile, preferences, origin.moduleSpecifier));
164205
164281
  const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
@@ -164207,7 +164283,7 @@ function getInsertTextAndReplacementSpanForImportCompletion(name, importStatemen
164207
164283
  const importKind = ts_codefix_exports.getImportKind(
164208
164284
  sourceFile,
164209
164285
  exportKind,
164210
- program,
164286
+ options,
164211
164287
  /*forceImportKeyword*/
164212
164288
  true
164213
164289
  );
@@ -166586,7 +166662,7 @@ function createNameAndKindSet() {
166586
166662
  }
166587
166663
  function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
166588
166664
  if (isInReferenceComment(sourceFile, position)) {
166589
- const entries = getTripleSlashReferenceCompletion(sourceFile, position, program, host);
166665
+ const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
166590
166666
  return entries && convertPathCompletions(entries);
166591
166667
  }
166592
166668
  if (isInString(sourceFile, position, contextToken)) {
@@ -166909,7 +166985,7 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, prog
166909
166985
  const compilerOptions = program.getCompilerOptions();
166910
166986
  const typeChecker = program.getTypeChecker();
166911
166987
  const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
166912
- return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, program, host, extensionOptions);
166988
+ return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
166913
166989
  }
166914
166990
  function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
166915
166991
  return {
@@ -166920,15 +166996,14 @@ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile
166920
166996
  resolutionMode
166921
166997
  };
166922
166998
  }
166923
- function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) {
166924
- const compilerOptions = program.getCompilerOptions();
166999
+ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) {
166925
167000
  if (compilerOptions.rootDirs) {
166926
167001
  return getCompletionEntriesForDirectoryFragmentWithRootDirs(
166927
167002
  compilerOptions.rootDirs,
166928
167003
  literalValue,
166929
167004
  scriptDirectory,
166930
167005
  extensionOptions,
166931
- program,
167006
+ compilerOptions,
166932
167007
  host,
166933
167008
  scriptPath
166934
167009
  );
@@ -166937,7 +167012,6 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, p
166937
167012
  literalValue,
166938
167013
  scriptDirectory,
166939
167014
  extensionOptions,
166940
- program,
166941
167015
  host,
166942
167016
  /*moduleSpecifierIsRelative*/
166943
167017
  true,
@@ -166964,8 +167038,7 @@ function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ign
166964
167038
  compareStringsCaseSensitive
166965
167039
  );
166966
167040
  }
166967
- function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, program, host, exclude) {
166968
- const compilerOptions = program.getCompilerOptions();
167041
+ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, compilerOptions, host, exclude) {
166969
167042
  const basePath = compilerOptions.project || host.getCurrentDirectory();
166970
167043
  const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
166971
167044
  const baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ignoreCase);
@@ -166974,7 +167047,6 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
166974
167047
  fragment,
166975
167048
  baseDirectory,
166976
167049
  extensionOptions,
166977
- program,
166978
167050
  host,
166979
167051
  /*moduleSpecifierIsRelative*/
166980
167052
  true,
@@ -166983,7 +167055,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
166983
167055
  (itemA, itemB) => itemA.name === itemB.name && itemA.kind === itemB.kind && itemA.extension === itemB.extension
166984
167056
  );
166985
167057
  }
166986
- function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, program, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
167058
+ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
166987
167059
  var _a;
166988
167060
  if (fragment === void 0) {
166989
167061
  fragment = "";
@@ -167008,7 +167080,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
167008
167080
  if (versionPaths) {
167009
167081
  const packageDirectory = getDirectoryPath(packageJsonPath);
167010
167082
  const pathInPackage = absolutePath.slice(ensureTrailingDirectorySeparator(packageDirectory).length);
167011
- if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, program, host, versionPaths)) {
167083
+ if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, host, versionPaths)) {
167012
167084
  return result;
167013
167085
  }
167014
167086
  }
@@ -167034,7 +167106,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
167034
167106
  }
167035
167107
  const { name, extension } = getFilenameWithExtensionOption(
167036
167108
  getBaseFileName(filePath),
167037
- program,
167109
+ host.getCompilationSettings(),
167038
167110
  extensionOptions,
167039
167111
  /*isExportsWildcard*/
167040
167112
  false
@@ -167053,7 +167125,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
167053
167125
  }
167054
167126
  return result;
167055
167127
  }
167056
- function getFilenameWithExtensionOption(name, program, extensionOptions, isExportsWildcard) {
167128
+ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions, isExportsWildcard) {
167057
167129
  const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
167058
167130
  if (nonJsResult) {
167059
167131
  return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
@@ -167063,8 +167135,7 @@ function getFilenameWithExtensionOption(name, program, extensionOptions, isExpor
167063
167135
  }
167064
167136
  let allowedEndings = getModuleSpecifierPreferences(
167065
167137
  { importModuleSpecifierEnding: extensionOptions.endingPreference },
167066
- program,
167067
- program.getCompilerOptions(),
167138
+ compilerOptions,
167068
167139
  extensionOptions.importingSourceFile
167069
167140
  ).getAllowedEndingsInPreferredOrder(extensionOptions.resolutionMode);
167070
167141
  if (isExportsWildcard) {
@@ -167074,16 +167145,16 @@ function getFilenameWithExtensionOption(name, program, extensionOptions, isExpor
167074
167145
  if (fileExtensionIsOneOf(name, supportedTSImplementationExtensions)) {
167075
167146
  return { name, extension: tryGetExtensionFromPath2(name) };
167076
167147
  }
167077
- const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
167148
+ const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
167078
167149
  return outputExtension2 ? { name: changeExtension(name, outputExtension2), extension: outputExtension2 } : { name, extension: tryGetExtensionFromPath2(name) };
167079
167150
  }
167080
167151
  if (!isExportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
167081
167152
  return { name: removeFileExtension(name), extension: tryGetExtensionFromPath2(name) };
167082
167153
  }
167083
- const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
167154
+ const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
167084
167155
  return outputExtension ? { name: changeExtension(name, outputExtension), extension: outputExtension } : { name, extension: tryGetExtensionFromPath2(name) };
167085
167156
  }
167086
- function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, program, host, paths) {
167157
+ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, host, paths) {
167087
167158
  const getPatternsForKey = (key) => paths[key];
167088
167159
  const comparePaths2 = (a, b) => {
167089
167160
  const patternA = tryParsePattern(a);
@@ -167099,14 +167170,13 @@ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensio
167099
167170
  fragment,
167100
167171
  baseDirectory,
167101
167172
  extensionOptions,
167102
- program,
167103
167173
  host,
167104
167174
  getOwnKeys(paths),
167105
167175
  getPatternsForKey,
167106
167176
  comparePaths2
167107
167177
  );
167108
167178
  }
167109
- function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, program, host, keys, getPatternsForKey, comparePaths2) {
167179
+ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
167110
167180
  let pathResults = [];
167111
167181
  let matchedPath;
167112
167182
  for (const key of keys) {
@@ -167125,7 +167195,7 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
167125
167195
  if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(key, matchedPath) !== 1 /* GreaterThan */) {
167126
167196
  pathResults.push({
167127
167197
  matchedPattern: isMatch,
167128
- results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, program, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
167198
+ results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
167129
167199
  });
167130
167200
  }
167131
167201
  }
@@ -167133,9 +167203,7 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
167133
167203
  pathResults.forEach((pathResult) => pathResult.results.forEach((r) => result.add(r)));
167134
167204
  return matchedPath !== void 0;
167135
167205
  }
167136
- function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, program, host, extensionOptions) {
167137
- const typeChecker = program.getTypeChecker();
167138
- const compilerOptions = program.getCompilerOptions();
167206
+ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, compilerOptions, host, extensionOptions, typeChecker) {
167139
167207
  const { baseUrl, paths } = compilerOptions;
167140
167208
  const result = createNameAndKindSet();
167141
167209
  const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
@@ -167145,7 +167213,6 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
167145
167213
  fragment,
167146
167214
  absolute,
167147
167215
  extensionOptions,
167148
- program,
167149
167216
  host,
167150
167217
  /*moduleSpecifierIsRelative*/
167151
167218
  false,
@@ -167156,7 +167223,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
167156
167223
  }
167157
167224
  if (paths) {
167158
167225
  const absolute = getPathsBasePath(compilerOptions, host);
167159
- addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, program, host, paths);
167226
+ addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, host, paths);
167160
167227
  }
167161
167228
  const fragmentDirectory = getFragmentDirectory(fragment);
167162
167229
  for (const ambientName of getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker)) {
@@ -167167,7 +167234,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
167167
167234
  void 0
167168
167235
  ));
167169
167236
  }
167170
- getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result);
167237
+ getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, fragmentDirectory, extensionOptions, result);
167171
167238
  if (moduleResolutionUsesNodeModules(moduleResolution)) {
167172
167239
  let foundGlobal = false;
167173
167240
  if (fragmentDirectory === void 0) {
@@ -167192,7 +167259,6 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
167192
167259
  fragment,
167193
167260
  nodeModules,
167194
167261
  extensionOptions,
167195
- program,
167196
167262
  host,
167197
167263
  /*moduleSpecifierIsRelative*/
167198
167264
  false,
@@ -167237,7 +167303,6 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
167237
167303
  fragmentSubpath,
167238
167304
  packageDirectory,
167239
167305
  extensionOptions,
167240
- program,
167241
167306
  host,
167242
167307
  keys,
167243
167308
  (key) => singleElementArray(getPatternFromFirstMatchingCondition(exports2[key], conditions)),
@@ -167270,7 +167335,7 @@ function getPatternFromFirstMatchingCondition(target, conditions) {
167270
167335
  function getFragmentDirectory(fragment) {
167271
167336
  return containsSlash(fragment) ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
167272
167337
  }
167273
- function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, program, host) {
167338
+ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, host) {
167274
167339
  if (!endsWith(path, "*")) {
167275
167340
  return !path.includes("*") ? justPathMappingName(path, "script" /* scriptElement */) : emptyArray;
167276
167341
  }
@@ -167280,15 +167345,15 @@ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory
167280
167345
  const starIsFullPathComponent = path[path.length - 2] === "/";
167281
167346
  return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
167282
167347
  var _a;
167283
- return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
167348
+ return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
167284
167349
  });
167285
167350
  }
167286
- return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host));
167351
+ return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host));
167287
167352
  function justPathMappingName(name, kind) {
167288
167353
  return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray;
167289
167354
  }
167290
167355
  }
167291
- function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host) {
167356
+ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host) {
167292
167357
  if (!host.readDirectory) {
167293
167358
  return void 0;
167294
167359
  }
@@ -167321,7 +167386,7 @@ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensio
167321
167386
  if (containsSlash(trimmedWithPattern)) {
167322
167387
  return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
167323
167388
  }
167324
- const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, program, extensionOptions, isExportsWildcard);
167389
+ const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, host.getCompilationSettings(), extensionOptions, isExportsWildcard);
167325
167390
  return nameAndKind(name, "script" /* scriptElement */, extension);
167326
167391
  }
167327
167392
  });
@@ -167349,8 +167414,7 @@ function getAmbientModuleCompletions(fragment, fragmentDirectory, checker) {
167349
167414
  }
167350
167415
  return nonRelativeModuleNames;
167351
167416
  }
167352
- function getTripleSlashReferenceCompletion(sourceFile, position, program, host) {
167353
- const compilerOptions = program.getCompilerOptions();
167417
+ function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) {
167354
167418
  const token = getTokenAtPosition(sourceFile, position);
167355
167419
  const commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
167356
167420
  const range = commentRanges && find(commentRanges, (commentRange) => position >= commentRange.pos && position <= commentRange.end);
@@ -167368,16 +167432,14 @@ function getTripleSlashReferenceCompletion(sourceFile, position, program, host)
167368
167432
  toComplete,
167369
167433
  scriptPath,
167370
167434
  getExtensionOptions(compilerOptions, 0 /* Filename */, sourceFile),
167371
- program,
167372
167435
  host,
167373
167436
  /*moduleSpecifierIsRelative*/
167374
167437
  true,
167375
167438
  sourceFile.path
167376
- ) : kind === "types" ? getCompletionEntriesFromTypings(host, program, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
167439
+ ) : kind === "types" ? getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
167377
167440
  return addReplacementSpans(toComplete, range.pos + prefix.length, arrayFrom(names.values()));
167378
167441
  }
167379
- function getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
167380
- const options = program.getCompilerOptions();
167442
+ function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
167381
167443
  const seen = /* @__PURE__ */ new Map();
167382
167444
  const typeRoots = tryAndIgnoreErrors(() => getEffectiveTypeRoots(options, host)) || emptyArray;
167383
167445
  for (const root of typeRoots) {
@@ -167411,7 +167473,6 @@ function getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDire
167411
167473
  remainingFragment,
167412
167474
  baseDirectory,
167413
167475
  extensionOptions,
167414
- program,
167415
167476
  host,
167416
167477
  /*moduleSpecifierIsRelative*/
167417
167478
  false,
@@ -178761,7 +178822,6 @@ __export(ts_exports2, {
178761
178822
  canHaveJSDoc: () => canHaveJSDoc,
178762
178823
  canHaveLocals: () => canHaveLocals,
178763
178824
  canHaveModifiers: () => canHaveModifiers,
178764
- canHaveModuleSpecifier: () => canHaveModuleSpecifier,
178765
178825
  canHaveSymbol: () => canHaveSymbol,
178766
178826
  canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics,
178767
178827
  canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
@@ -179238,7 +179298,6 @@ __export(ts_exports2, {
179238
179298
  getDefaultLibFilePath: () => getDefaultLibFilePath,
179239
179299
  getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
179240
179300
  getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
179241
- getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
179242
179301
  getDiagnosticText: () => getDiagnosticText,
179243
179302
  getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
179244
179303
  getDirectoryPath: () => getDirectoryPath,
@@ -179269,7 +179328,6 @@ __export(ts_exports2, {
179269
179328
  getEmitFlags: () => getEmitFlags,
179270
179329
  getEmitHelpers: () => getEmitHelpers,
179271
179330
  getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
179272
- getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
179273
179331
  getEmitModuleKind: () => getEmitModuleKind,
179274
179332
  getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
179275
179333
  getEmitScriptTarget: () => getEmitScriptTarget,
@@ -179320,7 +179378,6 @@ __export(ts_exports2, {
179320
179378
  getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
179321
179379
  getIdentifierTypeArguments: () => getIdentifierTypeArguments,
179322
179380
  getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
179323
- getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
179324
179381
  getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
179325
179382
  getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
179326
179383
  getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
@@ -179428,6 +179485,7 @@ __export(ts_exports2, {
179428
179485
  getNameOfScriptTarget: () => getNameOfScriptTarget,
179429
179486
  getNameOrArgument: () => getNameOrArgument,
179430
179487
  getNameTable: () => getNameTable,
179488
+ getNamesForExportedSymbol: () => getNamesForExportedSymbol,
179431
179489
  getNamespaceDeclarationNode: () => getNamespaceDeclarationNode,
179432
179490
  getNewLineCharacter: () => getNewLineCharacter,
179433
179491
  getNewLineKind: () => getNewLineKind,
@@ -179444,6 +179502,7 @@ __export(ts_exports2, {
179444
179502
  getNonAssignmentOperatorForCompoundAssignment: () => getNonAssignmentOperatorForCompoundAssignment,
179445
179503
  getNonAugmentationDeclaration: () => getNonAugmentationDeclaration,
179446
179504
  getNonDecoratorTokenPosOfNode: () => getNonDecoratorTokenPosOfNode,
179505
+ getNonIncrementalBuildInfoRoots: () => getNonIncrementalBuildInfoRoots,
179447
179506
  getNormalizedAbsolutePath: () => getNormalizedAbsolutePath,
179448
179507
  getNormalizedAbsolutePathWithoutRoot: () => getNormalizedAbsolutePathWithoutRoot,
179449
179508
  getNormalizedPathComponents: () => getNormalizedPathComponents,
@@ -179679,7 +179738,6 @@ __export(ts_exports2, {
179679
179738
  importDefaultHelper: () => importDefaultHelper,
179680
179739
  importFromModuleSpecifier: () => importFromModuleSpecifier,
179681
179740
  importStarHelper: () => importStarHelper,
179682
- importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
179683
179741
  indexOfAnyCharCode: () => indexOfAnyCharCode,
179684
179742
  indexOfNode: () => indexOfNode,
179685
179743
  indicesOf: () => indicesOf,
@@ -180155,6 +180213,7 @@ __export(ts_exports2, {
180155
180213
  isNonExportDefaultModifier: () => isNonExportDefaultModifier,
180156
180214
  isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
180157
180215
  isNonGlobalDeclaration: () => isNonGlobalDeclaration,
180216
+ isNonIncrementalBuildInfo: () => isNonIncrementalBuildInfo,
180158
180217
  isNonNullAccess: () => isNonNullAccess,
180159
180218
  isNonNullChain: () => isNonNullChain,
180160
180219
  isNonNullExpression: () => isNonNullExpression,
@@ -180267,6 +180326,7 @@ __export(ts_exports2, {
180267
180326
  isSimpleParameter: () => isSimpleParameter,
180268
180327
  isSimpleParameterList: () => isSimpleParameterList,
180269
180328
  isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
180329
+ isSourceElement: () => isSourceElement,
180270
180330
  isSourceFile: () => isSourceFile,
180271
180331
  isSourceFileFromLibrary: () => isSourceFileFromLibrary,
180272
180332
  isSourceFileJS: () => isSourceFileJS,
@@ -180400,7 +180460,6 @@ __export(ts_exports2, {
180400
180460
  linkNamePart: () => linkNamePart,
180401
180461
  linkPart: () => linkPart,
180402
180462
  linkTextPart: () => linkTextPart,
180403
- listFiles: () => listFiles,
180404
180463
  loadModuleFromGlobalCache: () => loadModuleFromGlobalCache,
180405
180464
  loadWithModeAwareCache: () => loadWithModeAwareCache,
180406
180465
  makeIdentifierFromModuleName: () => makeIdentifierFromModuleName,
@@ -180479,6 +180538,7 @@ __export(ts_exports2, {
180479
180538
  noopFileWatcher: () => noopFileWatcher,
180480
180539
  normalizePath: () => normalizePath,
180481
180540
  normalizeSlashes: () => normalizeSlashes,
180541
+ normalizeSpans: () => normalizeSpans,
180482
180542
  not: () => not,
180483
180543
  notImplemented: () => notImplemented,
180484
180544
  notImplementedResolver: () => notImplementedResolver,
@@ -180530,7 +180590,6 @@ __export(ts_exports2, {
180530
180590
  pathIsBareSpecifier: () => pathIsBareSpecifier,
180531
180591
  pathIsRelative: () => pathIsRelative,
180532
180592
  patternText: () => patternText,
180533
- perfLogger: () => perfLogger,
180534
180593
  performIncrementalCompilation: () => performIncrementalCompilation,
180535
180594
  performance: () => ts_performance_exports,
180536
180595
  plainJSErrors: () => plainJSErrors,
@@ -180738,7 +180797,10 @@ __export(ts_exports2, {
180738
180797
  textOrKeywordPart: () => textOrKeywordPart,
180739
180798
  textPart: () => textPart,
180740
180799
  textRangeContainsPositionInclusive: () => textRangeContainsPositionInclusive,
180800
+ textRangeContainsTextSpan: () => textRangeContainsTextSpan,
180801
+ textRangeIntersectsWithTextSpan: () => textRangeIntersectsWithTextSpan,
180741
180802
  textSpanContainsPosition: () => textSpanContainsPosition,
180803
+ textSpanContainsTextRange: () => textSpanContainsTextRange,
180742
180804
  textSpanContainsTextSpan: () => textSpanContainsTextSpan,
180743
180805
  textSpanEnd: () => textSpanEnd,
180744
180806
  textSpanIntersection: () => textSpanIntersection,
@@ -180779,11 +180841,11 @@ __export(ts_exports2, {
180779
180841
  transformESDecorators: () => transformESDecorators,
180780
180842
  transformESNext: () => transformESNext,
180781
180843
  transformGenerators: () => transformGenerators,
180782
- transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
180783
180844
  transformJsx: () => transformJsx,
180784
180845
  transformLegacyDecorators: () => transformLegacyDecorators,
180785
180846
  transformModule: () => transformModule,
180786
180847
  transformNamedEvaluation: () => transformNamedEvaluation,
180848
+ transformNodeModule: () => transformNodeModule,
180787
180849
  transformNodes: () => transformNodes,
180788
180850
  transformSystemModule: () => transformSystemModule,
180789
180851
  transformTypeScript: () => transformTypeScript,
@@ -181615,14 +181677,11 @@ var ThrottledOperations = class _ThrottledOperations {
181615
181677
  return this.pendingTimeouts.delete(operationId);
181616
181678
  }
181617
181679
  static run(operationId, self, cb) {
181618
- var _a, _b;
181619
- (_a = perfLogger) == null ? void 0 : _a.logStartScheduledOperation(operationId);
181620
181680
  self.pendingTimeouts.delete(operationId);
181621
181681
  if (self.logger) {
181622
181682
  self.logger.info(`Running: ${operationId}`);
181623
181683
  }
181624
181684
  cb();
181625
- (_b = perfLogger) == null ? void 0 : _b.logStopScheduledOperation();
181626
181685
  }
181627
181686
  };
181628
181687
  var GcTimer = class _GcTimer {
@@ -181638,9 +181697,7 @@ var GcTimer = class _GcTimer {
181638
181697
  this.timerId = this.host.setTimeout(_GcTimer.run, this.delay, this);
181639
181698
  }
181640
181699
  static run(self) {
181641
- var _a, _b;
181642
181700
  self.timerId = void 0;
181643
- (_a = perfLogger) == null ? void 0 : _a.logStartScheduledOperation("GC collect");
181644
181701
  const log = self.logger.hasLevel(2 /* requestTime */);
181645
181702
  const before = log && self.host.getMemoryUsage();
181646
181703
  self.host.gc();
@@ -181648,7 +181705,6 @@ var GcTimer = class _GcTimer {
181648
181705
  const after = self.host.getMemoryUsage();
181649
181706
  self.logger.perftrc(`GC::before ${before}, after ${after}`);
181650
181707
  }
181651
- (_b = perfLogger) == null ? void 0 : _b.logStopScheduledOperation();
181652
181708
  }
181653
181709
  };
181654
181710
  function getBaseConfigFileName(configFilePath) {
@@ -181682,7 +181738,7 @@ __export(ts_server_protocol_exports, {
181682
181738
  NewLineKind: () => NewLineKind2,
181683
181739
  OrganizeImportsMode: () => OrganizeImportsMode,
181684
181740
  PollingWatchKind: () => PollingWatchKind2,
181685
- ScriptTarget: () => ScriptTarget11,
181741
+ ScriptTarget: () => ScriptTarget10,
181686
181742
  SemicolonPreference: () => SemicolonPreference,
181687
181743
  WatchDirectoryKind: () => WatchDirectoryKind2,
181688
181744
  WatchFileKind: () => WatchFileKind2
@@ -181873,24 +181929,24 @@ var NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
181873
181929
  NewLineKind3["Lf"] = "Lf";
181874
181930
  return NewLineKind3;
181875
181931
  })(NewLineKind2 || {});
181876
- var ScriptTarget11 = /* @__PURE__ */ ((ScriptTarget12) => {
181877
- ScriptTarget12["ES3"] = "es3";
181878
- ScriptTarget12["ES5"] = "es5";
181879
- ScriptTarget12["ES6"] = "es6";
181880
- ScriptTarget12["ES2015"] = "es2015";
181881
- ScriptTarget12["ES2016"] = "es2016";
181882
- ScriptTarget12["ES2017"] = "es2017";
181883
- ScriptTarget12["ES2018"] = "es2018";
181884
- ScriptTarget12["ES2019"] = "es2019";
181885
- ScriptTarget12["ES2020"] = "es2020";
181886
- ScriptTarget12["ES2021"] = "es2021";
181887
- ScriptTarget12["ES2022"] = "es2022";
181888
- ScriptTarget12["ES2023"] = "es2023";
181889
- ScriptTarget12["ESNext"] = "esnext";
181890
- ScriptTarget12["JSON"] = "json";
181891
- ScriptTarget12["Latest"] = "esnext" /* ESNext */;
181892
- return ScriptTarget12;
181893
- })(ScriptTarget11 || {});
181932
+ var ScriptTarget10 = /* @__PURE__ */ ((ScriptTarget11) => {
181933
+ ScriptTarget11["ES3"] = "es3";
181934
+ ScriptTarget11["ES5"] = "es5";
181935
+ ScriptTarget11["ES6"] = "es6";
181936
+ ScriptTarget11["ES2015"] = "es2015";
181937
+ ScriptTarget11["ES2016"] = "es2016";
181938
+ ScriptTarget11["ES2017"] = "es2017";
181939
+ ScriptTarget11["ES2018"] = "es2018";
181940
+ ScriptTarget11["ES2019"] = "es2019";
181941
+ ScriptTarget11["ES2020"] = "es2020";
181942
+ ScriptTarget11["ES2021"] = "es2021";
181943
+ ScriptTarget11["ES2022"] = "es2022";
181944
+ ScriptTarget11["ES2023"] = "es2023";
181945
+ ScriptTarget11["ESNext"] = "esnext";
181946
+ ScriptTarget11["JSON"] = "json";
181947
+ ScriptTarget11["Latest"] = "esnext" /* ESNext */;
181948
+ return ScriptTarget11;
181949
+ })(ScriptTarget10 || {});
181894
181950
  {
181895
181951
  }
181896
181952
 
@@ -183375,9 +183431,8 @@ var Project3 = class _Project {
183375
183431
  * @returns: true if set of files in the project stays the same and false - otherwise.
183376
183432
  */
183377
183433
  updateGraph() {
183378
- var _a, _b, _c, _d;
183434
+ var _a, _b;
183379
183435
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "updateGraph", { name: this.projectName, kind: ProjectKind[this.projectKind] });
183380
- (_b = perfLogger) == null ? void 0 : _b.logStartUpdateGraph();
183381
183436
  this.resolutionCache.startRecordingFilesWithChangedResolutions();
183382
183437
  const hasNewProgram = this.updateGraphWorker();
183383
183438
  const hasAddedorRemovedFiles = this.hasAddedorRemovedFiles;
@@ -183405,8 +183460,7 @@ var Project3 = class _Project {
183405
183460
  if (isFirstProgramLoad) {
183406
183461
  this.getPackageJsonAutoImportProvider();
183407
183462
  }
183408
- (_c = perfLogger) == null ? void 0 : _c.logStopUpdateGraph();
183409
- (_d = tracing) == null ? void 0 : _d.pop();
183463
+ (_b = tracing) == null ? void 0 : _b.pop();
183410
183464
  return !hasNewProgram;
183411
183465
  }
183412
183466
  /** @internal */
@@ -189099,6 +189153,9 @@ var invalidSyntacticModeCommands = [
189099
189153
  var Session3 = class _Session {
189100
189154
  constructor(opts) {
189101
189155
  this.changeSeq = 0;
189156
+ // Minimum number of lines for attempting to use region diagnostics for a file.
189157
+ /** @internal */
189158
+ this.regionDiagLineCountThreshold = 500;
189102
189159
  this.handlers = new Map(Object.entries({
189103
189160
  // TODO(jakebailey): correctly type the handlers
189104
189161
  ["status" /* Status */]: () => {
@@ -189969,9 +190026,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
189969
190026
  this.writeMessage(msg);
189970
190027
  }
189971
190028
  writeMessage(msg) {
189972
- var _a;
189973
190029
  const msgText = formatMessage2(msg, this.logger, this.byteLength, this.host.newLine);
189974
- (_a = perfLogger) == null ? void 0 : _a.logEvent(`Response message size: ${msgText.length}`);
189975
190030
  this.host.write(msgText);
189976
190031
  }
189977
190032
  event(body, eventName) {
@@ -190015,32 +190070,70 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
190015
190070
  }
190016
190071
  semanticCheck(file, project) {
190017
190072
  var _a, _b;
190073
+ const diagnosticsStartTime = this.hrtime();
190018
190074
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "semanticCheck", { file, configFilePath: project.canonicalConfigFilePath });
190019
190075
  const diags = isDeclarationFileInJSOnlyNonConfiguredProject(project, file) ? emptyArray2 : project.getLanguageService().getSemanticDiagnostics(file).filter((d) => !!d.file);
190020
- this.sendDiagnosticsEvent(file, project, diags, "semanticDiag");
190076
+ this.sendDiagnosticsEvent(file, project, diags, "semanticDiag", diagnosticsStartTime);
190021
190077
  (_b = tracing) == null ? void 0 : _b.pop();
190022
190078
  }
190023
190079
  syntacticCheck(file, project) {
190024
190080
  var _a, _b;
190081
+ const diagnosticsStartTime = this.hrtime();
190025
190082
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "syntacticCheck", { file, configFilePath: project.canonicalConfigFilePath });
190026
- this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag");
190083
+ this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag", diagnosticsStartTime);
190027
190084
  (_b = tracing) == null ? void 0 : _b.pop();
190028
190085
  }
190029
190086
  suggestionCheck(file, project) {
190030
190087
  var _a, _b;
190088
+ const diagnosticsStartTime = this.hrtime();
190031
190089
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "suggestionCheck", { file, configFilePath: project.canonicalConfigFilePath });
190032
- this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag");
190090
+ this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag", diagnosticsStartTime);
190033
190091
  (_b = tracing) == null ? void 0 : _b.pop();
190034
190092
  }
190035
- sendDiagnosticsEvent(file, project, diagnostics, kind) {
190093
+ regionSemanticCheck(file, project, ranges) {
190094
+ var _a, _b, _c;
190095
+ const diagnosticsStartTime = this.hrtime();
190096
+ (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "regionSemanticCheck", { file, configFilePath: project.canonicalConfigFilePath });
190097
+ let diagnosticsResult;
190098
+ if (!this.shouldDoRegionCheck(file) || !(diagnosticsResult = project.getLanguageService().getRegionSemanticDiagnostics(file, ranges))) {
190099
+ (_b = tracing) == null ? void 0 : _b.pop();
190100
+ return;
190101
+ }
190102
+ this.sendDiagnosticsEvent(file, project, diagnosticsResult.diagnostics, "regionSemanticDiag", diagnosticsStartTime, diagnosticsResult.spans);
190103
+ (_c = tracing) == null ? void 0 : _c.pop();
190104
+ return;
190105
+ }
190106
+ // We should only do the region-based semantic check if we think it would be
190107
+ // considerably faster than a whole-file semantic check.
190108
+ /** @internal */
190109
+ shouldDoRegionCheck(file) {
190110
+ var _a;
190111
+ const lineCount = (_a = this.projectService.getScriptInfoForNormalizedPath(file)) == null ? void 0 : _a.textStorage.getLineInfo().getLineCount();
190112
+ return !!(lineCount && lineCount >= this.regionDiagLineCountThreshold);
190113
+ }
190114
+ sendDiagnosticsEvent(file, project, diagnostics, kind, diagnosticsStartTime, spans) {
190036
190115
  try {
190037
- this.event({ file, diagnostics: diagnostics.map((diag2) => formatDiag(file, project, diag2)) }, kind);
190116
+ const scriptInfo = Debug.checkDefined(project.getScriptInfo(file));
190117
+ const duration = hrTimeToMilliseconds(this.hrtime(diagnosticsStartTime));
190118
+ const body = {
190119
+ file,
190120
+ diagnostics: diagnostics.map((diag2) => formatDiag(file, project, diag2)),
190121
+ spans: spans == null ? void 0 : spans.map((span) => toProtocolTextSpan(span, scriptInfo)),
190122
+ duration
190123
+ };
190124
+ this.event(
190125
+ body,
190126
+ kind
190127
+ );
190038
190128
  } catch (err) {
190039
190129
  this.logError(err, kind);
190040
190130
  }
190041
190131
  }
190042
190132
  /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */
190043
190133
  updateErrorCheck(next, checkList, ms, requireOpen = true) {
190134
+ if (checkList.length === 0) {
190135
+ return;
190136
+ }
190044
190137
  Debug.assert(!this.suppressDiagnosticEvents);
190045
190138
  const seq = this.changeSeq;
190046
190139
  const followMs = Math.min(ms, 200);
@@ -190048,20 +190141,36 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
190048
190141
  const goNext = () => {
190049
190142
  index++;
190050
190143
  if (checkList.length > index) {
190051
- next.delay("checkOne", followMs, checkOne);
190144
+ return next.delay("checkOne", followMs, checkOne);
190052
190145
  }
190053
190146
  };
190147
+ const doSemanticCheck = (fileName, project) => {
190148
+ this.semanticCheck(fileName, project);
190149
+ if (this.changeSeq !== seq) {
190150
+ return;
190151
+ }
190152
+ if (this.getPreferences(fileName).disableSuggestions) {
190153
+ return goNext();
190154
+ }
190155
+ next.immediate("suggestionCheck", () => {
190156
+ this.suggestionCheck(fileName, project);
190157
+ goNext();
190158
+ });
190159
+ };
190054
190160
  const checkOne = () => {
190055
190161
  if (this.changeSeq !== seq) {
190056
190162
  return;
190057
190163
  }
190164
+ let ranges;
190058
190165
  let item = checkList[index];
190059
190166
  if (isString(item)) {
190060
190167
  item = this.toPendingErrorCheck(item);
190061
- if (!item) {
190062
- goNext();
190063
- return;
190064
- }
190168
+ } else if ("ranges" in item) {
190169
+ ranges = item.ranges;
190170
+ item = this.toPendingErrorCheck(item.file);
190171
+ }
190172
+ if (!item) {
190173
+ return goNext();
190065
190174
  }
190066
190175
  const { fileName, project } = item;
190067
190176
  updateProjectIfDirty(project);
@@ -190073,23 +190182,21 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
190073
190182
  return;
190074
190183
  }
190075
190184
  if (project.projectService.serverMode !== 0 /* Semantic */) {
190076
- goNext();
190077
- return;
190185
+ return goNext();
190078
190186
  }
190079
- next.immediate("semanticCheck", () => {
190080
- this.semanticCheck(fileName, project);
190081
- if (this.changeSeq !== seq) {
190082
- return;
190083
- }
190084
- if (this.getPreferences(fileName).disableSuggestions) {
190085
- goNext();
190086
- return;
190087
- }
190088
- next.immediate("suggestionCheck", () => {
190089
- this.suggestionCheck(fileName, project);
190090
- goNext();
190187
+ if (ranges) {
190188
+ return next.immediate("regionSemanticCheck", () => {
190189
+ const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(fileName);
190190
+ if (scriptInfo) {
190191
+ this.regionSemanticCheck(fileName, project, ranges.map((range) => this.getRange({ file: fileName, ...range }, scriptInfo)));
190192
+ }
190193
+ if (this.changeSeq !== seq) {
190194
+ return;
190195
+ }
190196
+ next.immediate("semanticCheck", () => doSemanticCheck(fileName, project));
190091
190197
  });
190092
- });
190198
+ }
190199
+ next.immediate("semanticCheck", () => doSemanticCheck(fileName, project));
190093
190200
  };
190094
190201
  if (checkList.length > index && this.changeSeq === seq) {
190095
190202
  next.delay("checkOne", ms, checkOne);
@@ -191168,12 +191275,12 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
191168
191275
  const project = this.projectService.tryGetDefaultProjectForFile(fileName);
191169
191276
  return project && { fileName, project };
191170
191277
  }
191171
- getDiagnostics(next, delay, fileNames) {
191278
+ getDiagnostics(next, delay, fileArgs) {
191172
191279
  if (this.suppressDiagnosticEvents) {
191173
191280
  return;
191174
191281
  }
191175
- if (fileNames.length > 0) {
191176
- this.updateErrorCheck(next, fileNames, delay);
191282
+ if (fileArgs.length > 0) {
191283
+ this.updateErrorCheck(next, fileArgs, delay);
191177
191284
  }
191178
191285
  }
191179
191286
  change(args) {
@@ -191809,7 +191916,7 @@ ${e.message}`;
191809
191916
  }
191810
191917
  }
191811
191918
  onMessage(message) {
191812
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
191919
+ var _a, _b, _c, _d, _e, _f, _g;
191813
191920
  this.gcTimer.scheduleCollect();
191814
191921
  this.performanceData = void 0;
191815
191922
  let start;
@@ -191825,8 +191932,7 @@ ${e.message}`;
191825
191932
  request = this.parseMessage(message);
191826
191933
  relevantFile = request.arguments && request.arguments.file ? request.arguments : void 0;
191827
191934
  (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.Session, "request", { seq: request.seq, command: request.command });
191828
- (_b = perfLogger) == null ? void 0 : _b.logStartCommand("" + request.command, this.toStringMessage(message).substring(0, 100));
191829
- (_c = tracing) == null ? void 0 : _c.push(
191935
+ (_b = tracing) == null ? void 0 : _b.push(
191830
191936
  tracing.Phase.Session,
191831
191937
  "executeCommand",
191832
191938
  { seq: request.seq, command: request.command },
@@ -191834,7 +191940,7 @@ ${e.message}`;
191834
191940
  true
191835
191941
  );
191836
191942
  const { response, responseRequired } = this.executeCommand(request);
191837
- (_d = tracing) == null ? void 0 : _d.pop();
191943
+ (_c = tracing) == null ? void 0 : _c.pop();
191838
191944
  if (this.logger.hasLevel(2 /* requestTime */)) {
191839
191945
  const elapsedTime = hrTimeToMilliseconds(this.hrtime(start)).toFixed(4);
191840
191946
  if (responseRequired) {
@@ -191843,8 +191949,7 @@ ${e.message}`;
191843
191949
  this.logger.perftrc(`${request.seq}::${request.command}: async elapsed time (in milliseconds) ${elapsedTime}`);
191844
191950
  }
191845
191951
  }
191846
- (_e = perfLogger) == null ? void 0 : _e.logStopCommand("" + request.command, "Success");
191847
- (_f = tracing) == null ? void 0 : _f.instant(tracing.Phase.Session, "response", { seq: request.seq, command: request.command, success: !!response });
191952
+ (_d = tracing) == null ? void 0 : _d.instant(tracing.Phase.Session, "response", { seq: request.seq, command: request.command, success: !!response });
191848
191953
  if (response) {
191849
191954
  this.doOutput(
191850
191955
  response,
@@ -191865,10 +191970,9 @@ ${e.message}`;
191865
191970
  );
191866
191971
  }
191867
191972
  } catch (err) {
191868
- (_g = tracing) == null ? void 0 : _g.popAll();
191973
+ (_e = tracing) == null ? void 0 : _e.popAll();
191869
191974
  if (err instanceof OperationCanceledException) {
191870
- (_h = perfLogger) == null ? void 0 : _h.logStopCommand("" + (request && request.command), "Canceled: " + err);
191871
- (_i = tracing) == null ? void 0 : _i.instant(tracing.Phase.Session, "commandCanceled", { seq: request == null ? void 0 : request.seq, command: request == null ? void 0 : request.command });
191975
+ (_f = tracing) == null ? void 0 : _f.instant(tracing.Phase.Session, "commandCanceled", { seq: request == null ? void 0 : request.seq, command: request == null ? void 0 : request.command });
191872
191976
  this.doOutput(
191873
191977
  { canceled: true },
191874
191978
  request.command,
@@ -191879,8 +191983,7 @@ ${e.message}`;
191879
191983
  return;
191880
191984
  }
191881
191985
  this.logErrorWorker(err, this.toStringMessage(message), relevantFile);
191882
- (_j = perfLogger) == null ? void 0 : _j.logStopCommand("" + (request && request.command), "Error: " + err);
191883
- (_k = tracing) == null ? void 0 : _k.instant(tracing.Phase.Session, "commandError", { seq: request == null ? void 0 : request.seq, command: request == null ? void 0 : request.command, message: err.message });
191986
+ (_g = tracing) == null ? void 0 : _g.instant(tracing.Phase.Session, "commandError", { seq: request == null ? void 0 : request.seq, command: request == null ? void 0 : request.command, message: err.message });
191884
191987
  this.doOutput(
191885
191988
  /*info*/
191886
191989
  void 0,
@@ -193200,7 +193303,6 @@ if (typeof console !== "undefined") {
193200
193303
  canHaveJSDoc,
193201
193304
  canHaveLocals,
193202
193305
  canHaveModifiers,
193203
- canHaveModuleSpecifier,
193204
193306
  canHaveSymbol,
193205
193307
  canIncludeBindAndCheckDiagnostics,
193206
193308
  canJsonReportNoInputFiles,
@@ -193677,7 +193779,6 @@ if (typeof console !== "undefined") {
193677
193779
  getDefaultLibFilePath,
193678
193780
  getDefaultLikeExportInfo,
193679
193781
  getDefaultLikeExportNameFromDeclaration,
193680
- getDefaultResolutionModeForFileWorker,
193681
193782
  getDiagnosticText,
193682
193783
  getDiagnosticsWithinSpan,
193683
193784
  getDirectoryPath,
@@ -193708,7 +193809,6 @@ if (typeof console !== "undefined") {
193708
193809
  getEmitFlags,
193709
193810
  getEmitHelpers,
193710
193811
  getEmitModuleDetectionKind,
193711
- getEmitModuleFormatOfFileWorker,
193712
193812
  getEmitModuleKind,
193713
193813
  getEmitModuleResolutionKind,
193714
193814
  getEmitScriptTarget,
@@ -193759,7 +193859,6 @@ if (typeof console !== "undefined") {
193759
193859
  getIdentifierGeneratedImportReference,
193760
193860
  getIdentifierTypeArguments,
193761
193861
  getImmediatelyInvokedFunctionExpression,
193762
- getImpliedNodeFormatForEmitWorker,
193763
193862
  getImpliedNodeFormatForFile,
193764
193863
  getImpliedNodeFormatForFileWorker,
193765
193864
  getImportNeedsImportDefaultHelper,
@@ -193867,6 +193966,7 @@ if (typeof console !== "undefined") {
193867
193966
  getNameOfScriptTarget,
193868
193967
  getNameOrArgument,
193869
193968
  getNameTable,
193969
+ getNamesForExportedSymbol,
193870
193970
  getNamespaceDeclarationNode,
193871
193971
  getNewLineCharacter,
193872
193972
  getNewLineKind,
@@ -193883,6 +193983,7 @@ if (typeof console !== "undefined") {
193883
193983
  getNonAssignmentOperatorForCompoundAssignment,
193884
193984
  getNonAugmentationDeclaration,
193885
193985
  getNonDecoratorTokenPosOfNode,
193986
+ getNonIncrementalBuildInfoRoots,
193886
193987
  getNormalizedAbsolutePath,
193887
193988
  getNormalizedAbsolutePathWithoutRoot,
193888
193989
  getNormalizedPathComponents,
@@ -194118,7 +194219,6 @@ if (typeof console !== "undefined") {
194118
194219
  importDefaultHelper,
194119
194220
  importFromModuleSpecifier,
194120
194221
  importStarHelper,
194121
- importSyntaxAffectsModuleResolution,
194122
194222
  indexOfAnyCharCode,
194123
194223
  indexOfNode,
194124
194224
  indicesOf,
@@ -194594,6 +194694,7 @@ if (typeof console !== "undefined") {
194594
194694
  isNonExportDefaultModifier,
194595
194695
  isNonGlobalAmbientModule,
194596
194696
  isNonGlobalDeclaration,
194697
+ isNonIncrementalBuildInfo,
194597
194698
  isNonNullAccess,
194598
194699
  isNonNullChain,
194599
194700
  isNonNullExpression,
@@ -194706,6 +194807,7 @@ if (typeof console !== "undefined") {
194706
194807
  isSimpleParameter,
194707
194808
  isSimpleParameterList,
194708
194809
  isSingleOrDoubleQuote,
194810
+ isSourceElement,
194709
194811
  isSourceFile,
194710
194812
  isSourceFileFromLibrary,
194711
194813
  isSourceFileJS,
@@ -194839,7 +194941,6 @@ if (typeof console !== "undefined") {
194839
194941
  linkNamePart,
194840
194942
  linkPart,
194841
194943
  linkTextPart,
194842
- listFiles,
194843
194944
  loadModuleFromGlobalCache,
194844
194945
  loadWithModeAwareCache,
194845
194946
  makeIdentifierFromModuleName,
@@ -194918,6 +195019,7 @@ if (typeof console !== "undefined") {
194918
195019
  noopFileWatcher,
194919
195020
  normalizePath,
194920
195021
  normalizeSlashes,
195022
+ normalizeSpans,
194921
195023
  not,
194922
195024
  notImplemented,
194923
195025
  notImplementedResolver,
@@ -194969,7 +195071,6 @@ if (typeof console !== "undefined") {
194969
195071
  pathIsBareSpecifier,
194970
195072
  pathIsRelative,
194971
195073
  patternText,
194972
- perfLogger,
194973
195074
  performIncrementalCompilation,
194974
195075
  performance,
194975
195076
  plainJSErrors,
@@ -195177,7 +195278,10 @@ if (typeof console !== "undefined") {
195177
195278
  textOrKeywordPart,
195178
195279
  textPart,
195179
195280
  textRangeContainsPositionInclusive,
195281
+ textRangeContainsTextSpan,
195282
+ textRangeIntersectsWithTextSpan,
195180
195283
  textSpanContainsPosition,
195284
+ textSpanContainsTextRange,
195181
195285
  textSpanContainsTextSpan,
195182
195286
  textSpanEnd,
195183
195287
  textSpanIntersection,
@@ -195218,11 +195322,11 @@ if (typeof console !== "undefined") {
195218
195322
  transformESDecorators,
195219
195323
  transformESNext,
195220
195324
  transformGenerators,
195221
- transformImpliedNodeFormatDependentModule,
195222
195325
  transformJsx,
195223
195326
  transformLegacyDecorators,
195224
195327
  transformModule,
195225
195328
  transformNamedEvaluation,
195329
+ transformNodeModule,
195226
195330
  transformNodes,
195227
195331
  transformSystemModule,
195228
195332
  transformTypeScript,