typescript 5.6.0-dev.20240613 → 5.6.0-dev.20240615

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,
@@ -2180,6 +2178,7 @@ __export(typescript_exports, {
2180
2178
  skipPartiallyEmittedExpressions: () => skipPartiallyEmittedExpressions,
2181
2179
  skipTrivia: () => skipTrivia,
2182
2180
  skipTypeChecking: () => skipTypeChecking,
2181
+ skipTypeCheckingIgnoringNoCheck: () => skipTypeCheckingIgnoringNoCheck,
2183
2182
  skipTypeParentheses: () => skipTypeParentheses,
2184
2183
  skipWhile: () => skipWhile,
2185
2184
  sliceAfter: () => sliceAfter,
@@ -2236,7 +2235,10 @@ __export(typescript_exports, {
2236
2235
  textOrKeywordPart: () => textOrKeywordPart,
2237
2236
  textPart: () => textPart,
2238
2237
  textRangeContainsPositionInclusive: () => textRangeContainsPositionInclusive,
2238
+ textRangeContainsTextSpan: () => textRangeContainsTextSpan,
2239
+ textRangeIntersectsWithTextSpan: () => textRangeIntersectsWithTextSpan,
2239
2240
  textSpanContainsPosition: () => textSpanContainsPosition,
2241
+ textSpanContainsTextRange: () => textSpanContainsTextRange,
2240
2242
  textSpanContainsTextSpan: () => textSpanContainsTextSpan,
2241
2243
  textSpanEnd: () => textSpanEnd,
2242
2244
  textSpanIntersection: () => textSpanIntersection,
@@ -2277,11 +2279,11 @@ __export(typescript_exports, {
2277
2279
  transformESDecorators: () => transformESDecorators,
2278
2280
  transformESNext: () => transformESNext,
2279
2281
  transformGenerators: () => transformGenerators,
2280
- transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
2281
2282
  transformJsx: () => transformJsx,
2282
2283
  transformLegacyDecorators: () => transformLegacyDecorators,
2283
2284
  transformModule: () => transformModule,
2284
2285
  transformNamedEvaluation: () => transformNamedEvaluation,
2286
+ transformNodeModule: () => transformNodeModule,
2285
2287
  transformNodes: () => transformNodes,
2286
2288
  transformSystemModule: () => transformSystemModule,
2287
2289
  transformTypeScript: () => transformTypeScript,
@@ -2375,7 +2377,7 @@ module.exports = __toCommonJS(typescript_exports);
2375
2377
 
2376
2378
  // src/compiler/corePublic.ts
2377
2379
  var versionMajorMinor = "5.6";
2378
- var version = `${versionMajorMinor}.0-dev.20240613`;
2380
+ var version = `${versionMajorMinor}.0-dev.20240615`;
2379
2381
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2380
2382
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2381
2383
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -5287,16 +5289,6 @@ function tryGetNativePerformanceHooks() {
5287
5289
  }
5288
5290
  var timestamp = nativePerformanceTime ? () => nativePerformanceTime.now() : Date.now;
5289
5291
 
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
5292
  // src/compiler/_namespaces/ts.performance.ts
5301
5293
  var ts_performance_exports = {};
5302
5294
  __export(ts_performance_exports, {
@@ -6583,6 +6575,7 @@ var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags3) => {
6583
6575
  NodeCheckFlags3[NodeCheckFlags3["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
6584
6576
  NodeCheckFlags3[NodeCheckFlags3["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
6585
6577
  NodeCheckFlags3[NodeCheckFlags3["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
6578
+ NodeCheckFlags3[NodeCheckFlags3["PartiallyTypeChecked"] = 8388608] = "PartiallyTypeChecked";
6586
6579
  NodeCheckFlags3[NodeCheckFlags3["LazyFlags"] = 539358128] = "LazyFlags";
6587
6580
  return NodeCheckFlags3;
6588
6581
  })(NodeCheckFlags || {});
@@ -6930,22 +6923,22 @@ var ScriptKind = /* @__PURE__ */ ((ScriptKind7) => {
6930
6923
  ScriptKind7[ScriptKind7["Deferred"] = 7] = "Deferred";
6931
6924
  return ScriptKind7;
6932
6925
  })(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;
6926
+ var ScriptTarget = /* @__PURE__ */ ((ScriptTarget11) => {
6927
+ ScriptTarget11[ScriptTarget11["ES3"] = 0] = "ES3";
6928
+ ScriptTarget11[ScriptTarget11["ES5"] = 1] = "ES5";
6929
+ ScriptTarget11[ScriptTarget11["ES2015"] = 2] = "ES2015";
6930
+ ScriptTarget11[ScriptTarget11["ES2016"] = 3] = "ES2016";
6931
+ ScriptTarget11[ScriptTarget11["ES2017"] = 4] = "ES2017";
6932
+ ScriptTarget11[ScriptTarget11["ES2018"] = 5] = "ES2018";
6933
+ ScriptTarget11[ScriptTarget11["ES2019"] = 6] = "ES2019";
6934
+ ScriptTarget11[ScriptTarget11["ES2020"] = 7] = "ES2020";
6935
+ ScriptTarget11[ScriptTarget11["ES2021"] = 8] = "ES2021";
6936
+ ScriptTarget11[ScriptTarget11["ES2022"] = 9] = "ES2022";
6937
+ ScriptTarget11[ScriptTarget11["ES2023"] = 10] = "ES2023";
6938
+ ScriptTarget11[ScriptTarget11["ESNext"] = 99] = "ESNext";
6939
+ ScriptTarget11[ScriptTarget11["JSON"] = 100] = "JSON";
6940
+ ScriptTarget11[ScriptTarget11["Latest"] = 99 /* ESNext */] = "Latest";
6941
+ return ScriptTarget11;
6949
6942
  })(ScriptTarget || {});
6950
6943
  var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => {
6951
6944
  LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard";
@@ -8676,7 +8669,7 @@ var sys = (() => {
8676
8669
  callback
8677
8670
  );
8678
8671
  }
8679
- function readFileWorker(fileName, _encoding) {
8672
+ function readFile(fileName, _encoding) {
8680
8673
  let buffer;
8681
8674
  try {
8682
8675
  buffer = _fs.readFileSync(fileName);
@@ -8701,16 +8694,7 @@ var sys = (() => {
8701
8694
  }
8702
8695
  return buffer.toString("utf8");
8703
8696
  }
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
8697
  function writeFile2(fileName, data, writeByteOrderMark) {
8712
- var _a;
8713
- (_a = perfLogger) == null ? void 0 : _a.logEvent("WriteFile: " + fileName);
8714
8698
  if (writeByteOrderMark) {
8715
8699
  data = byteOrderMarkIndicator + data;
8716
8700
  }
@@ -8731,8 +8715,6 @@ var sys = (() => {
8731
8715
  }
8732
8716
  }
8733
8717
  function getAccessibleFileSystemEntries(path) {
8734
- var _a;
8735
- (_a = perfLogger) == null ? void 0 : _a.logEvent("ReadDir: " + (path || "."));
8736
8718
  try {
8737
8719
  const entries = _fs.readdirSync(path || ".", { withFileTypes: true });
8738
8720
  const files = [];
@@ -9510,7 +9492,6 @@ var Diagnostics = {
9510
9492
  _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
9493
  _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
9494
  _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
9495
  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
9496
  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
9497
  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 +10380,6 @@ var Diagnostics = {
10399
10380
  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
10381
  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
10382
  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
10383
  Unknown_compiler_option_0: diag(5023, 1 /* Error */, "Unknown_compiler_option_0_5023", "Unknown compiler option '{0}'."),
10404
10384
  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
10385
  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}'?"),
@@ -10771,8 +10751,6 @@ var Diagnostics = {
10771
10751
  Building_project_0: diag(6358, 3 /* Message */, "Building_project_0_6358", "Building project '{0}'..."),
10772
10752
  Updating_output_timestamps_of_project_0: diag(6359, 3 /* Message */, "Updating_output_timestamps_of_project_0_6359", "Updating output timestamps of project '{0}'..."),
10773
10753
  Project_0_is_up_to_date: diag(6361, 3 /* Message */, "Project_0_is_up_to_date_6361", "Project '{0}' is up to date"),
10774
- Skipping_build_of_project_0_because_its_dependency_1_has_errors: diag(6362, 3 /* Message */, "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362", "Skipping build of project '{0}' because its dependency '{1}' has errors"),
10775
- Project_0_can_t_be_built_because_its_dependency_1_has_errors: diag(6363, 3 /* Message */, "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363", "Project '{0}' can't be built because its dependency '{1}' has errors"),
10776
10754
  Build_one_or_more_projects_and_their_dependencies_if_out_of_date: diag(6364, 3 /* Message */, "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364", "Build one or more projects and their dependencies, if out of date"),
10777
10755
  Delete_the_outputs_of_all_projects: diag(6365, 3 /* Message */, "Delete_the_outputs_of_all_projects_6365", "Delete the outputs of all projects."),
10778
10756
  Show_what_would_be_built_or_deleted_if_specified_with_clean: diag(6367, 3 /* Message */, "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367", "Show what would be built (or deleted, if specified with '--clean')"),
@@ -10784,8 +10762,6 @@ var Diagnostics = {
10784
10762
  Composite_projects_may_not_disable_incremental_compilation: diag(6379, 1 /* Error */, "Composite_projects_may_not_disable_incremental_compilation_6379", "Composite projects may not disable incremental compilation."),
10785
10763
  Specify_file_to_store_incremental_compilation_information: diag(6380, 3 /* Message */, "Specify_file_to_store_incremental_compilation_information_6380", "Specify file to store incremental compilation information"),
10786
10764
  Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2: diag(6381, 3 /* Message */, "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381", "Project '{0}' is out of date because output for it was generated with version '{1}' that differs with current version '{2}'"),
10787
- Skipping_build_of_project_0_because_its_dependency_1_was_not_built: diag(6382, 3 /* Message */, "Skipping_build_of_project_0_because_its_dependency_1_was_not_built_6382", "Skipping build of project '{0}' because its dependency '{1}' was not built"),
10788
- Project_0_can_t_be_built_because_its_dependency_1_was_not_built: diag(6383, 3 /* Message */, "Project_0_can_t_be_built_because_its_dependency_1_was_not_built_6383", "Project '{0}' can't be built because its dependency '{1}' was not built"),
10789
10765
  Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it: diag(6384, 3 /* Message */, "Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_di_6384", "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it."),
10790
10766
  _0_is_deprecated: diag(
10791
10767
  6385,
@@ -10843,6 +10819,8 @@ var Diagnostics = {
10843
10819
  Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
10844
10820
  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
10821
  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}."),
10822
+ 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."),
10823
+ 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
10824
  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
10825
  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
10826
  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 +14692,18 @@ function textSpanIsEmpty(span) {
14714
14692
  function textSpanContainsPosition(span, position) {
14715
14693
  return position >= span.start && position < textSpanEnd(span);
14716
14694
  }
14717
- function textRangeContainsPositionInclusive(span, position) {
14718
- return position >= span.pos && position <= span.end;
14695
+ function textRangeContainsPositionInclusive(range, position) {
14696
+ return position >= range.pos && position <= range.end;
14719
14697
  }
14720
14698
  function textSpanContainsTextSpan(span, other) {
14721
14699
  return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span);
14722
14700
  }
14701
+ function textSpanContainsTextRange(span, range) {
14702
+ return range.pos >= span.start && range.end <= textSpanEnd(span);
14703
+ }
14704
+ function textRangeContainsTextSpan(range, span) {
14705
+ return span.start >= range.pos && textSpanEnd(span) <= range.end;
14706
+ }
14723
14707
  function textSpanOverlapsWith(span, other) {
14724
14708
  return textSpanOverlap(span, other) !== void 0;
14725
14709
  }
@@ -14741,11 +14725,34 @@ function decodedTextSpanIntersectsWith(start1, length1, start2, length2) {
14741
14725
  function textSpanIntersectsWithPosition(span, position) {
14742
14726
  return position <= textSpanEnd(span) && position >= span.start;
14743
14727
  }
14728
+ function textRangeIntersectsWithTextSpan(range, span) {
14729
+ return textSpanIntersectsWith(span, range.pos, range.end - range.pos);
14730
+ }
14744
14731
  function textSpanIntersection(span1, span2) {
14745
14732
  const start = Math.max(span1.start, span2.start);
14746
14733
  const end = Math.min(textSpanEnd(span1), textSpanEnd(span2));
14747
14734
  return start <= end ? createTextSpanFromBounds(start, end) : void 0;
14748
14735
  }
14736
+ function normalizeSpans(spans) {
14737
+ spans = spans.filter((span) => span.length > 0).sort((a, b) => {
14738
+ return a.start !== b.start ? a.start - b.start : a.length - b.length;
14739
+ });
14740
+ const result = [];
14741
+ let i = 0;
14742
+ while (i < spans.length) {
14743
+ let span = spans[i];
14744
+ let j = i + 1;
14745
+ while (j < spans.length && textSpanIntersectsWithTextSpan(span, spans[j])) {
14746
+ const start = Math.min(span.start, spans[j].start);
14747
+ const end = Math.max(textSpanEnd(span), textSpanEnd(spans[j]));
14748
+ span = createTextSpanFromBounds(start, end);
14749
+ j++;
14750
+ }
14751
+ i = j;
14752
+ result.push(span);
14753
+ }
14754
+ return result;
14755
+ }
14749
14756
  function createTextSpan(start, length2) {
14750
14757
  if (start < 0) {
14751
14758
  throw new Error("start < 0");
@@ -18653,23 +18660,6 @@ function isFunctionSymbol(symbol) {
18653
18660
  const decl = symbol.valueDeclaration;
18654
18661
  return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
18655
18662
  }
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
18663
  function tryGetModuleSpecifierFromDeclaration(node) {
18674
18664
  var _a, _b;
18675
18665
  switch (node.kind) {
@@ -21684,8 +21674,8 @@ function walkTreeForJSXTags(node) {
21684
21674
  function isFileModuleFromUsingJSXTag(file) {
21685
21675
  return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0;
21686
21676
  }
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;
21677
+ function isFileForcedToBeModuleByFormat(file) {
21678
+ return (file.impliedNodeFormat === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
21689
21679
  }
21690
21680
  function getSetExternalModuleIndicator(options) {
21691
21681
  switch (getEmitModuleDetectionKind(options)) {
@@ -21704,14 +21694,10 @@ function getSetExternalModuleIndicator(options) {
21704
21694
  }
21705
21695
  checks.push(isFileForcedToBeModuleByFormat);
21706
21696
  const combined = or(...checks);
21707
- const callback = (file) => void (file.externalModuleIndicator = combined(file, options));
21697
+ const callback = (file) => void (file.externalModuleIndicator = combined(file));
21708
21698
  return callback;
21709
21699
  }
21710
21700
  }
21711
- function importSyntaxAffectsModuleResolution(options) {
21712
- const moduleResolution = getEmitModuleResolutionKind(options);
21713
- return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options);
21714
- }
21715
21701
  function createComputedCompilerOptions(options) {
21716
21702
  return options;
21717
21703
  }
@@ -22555,7 +22541,25 @@ function rangeOfTypeParameters(sourceFile, typeParameters) {
22555
22541
  return { pos, end };
22556
22542
  }
22557
22543
  function skipTypeChecking(sourceFile, options, host) {
22558
- return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName) || !canIncludeBindAndCheckDiagnostics(sourceFile, options);
22544
+ return skipTypeCheckingWorker(
22545
+ sourceFile,
22546
+ options,
22547
+ host,
22548
+ /*ignoreNoCheck*/
22549
+ false
22550
+ );
22551
+ }
22552
+ function skipTypeCheckingIgnoringNoCheck(sourceFile, options, host) {
22553
+ return skipTypeCheckingWorker(
22554
+ sourceFile,
22555
+ options,
22556
+ host,
22557
+ /*ignoreNoCheck*/
22558
+ true
22559
+ );
22560
+ }
22561
+ function skipTypeCheckingWorker(sourceFile, options, host, ignoreNoCheck) {
22562
+ return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || !ignoreNoCheck && options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName) || !canIncludeBindAndCheckDiagnostics(sourceFile, options);
22559
22563
  }
22560
22564
  function canIncludeBindAndCheckDiagnostics(sourceFile, options) {
22561
22565
  if (!!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false) return false;
@@ -23065,6 +23069,105 @@ function replaceFirstStar(s, replacement) {
23065
23069
  function getNameFromImportAttribute(node) {
23066
23070
  return isIdentifier(node.name) ? node.name.escapedText : escapeLeadingUnderscores(node.name.text);
23067
23071
  }
23072
+ function isSourceElement(node) {
23073
+ switch (node.kind) {
23074
+ case 168 /* TypeParameter */:
23075
+ case 169 /* Parameter */:
23076
+ case 172 /* PropertyDeclaration */:
23077
+ case 171 /* PropertySignature */:
23078
+ case 185 /* ConstructorType */:
23079
+ case 184 /* FunctionType */:
23080
+ case 179 /* CallSignature */:
23081
+ case 180 /* ConstructSignature */:
23082
+ case 181 /* IndexSignature */:
23083
+ case 174 /* MethodDeclaration */:
23084
+ case 173 /* MethodSignature */:
23085
+ case 175 /* ClassStaticBlockDeclaration */:
23086
+ case 176 /* Constructor */:
23087
+ case 177 /* GetAccessor */:
23088
+ case 178 /* SetAccessor */:
23089
+ case 183 /* TypeReference */:
23090
+ case 182 /* TypePredicate */:
23091
+ case 186 /* TypeQuery */:
23092
+ case 187 /* TypeLiteral */:
23093
+ case 188 /* ArrayType */:
23094
+ case 189 /* TupleType */:
23095
+ case 192 /* UnionType */:
23096
+ case 193 /* IntersectionType */:
23097
+ case 196 /* ParenthesizedType */:
23098
+ case 190 /* OptionalType */:
23099
+ case 191 /* RestType */:
23100
+ case 197 /* ThisType */:
23101
+ case 198 /* TypeOperator */:
23102
+ case 194 /* ConditionalType */:
23103
+ case 195 /* InferType */:
23104
+ case 203 /* TemplateLiteralType */:
23105
+ case 205 /* ImportType */:
23106
+ case 202 /* NamedTupleMember */:
23107
+ case 328 /* JSDocAugmentsTag */:
23108
+ case 329 /* JSDocImplementsTag */:
23109
+ case 346 /* JSDocTypedefTag */:
23110
+ case 338 /* JSDocCallbackTag */:
23111
+ case 340 /* JSDocEnumTag */:
23112
+ case 345 /* JSDocTemplateTag */:
23113
+ case 344 /* JSDocTypeTag */:
23114
+ case 324 /* JSDocLink */:
23115
+ case 325 /* JSDocLinkCode */:
23116
+ case 326 /* JSDocLinkPlain */:
23117
+ case 341 /* JSDocParameterTag */:
23118
+ case 348 /* JSDocPropertyTag */:
23119
+ case 317 /* JSDocFunctionType */:
23120
+ case 315 /* JSDocNonNullableType */:
23121
+ case 314 /* JSDocNullableType */:
23122
+ case 312 /* JSDocAllType */:
23123
+ case 313 /* JSDocUnknownType */:
23124
+ case 322 /* JSDocTypeLiteral */:
23125
+ case 318 /* JSDocVariadicType */:
23126
+ case 309 /* JSDocTypeExpression */:
23127
+ case 333 /* JSDocPublicTag */:
23128
+ case 335 /* JSDocProtectedTag */:
23129
+ case 334 /* JSDocPrivateTag */:
23130
+ case 350 /* JSDocSatisfiesTag */:
23131
+ case 343 /* JSDocThisTag */:
23132
+ case 199 /* IndexedAccessType */:
23133
+ case 200 /* MappedType */:
23134
+ case 262 /* FunctionDeclaration */:
23135
+ case 241 /* Block */:
23136
+ case 268 /* ModuleBlock */:
23137
+ case 243 /* VariableStatement */:
23138
+ case 244 /* ExpressionStatement */:
23139
+ case 245 /* IfStatement */:
23140
+ case 246 /* DoStatement */:
23141
+ case 247 /* WhileStatement */:
23142
+ case 248 /* ForStatement */:
23143
+ case 249 /* ForInStatement */:
23144
+ case 250 /* ForOfStatement */:
23145
+ case 251 /* ContinueStatement */:
23146
+ case 252 /* BreakStatement */:
23147
+ case 253 /* ReturnStatement */:
23148
+ case 254 /* WithStatement */:
23149
+ case 255 /* SwitchStatement */:
23150
+ case 256 /* LabeledStatement */:
23151
+ case 257 /* ThrowStatement */:
23152
+ case 258 /* TryStatement */:
23153
+ case 260 /* VariableDeclaration */:
23154
+ case 208 /* BindingElement */:
23155
+ case 263 /* ClassDeclaration */:
23156
+ case 264 /* InterfaceDeclaration */:
23157
+ case 265 /* TypeAliasDeclaration */:
23158
+ case 266 /* EnumDeclaration */:
23159
+ case 267 /* ModuleDeclaration */:
23160
+ case 272 /* ImportDeclaration */:
23161
+ case 271 /* ImportEqualsDeclaration */:
23162
+ case 278 /* ExportDeclaration */:
23163
+ case 277 /* ExportAssignment */:
23164
+ case 242 /* EmptyStatement */:
23165
+ case 259 /* DebuggerStatement */:
23166
+ case 282 /* MissingDeclaration */:
23167
+ return true;
23168
+ }
23169
+ return false;
23170
+ }
23068
23171
  function evaluatorResult(value, isSyntacticallyString = false, resolvedOtherFiles = false, hasExternalReferences = false) {
23069
23172
  return { value, isSyntacticallyString, resolvedOtherFiles, hasExternalReferences };
23070
23173
  }
@@ -31076,7 +31179,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
31076
31179
  if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
31077
31180
  let namedBindings;
31078
31181
  const moduleKind = getEmitModuleKind(compilerOptions);
31079
- if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions) === 99 /* ESNext */) {
31182
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || sourceFile.impliedNodeFormat === 99 /* ESNext */) {
31080
31183
  const helpers = getEmitHelpers(sourceFile);
31081
31184
  if (helpers) {
31082
31185
  const helperNames = [];
@@ -31141,7 +31244,8 @@ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOp
31141
31244
  if (externalHelpersModuleName) {
31142
31245
  return externalHelpersModuleName;
31143
31246
  }
31144
- let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && getEmitModuleFormatOfFileWorker(node, compilerOptions) < 4 /* System */;
31247
+ const moduleKind = getEmitModuleKind(compilerOptions);
31248
+ let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || node.impliedNodeFormat === 1 /* CommonJS */);
31145
31249
  if (!create) {
31146
31250
  const helpers = getEmitHelpers(node);
31147
31251
  if (helpers) {
@@ -32327,7 +32431,7 @@ function setExternalModuleIndicator(sourceFile) {
32327
32431
  sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile);
32328
32432
  }
32329
32433
  function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind) {
32330
- var _a, _b, _c, _d;
32434
+ var _a, _b;
32331
32435
  (_a = tracing) == null ? void 0 : _a.push(
32332
32436
  tracing.Phase.Parse,
32333
32437
  "createSourceFile",
@@ -32337,7 +32441,6 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
32337
32441
  );
32338
32442
  mark("beforeParse");
32339
32443
  let result;
32340
- (_b = perfLogger) == null ? void 0 : _b.logStartParseSourceFile(fileName);
32341
32444
  const {
32342
32445
  languageVersion,
32343
32446
  setExternalModuleIndicator: overrideSetExternalModuleIndicator,
@@ -32373,10 +32476,9 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
32373
32476
  jsDocParsingMode
32374
32477
  );
32375
32478
  }
32376
- (_c = perfLogger) == null ? void 0 : _c.logStopParseSourceFile();
32377
32479
  mark("afterParse");
32378
32480
  measure("Parse", "beforeParse", "afterParse");
32379
- (_d = tracing) == null ? void 0 : _d.pop();
32481
+ (_b = tracing) == null ? void 0 : _b.pop();
32380
32482
  return result;
32381
32483
  }
32382
32484
  function parseIsolatedEntityName(text, languageVersion) {
@@ -40155,6 +40257,25 @@ var commonOptionsWithBuild = [
40155
40257
  description: Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
40156
40258
  defaultValueDescription: false
40157
40259
  },
40260
+ {
40261
+ name: "noCheck",
40262
+ type: "boolean",
40263
+ showInSimplifiedHelpView: false,
40264
+ category: Diagnostics.Compiler_Diagnostics,
40265
+ description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
40266
+ transpileOptionValue: true,
40267
+ defaultValueDescription: false
40268
+ // Not setting affectsSemanticDiagnostics or affectsBuildInfo because we dont want all diagnostics to go away, its handled in builder
40269
+ },
40270
+ {
40271
+ name: "noEmit",
40272
+ type: "boolean",
40273
+ showInSimplifiedHelpView: true,
40274
+ category: Diagnostics.Emit,
40275
+ description: Diagnostics.Disable_emitting_files_from_a_compilation,
40276
+ transpileOptionValue: void 0,
40277
+ defaultValueDescription: false
40278
+ },
40158
40279
  {
40159
40280
  name: "assumeChangesOnlyAffectDirectDependencies",
40160
40281
  type: "boolean",
@@ -40419,29 +40540,6 @@ var commandOptionsWithoutBuild = [
40419
40540
  defaultValueDescription: false,
40420
40541
  description: Diagnostics.Disable_emitting_comments
40421
40542
  },
40422
- {
40423
- name: "noCheck",
40424
- type: "boolean",
40425
- showInSimplifiedHelpView: false,
40426
- category: Diagnostics.Compiler_Diagnostics,
40427
- description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
40428
- transpileOptionValue: true,
40429
- defaultValueDescription: false,
40430
- affectsSemanticDiagnostics: true,
40431
- affectsBuildInfo: true,
40432
- extraValidation() {
40433
- return [Diagnostics.Unknown_compiler_option_0, "noCheck"];
40434
- }
40435
- },
40436
- {
40437
- name: "noEmit",
40438
- type: "boolean",
40439
- showInSimplifiedHelpView: true,
40440
- category: Diagnostics.Emit,
40441
- description: Diagnostics.Disable_emitting_files_from_a_compilation,
40442
- transpileOptionValue: void 0,
40443
- defaultValueDescription: false
40444
- },
40445
40543
  {
40446
40544
  name: "importHelpers",
40447
40545
  type: "boolean",
@@ -43980,7 +44078,6 @@ function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
43980
44078
  );
43981
44079
  }
43982
44080
  function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
43983
- var _a, _b, _c;
43984
44081
  const traceEnabled = isTraceEnabled(compilerOptions, host);
43985
44082
  if (redirectedReference) {
43986
44083
  compilerOptions = redirectedReference.commandLine.options;
@@ -44009,7 +44106,6 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
44009
44106
  trace(host, Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ModuleResolutionKind[moduleResolution]);
44010
44107
  }
44011
44108
  }
44012
- (_a = perfLogger) == null ? void 0 : _a.logStartResolveModule(moduleName);
44013
44109
  switch (moduleResolution) {
44014
44110
  case 3 /* Node16 */:
44015
44111
  result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
@@ -44029,8 +44125,6 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
44029
44125
  default:
44030
44126
  return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`);
44031
44127
  }
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
44128
  if (cache && !cache.isReadonly) {
44035
44129
  cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
44036
44130
  if (!isExternalModuleNameRelative(moduleName)) {
@@ -45878,11 +45972,8 @@ function createFlowNode(flags, node, antecedent) {
45878
45972
  }
45879
45973
  var binder = /* @__PURE__ */ createBinder();
45880
45974
  function bindSourceFile(file, options) {
45881
- var _a, _b;
45882
45975
  mark("beforeBind");
45883
- (_a = perfLogger) == null ? void 0 : _a.logStartBindFile("" + file.fileName);
45884
45976
  binder(file, options);
45885
- (_b = perfLogger) == null ? void 0 : _b.logStopBindFile();
45886
45977
  mark("afterBind");
45887
45978
  measure("Bind", "beforeBind", "afterBind");
45888
45979
  }
@@ -48875,15 +48966,13 @@ var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
48875
48966
  RelativePreference2[RelativePreference2["ExternalNonRelative"] = 3] = "ExternalNonRelative";
48876
48967
  return RelativePreference2;
48877
48968
  })(RelativePreference || {});
48878
- function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
48969
+ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
48879
48970
  const filePreferredEnding = getPreferredEnding();
48880
48971
  return {
48881
48972
  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
48973
  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 */) {
48974
+ const preferredEnding = syntaxImpliedNodeFormat !== importingSourceFile.impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
48975
+ if ((syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === 99 /* ESNext */) {
48887
48976
  if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
48888
48977
  return [3 /* TsExtension */, 2 /* JsExtension */];
48889
48978
  }
@@ -48914,19 +49003,19 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
48914
49003
  }
48915
49004
  return getModuleSpecifierEndingPreference(
48916
49005
  importModuleSpecifierEnding,
48917
- resolutionMode ?? getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions),
49006
+ resolutionMode ?? importingSourceFile.impliedNodeFormat,
48918
49007
  compilerOptions,
48919
49008
  isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
48920
49009
  );
48921
49010
  }
48922
49011
  }
48923
49012
  function updateModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, oldImportSpecifier, options = {}) {
48924
- const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
49013
+ const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
48925
49014
  if (res === oldImportSpecifier) return void 0;
48926
49015
  return res;
48927
49016
  }
48928
49017
  function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
48929
- return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile), {}, options);
49018
+ return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
48930
49019
  }
48931
49020
  function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
48932
49021
  const info = getInfo(importingSourceFile.fileName, host);
@@ -48956,7 +49045,7 @@ function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importin
48956
49045
  /*packageNameOnly*/
48957
49046
  void 0,
48958
49047
  options.overrideImportMode
48959
- )) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions), preferences);
49048
+ )) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
48960
49049
  }
48961
49050
  function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
48962
49051
  const result = tryGetModuleSpecifiersFromCacheWorker(
@@ -49027,21 +49116,17 @@ function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName,
49027
49116
  compilerOptions,
49028
49117
  host,
49029
49118
  importMode,
49030
- getModuleSpecifierPreferences({}, host, compilerOptions, importingFile)
49119
+ getModuleSpecifierPreferences({}, compilerOptions, importingFile)
49031
49120
  );
49032
49121
  }
49033
49122
  function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
49034
49123
  const info = getInfo(importingSourceFile.fileName, host);
49035
- const preferences = getModuleSpecifierPreferences(userPreferences, host, compilerOptions, importingSourceFile);
49124
+ const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
49036
49125
  const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
49037
49126
  host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
49038
49127
  (reason) => {
49039
49128
  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
- }
49129
+ if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions)) return void 0;
49045
49130
  const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
49046
49131
  return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
49047
49132
  }
@@ -49571,7 +49656,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
49571
49656
  if (!parts) {
49572
49657
  return void 0;
49573
49658
  }
49574
- const preferences = getModuleSpecifierPreferences(userPreferences, host, options, importingSourceFile);
49659
+ const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
49575
49660
  const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
49576
49661
  let moduleSpecifier = path;
49577
49662
  let isPackageRootPath = false;
@@ -49621,7 +49706,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
49621
49706
  const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
49622
49707
  if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
49623
49708
  const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
49624
- const importMode = overrideMode || getDefaultResolutionModeForFile(importingSourceFile, host, options);
49709
+ const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
49625
49710
  if (getResolvePackageJsonExports(options)) {
49626
49711
  const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
49627
49712
  const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
@@ -49771,9 +49856,6 @@ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName
49771
49856
  function isPathRelativeToParent(path) {
49772
49857
  return startsWith(path, "..");
49773
49858
  }
49774
- function getDefaultResolutionModeForFile(file, host, compilerOptions) {
49775
- return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
49776
- }
49777
49859
 
49778
49860
  // src/compiler/checker.ts
49779
49861
  var ambientModuleSymbolRegex = /^".+"$/;
@@ -51996,28 +52078,22 @@ function createTypeChecker(host) {
51996
52078
  function isSyntacticDefault(node) {
51997
52079
  return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
51998
52080
  }
51999
- function getEmitSyntaxForModuleSpecifierExpression(usage) {
52000
- return isStringLiteralLike(usage) ? host.getEmitSyntaxForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
52081
+ function getUsageModeForExpression(usage) {
52082
+ return isStringLiteralLike(usage) ? host.getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
52001
52083
  }
52002
52084
  function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
52003
52085
  return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
52004
52086
  }
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;
52087
+ function isOnlyImportedAsDefault(usage) {
52088
+ const usageMode = getUsageModeForExpression(usage);
52089
+ return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
52011
52090
  }
52012
52091
  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;
52092
+ const usageMode = file && getUsageModeForExpression(usage);
52093
+ if (file && usageMode !== void 0 && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
52094
+ const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
52095
+ if (usageMode === 99 /* ESNext */ || result) {
52096
+ return result;
52021
52097
  }
52022
52098
  }
52023
52099
  if (!allowSyntheticDefaultImports) {
@@ -52076,7 +52152,7 @@ function createTypeChecker(host) {
52076
52152
  if (!specifier) {
52077
52153
  return exportDefaultSymbol;
52078
52154
  }
52079
- const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
52155
+ const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
52080
52156
  const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
52081
52157
  if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
52082
52158
  if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
@@ -52278,7 +52354,7 @@ function createTypeChecker(host) {
52278
52354
  let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
52279
52355
  if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
52280
52356
  const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
52281
- if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
52357
+ if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
52282
52358
  symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
52283
52359
  }
52284
52360
  }
@@ -52882,7 +52958,7 @@ function createTypeChecker(host) {
52882
52958
  /*requireStringLiteralLikeArgument*/
52883
52959
  true
52884
52960
  ) ? 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);
52961
+ const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
52886
52962
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
52887
52963
  const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
52888
52964
  const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
@@ -53126,7 +53202,7 @@ function createTypeChecker(host) {
53126
53202
  return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
53127
53203
  }
53128
53204
  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));
53205
+ const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getUsageModeForExpression(reference), targetFile.impliedNodeFormat);
53130
53206
  if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
53131
53207
  let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
53132
53208
  if (!sigs || !sigs.length) {
@@ -55732,10 +55808,8 @@ function createTypeChecker(host) {
55732
55808
  }
55733
55809
  return getSourceFileOfNode(getNonAugmentationDeclaration(symbol)).fileName;
55734
55810
  }
55735
- const enclosingDeclaration = getOriginalNode(context.enclosingDeclaration);
55736
- const originalModuleSpecifier = canHaveModuleSpecifier(enclosingDeclaration) ? tryGetModuleSpecifierFromDeclaration(enclosingDeclaration) : void 0;
55737
55811
  const contextFile = context.enclosingFile;
55738
- const resolutionMode = overrideImportMode || originalModuleSpecifier && host.getModeForUsageLocation(contextFile, originalModuleSpecifier) || contextFile && host.getDefaultResolutionModeForFile(contextFile);
55812
+ const resolutionMode = overrideImportMode || (contextFile == null ? void 0 : contextFile.impliedNodeFormat);
55739
55813
  const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
55740
55814
  const links = getSymbolLinks(symbol);
55741
55815
  let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
@@ -56557,7 +56631,7 @@ function createTypeChecker(host) {
56557
56631
  }
56558
56632
  if (isJSDocTypeLiteral(node)) {
56559
56633
  return factory.createTypeLiteralNode(map(node.jsDocPropertyTags, (t) => {
56560
- const name = isIdentifier(t.name) ? t.name : t.name.right;
56634
+ const name = visitNode(isIdentifier(t.name) ? t.name : t.name.right, visitExistingNodeTreeSymbols, isIdentifier);
56561
56635
  const typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode2(context, node), name.escapedText);
56562
56636
  const overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode2(context, t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : void 0;
56563
56637
  return factory.createPropertySignature(
@@ -56601,7 +56675,7 @@ function createTypeChecker(host) {
56601
56675
  void 0,
56602
56676
  getEffectiveDotDotDotForParameter(p),
56603
56677
  setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
56604
- p.questionToken,
56678
+ factory.cloneNode(p.questionToken),
56605
56679
  visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
56606
56680
  /*initializer*/
56607
56681
  void 0
@@ -56616,7 +56690,7 @@ function createTypeChecker(host) {
56616
56690
  void 0,
56617
56691
  getEffectiveDotDotDotForParameter(p),
56618
56692
  setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
56619
- p.questionToken,
56693
+ factory.cloneNode(p.questionToken),
56620
56694
  visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
56621
56695
  /*initializer*/
56622
56696
  void 0
@@ -56635,7 +56709,7 @@ function createTypeChecker(host) {
56635
56709
  if (isTypeParameterDeclaration(node)) {
56636
56710
  return factory.updateTypeParameterDeclaration(
56637
56711
  node,
56638
- node.modifiers,
56712
+ visitNodes2(node.modifiers, visitExistingNodeTreeSymbols, isModifier),
56639
56713
  setTextRange2(context, typeParameterToName(getDeclaredTypeOfSymbol(getSymbolOfDeclaration(node)), context), node),
56640
56714
  visitNode(node.constraint, visitExistingNodeTreeSymbols, isTypeNode),
56641
56715
  visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
@@ -56667,8 +56741,8 @@ function createTypeChecker(host) {
56667
56741
  return factory.updateImportTypeNode(
56668
56742
  node,
56669
56743
  factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)),
56670
- node.attributes,
56671
- node.qualifier,
56744
+ visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
56745
+ visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
56672
56746
  visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
56673
56747
  node.isTypeOf
56674
56748
  );
@@ -56704,8 +56778,28 @@ function createTypeChecker(host) {
56704
56778
  } else {
56705
56779
  const type = getWidenedType(getRegularTypeOfExpression(node.expression));
56706
56780
  const computedPropertyNameType = typeToTypeNodeHelper(type, context);
56707
- Debug.assertNode(computedPropertyNameType, isLiteralTypeNode);
56708
- const literal = computedPropertyNameType.literal;
56781
+ let literal;
56782
+ if (isLiteralTypeNode(computedPropertyNameType)) {
56783
+ literal = computedPropertyNameType.literal;
56784
+ } else {
56785
+ const evaluated = evaluateEntityNameExpression(node.expression);
56786
+ const literalNode = typeof evaluated.value === "string" ? factory.createStringLiteral(
56787
+ evaluated.value,
56788
+ /*isSingleQuote*/
56789
+ void 0
56790
+ ) : typeof evaluated.value === "number" ? factory.createNumericLiteral(
56791
+ evaluated.value,
56792
+ /*numericLiteralFlags*/
56793
+ 0
56794
+ ) : void 0;
56795
+ if (!literalNode) {
56796
+ if (isImportTypeNode(computedPropertyNameType)) {
56797
+ trackComputedName(node.expression, context.enclosingDeclaration, context);
56798
+ }
56799
+ return node;
56800
+ }
56801
+ literal = literalNode;
56802
+ }
56709
56803
  if (literal.kind === 11 /* StringLiteral */ && isIdentifierText(literal.text, getEmitScriptTarget(compilerOptions))) {
56710
56804
  return factory.createIdentifier(literal.text);
56711
56805
  }
@@ -56722,9 +56816,9 @@ function createTypeChecker(host) {
56722
56816
  hadError = hadError || introducesError;
56723
56817
  parameterName = result;
56724
56818
  } else {
56725
- parameterName = node.parameterName;
56819
+ parameterName = factory.cloneNode(node.parameterName);
56726
56820
  }
56727
- return factory.updateTypePredicateNode(node, node.assertsModifier, parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
56821
+ return factory.updateTypePredicateNode(node, factory.cloneNode(node.assertsModifier), parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
56728
56822
  }
56729
56823
  if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
56730
56824
  const visited = visitEachChild2(node, visitExistingNodeTreeSymbols);
@@ -69460,7 +69554,7 @@ function createTypeChecker(host) {
69460
69554
  const sourceArity = getTypeReferenceArity(source2);
69461
69555
  const targetArity = getTypeReferenceArity(target2);
69462
69556
  const sourceRestFlag = isTupleType(source2) ? source2.target.combinedFlags & 4 /* Rest */ : 4 /* Rest */;
69463
- const targetRestFlag = target2.target.combinedFlags & 4 /* Rest */;
69557
+ const targetHasRestElement = !!(target2.target.combinedFlags & 12 /* Variable */);
69464
69558
  const sourceMinLength = isTupleType(source2) ? source2.target.minLength : 0;
69465
69559
  const targetMinLength = target2.target.minLength;
69466
69560
  if (!sourceRestFlag && sourceArity < targetMinLength) {
@@ -69469,13 +69563,13 @@ function createTypeChecker(host) {
69469
69563
  }
69470
69564
  return 0 /* False */;
69471
69565
  }
69472
- if (!targetRestFlag && targetArity < sourceMinLength) {
69566
+ if (!targetHasRestElement && targetArity < sourceMinLength) {
69473
69567
  if (reportErrors2) {
69474
69568
  reportError(Diagnostics.Source_has_0_element_s_but_target_allows_only_1, sourceMinLength, targetArity);
69475
69569
  }
69476
69570
  return 0 /* False */;
69477
69571
  }
69478
- if (!targetRestFlag && (sourceRestFlag || targetArity < sourceArity)) {
69572
+ if (!targetHasRestElement && (sourceRestFlag || targetArity < sourceArity)) {
69479
69573
  if (reportErrors2) {
69480
69574
  if (sourceMinLength < targetMinLength) {
69481
69575
  reportError(Diagnostics.Target_requires_0_element_s_but_source_may_have_fewer, targetMinLength);
@@ -69489,7 +69583,6 @@ function createTypeChecker(host) {
69489
69583
  const targetTypeArguments = getTypeArguments(target2);
69490
69584
  const targetStartCount = getStartElementCount(target2.target, 11 /* NonRest */);
69491
69585
  const targetEndCount = getEndElementCount(target2.target, 11 /* NonRest */);
69492
- const targetHasRestElement = target2.target.hasRestElement;
69493
69586
  let canExcludeDiscriminants = !!excludedProperties;
69494
69587
  for (let sourcePosition = 0; sourcePosition < sourceArity; sourcePosition++) {
69495
69588
  const sourceFlags = isTupleType(source2) ? source2.target.elementFlags[sourcePosition] : 4 /* Rest */;
@@ -70729,6 +70822,7 @@ function createTypeChecker(host) {
70729
70822
  return type;
70730
70823
  }
70731
70824
  function reportWideningErrorsInType(type) {
70825
+ var _a;
70732
70826
  let errorReported = false;
70733
70827
  if (getObjectFlags(type) & 65536 /* ContainsWideningType */) {
70734
70828
  if (type.flags & 1048576 /* Union */) {
@@ -70736,27 +70830,28 @@ function createTypeChecker(host) {
70736
70830
  errorReported = true;
70737
70831
  } else {
70738
70832
  for (const t of type.types) {
70739
- if (reportWideningErrorsInType(t)) {
70740
- errorReported = true;
70741
- }
70833
+ errorReported || (errorReported = reportWideningErrorsInType(t));
70742
70834
  }
70743
70835
  }
70744
- }
70745
- if (isArrayOrTupleType(type)) {
70836
+ } else if (isArrayOrTupleType(type)) {
70746
70837
  for (const t of getTypeArguments(type)) {
70747
- if (reportWideningErrorsInType(t)) {
70748
- errorReported = true;
70749
- }
70838
+ errorReported || (errorReported = reportWideningErrorsInType(t));
70750
70839
  }
70751
- }
70752
- if (isObjectLiteralType2(type)) {
70840
+ } else if (isObjectLiteralType2(type)) {
70753
70841
  for (const p of getPropertiesOfObjectType(type)) {
70754
70842
  const t = getTypeOfSymbol(p);
70755
70843
  if (getObjectFlags(t) & 65536 /* ContainsWideningType */) {
70756
- if (!reportWideningErrorsInType(t)) {
70757
- error2(p.valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t)));
70844
+ errorReported = reportWideningErrorsInType(t);
70845
+ if (!errorReported) {
70846
+ const valueDeclaration = (_a = p.declarations) == null ? void 0 : _a.find((d) => {
70847
+ var _a2;
70848
+ return ((_a2 = d.symbol.valueDeclaration) == null ? void 0 : _a2.parent) === type.symbol.valueDeclaration;
70849
+ });
70850
+ if (valueDeclaration) {
70851
+ error2(valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t)));
70852
+ errorReported = true;
70853
+ }
70758
70854
  }
70759
- errorReported = true;
70760
70855
  }
70761
70856
  }
70762
70857
  }
@@ -80207,7 +80302,7 @@ function createTypeChecker(host) {
80207
80302
  return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
80208
80303
  }
80209
80304
  function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
80210
- const hasDefaultOnly = isOnlyImportableAsDefault(moduleSpecifier);
80305
+ const hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
80211
80306
  if (hasDefaultOnly && type && !isErrorType(type)) {
80212
80307
  const synthType = type;
80213
80308
  if (!synthType.defaultOnlyType) {
@@ -85434,7 +85529,7 @@ function createTypeChecker(host) {
85434
85529
  });
85435
85530
  }
85436
85531
  function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
85437
- if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) >= 5 /* ES2015 */) {
85532
+ if (moduleKind >= 5 /* ES2015 */ && !(moduleKind >= 100 /* Node16 */ && getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
85438
85533
  return;
85439
85534
  }
85440
85535
  if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
@@ -86855,7 +86950,7 @@ function createTypeChecker(host) {
86855
86950
  }
86856
86951
  }
86857
86952
  function checkClassNameCollisionWithObject(name) {
86858
- if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) {
86953
+ if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(name).impliedNodeFormat === 1 /* CommonJS */)) {
86859
86954
  error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
86860
86955
  }
86861
86956
  }
@@ -87935,7 +88030,7 @@ function createTypeChecker(host) {
87935
88030
  getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
87936
88031
  }
87937
88032
  }
87938
- if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(node.parent) === 1 /* CommonJS */) {
88033
+ if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
87939
88034
  const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
87940
88035
  if (exportModifier) {
87941
88036
  error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
@@ -88155,10 +88250,8 @@ function createTypeChecker(host) {
88155
88250
  }
88156
88251
  }
88157
88252
  }
88158
- if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
88253
+ if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
88159
88254
  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
88255
  }
88163
88256
  }
88164
88257
  if (isImportSpecifier(node)) {
@@ -88199,7 +88292,7 @@ function createTypeChecker(host) {
88199
88292
  checkAliasSymbol(node);
88200
88293
  if (node.kind === 276 /* ImportSpecifier */) {
88201
88294
  checkModuleExportName(node.propertyName);
88202
- if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88295
+ if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
88203
88296
  checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88204
88297
  }
88205
88298
  }
@@ -88221,7 +88314,7 @@ function createTypeChecker(host) {
88221
88314
  if (validForTypeAttributes && override) {
88222
88315
  return;
88223
88316
  }
88224
- const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier);
88317
+ const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
88225
88318
  if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
88226
88319
  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
88320
  return grammarErrorOnNode(node, message);
@@ -88254,7 +88347,7 @@ function createTypeChecker(host) {
88254
88347
  if (importClause.namedBindings) {
88255
88348
  if (importClause.namedBindings.kind === 274 /* NamespaceImport */) {
88256
88349
  checkImportBinding(importClause.namedBindings);
88257
- if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && getESModuleInterop(compilerOptions)) {
88350
+ if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && getESModuleInterop(compilerOptions)) {
88258
88351
  checkExternalEmitHelpers(node, 65536 /* ImportStar */);
88259
88352
  }
88260
88353
  } else {
@@ -88294,7 +88387,7 @@ function createTypeChecker(host) {
88294
88387
  grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
88295
88388
  }
88296
88389
  } else {
88297
- if (5 /* ES2015 */ <= moduleKind && moduleKind <= 99 /* ESNext */ && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
88390
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
88298
88391
  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
88392
  }
88300
88393
  }
@@ -88324,7 +88417,7 @@ function createTypeChecker(host) {
88324
88417
  checkAliasSymbol(node.exportClause);
88325
88418
  checkModuleExportName(node.exportClause.name);
88326
88419
  }
88327
- if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88420
+ if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
88328
88421
  if (node.exportClause) {
88329
88422
  if (getESModuleInterop(compilerOptions)) {
88330
88423
  checkExternalEmitHelpers(node, 65536 /* ImportStar */);
@@ -88383,7 +88476,7 @@ function createTypeChecker(host) {
88383
88476
  markLinkedReferences(node, 7 /* ExportSpecifier */);
88384
88477
  }
88385
88478
  } else {
88386
- if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && moduleExportNameIsDefault(node.propertyName || node.name)) {
88479
+ if (getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleExportNameIsDefault(node.propertyName || node.name)) {
88387
88480
  checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88388
88481
  }
88389
88482
  }
@@ -88409,7 +88502,7 @@ function createTypeChecker(host) {
88409
88502
  if (typeAnnotationNode) {
88410
88503
  checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
88411
88504
  }
88412
- const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */;
88505
+ const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
88413
88506
  if (node.expression.kind === 80 /* Identifier */) {
88414
88507
  const id = node.expression;
88415
88508
  const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
@@ -88489,7 +88582,7 @@ function createTypeChecker(host) {
88489
88582
  grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
88490
88583
  }
88491
88584
  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 */)) {
88585
+ 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
88586
  grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
88494
88587
  } else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
88495
88588
  grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
@@ -88550,6 +88643,9 @@ function createTypeChecker(host) {
88550
88643
  }
88551
88644
  }
88552
88645
  function checkSourceElementWorker(node) {
88646
+ if (getNodeCheckFlags(node) & 8388608 /* PartiallyTypeChecked */) {
88647
+ return;
88648
+ }
88553
88649
  if (canHaveJSDoc(node)) {
88554
88650
  forEach(node.jsDoc, ({ comment, tags }) => {
88555
88651
  checkJSDocCommentWorker(comment);
@@ -88893,19 +88989,21 @@ function createTypeChecker(host) {
88893
88989
  currentNode = saveCurrentNode;
88894
88990
  (_b = tracing) == null ? void 0 : _b.pop();
88895
88991
  }
88896
- function checkSourceFile(node) {
88992
+ function checkSourceFile(node, nodesToCheck) {
88897
88993
  var _a, _b;
88898
88994
  (_a = tracing) == null ? void 0 : _a.push(
88899
88995
  tracing.Phase.Check,
88900
- "checkSourceFile",
88996
+ nodesToCheck ? "checkSourceFileNodes" : "checkSourceFile",
88901
88997
  { path: node.path },
88902
88998
  /*separateBeginAndEnd*/
88903
88999
  true
88904
89000
  );
88905
- mark("beforeCheck");
88906
- checkSourceFileWorker(node);
88907
- mark("afterCheck");
88908
- measure("Check", "beforeCheck", "afterCheck");
89001
+ const beforeMark = nodesToCheck ? "beforeCheckNodes" : "beforeCheck";
89002
+ const afterMark = nodesToCheck ? "afterCheckNodes" : "afterCheck";
89003
+ mark(beforeMark);
89004
+ nodesToCheck ? checkSourceFileNodesWorker(node, nodesToCheck) : checkSourceFileWorker(node);
89005
+ mark(afterMark);
89006
+ measure("Check", beforeMark, afterMark);
88909
89007
  (_b = tracing) == null ? void 0 : _b.pop();
88910
89008
  }
88911
89009
  function unusedIsError(kind, isAmbient) {
@@ -88936,6 +89034,13 @@ function createTypeChecker(host) {
88936
89034
  clear(potentialWeakMapSetCollisions);
88937
89035
  clear(potentialReflectCollisions);
88938
89036
  clear(potentialUnusedRenamedBindingElementsInTypes);
89037
+ if (links.flags & 8388608 /* PartiallyTypeChecked */) {
89038
+ potentialThisCollisions = links.potentialThisCollisions;
89039
+ potentialNewTargetCollisions = links.potentialNewTargetCollisions;
89040
+ potentialWeakMapSetCollisions = links.potentialWeakMapSetCollisions;
89041
+ potentialReflectCollisions = links.potentialReflectCollisions;
89042
+ potentialUnusedRenamedBindingElementsInTypes = links.potentialUnusedRenamedBindingElementsInTypes;
89043
+ }
88939
89044
  forEach(node.statements, checkSourceElement);
88940
89045
  checkSourceElement(node.endOfFileToken);
88941
89046
  checkDeferredNodes(node);
@@ -88976,10 +89081,38 @@ function createTypeChecker(host) {
88976
89081
  links.flags |= 1 /* TypeChecked */;
88977
89082
  }
88978
89083
  }
88979
- function getDiagnostics2(sourceFile, ct) {
89084
+ function checkSourceFileNodesWorker(file, nodes) {
89085
+ const links = getNodeLinks(file);
89086
+ if (!(links.flags & 1 /* TypeChecked */)) {
89087
+ if (skipTypeChecking(file, compilerOptions, host)) {
89088
+ return;
89089
+ }
89090
+ checkGrammarSourceFile(file);
89091
+ clear(potentialThisCollisions);
89092
+ clear(potentialNewTargetCollisions);
89093
+ clear(potentialWeakMapSetCollisions);
89094
+ clear(potentialReflectCollisions);
89095
+ clear(potentialUnusedRenamedBindingElementsInTypes);
89096
+ forEach(nodes, checkSourceElement);
89097
+ checkDeferredNodes(file);
89098
+ (links.potentialThisCollisions || (links.potentialThisCollisions = [])).push(...potentialThisCollisions);
89099
+ (links.potentialNewTargetCollisions || (links.potentialNewTargetCollisions = [])).push(...potentialNewTargetCollisions);
89100
+ (links.potentialWeakMapSetCollisions || (links.potentialWeakMapSetCollisions = [])).push(...potentialWeakMapSetCollisions);
89101
+ (links.potentialReflectCollisions || (links.potentialReflectCollisions = [])).push(...potentialReflectCollisions);
89102
+ (links.potentialUnusedRenamedBindingElementsInTypes || (links.potentialUnusedRenamedBindingElementsInTypes = [])).push(
89103
+ ...potentialUnusedRenamedBindingElementsInTypes
89104
+ );
89105
+ links.flags |= 8388608 /* PartiallyTypeChecked */;
89106
+ for (const node of nodes) {
89107
+ const nodeLinks2 = getNodeLinks(node);
89108
+ nodeLinks2.flags |= 8388608 /* PartiallyTypeChecked */;
89109
+ }
89110
+ }
89111
+ }
89112
+ function getDiagnostics2(sourceFile, ct, nodesToCheck) {
88980
89113
  try {
88981
89114
  cancellationToken = ct;
88982
- return getDiagnosticsWorker(sourceFile);
89115
+ return getDiagnosticsWorker(sourceFile, nodesToCheck);
88983
89116
  } finally {
88984
89117
  cancellationToken = void 0;
88985
89118
  }
@@ -88990,20 +89123,23 @@ function createTypeChecker(host) {
88990
89123
  }
88991
89124
  deferredDiagnosticsCallbacks = [];
88992
89125
  }
88993
- function checkSourceFileWithEagerDiagnostics(sourceFile) {
89126
+ function checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck) {
88994
89127
  ensurePendingDiagnosticWorkComplete();
88995
89128
  const oldAddLazyDiagnostics = addLazyDiagnostic;
88996
89129
  addLazyDiagnostic = (cb) => cb();
88997
- checkSourceFile(sourceFile);
89130
+ checkSourceFile(sourceFile, nodesToCheck);
88998
89131
  addLazyDiagnostic = oldAddLazyDiagnostics;
88999
89132
  }
89000
- function getDiagnosticsWorker(sourceFile) {
89133
+ function getDiagnosticsWorker(sourceFile, nodesToCheck) {
89001
89134
  if (sourceFile) {
89002
89135
  ensurePendingDiagnosticWorkComplete();
89003
89136
  const previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
89004
89137
  const previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;
89005
- checkSourceFileWithEagerDiagnostics(sourceFile);
89138
+ checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck);
89006
89139
  const semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
89140
+ if (nodesToCheck) {
89141
+ return semanticDiagnostics;
89142
+ }
89007
89143
  const currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
89008
89144
  if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {
89009
89145
  const deferredGlobalDiagnostics = relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, compareDiagnostics);
@@ -89013,7 +89149,7 @@ function createTypeChecker(host) {
89013
89149
  }
89014
89150
  return semanticDiagnostics;
89015
89151
  }
89016
- forEach(host.getSourceFiles(), checkSourceFileWithEagerDiagnostics);
89152
+ forEach(host.getSourceFiles(), (file) => checkSourceFileWithEagerDiagnostics(file));
89017
89153
  return diagnostics.getDiagnostics();
89018
89154
  }
89019
89155
  function getGlobalDiagnostics() {
@@ -90992,7 +91128,7 @@ function createTypeChecker(host) {
90992
91128
  break;
90993
91129
  case 95 /* ExportKeyword */:
90994
91130
  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 */) {
91131
+ node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
90996
91132
  return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
90997
91133
  }
90998
91134
  if (flags & 32 /* Export */) {
@@ -91901,7 +92037,7 @@ function createTypeChecker(host) {
91901
92037
  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
92038
  return grammarErrorOnNode(node.exclamationToken, message);
91903
92039
  }
91904
- if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
92040
+ 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
92041
  checkESModuleMarker(node.name);
91906
92042
  }
91907
92043
  return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
@@ -92402,9 +92538,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
92402
92538
  isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
92403
92539
  fileExists: (fileName) => host.fileExists(fileName),
92404
92540
  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)
92541
+ readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
92408
92542
  };
92409
92543
  }
92410
92544
  var SymbolTrackerImpl = class _SymbolTrackerImpl {
@@ -112259,7 +112393,7 @@ function transformModule(context) {
112259
112393
  case 354 /* PartiallyEmittedExpression */:
112260
112394
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
112261
112395
  case 213 /* CallExpression */:
112262
- if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
112396
+ if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) {
112263
112397
  return visitImportCallExpression(node);
112264
112398
  }
112265
112399
  break;
@@ -115255,8 +115389,8 @@ function transformECMAScriptModule(context) {
115255
115389
  }
115256
115390
  }
115257
115391
 
115258
- // src/compiler/transformers/module/impliedNodeFormatDependent.ts
115259
- function transformImpliedNodeFormatDependentModule(context) {
115392
+ // src/compiler/transformers/module/node.ts
115393
+ function transformNodeModule(context) {
115260
115394
  const previousOnSubstituteNode = context.onSubstituteNode;
115261
115395
  const previousOnEmitNode = context.onEmitNode;
115262
115396
  const esmTransform = transformECMAScriptModule(context);
@@ -115267,7 +115401,6 @@ function transformImpliedNodeFormatDependentModule(context) {
115267
115401
  const cjsTransform = transformModule(context);
115268
115402
  const cjsOnSubstituteNode = context.onSubstituteNode;
115269
115403
  const cjsOnEmitNode = context.onEmitNode;
115270
- const getEmitModuleFormatOfFile2 = (file) => context.getEmitHost().getEmitModuleFormatOfFile(file);
115271
115404
  context.onSubstituteNode = onSubstituteNode;
115272
115405
  context.onEmitNode = onEmitNode;
115273
115406
  context.enableSubstitution(307 /* SourceFile */);
@@ -115282,7 +115415,7 @@ function transformImpliedNodeFormatDependentModule(context) {
115282
115415
  if (!currentSourceFile) {
115283
115416
  return previousOnSubstituteNode(hint, node);
115284
115417
  }
115285
- if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
115418
+ if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
115286
115419
  return esmOnSubstituteNode(hint, node);
115287
115420
  }
115288
115421
  return cjsOnSubstituteNode(hint, node);
@@ -115295,13 +115428,13 @@ function transformImpliedNodeFormatDependentModule(context) {
115295
115428
  if (!currentSourceFile) {
115296
115429
  return previousOnEmitNode(hint, node, emitCallback);
115297
115430
  }
115298
- if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
115431
+ if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
115299
115432
  return esmOnEmitNode(hint, node, emitCallback);
115300
115433
  }
115301
115434
  return cjsOnEmitNode(hint, node, emitCallback);
115302
115435
  }
115303
115436
  function getModuleTransformForFile(file) {
115304
- return getEmitModuleFormatOfFile2(file) >= 5 /* ES2015 */ ? esmTransform : cjsTransform;
115437
+ return file.impliedNodeFormat === 99 /* ESNext */ ? esmTransform : cjsTransform;
115305
115438
  }
115306
115439
  function transformSourceFile(node) {
115307
115440
  if (node.isDeclarationFile) {
@@ -117423,18 +117556,17 @@ function isProcessedComponent(node) {
117423
117556
  // src/compiler/transformer.ts
117424
117557
  function getModuleTransformer(moduleKind) {
117425
117558
  switch (moduleKind) {
117426
- case 200 /* Preserve */:
117427
- return transformECMAScriptModule;
117428
117559
  case 99 /* ESNext */:
117429
117560
  case 7 /* ES2022 */:
117430
117561
  case 6 /* ES2020 */:
117431
117562
  case 5 /* ES2015 */:
117432
- case 100 /* Node16 */:
117433
- case 199 /* NodeNext */:
117434
- case 1 /* CommonJS */:
117435
- return transformImpliedNodeFormatDependentModule;
117563
+ case 200 /* Preserve */:
117564
+ return transformECMAScriptModule;
117436
117565
  case 4 /* System */:
117437
117566
  return transformSystemModule;
117567
+ case 100 /* Node16 */:
117568
+ case 199 /* NodeNext */:
117569
+ return transformNodeModule;
117438
117570
  default:
117439
117571
  return transformModule;
117440
117572
  }
@@ -118162,7 +118294,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118162
118294
  newLine: compilerOptions.newLine,
118163
118295
  noEmitHelpers: compilerOptions.noEmitHelpers,
118164
118296
  module: getEmitModuleKind(compilerOptions),
118165
- moduleResolution: getEmitModuleResolutionKind(compilerOptions),
118166
118297
  target: getEmitScriptTarget(compilerOptions),
118167
118298
  sourceMap: compilerOptions.sourceMap,
118168
118299
  inlineSourceMap: compilerOptions.inlineSourceMap,
@@ -118225,7 +118356,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118225
118356
  newLine: compilerOptions.newLine,
118226
118357
  noEmitHelpers: true,
118227
118358
  module: compilerOptions.module,
118228
- moduleResolution: compilerOptions.moduleResolution,
118229
118359
  target: compilerOptions.target,
118230
118360
  sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
118231
118361
  inlineSourceMap: compilerOptions.inlineSourceMap,
@@ -118241,7 +118371,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118241
118371
  isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
118242
118372
  substituteNode: declarationTransform.substituteNode
118243
118373
  });
118244
- printSourceFileOrBundle(
118374
+ const dtsWritten = printSourceFileOrBundle(
118245
118375
  declarationFilePath,
118246
118376
  declarationMapPath,
118247
118377
  declarationTransform,
@@ -118255,7 +118385,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118255
118385
  }
118256
118386
  );
118257
118387
  if (emittedFilesList) {
118258
- emittedFilesList.push(declarationFilePath);
118388
+ if (dtsWritten) emittedFilesList.push(declarationFilePath);
118259
118389
  if (declarationMapPath) {
118260
118390
  emittedFilesList.push(declarationMapPath);
118261
118391
  }
@@ -118346,8 +118476,10 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118346
118476
  writer.writeLine();
118347
118477
  }
118348
118478
  const text = writer.getText();
118349
- writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos, diagnostics: transform2.diagnostics });
118479
+ const data = { sourceMapUrlPos, diagnostics: transform2.diagnostics };
118480
+ writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
118350
118481
  writer.clear();
118482
+ return !data.skippedDtsWrite;
118351
118483
  }
118352
118484
  function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
118353
118485
  return (mapOptions.sourceMap || mapOptions.inlineSourceMap) && (sourceFileOrBundle.kind !== 307 /* SourceFile */ || !fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
@@ -123734,6 +123866,7 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
123734
123866
  return getModeForUsageLocationWorker(file, usage, compilerOptions);
123735
123867
  }
123736
123868
  function getModeForUsageLocationWorker(file, usage, compilerOptions) {
123869
+ var _a;
123737
123870
  if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
123738
123871
  const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
123739
123872
  if (isTypeOnly) {
@@ -123749,28 +123882,19 @@ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
123749
123882
  return override;
123750
123883
  }
123751
123884
  }
123752
- if (compilerOptions && importSyntaxAffectsModuleResolution(compilerOptions)) {
123753
- return getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions);
123885
+ if (compilerOptions && getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
123886
+ return usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(
123887
+ usage.parent,
123888
+ /*requireStringLiteralLikeArgument*/
123889
+ false
123890
+ ) ? 1 /* CommonJS */ : 99 /* ESNext */;
123754
123891
  }
123755
- }
123756
- function getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions) {
123757
- var _a;
123758
- if (!compilerOptions) {
123759
- return void 0;
123892
+ if (file.impliedNodeFormat === void 0) return void 0;
123893
+ if (file.impliedNodeFormat !== 99 /* ESNext */) {
123894
+ return isImportCall(walkUpParenthesizedExpressions(usage.parent)) ? 99 /* ESNext */ : 1 /* CommonJS */;
123760
123895
  }
123761
123896
  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;
123897
+ return exprParentParent && isImportEqualsDeclaration(exprParentParent) ? 1 /* CommonJS */ : 99 /* ESNext */;
123774
123898
  }
123775
123899
  function getResolutionModeOverride(node, grammarErrorOnNode) {
123776
123900
  if (!node) return void 0;
@@ -123827,7 +123951,7 @@ function getTypeReferenceResolutionName(entry) {
123827
123951
  }
123828
123952
  var typeReferenceResolutionNameAndModeGetter = {
123829
123953
  getName: getTypeReferenceResolutionName,
123830
- getMode: (entry, file, compilerOptions) => getModeForFileReference(entry, file && getDefaultResolutionModeForFileWorker(file, compilerOptions))
123954
+ getMode: (entry, file) => getModeForFileReference(entry, file == null ? void 0 : file.impliedNodeFormat)
123831
123955
  };
123832
123956
  function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
123833
123957
  return {
@@ -124466,7 +124590,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124466
124590
  isSourceFileFromExternalLibrary,
124467
124591
  isSourceFileDefaultLibrary,
124468
124592
  getModeForUsageLocation: getModeForUsageLocation2,
124469
- getEmitSyntaxForUsageLocation,
124470
124593
  getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
124471
124594
  getSourceFileFromReference,
124472
124595
  getLibFileFromReference,
@@ -124495,11 +124618,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124495
124618
  forEachResolvedProjectReference: forEachResolvedProjectReference2,
124496
124619
  isSourceOfProjectReferenceRedirect,
124497
124620
  getRedirectReferenceForResolutionFromSourceOfProject,
124498
- getCompilerOptionsForFile,
124499
- getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
124500
- getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
124501
- getImpliedNodeFormatForEmit: getImpliedNodeFormatForEmit2,
124502
- shouldTransformImportCall,
124503
124621
  emitBuildInfo,
124504
124622
  fileExists,
124505
124623
  readFile,
@@ -125082,10 +125200,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125082
125200
  getSymlinkCache,
125083
125201
  writeFile: writeFileCallback || writeFile2,
125084
125202
  isEmitBlocked,
125085
- shouldTransformImportCall,
125086
- getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
125087
- getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
125088
- getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
125089
125203
  readFile: (f) => host.readFile(f),
125090
125204
  fileExists: (f) => {
125091
125205
  const path = toPath3(f);
@@ -125243,15 +125357,24 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125243
125357
  function getSyntacticDiagnostics(sourceFile, cancellationToken) {
125244
125358
  return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken);
125245
125359
  }
125246
- function getSemanticDiagnostics(sourceFile, cancellationToken) {
125247
- return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken);
125360
+ function getSemanticDiagnostics(sourceFile, cancellationToken, nodesToCheck) {
125361
+ return getDiagnosticsHelper(
125362
+ sourceFile,
125363
+ (sourceFile2, cancellationToken2) => getSemanticDiagnosticsForFile(sourceFile2, cancellationToken2, nodesToCheck),
125364
+ cancellationToken
125365
+ );
125248
125366
  }
125249
125367
  function getCachedSemanticDiagnostics(sourceFile) {
125250
125368
  var _a2;
125251
125369
  return sourceFile ? (_a2 = cachedBindAndCheckDiagnosticsForFile.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics;
125252
125370
  }
125253
125371
  function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
125254
- return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken);
125372
+ return getBindAndCheckDiagnosticsForFile(
125373
+ sourceFile,
125374
+ cancellationToken,
125375
+ /*nodesToCheck*/
125376
+ void 0
125377
+ );
125255
125378
  }
125256
125379
  function getProgramDiagnostics(sourceFile) {
125257
125380
  var _a2;
@@ -125291,16 +125414,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125291
125414
  throw e;
125292
125415
  }
125293
125416
  }
125294
- function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) {
125417
+ function getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
125295
125418
  return concatenate(
125296
- filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken), options),
125419
+ filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), options),
125297
125420
  getProgramDiagnostics(sourceFile)
125298
125421
  );
125299
125422
  }
125300
- function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken) {
125423
+ function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
125424
+ if (nodesToCheck) {
125425
+ return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck);
125426
+ }
125301
125427
  return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache);
125302
125428
  }
125303
- function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
125429
+ function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck) {
125304
125430
  return runWithCancellationToken(() => {
125305
125431
  if (skipTypeChecking(sourceFile, options, program)) {
125306
125432
  return emptyArray;
@@ -125308,24 +125434,34 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125308
125434
  const typeChecker2 = getTypeChecker();
125309
125435
  Debug.assert(!!sourceFile.bindDiagnostics);
125310
125436
  const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
125311
- const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
125312
125437
  const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
125438
+ const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
125313
125439
  let bindDiagnostics = sourceFile.bindDiagnostics;
125314
- let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken);
125440
+ let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken, nodesToCheck);
125315
125441
  if (isPlainJs) {
125316
125442
  bindDiagnostics = filter(bindDiagnostics, (d) => plainJSErrors.has(d.code));
125317
125443
  checkDiagnostics = filter(checkDiagnostics, (d) => plainJSErrors.has(d.code));
125318
125444
  }
125319
- return getMergedBindAndCheckDiagnostics(sourceFile, !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : void 0);
125445
+ return getMergedBindAndCheckDiagnostics(
125446
+ sourceFile,
125447
+ !isPlainJs,
125448
+ !!nodesToCheck,
125449
+ bindDiagnostics,
125450
+ checkDiagnostics,
125451
+ isCheckJs ? sourceFile.jsDocDiagnostics : void 0
125452
+ );
125320
125453
  });
125321
125454
  }
125322
- function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, ...allDiagnostics) {
125455
+ function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, partialCheck, ...allDiagnostics) {
125323
125456
  var _a2;
125324
125457
  const flatDiagnostics = flatten(allDiagnostics);
125325
125458
  if (!includeBindAndCheckDiagnostics || !((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
125326
125459
  return flatDiagnostics;
125327
125460
  }
125328
125461
  const { diagnostics, directives } = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics);
125462
+ if (partialCheck) {
125463
+ return diagnostics;
125464
+ }
125329
125465
  for (const errorExpectation of directives.getUnusedExpectations()) {
125330
125466
  diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive));
125331
125467
  }
@@ -126146,14 +126282,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126146
126282
  const resolvedTypeReferenceDirective = resolutions[index];
126147
126283
  const fileName = ref.fileName;
126148
126284
  resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
126149
- const mode = ref.resolutionMode || getDefaultResolutionModeForFile2(file);
126285
+ const mode = ref.resolutionMode || file.impliedNodeFormat;
126150
126286
  processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
126151
126287
  }
126152
126288
  }
126153
- function getCompilerOptionsForFile(file) {
126154
- var _a2;
126155
- return ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
126156
- }
126157
126289
  function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
126158
126290
  var _a2, _b2;
126159
126291
  (_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 +126386,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126254
126386
  return host.getCanonicalFileName(fileName);
126255
126387
  }
126256
126388
  function processImportedModules(file) {
126389
+ var _a2;
126257
126390
  collectExternalModuleReferences(file);
126258
126391
  if (file.imports.length || file.moduleAugmentations.length) {
126259
126392
  const moduleNames = getModuleNames(file);
126260
126393
  const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
126261
126394
  Debug.assert(resolutions.length === moduleNames.length);
126262
- const optionsForFile = getCompilerOptionsForFile(file);
126395
+ const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
126263
126396
  const resolutionsInFile = createModeAwareCache();
126264
126397
  (resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
126265
126398
  for (let index = 0; index < moduleNames.length; index++) {
@@ -126815,7 +126948,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126815
126948
  redirectInfo = cachedChain.redirectInfo;
126816
126949
  } else {
126817
126950
  reasons == null ? void 0 : reasons.forEach(processReason);
126818
- redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
126951
+ redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
126819
126952
  }
126820
126953
  if (fileProcessingReason) processReason(fileProcessingReason);
126821
126954
  const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
@@ -127173,53 +127306,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127173
127306
  return symlinks;
127174
127307
  }
127175
127308
  function getModeForUsageLocation2(file, usage) {
127176
- return getModeForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
127177
- }
127178
- function getEmitSyntaxForUsageLocation(file, usage) {
127179
- return getEmitSyntaxForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
127309
+ var _a2;
127310
+ const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
127311
+ return getModeForUsageLocationWorker(file, usage, optionsForFile);
127180
127312
  }
127181
127313
  function getModeForResolutionAtIndex2(file, index) {
127182
127314
  return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
127183
127315
  }
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
127316
  }
127224
127317
  function updateHostForUseSourceOfProjectReferenceRedirect(host) {
127225
127318
  let setOfDeclarationDirectories;
@@ -127887,6 +127980,7 @@ function createBuilderProgramState(newProgram, oldState) {
127887
127980
  }
127888
127981
  state.changedFilesSet = /* @__PURE__ */ new Set();
127889
127982
  state.latestChangedDtsFile = compilerOptions.composite ? oldState == null ? void 0 : oldState.latestChangedDtsFile : void 0;
127983
+ state.checkPending = state.compilerOptions.noCheck ? true : void 0;
127890
127984
  const useOldState = BuilderState.canReuseOldState(state.referencedMap, oldState);
127891
127985
  const oldCompilerOptions = useOldState ? oldState.compilerOptions : void 0;
127892
127986
  let canCopySemanticDiagnostics = useOldState && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
@@ -127903,6 +127997,7 @@ function createBuilderProgramState(newProgram, oldState) {
127903
127997
  canCopySemanticDiagnostics = false;
127904
127998
  canCopyEmitDiagnostics = false;
127905
127999
  }
128000
+ state.hasErrorsFromOldState = oldState.hasErrors;
127906
128001
  } else {
127907
128002
  state.buildInfoEmitPending = isIncrementalCompilation(compilerOptions);
127908
128003
  }
@@ -127983,6 +128078,7 @@ function createBuilderProgramState(newProgram, oldState) {
127983
128078
  state.buildInfoEmitPending = true;
127984
128079
  }
127985
128080
  }
128081
+ if (useOldState && state.semanticDiagnosticsPerFile.size !== state.fileInfos.size && oldState.checkPending !== state.checkPending) state.buildInfoEmitPending = true;
127986
128082
  return state;
127987
128083
  function addFileToChangeSet(path) {
127988
128084
  state.changedFilesSet.add(path);
@@ -128062,40 +128158,6 @@ function releaseCache(state) {
128062
128158
  BuilderState.releaseCache(state);
128063
128159
  state.program = void 0;
128064
128160
  }
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
128161
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
128100
128162
  Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
128101
128163
  }
@@ -128200,7 +128262,7 @@ function removeDiagnosticsOfLibraryFiles(state) {
128200
128262
  if (!state.cleanedDiagnosticsOfLibFiles) {
128201
128263
  state.cleanedDiagnosticsOfLibFiles = true;
128202
128264
  const options = state.program.getCompilerOptions();
128203
- forEach(state.program.getSourceFiles(), (f) => state.program.isSourceFileDefaultLibrary(f) && !skipTypeChecking(f, options, state.program) && removeSemanticDiagnosticsOf(state, f.resolvedPath));
128265
+ forEach(state.program.getSourceFiles(), (f) => state.program.isSourceFileDefaultLibrary(f) && !skipTypeCheckingIgnoringNoCheck(f, options, state.program) && removeSemanticDiagnosticsOf(state, f.resolvedPath));
128204
128266
  }
128205
128267
  }
128206
128268
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
@@ -128363,6 +128425,7 @@ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, invalidateJsF
128363
128425
  return void 0;
128364
128426
  }
128365
128427
  function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
128428
+ if (state.compilerOptions.noCheck) return emptyArray;
128366
128429
  return concatenate(
128367
128430
  getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile),
128368
128431
  state.program.getProgramDiagnostics(sourceFile)
@@ -128377,6 +128440,7 @@ function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationTok
128377
128440
  }
128378
128441
  const diagnostics = state.program.getBindAndCheckDiagnostics(sourceFile, cancellationToken);
128379
128442
  semanticDiagnosticsPerFile.set(path, diagnostics);
128443
+ state.buildInfoEmitPending = true;
128380
128444
  return filterSemanticDiagnostics(diagnostics, state.compilerOptions);
128381
128445
  }
128382
128446
  function isIncrementalBundleEmitBuildInfo(info) {
@@ -128386,6 +128450,35 @@ function isIncrementalBundleEmitBuildInfo(info) {
128386
128450
  function isIncrementalBuildInfo(info) {
128387
128451
  return !!info.fileNames;
128388
128452
  }
128453
+ function isNonIncrementalBuildInfo(info) {
128454
+ return !isIncrementalBuildInfo(info) && !!info.root;
128455
+ }
128456
+ function ensureHasErrorsForState(state) {
128457
+ if (state.hasErrors !== void 0) return;
128458
+ if (isIncrementalCompilation(state.compilerOptions)) {
128459
+ state.hasErrors = !some(state.program.getSourceFiles(), (f) => {
128460
+ var _a, _b;
128461
+ const bindAndCheckDiagnostics = state.semanticDiagnosticsPerFile.get(f.resolvedPath);
128462
+ return bindAndCheckDiagnostics === void 0 || // Missing semantic diagnostics in cache will be encoded in buildInfo
128463
+ !!bindAndCheckDiagnostics.length || // cached semantic diagnostics will be encoded in buildInfo
128464
+ !!((_b = (_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.get(f.resolvedPath)) == null ? void 0 : _b.length);
128465
+ }) && (hasSyntaxOrGlobalErrors(state) || some(state.program.getSourceFiles(), (f) => !!state.program.getProgramDiagnostics(f).length));
128466
+ } else {
128467
+ state.hasErrors = some(state.program.getSourceFiles(), (f) => {
128468
+ var _a, _b;
128469
+ const bindAndCheckDiagnostics = state.semanticDiagnosticsPerFile.get(f.resolvedPath);
128470
+ return !!(bindAndCheckDiagnostics == null ? void 0 : bindAndCheckDiagnostics.length) || // If has semantic diagnostics
128471
+ !!((_b = (_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.get(f.resolvedPath)) == null ? void 0 : _b.length);
128472
+ }) || hasSyntaxOrGlobalErrors(state);
128473
+ }
128474
+ }
128475
+ function hasSyntaxOrGlobalErrors(state) {
128476
+ return !!state.program.getConfigFileParsingDiagnostics().length || !!state.program.getSyntacticDiagnostics().length || !!state.program.getOptionsDiagnostics().length || !!state.program.getGlobalDiagnostics().length;
128477
+ }
128478
+ function getBuildInfoEmitPending(state) {
128479
+ ensureHasErrorsForState(state);
128480
+ return state.buildInfoEmitPending ?? (state.buildInfoEmitPending = !!state.hasErrorsFromOldState !== !!state.hasErrors);
128481
+ }
128389
128482
  function getBuildInfo2(state) {
128390
128483
  var _a, _b;
128391
128484
  const currentDirectory = state.program.getCurrentDirectory();
@@ -128394,7 +128487,16 @@ function getBuildInfo2(state) {
128394
128487
  const fileNames = [];
128395
128488
  const fileNameToFileId = /* @__PURE__ */ new Map();
128396
128489
  const rootFileNames = new Set(state.program.getRootFileNames().map((f) => toPath(f, currentDirectory, state.program.getCanonicalFileName)));
128397
- if (!isIncrementalCompilation(state.compilerOptions)) return { version };
128490
+ ensureHasErrorsForState(state);
128491
+ if (!isIncrementalCompilation(state.compilerOptions)) {
128492
+ const buildInfo2 = {
128493
+ root: arrayFrom(rootFileNames, (r) => relativeToBuildInfo(r)),
128494
+ errors: state.hasErrors ? true : void 0,
128495
+ checkPending: state.checkPending,
128496
+ version
128497
+ };
128498
+ return buildInfo2;
128499
+ }
128398
128500
  const root = [];
128399
128501
  if (state.compilerOptions.outFile) {
128400
128502
  const fileInfos2 = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
@@ -128410,7 +128512,6 @@ function getBuildInfo2(state) {
128410
128512
  options: toIncrementalBuildInfoCompilerOptions(state.compilerOptions),
128411
128513
  semanticDiagnosticsPerFile: toIncrementalBuildInfoDiagnostics(),
128412
128514
  emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
128413
- changeFileSet: toChangeFileSet(),
128414
128515
  outSignature: state.outSignature,
128415
128516
  latestChangedDtsFile,
128416
128517
  pendingEmit: !state.programEmitPending ? void 0 : (
@@ -128421,6 +128522,8 @@ function getBuildInfo2(state) {
128421
128522
  )
128422
128523
  ),
128423
128524
  // Actual value
128525
+ errors: state.hasErrors ? true : void 0,
128526
+ checkPending: state.checkPending,
128424
128527
  version
128425
128528
  };
128426
128529
  return buildInfo2;
@@ -128513,9 +128616,10 @@ function getBuildInfo2(state) {
128513
128616
  semanticDiagnosticsPerFile,
128514
128617
  emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
128515
128618
  affectedFilesPendingEmit,
128516
- changeFileSet: toChangeFileSet(),
128517
128619
  emitSignatures,
128518
128620
  latestChangedDtsFile,
128621
+ errors: state.hasErrors ? true : void 0,
128622
+ checkPending: state.checkPending,
128519
128623
  version
128520
128624
  };
128521
128625
  return buildInfo;
@@ -128599,7 +128703,7 @@ function getBuildInfo2(state) {
128599
128703
  state.fileInfos.forEach((_value, key) => {
128600
128704
  const value = state.semanticDiagnosticsPerFile.get(key);
128601
128705
  if (!value) {
128602
- if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
128706
+ result = append(result, toFileId(key));
128603
128707
  } else if (value.length) {
128604
128708
  result = append(result, [
128605
128709
  toFileId(key),
@@ -128666,15 +128770,6 @@ function getBuildInfo2(state) {
128666
128770
  return result;
128667
128771
  }) || array;
128668
128772
  }
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
128773
  }
128679
128774
  var BuilderProgramKind = /* @__PURE__ */ ((BuilderProgramKind2) => {
128680
128775
  BuilderProgramKind2[BuilderProgramKind2["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram";
@@ -128751,8 +128846,6 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128751
128846
  oldState = void 0;
128752
128847
  const builderProgram = createRedirectedBuilderProgram(state, configFileParsingDiagnostics);
128753
128848
  builderProgram.state = state;
128754
- builderProgram.saveEmitState = () => backupBuilderProgramEmitState(state);
128755
- builderProgram.restoreEmitState = (saved) => restoreBuilderProgramEmitState(state, saved);
128756
128849
  builderProgram.hasChangedEmitSignature = () => !!state.hasChangedEmitSignature;
128757
128850
  builderProgram.getAllDependencies = (sourceFile) => BuilderState.getAllDependencies(
128758
128851
  state,
@@ -128774,7 +128867,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128774
128867
  return builderProgram;
128775
128868
  function emitBuildInfo(writeFile2, cancellationToken) {
128776
128869
  Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
128777
- if (state.buildInfoEmitPending) {
128870
+ if (getBuildInfoEmitPending(state)) {
128778
128871
  const result = state.program.emitBuildInfo(
128779
128872
  writeFile2 || maybeBind(host, host.writeFile),
128780
128873
  cancellationToken
@@ -128825,7 +128918,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128825
128918
  }
128826
128919
  }
128827
128920
  if (!affected) {
128828
- if (!state.buildInfoEmitPending) return void 0;
128921
+ if (!getBuildInfoEmitPending(state)) return void 0;
128829
128922
  const affected2 = state.program;
128830
128923
  const result2 = affected2.emitBuildInfo(
128831
128924
  writeFile2 || maybeBind(host, host.writeFile),
@@ -128913,7 +129006,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128913
129006
  if (state.compilerOptions.composite) {
128914
129007
  const filePath = sourceFiles[0].resolvedPath;
128915
129008
  emitSignature = handleNewSignature((_c = state.emitSignatures) == null ? void 0 : _c.get(filePath), emitSignature);
128916
- if (!emitSignature) return;
129009
+ if (!emitSignature) return data.skippedDtsWrite = true;
128917
129010
  (state.emitSignatures ?? (state.emitSignatures = /* @__PURE__ */ new Map())).set(filePath, emitSignature);
128918
129011
  }
128919
129012
  } else if (state.compilerOptions.composite) {
@@ -128922,7 +129015,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128922
129015
  /*newSignature*/
128923
129016
  void 0
128924
129017
  );
128925
- if (!newSignature) return;
129018
+ if (!newSignature) return data.skippedDtsWrite = true;
128926
129019
  state.outSignature = newSignature;
128927
129020
  }
128928
129021
  }
@@ -128992,8 +129085,13 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128992
129085
  while (true) {
128993
129086
  const affected = getNextAffectedFile(state, cancellationToken, host);
128994
129087
  let result;
128995
- if (!affected) return void 0;
128996
- else if (affected !== state.program) {
129088
+ if (!affected) {
129089
+ if (state.checkPending && !state.compilerOptions.noCheck) {
129090
+ state.checkPending = void 0;
129091
+ state.buildInfoEmitPending = true;
129092
+ }
129093
+ return void 0;
129094
+ } else if (affected !== state.program) {
128997
129095
  const affectedSourceFile = affected;
128998
129096
  if (!ignoreSourceFile || !ignoreSourceFile(affectedSourceFile)) {
128999
129097
  result = getSemanticDiagnosticsOfFile(state, affectedSourceFile, cancellationToken);
@@ -129020,6 +129118,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
129020
129118
  result = diagnostics || emptyArray;
129021
129119
  state.changedFilesSet.clear();
129022
129120
  state.programEmitPending = getBuilderFileEmit(state.compilerOptions);
129121
+ if (!state.compilerOptions.noCheck) state.checkPending = void 0;
129023
129122
  state.buildInfoEmitPending = true;
129024
129123
  }
129025
129124
  return { result, affected };
@@ -129040,6 +129139,10 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
129040
129139
  for (const sourceFile2 of state.program.getSourceFiles()) {
129041
129140
  diagnostics = addRange(diagnostics, getSemanticDiagnosticsOfFile(state, sourceFile2, cancellationToken));
129042
129141
  }
129142
+ if (state.checkPending && !state.compilerOptions.noCheck) {
129143
+ state.checkPending = void 0;
129144
+ state.buildInfoEmitPending = true;
129145
+ }
129043
129146
  return diagnostics || emptyArray;
129044
129147
  }
129045
129148
  }
@@ -129067,7 +129170,6 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
129067
129170
  let filePathsSetList;
129068
129171
  const latestChangedDtsFile = buildInfo.latestChangedDtsFile ? toAbsolutePath(buildInfo.latestChangedDtsFile) : void 0;
129069
129172
  const fileInfos = /* @__PURE__ */ new Map();
129070
- const changedFilesSet = new Set(map(buildInfo.changeFileSet, toFilePath));
129071
129173
  if (isIncrementalBundleEmitBuildInfo(buildInfo)) {
129072
129174
  buildInfo.fileInfos.forEach((fileInfo, index) => {
129073
129175
  const path = toFilePath(index + 1);
@@ -129079,10 +129181,11 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
129079
129181
  semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
129080
129182
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
129081
129183
  hasReusableDiagnostic: true,
129082
- changedFilesSet,
129083
129184
  latestChangedDtsFile,
129084
129185
  outSignature: buildInfo.outSignature,
129085
- programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options)
129186
+ programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options),
129187
+ hasErrors: buildInfo.errors,
129188
+ checkPending: buildInfo.checkPending
129086
129189
  };
129087
129190
  } else {
129088
129191
  filePathsSetList = (_b = buildInfo.fileIdsList) == null ? void 0 : _b.map((fileIds) => new Set(fileIds.map(toFilePath)));
@@ -129115,15 +129218,14 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
129115
129218
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
129116
129219
  hasReusableDiagnostic: true,
129117
129220
  affectedFilesPendingEmit: buildInfo.affectedFilesPendingEmit && arrayToMap(buildInfo.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
129118
- changedFilesSet,
129119
129221
  latestChangedDtsFile,
129120
- emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0
129222
+ emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0,
129223
+ hasErrors: buildInfo.errors,
129224
+ checkPending: buildInfo.checkPending
129121
129225
  };
129122
129226
  }
129123
129227
  return {
129124
129228
  state,
129125
- saveEmitState: noop,
129126
- restoreEmitState: noop,
129127
129229
  getProgram: notImplemented,
129128
129230
  getProgramOrUndefined: returnUndefined,
129129
129231
  releaseProgram: noop,
@@ -129167,7 +129269,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
129167
129269
  const semanticDiagnostics = new Map(
129168
129270
  mapDefinedIterator(
129169
129271
  fileInfos.keys(),
129170
- (key) => !changedFilesSet.has(key) ? [key, emptyArray] : void 0
129272
+ (key) => [key, emptyArray]
129171
129273
  )
129172
129274
  );
129173
129275
  diagnostics == null ? void 0 : diagnostics.forEach((value) => {
@@ -129215,11 +129317,15 @@ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
129215
129317
  }
129216
129318
  }
129217
129319
  }
129320
+ function getNonIncrementalBuildInfoRoots(buildInfo, buildInfoPath, host) {
129321
+ if (!isNonIncrementalBuildInfo(buildInfo)) return void 0;
129322
+ const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
129323
+ const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
129324
+ return buildInfo.root.map((r) => toPath(r, buildInfoDirectory, getCanonicalFileName));
129325
+ }
129218
129326
  function createRedirectedBuilderProgram(state, configFileParsingDiagnostics) {
129219
129327
  return {
129220
129328
  state: void 0,
129221
- saveEmitState: noop,
129222
- restoreEmitState: noop,
129223
129329
  getProgram,
129224
129330
  getProgramOrUndefined: () => state.program,
129225
129331
  releaseProgram: () => state.program = void 0,
@@ -130577,10 +130683,10 @@ function explainFiles(program, write) {
130577
130683
  for (const file of program.getSourceFiles()) {
130578
130684
  write(`${toFileName(file, relativeFileName)}`);
130579
130685
  (_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}`));
130686
+ (_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
130581
130687
  }
130582
130688
  }
130583
- function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConvertor) {
130689
+ function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
130584
130690
  var _a;
130585
130691
  let result;
130586
130692
  if (file.path !== file.resolvedPath) {
@@ -130600,7 +130706,7 @@ function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConverto
130600
130706
  ));
130601
130707
  }
130602
130708
  if (isExternalOrCommonJsModule(file)) {
130603
- switch (getImpliedNodeFormatForEmitWorker(file, options)) {
130709
+ switch (file.impliedNodeFormat) {
130604
130710
  case 99 /* ESNext */:
130605
130711
  if (file.packageJsonScope) {
130606
130712
  (result ?? (result = [])).push(chainDiagnosticMessages(
@@ -130797,13 +130903,12 @@ function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummar
130797
130903
  emitOnlyDtsFiles,
130798
130904
  customTransformers
130799
130905
  );
130800
- const { emittedFiles, diagnostics: emitDiagnostics } = emitResult;
130801
- addRange(allDiagnostics, emitDiagnostics);
130906
+ addRange(allDiagnostics, emitResult.diagnostics);
130802
130907
  const diagnostics = sortAndDeduplicateDiagnostics(allDiagnostics);
130803
130908
  diagnostics.forEach(reportDiagnostic);
130804
130909
  if (write) {
130805
130910
  const currentDir = program.getCurrentDirectory();
130806
- forEach(emittedFiles, (file) => {
130911
+ forEach(emitResult.emittedFiles, (file) => {
130807
130912
  const filepath = getNormalizedAbsolutePath(file, currentDir);
130808
130913
  write(`TSFILE: ${filepath}`);
130809
130914
  });
@@ -131486,22 +131591,17 @@ function createWatchProgram(host) {
131486
131591
  updateProgram();
131487
131592
  }
131488
131593
  function updateProgram() {
131489
- var _a, _b, _c, _d;
131490
131594
  switch (updateLevel) {
131491
131595
  case 1 /* RootNamesAndUpdate */:
131492
- (_a = perfLogger) == null ? void 0 : _a.logStartUpdateProgram("PartialConfigReload");
131493
131596
  reloadFileNamesFromConfigFile();
131494
131597
  break;
131495
131598
  case 2 /* Full */:
131496
- (_b = perfLogger) == null ? void 0 : _b.logStartUpdateProgram("FullConfigReload");
131497
131599
  reloadConfigFile();
131498
131600
  break;
131499
131601
  default:
131500
- (_c = perfLogger) == null ? void 0 : _c.logStartUpdateProgram("SynchronizeProgram");
131501
131602
  synchronizeProgram();
131502
131603
  break;
131503
131604
  }
131504
- (_d = perfLogger) == null ? void 0 : _d.logStopUpdateProgram("Done");
131505
131605
  return getCurrentBuilderProgram();
131506
131606
  }
131507
131607
  function reloadFileNamesFromConfigFile() {
@@ -131783,11 +131883,11 @@ var UpToDateStatusType = /* @__PURE__ */ ((UpToDateStatusType2) => {
131783
131883
  UpToDateStatusType2[UpToDateStatusType2["ErrorReadingFile"] = 4] = "ErrorReadingFile";
131784
131884
  UpToDateStatusType2[UpToDateStatusType2["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
131785
131885
  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";
131886
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateBuildInfoWithPendingEmit"] = 7] = "OutOfDateBuildInfoWithPendingEmit";
131887
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateBuildInfoWithErrors"] = 8] = "OutOfDateBuildInfoWithErrors";
131888
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateOptions"] = 9] = "OutOfDateOptions";
131889
+ UpToDateStatusType2[UpToDateStatusType2["OutOfDateRoots"] = 10] = "OutOfDateRoots";
131890
+ UpToDateStatusType2[UpToDateStatusType2["UpstreamOutOfDate"] = 11] = "UpstreamOutOfDate";
131791
131891
  UpToDateStatusType2[UpToDateStatusType2["ComputingUpstream"] = 12] = "ComputingUpstream";
131792
131892
  UpToDateStatusType2[UpToDateStatusType2["TsVersionOutputOfDate"] = 13] = "TsVersionOutputOfDate";
131793
131893
  UpToDateStatusType2[UpToDateStatusType2["UpToDateWithInputFileText"] = 14] = "UpToDateWithInputFileText";
@@ -132262,7 +132362,7 @@ function createUpdateOutputFileStampsProject(state, project, projectPath, config
132262
132362
  }
132263
132363
  };
132264
132364
  }
132265
- function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex, config, buildOrder) {
132365
+ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex, config, status, buildOrder) {
132266
132366
  let step = 0 /* CreateProgram */;
132267
132367
  let program;
132268
132368
  let buildResult;
@@ -132313,17 +132413,13 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
132313
132413
  }
132314
132414
  );
132315
132415
  }
132316
- executeSteps(2 /* SemanticDiagnostics */, cancellationToken);
132317
- if (step === 4 /* EmitBuildInfo */) {
132318
- return emitBuildInfo(writeFile2, cancellationToken);
132319
- }
132320
- if (step !== 3 /* Emit */) return void 0;
132416
+ executeSteps(0 /* CreateProgram */, cancellationToken);
132321
132417
  return emit(writeFile2, cancellationToken, customTransformers);
132322
132418
  },
132323
132419
  done
132324
132420
  };
132325
132421
  function done(cancellationToken, writeFile2, customTransformers) {
132326
- executeSteps(6 /* Done */, cancellationToken, writeFile2, customTransformers);
132422
+ executeSteps(3 /* Done */, cancellationToken, writeFile2, customTransformers);
132327
132423
  mark("SolutionBuilder::Projects built");
132328
132424
  return doneInvalidatedProject(state, projectPath);
132329
132425
  }
@@ -132340,14 +132436,14 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
132340
132436
  if (state.options.dry) {
132341
132437
  reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
132342
132438
  buildResult = 1 /* Success */;
132343
- step = 5 /* QueueReferencingProjects */;
132439
+ step = 2 /* QueueReferencingProjects */;
132344
132440
  return;
132345
132441
  }
132346
132442
  if (state.options.verbose) reportStatus(state, Diagnostics.Building_project_0, project);
132347
132443
  if (config.fileNames.length === 0) {
132348
132444
  reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
132349
132445
  buildResult = 0 /* None */;
132350
- step = 5 /* QueueReferencingProjects */;
132446
+ step = 2 /* QueueReferencingProjects */;
132351
132447
  return;
132352
132448
  }
132353
132449
  const { host, compilerHost } = state;
@@ -132375,179 +132471,97 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
132375
132471
  }
132376
132472
  step++;
132377
132473
  }
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
132474
  function emit(writeFileCallback, cancellationToken, customTransformers) {
132420
132475
  var _a, _b, _c;
132421
132476
  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(
132477
+ Debug.assert(step === 1 /* Emit */);
132478
+ const { host, compilerHost } = state;
132479
+ const emittedOutputs = /* @__PURE__ */ new Map();
132480
+ const options = program.getCompilerOptions();
132481
+ const isIncremental = isIncrementalCompilation(options);
132482
+ let outputTimeStampMap;
132483
+ let now;
132484
+ const { emitResult, diagnostics } = emitFilesAndReportErrors(
132428
132485
  program,
132429
- reportDeclarationDiagnostics,
132430
- /*write*/
132431
- void 0,
132486
+ (d) => host.reportDiagnostic(d),
132487
+ state.write,
132432
132488
  /*reportSummary*/
132433
132489
  void 0,
132434
- (name, text, writeByteOrderMark, _onError, _sourceFiles, data) => outputFiles.push({ name, text, writeByteOrderMark, data }),
132490
+ (name, text, writeByteOrderMark, onError, sourceFiles, data) => {
132491
+ var _a2;
132492
+ const path = toPath2(state, name);
132493
+ emittedOutputs.set(toPath2(state, name), name);
132494
+ if (data == null ? void 0 : data.buildInfo) {
132495
+ now || (now = getCurrentTime(state.host));
132496
+ const isChangedSignature2 = (_a2 = program.hasChangedEmitSignature) == null ? void 0 : _a2.call(program);
132497
+ const existing = getBuildInfoCacheEntry(state, name, projectPath);
132498
+ if (existing) {
132499
+ existing.buildInfo = data.buildInfo;
132500
+ existing.modifiedTime = now;
132501
+ if (isChangedSignature2) existing.latestChangedDtsTime = now;
132502
+ } else {
132503
+ state.buildInfoCache.set(projectPath, {
132504
+ path: toPath2(state, name),
132505
+ buildInfo: data.buildInfo,
132506
+ modifiedTime: now,
132507
+ latestChangedDtsTime: isChangedSignature2 ? now : void 0
132508
+ });
132509
+ }
132510
+ }
132511
+ const modifiedTime = (data == null ? void 0 : data.differsOnlyInMap) ? getModifiedTime(state.host, name) : void 0;
132512
+ (writeFileCallback || compilerHost.writeFile)(
132513
+ name,
132514
+ text,
132515
+ writeByteOrderMark,
132516
+ onError,
132517
+ sourceFiles,
132518
+ data
132519
+ );
132520
+ if (data == null ? void 0 : data.differsOnlyInMap) state.host.setModifiedTime(name, modifiedTime);
132521
+ else if (!isIncremental && state.watch) {
132522
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
132523
+ }
132524
+ },
132435
132525
  cancellationToken,
132436
132526
  /*emitOnlyDtsFiles*/
132437
- false,
132527
+ void 0,
132438
132528
  customTransformers || ((_b = (_a = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a, project))
132439
132529
  );
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
- };
132530
+ if ((!options.noEmitOnError || !diagnostics.length) && (emittedOutputs.size || status.type !== 8 /* OutOfDateBuildInfoWithErrors */)) {
132531
+ updateOutputTimestampsWorker(state, config, projectPath, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
132453
132532
  }
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));
132533
+ state.projectErrorsReported.set(projectPath, true);
132534
+ buildResult = ((_c = program.hasChangedEmitSignature) == null ? void 0 : _c.call(program)) ? 0 /* None */ : 2 /* DeclarationOutputUnchanged */;
132535
+ if (!diagnostics.length) {
132536
+ state.diagnostics.delete(projectPath);
132537
+ state.projectStatus.set(projectPath, {
132538
+ type: 1 /* UpToDate */,
132539
+ oldestOutputFileName: firstOrUndefinedIterator(emittedOutputs.values()) ?? getFirstProjectOutput(config, !host.useCaseSensitiveFileNames())
132540
+ });
132541
+ } else {
132542
+ state.diagnostics.set(projectPath, diagnostics);
132543
+ state.projectStatus.set(projectPath, { type: 0 /* Unbuildable */, reason: `it had errors` });
132544
+ buildResult |= 4 /* AnyErrors */;
132496
132545
  }
132497
132546
  afterProgramDone(state, program);
132498
- step = 5 /* QueueReferencingProjects */;
132547
+ step = 2 /* QueueReferencingProjects */;
132499
132548
  return emitResult;
132500
132549
  }
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
132550
  function executeSteps(till, cancellationToken, writeFile2, customTransformers) {
132528
- while (step <= till && step < 6 /* Done */) {
132551
+ while (step <= till && step < 3 /* Done */) {
132529
132552
  const currentStep = step;
132530
132553
  switch (step) {
132531
132554
  case 0 /* CreateProgram */:
132532
132555
  createProgram2();
132533
132556
  break;
132534
- case 1 /* SyntaxDiagnostics */:
132535
- getSyntaxDiagnostics(cancellationToken);
132536
- break;
132537
- case 2 /* SemanticDiagnostics */:
132538
- getSemanticDiagnostics(cancellationToken);
132539
- break;
132540
- case 3 /* Emit */:
132557
+ case 1 /* Emit */:
132541
132558
  emit(writeFile2, cancellationToken, customTransformers);
132542
132559
  break;
132543
- case 4 /* EmitBuildInfo */:
132544
- emitBuildInfo(writeFile2, cancellationToken);
132545
- break;
132546
- case 5 /* QueueReferencingProjects */:
132560
+ case 2 /* QueueReferencingProjects */:
132547
132561
  queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult));
132548
132562
  step++;
132549
132563
  break;
132550
- case 6 /* Done */:
132564
+ case 3 /* Done */:
132551
132565
  default:
132552
132566
  assertType(step);
132553
132567
  }
@@ -132609,20 +132623,6 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
132609
132623
  };
132610
132624
  }
132611
132625
  }
132612
- if (status.type === 11 /* UpstreamBlocked */) {
132613
- verboseReportProjectStatus(state, project, status);
132614
- reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
132615
- projectPendingBuild.delete(projectPath);
132616
- if (options.verbose) {
132617
- reportStatus(
132618
- state,
132619
- status.upstreamProjectBlocked ? Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built : Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors,
132620
- project,
132621
- status.upstreamProjectName
132622
- );
132623
- }
132624
- continue;
132625
- }
132626
132626
  if (status.type === 15 /* ContainerOnly */) {
132627
132627
  verboseReportProjectStatus(state, project, status);
132628
132628
  reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
@@ -132648,6 +132648,7 @@ function createInvalidatedProjectWithInfo(state, info, buildOrder) {
132648
132648
  info.projectPath,
132649
132649
  info.projectIndex,
132650
132650
  info.config,
132651
+ info.status,
132651
132652
  buildOrder
132652
132653
  ) : createUpdateOutputFileStampsProject(
132653
132654
  state,
@@ -132662,11 +132663,6 @@ function getNextInvalidatedProject(state, buildOrder, reportQueue) {
132662
132663
  if (!info) return info;
132663
132664
  return createInvalidatedProjectWithInfo(state, info, buildOrder);
132664
132665
  }
132665
- function listEmittedFile({ write }, proj, file) {
132666
- if (write && proj.options.listEmittedFiles) {
132667
- write(`TSFILE: ${file}`);
132668
- }
132669
- }
132670
132666
  function getOldProgram({ options, builderPrograms, compilerHost }, proj, parsed) {
132671
132667
  if (options.force) return void 0;
132672
132668
  const value = builderPrograms.get(proj);
@@ -132675,7 +132671,6 @@ function getOldProgram({ options, builderPrograms, compilerHost }, proj, parsed)
132675
132671
  }
132676
132672
  function afterProgramDone(state, program) {
132677
132673
  if (program) {
132678
- if (state.write) listFiles(program, state.write);
132679
132674
  if (state.host.afterProgramEmitAndDiagnostics) {
132680
132675
  state.host.afterProgramEmitAndDiagnostics(program);
132681
132676
  }
@@ -132683,11 +132678,6 @@ function afterProgramDone(state, program) {
132683
132678
  }
132684
132679
  state.projectCompilerOptions = state.baseCompilerOptions;
132685
132680
  }
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
132681
  function isFileWatcherWithModifiedTime(value) {
132692
132682
  return !!value.watcher;
132693
132683
  }
@@ -132745,23 +132735,6 @@ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
132745
132735
  if (!result) state.outputTimeStamps.set(resolvedConfigFilePath, result = /* @__PURE__ */ new Map());
132746
132736
  return result;
132747
132737
  }
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
132738
  function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
132766
132739
  const path = toPath2(state, buildInfoPath);
132767
132740
  const existing = state.buildInfoCache.get(resolvedConfigPath);
@@ -132789,7 +132762,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
132789
132762
  }
132790
132763
  }
132791
132764
  function getUpToDateStatusWorker(state, project, resolvedPath) {
132792
- var _a, _b, _c, _d;
132765
+ var _a, _b, _c;
132793
132766
  if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
132794
132767
  return {
132795
132768
  type: 15 /* ContainerOnly */
@@ -132807,19 +132780,6 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132807
132780
  if (refStatus.type === 12 /* ComputingUpstream */ || refStatus.type === 15 /* ContainerOnly */) {
132808
132781
  continue;
132809
132782
  }
132810
- if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 11 /* UpstreamBlocked */) {
132811
- return {
132812
- type: 11 /* UpstreamBlocked */,
132813
- upstreamProjectName: ref.path,
132814
- upstreamProjectBlocked: refStatus.type === 11 /* UpstreamBlocked */
132815
- };
132816
- }
132817
- if (refStatus.type !== 1 /* UpToDate */) {
132818
- return {
132819
- type: 10 /* UpstreamOutOfDate */,
132820
- upstreamProjectName: ref.path
132821
- };
132822
- }
132823
132783
  if (!force) (referenceStatuses || (referenceStatuses = [])).push({ ref, refStatus, resolvedRefPath, resolvedConfig });
132824
132784
  }
132825
132785
  }
@@ -132856,16 +132816,29 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132856
132816
  version: buildInfo.version
132857
132817
  };
132858
132818
  }
132819
+ if (!project.options.noCheck && (buildInfo.errors || // TODO: syntax errors????
132820
+ buildInfo.checkPending)) {
132821
+ return {
132822
+ type: 8 /* OutOfDateBuildInfoWithErrors */,
132823
+ buildInfoFile: buildInfoPath
132824
+ };
132825
+ }
132859
132826
  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)) {
132827
+ if (!project.options.noCheck && (((_a = incrementalBuildInfo.semanticDiagnosticsPerFile) == null ? void 0 : _a.length) || !project.options.noEmit && getEmitDeclarations(project.options) && ((_b = incrementalBuildInfo.emitDiagnosticsPerFile) == null ? void 0 : _b.length))) {
132828
+ return {
132829
+ type: 8 /* OutOfDateBuildInfoWithErrors */,
132830
+ buildInfoFile: buildInfoPath
132831
+ };
132832
+ }
132833
+ if (!project.options.noEmit && (((_c = incrementalBuildInfo.affectedFilesPendingEmit) == null ? void 0 : _c.length) || incrementalBuildInfo.pendingEmit !== void 0)) {
132861
132834
  return {
132862
- type: 7 /* OutOfDateBuildInfo */,
132835
+ type: 7 /* OutOfDateBuildInfoWithPendingEmit */,
132863
132836
  buildInfoFile: buildInfoPath
132864
132837
  };
132865
132838
  }
132866
132839
  if (!project.options.noEmit && getPendingEmitKind(project.options, incrementalBuildInfo.options || {})) {
132867
132840
  return {
132868
- type: 8 /* OutOfDateOptions */,
132841
+ type: 9 /* OutOfDateOptions */,
132869
132842
  buildInfoFile: buildInfoPath
132870
132843
  };
132871
132844
  }
@@ -132885,7 +132858,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132885
132858
  reason: `${inputFile} does not exist`
132886
132859
  };
132887
132860
  }
132888
- const inputPath = incrementalBuildInfo ? toPath2(state, inputFile) : void 0;
132861
+ const inputPath = toPath2(state, inputFile);
132889
132862
  if (buildInfoTime < inputTime) {
132890
132863
  let version2;
132891
132864
  let currentVersion;
@@ -132909,22 +132882,28 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132909
132882
  newestInputFileName = inputFile;
132910
132883
  newestInputFileTime = inputTime;
132911
132884
  }
132912
- if (incrementalBuildInfo) seenRoots.add(inputPath);
132885
+ seenRoots.add(inputPath);
132913
132886
  }
132887
+ let existingRoot;
132914
132888
  if (incrementalBuildInfo) {
132915
132889
  if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(incrementalBuildInfo, buildInfoPath, host);
132916
- const existingRoot = forEachEntry(
132890
+ existingRoot = forEachEntry(
132917
132891
  buildInfoVersionMap.roots,
132918
132892
  // File was root file when project was built but its not any more
132919
132893
  (_resolved, existingRoot2) => !seenRoots.has(existingRoot2) ? existingRoot2 : void 0
132920
132894
  );
132921
- if (existingRoot) {
132922
- return {
132923
- type: 9 /* OutOfDateRoots */,
132924
- buildInfoFile: buildInfoPath,
132925
- inputFile: existingRoot
132926
- };
132927
- }
132895
+ } else {
132896
+ existingRoot = forEach(
132897
+ getNonIncrementalBuildInfoRoots(buildInfo, buildInfoPath, host),
132898
+ (root) => !seenRoots.has(root) ? root : void 0
132899
+ );
132900
+ }
132901
+ if (existingRoot) {
132902
+ return {
132903
+ type: 10 /* OutOfDateRoots */,
132904
+ buildInfoFile: buildInfoPath,
132905
+ inputFile: existingRoot
132906
+ };
132928
132907
  }
132929
132908
  if (!isIncremental) {
132930
132909
  const outputs = getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
@@ -133005,7 +132984,7 @@ function hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath) {
133005
132984
  }
133006
132985
  function getUpToDateStatus(state, project, resolvedPath) {
133007
132986
  if (project === void 0) {
133008
- return { type: 0 /* Unbuildable */, reason: "File deleted mid-build" };
132987
+ return { type: 0 /* Unbuildable */, reason: "config file deleted mid-build" };
133009
132988
  }
133010
132989
  const prior = state.projectStatus.get(resolvedPath);
133011
132990
  if (prior !== void 0) {
@@ -133076,7 +133055,6 @@ function updateOutputTimestamps(state, proj, resolvedPath) {
133076
133055
  });
133077
133056
  }
133078
133057
  function queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, buildResult) {
133079
- if (buildResult & 124 /* AnyErrors */) return;
133080
133058
  if (!config.options.composite) return;
133081
133059
  for (let index = projectIndex + 1; index < buildOrder.length; index++) {
133082
133060
  const nextProject = buildOrder[index];
@@ -133105,11 +133083,6 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
133105
133083
  });
133106
133084
  }
133107
133085
  break;
133108
- case 11 /* UpstreamBlocked */:
133109
- if (toResolvedConfigFilePath(state, resolveProjectName(state, status.upstreamProjectName)) === projectPath) {
133110
- clearProjectStatus(state, nextProjectPath);
133111
- }
133112
- break;
133113
133086
  }
133114
133087
  }
133115
133088
  addProjToQueue(state, nextProjectPath, 0 /* Update */);
@@ -133524,21 +133497,28 @@ function reportUpToDateStatus(state, configFileName, status) {
133524
133497
  relName(state, configFileName),
133525
133498
  relName(state, status.fileName)
133526
133499
  );
133527
- case 7 /* OutOfDateBuildInfo */:
133500
+ case 7 /* OutOfDateBuildInfoWithPendingEmit */:
133528
133501
  return reportStatus(
133529
133502
  state,
133530
133503
  Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted,
133531
133504
  relName(state, configFileName),
133532
133505
  relName(state, status.buildInfoFile)
133533
133506
  );
133534
- case 8 /* OutOfDateOptions */:
133507
+ case 8 /* OutOfDateBuildInfoWithErrors */:
133508
+ return reportStatus(
133509
+ state,
133510
+ Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors,
133511
+ relName(state, configFileName),
133512
+ relName(state, status.buildInfoFile)
133513
+ );
133514
+ case 9 /* OutOfDateOptions */:
133535
133515
  return reportStatus(
133536
133516
  state,
133537
133517
  Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_there_is_change_in_compilerOptions,
133538
133518
  relName(state, configFileName),
133539
133519
  relName(state, status.buildInfoFile)
133540
133520
  );
133541
- case 9 /* OutOfDateRoots */:
133521
+ case 10 /* OutOfDateRoots */:
133542
133522
  return reportStatus(
133543
133523
  state,
133544
133524
  Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more,
@@ -133569,24 +133549,17 @@ function reportUpToDateStatus(state, configFileName, status) {
133569
133549
  Diagnostics.Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files,
133570
133550
  relName(state, configFileName)
133571
133551
  );
133572
- case 10 /* UpstreamOutOfDate */:
133552
+ case 11 /* UpstreamOutOfDate */:
133573
133553
  return reportStatus(
133574
133554
  state,
133575
133555
  Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date,
133576
133556
  relName(state, configFileName),
133577
133557
  relName(state, status.upstreamProjectName)
133578
133558
  );
133579
- case 11 /* UpstreamBlocked */:
133580
- return reportStatus(
133581
- state,
133582
- 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,
133583
- relName(state, configFileName),
133584
- relName(state, status.upstreamProjectName)
133585
- );
133586
133559
  case 0 /* Unbuildable */:
133587
133560
  return reportStatus(
133588
133561
  state,
133589
- Diagnostics.Failed_to_parse_file_0_Colon_1,
133562
+ Diagnostics.Project_0_is_out_of_date_because_1,
133590
133563
  relName(state, configFileName),
133591
133564
  status.reason
133592
133565
  );
@@ -137259,9 +137232,7 @@ function createModuleSpecifierResolutionHost(program, host) {
137259
137232
  isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
137260
137233
  getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
137261
137234
  getFileIncludeReasons: () => program.getFileIncludeReasons(),
137262
- getCommonSourceDirectory: () => program.getCommonSourceDirectory(),
137263
- getDefaultResolutionModeForFile: (file) => program.getDefaultResolutionModeForFile(file),
137264
- getModeForResolutionAtIndex: (file, index) => program.getModeForResolutionAtIndex(file, index)
137235
+ getCommonSourceDirectory: () => program.getCommonSourceDirectory()
137265
137236
  };
137266
137237
  }
137267
137238
  function getModuleSpecifierResolverHost(program, host) {
@@ -138365,12 +138336,36 @@ function mapOneOrMany(valueOrArray, f, resultSelector = identity) {
138365
138336
  function firstOrOnly(valueOrArray) {
138366
138337
  return isArray(valueOrArray) ? first(valueOrArray) : valueOrArray;
138367
138338
  }
138339
+ function getNamesForExportedSymbol(symbol, scriptTarget) {
138340
+ if (needsNameFromDeclaration(symbol)) {
138341
+ const fromDeclaration = getDefaultLikeExportNameFromDeclaration(symbol);
138342
+ if (fromDeclaration) return fromDeclaration;
138343
+ const fileNameCase = moduleSymbolToValidIdentifier(
138344
+ getSymbolParentOrFail(symbol),
138345
+ scriptTarget,
138346
+ /*forceCapitalize*/
138347
+ false
138348
+ );
138349
+ const capitalized = moduleSymbolToValidIdentifier(
138350
+ getSymbolParentOrFail(symbol),
138351
+ scriptTarget,
138352
+ /*forceCapitalize*/
138353
+ true
138354
+ );
138355
+ if (fileNameCase === capitalized) return fileNameCase;
138356
+ return [fileNameCase, capitalized];
138357
+ }
138358
+ return symbol.name;
138359
+ }
138368
138360
  function getNameForExportedSymbol(symbol, scriptTarget, preferCapitalized) {
138369
- if (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */) {
138361
+ if (needsNameFromDeclaration(symbol)) {
138370
138362
  return getDefaultLikeExportNameFromDeclaration(symbol) || moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
138371
138363
  }
138372
138364
  return symbol.name;
138373
138365
  }
138366
+ function needsNameFromDeclaration(symbol) {
138367
+ return !(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */);
138368
+ }
138374
138369
  function getDefaultLikeExportNameFromDeclaration(symbol) {
138375
138370
  return firstDefined(symbol.declarations, (d) => {
138376
138371
  var _a, _b, _c;
@@ -138543,13 +138538,9 @@ function fileShouldUseJavaScriptRequire(file, program, host, preferRequire) {
138543
138538
  if (!hasJSFileExtension(fileName)) {
138544
138539
  return false;
138545
138540
  }
138546
- const compilerOptions = typeof file === "string" ? program.getCompilerOptions() : program.getCompilerOptionsForFile(file);
138541
+ const compilerOptions = program.getCompilerOptions();
138547
138542
  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);
138543
+ 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
138544
  if (impliedNodeFormat === 99 /* ESNext */) {
138554
138545
  return false;
138555
138546
  }
@@ -138661,7 +138652,6 @@ function createCacheableExportInfoMap(host) {
138661
138652
  const namedSymbol = isDefault && getLocalSymbolForExportDefault(symbol) || symbol;
138662
138653
  const names = exportKind === 0 /* Named */ || isExternalModuleSymbol(namedSymbol) ? unescapeLeadingUnderscores(symbolTableKey) : getNamesForExportedSymbol(
138663
138654
  namedSymbol,
138664
- checker,
138665
138655
  /*scriptTarget*/
138666
138656
  void 0
138667
138657
  );
@@ -138986,15 +138976,7 @@ function getDefaultLikeExportInfo(moduleSymbol, checker) {
138986
138976
  function isImportableSymbol(symbol, checker) {
138987
138977
  return !checker.isUndefinedSymbol(symbol) && !checker.isUnknownSymbol(symbol) && !isKnownSymbol(symbol) && !isPrivateIdentifierSymbol(symbol);
138988
138978
  }
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) {
138979
+ function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, preferCapitalizedNames, cb) {
138998
138980
  let chain;
138999
138981
  let current = defaultExport;
139000
138982
  while (current) {
@@ -139012,20 +138994,7 @@ function forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, cb) {
139012
138994
  }
139013
138995
  for (const symbol of chain ?? emptyArray) {
139014
138996
  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
- );
138997
+ const final = cb(moduleSymbolToValidIdentifier(symbol.parent, getEmitScriptTarget(compilerOptions), preferCapitalizedNames));
139029
138998
  if (final) return final;
139030
138999
  }
139031
139000
  }
@@ -141551,7 +141520,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
141551
141520
  program.getSemanticDiagnostics(sourceFile, cancellationToken);
141552
141521
  const diags = [];
141553
141522
  const checker = program.getTypeChecker();
141554
- const isCommonJSFile = program.getImpliedNodeFormatForEmit(sourceFile) === 1 /* CommonJS */ || fileExtensionIsOneOf(sourceFile.fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]);
141523
+ const isCommonJSFile = sourceFile.impliedNodeFormat === 1 /* CommonJS */ || fileExtensionIsOneOf(sourceFile.fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]);
141555
141524
  if (!isCommonJSFile && sourceFile.commonJsModuleIndicator && (programContainsEsModules(program) || compilerOptionsIndicateEsModules(program.getCompilerOptions())) && containsTopLevelCommonjs(sourceFile)) {
141556
141525
  diags.push(createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module));
141557
141526
  }
@@ -149406,6 +149375,108 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
149406
149375
  const declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile, cancellationToken);
149407
149376
  return [...semanticDiagnostics, ...declarationDiagnostics];
149408
149377
  }
149378
+ function getRegionSemanticDiagnostics(fileName, ranges) {
149379
+ synchronizeHostData();
149380
+ const sourceFile = getValidSourceFile(fileName);
149381
+ const options = program.getCompilerOptions();
149382
+ if (skipTypeChecking(sourceFile, options, program) || !canIncludeBindAndCheckDiagnostics(sourceFile, options) || program.getCachedSemanticDiagnostics(sourceFile)) {
149383
+ return void 0;
149384
+ }
149385
+ const nodes = getNodesForRanges(sourceFile, ranges);
149386
+ if (!nodes) {
149387
+ return void 0;
149388
+ }
149389
+ const checkedSpans = normalizeSpans(nodes.map((node) => createTextSpanFromBounds(node.getFullStart(), node.getEnd())));
149390
+ const semanticDiagnostics = program.getSemanticDiagnostics(sourceFile, cancellationToken, nodes);
149391
+ return {
149392
+ diagnostics: semanticDiagnostics.slice(),
149393
+ spans: checkedSpans
149394
+ };
149395
+ }
149396
+ function getNodesForRanges(file, ranges) {
149397
+ const nodes = [];
149398
+ const spans = normalizeSpans(ranges.map((range) => createTextSpanFromRange(range)));
149399
+ for (const span of spans) {
149400
+ const nodesForSpan = getNodesForSpan(file, span);
149401
+ if (!nodesForSpan) {
149402
+ return void 0;
149403
+ }
149404
+ nodes.push(...nodesForSpan);
149405
+ }
149406
+ if (!nodes.length) {
149407
+ return void 0;
149408
+ }
149409
+ return nodes;
149410
+ }
149411
+ function getNodesForSpan(file, span) {
149412
+ if (textSpanContainsTextRange(span, file)) {
149413
+ return void 0;
149414
+ }
149415
+ const endToken = findTokenOnLeftOfPosition(file, textSpanEnd(span)) || file;
149416
+ const enclosingNode = findAncestor(endToken, (node) => textRangeContainsTextSpan(node, span));
149417
+ const nodes = [];
149418
+ chooseOverlappingNodes(span, enclosingNode, nodes);
149419
+ if (file.end === span.start + span.length) {
149420
+ nodes.push(file.endOfFileToken);
149421
+ }
149422
+ if (some(nodes, isSourceFile)) {
149423
+ return void 0;
149424
+ }
149425
+ return nodes;
149426
+ }
149427
+ function chooseOverlappingNodes(span, node, result) {
149428
+ if (!nodeOverlapsWithSpan(node, span)) {
149429
+ return false;
149430
+ }
149431
+ if (textSpanContainsTextRange(span, node)) {
149432
+ addSourceElement(node, result);
149433
+ return true;
149434
+ }
149435
+ if (isBlockLike(node)) {
149436
+ return chooseOverlappingBlockLike(span, node, result);
149437
+ }
149438
+ if (isClassLike(node)) {
149439
+ return chooseOverlappingClassLike(span, node, result);
149440
+ }
149441
+ addSourceElement(node, result);
149442
+ return true;
149443
+ }
149444
+ function nodeOverlapsWithSpan(node, span) {
149445
+ const spanEnd = span.start + span.length;
149446
+ return node.pos < spanEnd && node.end > span.start;
149447
+ }
149448
+ function addSourceElement(node, result) {
149449
+ while (node.parent && !isSourceElement(node)) {
149450
+ node = node.parent;
149451
+ }
149452
+ result.push(node);
149453
+ }
149454
+ function chooseOverlappingBlockLike(span, node, result) {
149455
+ const childResult = [];
149456
+ const stmts = node.statements.filter((stmt) => chooseOverlappingNodes(span, stmt, childResult));
149457
+ if (stmts.length === node.statements.length) {
149458
+ addSourceElement(node, result);
149459
+ return true;
149460
+ }
149461
+ result.push(...childResult);
149462
+ return false;
149463
+ }
149464
+ function chooseOverlappingClassLike(span, node, result) {
149465
+ var _a2, _b, _c;
149466
+ const overlaps = (n) => textRangeIntersectsWithTextSpan(n, span);
149467
+ 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))) {
149468
+ addSourceElement(node, result);
149469
+ return true;
149470
+ }
149471
+ const childResult = [];
149472
+ const members = node.members.filter((member) => chooseOverlappingNodes(span, member, childResult));
149473
+ if (members.length === node.members.length) {
149474
+ addSourceElement(node, result);
149475
+ return true;
149476
+ }
149477
+ result.push(...childResult);
149478
+ return false;
149479
+ }
149409
149480
  function getSuggestionDiagnostics(fileName) {
149410
149481
  synchronizeHostData();
149411
149482
  return computeSuggestionDiagnostics(getValidSourceFile(fileName), program, cancellationToken);
@@ -150220,6 +150291,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
150220
150291
  cleanupSemanticCache,
150221
150292
  getSyntacticDiagnostics,
150222
150293
  getSemanticDiagnostics,
150294
+ getRegionSemanticDiagnostics,
150223
150295
  getSuggestionDiagnostics,
150224
150296
  getCompilerOptionsDiagnostics,
150225
150297
  getSyntacticClassifications: getSyntacticClassifications2,
@@ -154547,7 +154619,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
154547
154619
  compilerOptions,
154548
154620
  createModuleSpecifierResolutionHost(program, host)
154549
154621
  );
154550
- const importKind = getImportKind(futureExportingSourceFile, exportKind, program);
154622
+ const importKind = getImportKind(futureExportingSourceFile, exportKind, compilerOptions);
154551
154623
  const addAsTypeOnly = getAddAsTypeOnly(
154552
154624
  isImportUsageValidAsTypeOnly,
154553
154625
  /*isForNewImportDeclaration*/
@@ -154887,7 +154959,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
154887
154959
  }
154888
154960
  function createImportSpecifierResolver(importingFile, program, host, preferences) {
154889
154961
  const packageJsonImportFilter = createPackageJsonImportFilter(importingFile, preferences, host);
154890
- const importMap = createExistingImportMap(importingFile, program);
154962
+ const importMap = createExistingImportMap(program.getTypeChecker(), importingFile, program.getCompilerOptions());
154891
154963
  return { getModuleSpecifierForBestExportInfo };
154892
154964
  function getModuleSpecifierForBestExportInfo(exportInfo, position, isValidTypeOnlyUseSite, fromCacheOnly) {
154893
154965
  const { fixes, computedWithoutCacheCount } = getImportFixes(
@@ -154990,7 +155062,7 @@ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program
154990
155062
  }
154991
155063
  }
154992
155064
  }
154993
- function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(sourceFile, program) : void 0, fromCacheOnly) {
155065
+ function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(program.getTypeChecker(), sourceFile, program.getCompilerOptions()) : void 0, fromCacheOnly) {
154994
155066
  const checker = program.getTypeChecker();
154995
155067
  const existingImports = importMap ? flatMap(exportInfos, importMap.getImportsForExportInfo) : emptyArray;
154996
155068
  const useNamespace = usagePosition !== void 0 && tryUseExistingNamespaceImport(existingImports, usagePosition);
@@ -155105,8 +155177,7 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
155105
155177
  };
155106
155178
  }
155107
155179
  }
155108
- function createExistingImportMap(importingFile, program) {
155109
- const checker = program.getTypeChecker();
155180
+ function createExistingImportMap(checker, importingFile, compilerOptions) {
155110
155181
  let importMap;
155111
155182
  for (const moduleSpecifier of importingFile.imports) {
155112
155183
  const i = importFromModuleSpecifier(moduleSpecifier);
@@ -155127,7 +155198,7 @@ function createExistingImportMap(importingFile, program) {
155127
155198
  const matchingDeclarations = importMap == null ? void 0 : importMap.get(getSymbolId(moduleSymbol));
155128
155199
  if (!matchingDeclarations) return emptyArray;
155129
155200
  if (isSourceFileJS(importingFile) && !(targetFlags & 111551 /* Value */) && !every(matchingDeclarations, isJSDocImportTag)) return emptyArray;
155130
- const importKind = getImportKind(importingFile, exportKind, program);
155201
+ const importKind = getImportKind(importingFile, exportKind, compilerOptions);
155131
155202
  return matchingDeclarations.map((declaration) => ({ declaration, importKind, symbol, targetFlags }));
155132
155203
  }
155133
155204
  };
@@ -155142,8 +155213,8 @@ function shouldUseRequire(sourceFile, program) {
155142
155213
  if (compilerOptions.configFile) {
155143
155214
  return getEmitModuleKind(compilerOptions) < 5 /* ES2015 */;
155144
155215
  }
155145
- if (getImpliedNodeFormatForEmit(sourceFile, program) === 1 /* CommonJS */) return true;
155146
- if (getImpliedNodeFormatForEmit(sourceFile, program) === 99 /* ESNext */) return false;
155216
+ if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) return true;
155217
+ if (sourceFile.impliedNodeFormat === 99 /* ESNext */) return false;
155147
155218
  for (const otherFile of program.getSourceFiles()) {
155148
155219
  if (otherFile === sourceFile || !isSourceFileJS(otherFile) || program.isSourceFileFromExternalLibrary(otherFile)) continue;
155149
155220
  if (otherFile.commonJsModuleIndicator && !otherFile.externalModuleIndicator) return true;
@@ -155195,13 +155266,20 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
155195
155266
  if (!importedSymbolHasValueMeaning && isJs && usagePosition !== void 0) {
155196
155267
  return { kind: 1 /* JsdocTypeImport */, moduleSpecifierKind, moduleSpecifier, usagePosition, exportInfo: exportInfo2, isReExport: i > 0 };
155197
155268
  }
155198
- const importKind = getImportKind(sourceFile, exportInfo2.exportKind, program);
155269
+ const importKind = getImportKind(sourceFile, exportInfo2.exportKind, compilerOptions);
155199
155270
  let qualification;
155200
155271
  if (usagePosition !== void 0 && importKind === 3 /* CommonJS */ && exportInfo2.exportKind === 0 /* Named */) {
155201
155272
  const exportEquals = checker.resolveExternalModuleSymbol(exportInfo2.moduleSymbol);
155202
155273
  let namespacePrefix;
155203
155274
  if (exportEquals !== exportInfo2.moduleSymbol) {
155204
- namespacePrefix = forEachNameOfDefaultExport(exportEquals, checker, getEmitScriptTarget(compilerOptions), identity);
155275
+ namespacePrefix = forEachNameOfDefaultExport(
155276
+ exportEquals,
155277
+ checker,
155278
+ compilerOptions,
155279
+ /*preferCapitalizedNames*/
155280
+ false,
155281
+ identity
155282
+ );
155205
155283
  }
155206
155284
  namespacePrefix || (namespacePrefix = moduleSymbolToValidIdentifier(
155207
155285
  exportInfo2.moduleSymbol,
@@ -155374,8 +155452,8 @@ function getUmdSymbol(token, checker) {
155374
155452
  }
155375
155453
  return void 0;
155376
155454
  }
155377
- function getImportKind(importingFile, exportKind, program, forceImportKeyword) {
155378
- if (program.getCompilerOptions().verbatimModuleSyntax && getEmitModuleFormatOfFile(importingFile, program) === 1 /* CommonJS */) {
155455
+ function getImportKind(importingFile, exportKind, compilerOptions, forceImportKeyword) {
155456
+ if (compilerOptions.verbatimModuleSyntax && (getEmitModuleKind(compilerOptions) === 1 /* CommonJS */ || importingFile.impliedNodeFormat === 1 /* CommonJS */)) {
155379
155457
  return 3 /* CommonJS */;
155380
155458
  }
155381
155459
  switch (exportKind) {
@@ -155384,18 +155462,18 @@ function getImportKind(importingFile, exportKind, program, forceImportKeyword) {
155384
155462
  case 1 /* Default */:
155385
155463
  return 1 /* Default */;
155386
155464
  case 2 /* ExportEquals */:
155387
- return getExportEqualsImportKind(importingFile, program.getCompilerOptions(), !!forceImportKeyword);
155465
+ return getExportEqualsImportKind(importingFile, compilerOptions, !!forceImportKeyword);
155388
155466
  case 3 /* UMD */:
155389
- return getUmdImportKind(importingFile, program, !!forceImportKeyword);
155467
+ return getUmdImportKind(importingFile, compilerOptions, !!forceImportKeyword);
155390
155468
  default:
155391
155469
  return Debug.assertNever(exportKind);
155392
155470
  }
155393
155471
  }
155394
- function getUmdImportKind(importingFile, program, forceImportKeyword) {
155395
- if (getAllowSyntheticDefaultImports(program.getCompilerOptions())) {
155472
+ function getUmdImportKind(importingFile, compilerOptions, forceImportKeyword) {
155473
+ if (getAllowSyntheticDefaultImports(compilerOptions)) {
155396
155474
  return 1 /* Default */;
155397
155475
  }
155398
- const moduleKind = getEmitModuleKind(program.getCompilerOptions());
155476
+ const moduleKind = getEmitModuleKind(compilerOptions);
155399
155477
  switch (moduleKind) {
155400
155478
  case 2 /* AMD */:
155401
155479
  case 1 /* CommonJS */:
@@ -155414,7 +155492,7 @@ function getUmdImportKind(importingFile, program, forceImportKeyword) {
155414
155492
  return 2 /* Namespace */;
155415
155493
  case 100 /* Node16 */:
155416
155494
  case 199 /* NodeNext */:
155417
- return getImpliedNodeFormatForEmit(importingFile, program) === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
155495
+ return importingFile.impliedNodeFormat === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
155418
155496
  default:
155419
155497
  return Debug.assertNever(moduleKind, `Unexpected moduleKind ${moduleKind}`);
155420
155498
  }
@@ -155497,7 +155575,7 @@ function getExportInfos(symbolName2, isJsxTagName, currentTokenMeaning, cancella
155497
155575
  cancellationToken.throwIfCancellationRequested();
155498
155576
  const compilerOptions = program2.getCompilerOptions();
155499
155577
  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)) {
155578
+ if (defaultInfo && symbolFlagsHaveMeaning(checker.getSymbolFlags(defaultInfo.symbol), currentTokenMeaning) && forEachNameOfDefaultExport(defaultInfo.symbol, checker, compilerOptions, isJsxTagName, (name) => name === symbolName2)) {
155501
155579
  addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program2, isFromPackageJson);
155502
155580
  }
155503
155581
  const exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
@@ -155898,12 +155976,6 @@ function createConstEqualsRequireDeclaration(name, quotedModuleSpecifier) {
155898
155976
  function symbolFlagsHaveMeaning(flags, meaning) {
155899
155977
  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
155978
  }
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
155979
 
155908
155980
  // src/services/codefixes/fixAddMissingConstraint.ts
155909
155981
  var fixId17 = "addMissingConstraint";
@@ -163176,12 +163248,10 @@ function getJSDocParamAnnotation(paramName, initializer, dotDotDotToken, isJs, i
163176
163248
  const printer = isSnippet ? createSnippetPrinter({
163177
163249
  removeComments: true,
163178
163250
  module: options.module,
163179
- moduleResolution: options.moduleResolution,
163180
163251
  target: options.target
163181
163252
  }) : createPrinter({
163182
163253
  removeComments: true,
163183
163254
  module: options.module,
163184
- moduleResolution: options.moduleResolution,
163185
163255
  target: options.target
163186
163256
  });
163187
163257
  setEmitFlags(typeNode, 1 /* SingleLine */);
@@ -163437,7 +163507,6 @@ function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options,
163437
163507
  const printer = createSnippetPrinter({
163438
163508
  removeComments: true,
163439
163509
  module: options.module,
163440
- moduleResolution: options.moduleResolution,
163441
163510
  target: options.target,
163442
163511
  newLine: getNewLineKind(newLineChar)
163443
163512
  });
@@ -163624,7 +163693,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
163624
163693
  if (originIsResolvedExport(origin)) {
163625
163694
  sourceDisplay = [textPart(origin.moduleSpecifier)];
163626
163695
  if (importStatementCompletion) {
163627
- ({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences));
163696
+ ({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences));
163628
163697
  isSnippet = preferences.includeCompletionsWithSnippetText ? true : void 0;
163629
163698
  }
163630
163699
  }
@@ -163765,7 +163834,6 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
163765
163834
  const printer = createSnippetPrinter({
163766
163835
  removeComments: true,
163767
163836
  module: options.module,
163768
- moduleResolution: options.moduleResolution,
163769
163837
  target: options.target,
163770
163838
  omitTrailingSemicolon: false,
163771
163839
  newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
@@ -163916,7 +163984,6 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
163916
163984
  const printer = createSnippetPrinter({
163917
163985
  removeComments: true,
163918
163986
  module: options.module,
163919
- moduleResolution: options.moduleResolution,
163920
163987
  target: options.target,
163921
163988
  omitTrailingSemicolon: false,
163922
163989
  newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
@@ -163937,7 +164004,6 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
163937
164004
  const signaturePrinter = createPrinter({
163938
164005
  removeComments: true,
163939
164006
  module: options.module,
163940
- moduleResolution: options.moduleResolution,
163941
164007
  target: options.target,
163942
164008
  omitTrailingSemicolon: true
163943
164009
  });
@@ -164199,7 +164265,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
164199
164265
  };
164200
164266
  return unresolvedOrigin;
164201
164267
  }
164202
- function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences) {
164268
+ function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
164203
164269
  const replacementSpan = importStatementCompletion.replacementSpan;
164204
164270
  const quotedModuleSpecifier = escapeSnippetText(quote(sourceFile, preferences, origin.moduleSpecifier));
164205
164271
  const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
@@ -164207,7 +164273,7 @@ function getInsertTextAndReplacementSpanForImportCompletion(name, importStatemen
164207
164273
  const importKind = ts_codefix_exports.getImportKind(
164208
164274
  sourceFile,
164209
164275
  exportKind,
164210
- program,
164276
+ options,
164211
164277
  /*forceImportKeyword*/
164212
164278
  true
164213
164279
  );
@@ -166586,7 +166652,7 @@ function createNameAndKindSet() {
166586
166652
  }
166587
166653
  function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
166588
166654
  if (isInReferenceComment(sourceFile, position)) {
166589
- const entries = getTripleSlashReferenceCompletion(sourceFile, position, program, host);
166655
+ const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
166590
166656
  return entries && convertPathCompletions(entries);
166591
166657
  }
166592
166658
  if (isInString(sourceFile, position, contextToken)) {
@@ -166909,7 +166975,7 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, prog
166909
166975
  const compilerOptions = program.getCompilerOptions();
166910
166976
  const typeChecker = program.getTypeChecker();
166911
166977
  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);
166978
+ 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
166979
  }
166914
166980
  function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
166915
166981
  return {
@@ -166920,15 +166986,14 @@ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile
166920
166986
  resolutionMode
166921
166987
  };
166922
166988
  }
166923
- function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) {
166924
- const compilerOptions = program.getCompilerOptions();
166989
+ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) {
166925
166990
  if (compilerOptions.rootDirs) {
166926
166991
  return getCompletionEntriesForDirectoryFragmentWithRootDirs(
166927
166992
  compilerOptions.rootDirs,
166928
166993
  literalValue,
166929
166994
  scriptDirectory,
166930
166995
  extensionOptions,
166931
- program,
166996
+ compilerOptions,
166932
166997
  host,
166933
166998
  scriptPath
166934
166999
  );
@@ -166937,7 +167002,6 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, p
166937
167002
  literalValue,
166938
167003
  scriptDirectory,
166939
167004
  extensionOptions,
166940
- program,
166941
167005
  host,
166942
167006
  /*moduleSpecifierIsRelative*/
166943
167007
  true,
@@ -166964,8 +167028,7 @@ function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ign
166964
167028
  compareStringsCaseSensitive
166965
167029
  );
166966
167030
  }
166967
- function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, program, host, exclude) {
166968
- const compilerOptions = program.getCompilerOptions();
167031
+ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, compilerOptions, host, exclude) {
166969
167032
  const basePath = compilerOptions.project || host.getCurrentDirectory();
166970
167033
  const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
166971
167034
  const baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ignoreCase);
@@ -166974,7 +167037,6 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
166974
167037
  fragment,
166975
167038
  baseDirectory,
166976
167039
  extensionOptions,
166977
- program,
166978
167040
  host,
166979
167041
  /*moduleSpecifierIsRelative*/
166980
167042
  true,
@@ -166983,7 +167045,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
166983
167045
  (itemA, itemB) => itemA.name === itemB.name && itemA.kind === itemB.kind && itemA.extension === itemB.extension
166984
167046
  );
166985
167047
  }
166986
- function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, program, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
167048
+ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
166987
167049
  var _a;
166988
167050
  if (fragment === void 0) {
166989
167051
  fragment = "";
@@ -167008,7 +167070,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
167008
167070
  if (versionPaths) {
167009
167071
  const packageDirectory = getDirectoryPath(packageJsonPath);
167010
167072
  const pathInPackage = absolutePath.slice(ensureTrailingDirectorySeparator(packageDirectory).length);
167011
- if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, program, host, versionPaths)) {
167073
+ if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, host, versionPaths)) {
167012
167074
  return result;
167013
167075
  }
167014
167076
  }
@@ -167034,7 +167096,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
167034
167096
  }
167035
167097
  const { name, extension } = getFilenameWithExtensionOption(
167036
167098
  getBaseFileName(filePath),
167037
- program,
167099
+ host.getCompilationSettings(),
167038
167100
  extensionOptions,
167039
167101
  /*isExportsWildcard*/
167040
167102
  false
@@ -167053,7 +167115,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
167053
167115
  }
167054
167116
  return result;
167055
167117
  }
167056
- function getFilenameWithExtensionOption(name, program, extensionOptions, isExportsWildcard) {
167118
+ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions, isExportsWildcard) {
167057
167119
  const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
167058
167120
  if (nonJsResult) {
167059
167121
  return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
@@ -167063,8 +167125,7 @@ function getFilenameWithExtensionOption(name, program, extensionOptions, isExpor
167063
167125
  }
167064
167126
  let allowedEndings = getModuleSpecifierPreferences(
167065
167127
  { importModuleSpecifierEnding: extensionOptions.endingPreference },
167066
- program,
167067
- program.getCompilerOptions(),
167128
+ compilerOptions,
167068
167129
  extensionOptions.importingSourceFile
167069
167130
  ).getAllowedEndingsInPreferredOrder(extensionOptions.resolutionMode);
167070
167131
  if (isExportsWildcard) {
@@ -167074,16 +167135,16 @@ function getFilenameWithExtensionOption(name, program, extensionOptions, isExpor
167074
167135
  if (fileExtensionIsOneOf(name, supportedTSImplementationExtensions)) {
167075
167136
  return { name, extension: tryGetExtensionFromPath2(name) };
167076
167137
  }
167077
- const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
167138
+ const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
167078
167139
  return outputExtension2 ? { name: changeExtension(name, outputExtension2), extension: outputExtension2 } : { name, extension: tryGetExtensionFromPath2(name) };
167079
167140
  }
167080
167141
  if (!isExportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
167081
167142
  return { name: removeFileExtension(name), extension: tryGetExtensionFromPath2(name) };
167082
167143
  }
167083
- const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
167144
+ const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
167084
167145
  return outputExtension ? { name: changeExtension(name, outputExtension), extension: outputExtension } : { name, extension: tryGetExtensionFromPath2(name) };
167085
167146
  }
167086
- function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, program, host, paths) {
167147
+ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, host, paths) {
167087
167148
  const getPatternsForKey = (key) => paths[key];
167088
167149
  const comparePaths2 = (a, b) => {
167089
167150
  const patternA = tryParsePattern(a);
@@ -167099,14 +167160,13 @@ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensio
167099
167160
  fragment,
167100
167161
  baseDirectory,
167101
167162
  extensionOptions,
167102
- program,
167103
167163
  host,
167104
167164
  getOwnKeys(paths),
167105
167165
  getPatternsForKey,
167106
167166
  comparePaths2
167107
167167
  );
167108
167168
  }
167109
- function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, program, host, keys, getPatternsForKey, comparePaths2) {
167169
+ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
167110
167170
  let pathResults = [];
167111
167171
  let matchedPath;
167112
167172
  for (const key of keys) {
@@ -167125,7 +167185,7 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
167125
167185
  if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(key, matchedPath) !== 1 /* GreaterThan */) {
167126
167186
  pathResults.push({
167127
167187
  matchedPattern: isMatch,
167128
- results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, program, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
167188
+ results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
167129
167189
  });
167130
167190
  }
167131
167191
  }
@@ -167133,9 +167193,7 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
167133
167193
  pathResults.forEach((pathResult) => pathResult.results.forEach((r) => result.add(r)));
167134
167194
  return matchedPath !== void 0;
167135
167195
  }
167136
- function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, program, host, extensionOptions) {
167137
- const typeChecker = program.getTypeChecker();
167138
- const compilerOptions = program.getCompilerOptions();
167196
+ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, compilerOptions, host, extensionOptions, typeChecker) {
167139
167197
  const { baseUrl, paths } = compilerOptions;
167140
167198
  const result = createNameAndKindSet();
167141
167199
  const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
@@ -167145,7 +167203,6 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
167145
167203
  fragment,
167146
167204
  absolute,
167147
167205
  extensionOptions,
167148
- program,
167149
167206
  host,
167150
167207
  /*moduleSpecifierIsRelative*/
167151
167208
  false,
@@ -167156,7 +167213,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
167156
167213
  }
167157
167214
  if (paths) {
167158
167215
  const absolute = getPathsBasePath(compilerOptions, host);
167159
- addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, program, host, paths);
167216
+ addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, host, paths);
167160
167217
  }
167161
167218
  const fragmentDirectory = getFragmentDirectory(fragment);
167162
167219
  for (const ambientName of getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker)) {
@@ -167167,7 +167224,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
167167
167224
  void 0
167168
167225
  ));
167169
167226
  }
167170
- getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result);
167227
+ getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, fragmentDirectory, extensionOptions, result);
167171
167228
  if (moduleResolutionUsesNodeModules(moduleResolution)) {
167172
167229
  let foundGlobal = false;
167173
167230
  if (fragmentDirectory === void 0) {
@@ -167192,7 +167249,6 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
167192
167249
  fragment,
167193
167250
  nodeModules,
167194
167251
  extensionOptions,
167195
- program,
167196
167252
  host,
167197
167253
  /*moduleSpecifierIsRelative*/
167198
167254
  false,
@@ -167237,7 +167293,6 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
167237
167293
  fragmentSubpath,
167238
167294
  packageDirectory,
167239
167295
  extensionOptions,
167240
- program,
167241
167296
  host,
167242
167297
  keys,
167243
167298
  (key) => singleElementArray(getPatternFromFirstMatchingCondition(exports2[key], conditions)),
@@ -167270,7 +167325,7 @@ function getPatternFromFirstMatchingCondition(target, conditions) {
167270
167325
  function getFragmentDirectory(fragment) {
167271
167326
  return containsSlash(fragment) ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
167272
167327
  }
167273
- function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, program, host) {
167328
+ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, host) {
167274
167329
  if (!endsWith(path, "*")) {
167275
167330
  return !path.includes("*") ? justPathMappingName(path, "script" /* scriptElement */) : emptyArray;
167276
167331
  }
@@ -167280,15 +167335,15 @@ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory
167280
167335
  const starIsFullPathComponent = path[path.length - 2] === "/";
167281
167336
  return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
167282
167337
  var _a;
167283
- return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
167338
+ return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
167284
167339
  });
167285
167340
  }
167286
- return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host));
167341
+ return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host));
167287
167342
  function justPathMappingName(name, kind) {
167288
167343
  return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray;
167289
167344
  }
167290
167345
  }
167291
- function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host) {
167346
+ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host) {
167292
167347
  if (!host.readDirectory) {
167293
167348
  return void 0;
167294
167349
  }
@@ -167321,7 +167376,7 @@ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensio
167321
167376
  if (containsSlash(trimmedWithPattern)) {
167322
167377
  return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
167323
167378
  }
167324
- const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, program, extensionOptions, isExportsWildcard);
167379
+ const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, host.getCompilationSettings(), extensionOptions, isExportsWildcard);
167325
167380
  return nameAndKind(name, "script" /* scriptElement */, extension);
167326
167381
  }
167327
167382
  });
@@ -167349,8 +167404,7 @@ function getAmbientModuleCompletions(fragment, fragmentDirectory, checker) {
167349
167404
  }
167350
167405
  return nonRelativeModuleNames;
167351
167406
  }
167352
- function getTripleSlashReferenceCompletion(sourceFile, position, program, host) {
167353
- const compilerOptions = program.getCompilerOptions();
167407
+ function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) {
167354
167408
  const token = getTokenAtPosition(sourceFile, position);
167355
167409
  const commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
167356
167410
  const range = commentRanges && find(commentRanges, (commentRange) => position >= commentRange.pos && position <= commentRange.end);
@@ -167368,16 +167422,14 @@ function getTripleSlashReferenceCompletion(sourceFile, position, program, host)
167368
167422
  toComplete,
167369
167423
  scriptPath,
167370
167424
  getExtensionOptions(compilerOptions, 0 /* Filename */, sourceFile),
167371
- program,
167372
167425
  host,
167373
167426
  /*moduleSpecifierIsRelative*/
167374
167427
  true,
167375
167428
  sourceFile.path
167376
- ) : kind === "types" ? getCompletionEntriesFromTypings(host, program, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
167429
+ ) : kind === "types" ? getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
167377
167430
  return addReplacementSpans(toComplete, range.pos + prefix.length, arrayFrom(names.values()));
167378
167431
  }
167379
- function getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
167380
- const options = program.getCompilerOptions();
167432
+ function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
167381
167433
  const seen = /* @__PURE__ */ new Map();
167382
167434
  const typeRoots = tryAndIgnoreErrors(() => getEffectiveTypeRoots(options, host)) || emptyArray;
167383
167435
  for (const root of typeRoots) {
@@ -167411,7 +167463,6 @@ function getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDire
167411
167463
  remainingFragment,
167412
167464
  baseDirectory,
167413
167465
  extensionOptions,
167414
- program,
167415
167466
  host,
167416
167467
  /*moduleSpecifierIsRelative*/
167417
167468
  false,
@@ -173131,9 +173182,6 @@ function getArgumentOrParameterListInfo(node, position, sourceFile, checker) {
173131
173182
  if (!info) return void 0;
173132
173183
  const { list, argumentIndex } = info;
173133
173184
  const argumentCount = getArgumentCount(checker, list);
173134
- if (argumentIndex !== 0) {
173135
- Debug.assertLessThan(argumentIndex, argumentCount);
173136
- }
173137
173185
  const argumentsSpan = getApplicableSpanForArguments(list, sourceFile);
173138
173186
  return { list, argumentIndex, argumentCount, argumentsSpan };
173139
173187
  }
@@ -173406,9 +173454,6 @@ function createSignatureHelpItems(candidates, resolvedSignature, { isTypeParamet
173406
173454
  void 0
173407
173455
  ) : emptyArray;
173408
173456
  const items = map(candidates, (candidateSignature) => getSignatureHelpItem(candidateSignature, callTargetDisplayParts, isTypeParameterList, typeChecker, enclosingDeclaration, sourceFile));
173409
- if (argumentIndex !== 0) {
173410
- Debug.assertLessThan(argumentIndex, argumentCount);
173411
- }
173412
173457
  let selectedItemIndex = 0;
173413
173458
  let itemsSeen = 0;
173414
173459
  for (let i = 0; i < items.length; i++) {
@@ -178761,7 +178806,6 @@ __export(ts_exports2, {
178761
178806
  canHaveJSDoc: () => canHaveJSDoc,
178762
178807
  canHaveLocals: () => canHaveLocals,
178763
178808
  canHaveModifiers: () => canHaveModifiers,
178764
- canHaveModuleSpecifier: () => canHaveModuleSpecifier,
178765
178809
  canHaveSymbol: () => canHaveSymbol,
178766
178810
  canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics,
178767
178811
  canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
@@ -179238,7 +179282,6 @@ __export(ts_exports2, {
179238
179282
  getDefaultLibFilePath: () => getDefaultLibFilePath,
179239
179283
  getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
179240
179284
  getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
179241
- getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
179242
179285
  getDiagnosticText: () => getDiagnosticText,
179243
179286
  getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
179244
179287
  getDirectoryPath: () => getDirectoryPath,
@@ -179269,7 +179312,6 @@ __export(ts_exports2, {
179269
179312
  getEmitFlags: () => getEmitFlags,
179270
179313
  getEmitHelpers: () => getEmitHelpers,
179271
179314
  getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
179272
- getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
179273
179315
  getEmitModuleKind: () => getEmitModuleKind,
179274
179316
  getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
179275
179317
  getEmitScriptTarget: () => getEmitScriptTarget,
@@ -179320,7 +179362,6 @@ __export(ts_exports2, {
179320
179362
  getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
179321
179363
  getIdentifierTypeArguments: () => getIdentifierTypeArguments,
179322
179364
  getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
179323
- getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
179324
179365
  getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
179325
179366
  getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
179326
179367
  getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
@@ -179428,6 +179469,7 @@ __export(ts_exports2, {
179428
179469
  getNameOfScriptTarget: () => getNameOfScriptTarget,
179429
179470
  getNameOrArgument: () => getNameOrArgument,
179430
179471
  getNameTable: () => getNameTable,
179472
+ getNamesForExportedSymbol: () => getNamesForExportedSymbol,
179431
179473
  getNamespaceDeclarationNode: () => getNamespaceDeclarationNode,
179432
179474
  getNewLineCharacter: () => getNewLineCharacter,
179433
179475
  getNewLineKind: () => getNewLineKind,
@@ -179444,6 +179486,7 @@ __export(ts_exports2, {
179444
179486
  getNonAssignmentOperatorForCompoundAssignment: () => getNonAssignmentOperatorForCompoundAssignment,
179445
179487
  getNonAugmentationDeclaration: () => getNonAugmentationDeclaration,
179446
179488
  getNonDecoratorTokenPosOfNode: () => getNonDecoratorTokenPosOfNode,
179489
+ getNonIncrementalBuildInfoRoots: () => getNonIncrementalBuildInfoRoots,
179447
179490
  getNormalizedAbsolutePath: () => getNormalizedAbsolutePath,
179448
179491
  getNormalizedAbsolutePathWithoutRoot: () => getNormalizedAbsolutePathWithoutRoot,
179449
179492
  getNormalizedPathComponents: () => getNormalizedPathComponents,
@@ -179679,7 +179722,6 @@ __export(ts_exports2, {
179679
179722
  importDefaultHelper: () => importDefaultHelper,
179680
179723
  importFromModuleSpecifier: () => importFromModuleSpecifier,
179681
179724
  importStarHelper: () => importStarHelper,
179682
- importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
179683
179725
  indexOfAnyCharCode: () => indexOfAnyCharCode,
179684
179726
  indexOfNode: () => indexOfNode,
179685
179727
  indicesOf: () => indicesOf,
@@ -180155,6 +180197,7 @@ __export(ts_exports2, {
180155
180197
  isNonExportDefaultModifier: () => isNonExportDefaultModifier,
180156
180198
  isNonGlobalAmbientModule: () => isNonGlobalAmbientModule,
180157
180199
  isNonGlobalDeclaration: () => isNonGlobalDeclaration,
180200
+ isNonIncrementalBuildInfo: () => isNonIncrementalBuildInfo,
180158
180201
  isNonNullAccess: () => isNonNullAccess,
180159
180202
  isNonNullChain: () => isNonNullChain,
180160
180203
  isNonNullExpression: () => isNonNullExpression,
@@ -180267,6 +180310,7 @@ __export(ts_exports2, {
180267
180310
  isSimpleParameter: () => isSimpleParameter,
180268
180311
  isSimpleParameterList: () => isSimpleParameterList,
180269
180312
  isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
180313
+ isSourceElement: () => isSourceElement,
180270
180314
  isSourceFile: () => isSourceFile,
180271
180315
  isSourceFileFromLibrary: () => isSourceFileFromLibrary,
180272
180316
  isSourceFileJS: () => isSourceFileJS,
@@ -180400,7 +180444,6 @@ __export(ts_exports2, {
180400
180444
  linkNamePart: () => linkNamePart,
180401
180445
  linkPart: () => linkPart,
180402
180446
  linkTextPart: () => linkTextPart,
180403
- listFiles: () => listFiles,
180404
180447
  loadModuleFromGlobalCache: () => loadModuleFromGlobalCache,
180405
180448
  loadWithModeAwareCache: () => loadWithModeAwareCache,
180406
180449
  makeIdentifierFromModuleName: () => makeIdentifierFromModuleName,
@@ -180479,6 +180522,7 @@ __export(ts_exports2, {
180479
180522
  noopFileWatcher: () => noopFileWatcher,
180480
180523
  normalizePath: () => normalizePath,
180481
180524
  normalizeSlashes: () => normalizeSlashes,
180525
+ normalizeSpans: () => normalizeSpans,
180482
180526
  not: () => not,
180483
180527
  notImplemented: () => notImplemented,
180484
180528
  notImplementedResolver: () => notImplementedResolver,
@@ -180530,7 +180574,6 @@ __export(ts_exports2, {
180530
180574
  pathIsBareSpecifier: () => pathIsBareSpecifier,
180531
180575
  pathIsRelative: () => pathIsRelative,
180532
180576
  patternText: () => patternText,
180533
- perfLogger: () => perfLogger,
180534
180577
  performIncrementalCompilation: () => performIncrementalCompilation,
180535
180578
  performance: () => ts_performance_exports,
180536
180579
  plainJSErrors: () => plainJSErrors,
@@ -180682,6 +180725,7 @@ __export(ts_exports2, {
180682
180725
  skipPartiallyEmittedExpressions: () => skipPartiallyEmittedExpressions,
180683
180726
  skipTrivia: () => skipTrivia,
180684
180727
  skipTypeChecking: () => skipTypeChecking,
180728
+ skipTypeCheckingIgnoringNoCheck: () => skipTypeCheckingIgnoringNoCheck,
180685
180729
  skipTypeParentheses: () => skipTypeParentheses,
180686
180730
  skipWhile: () => skipWhile,
180687
180731
  sliceAfter: () => sliceAfter,
@@ -180738,7 +180782,10 @@ __export(ts_exports2, {
180738
180782
  textOrKeywordPart: () => textOrKeywordPart,
180739
180783
  textPart: () => textPart,
180740
180784
  textRangeContainsPositionInclusive: () => textRangeContainsPositionInclusive,
180785
+ textRangeContainsTextSpan: () => textRangeContainsTextSpan,
180786
+ textRangeIntersectsWithTextSpan: () => textRangeIntersectsWithTextSpan,
180741
180787
  textSpanContainsPosition: () => textSpanContainsPosition,
180788
+ textSpanContainsTextRange: () => textSpanContainsTextRange,
180742
180789
  textSpanContainsTextSpan: () => textSpanContainsTextSpan,
180743
180790
  textSpanEnd: () => textSpanEnd,
180744
180791
  textSpanIntersection: () => textSpanIntersection,
@@ -180779,11 +180826,11 @@ __export(ts_exports2, {
180779
180826
  transformESDecorators: () => transformESDecorators,
180780
180827
  transformESNext: () => transformESNext,
180781
180828
  transformGenerators: () => transformGenerators,
180782
- transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
180783
180829
  transformJsx: () => transformJsx,
180784
180830
  transformLegacyDecorators: () => transformLegacyDecorators,
180785
180831
  transformModule: () => transformModule,
180786
180832
  transformNamedEvaluation: () => transformNamedEvaluation,
180833
+ transformNodeModule: () => transformNodeModule,
180787
180834
  transformNodes: () => transformNodes,
180788
180835
  transformSystemModule: () => transformSystemModule,
180789
180836
  transformTypeScript: () => transformTypeScript,
@@ -181615,14 +181662,11 @@ var ThrottledOperations = class _ThrottledOperations {
181615
181662
  return this.pendingTimeouts.delete(operationId);
181616
181663
  }
181617
181664
  static run(operationId, self, cb) {
181618
- var _a, _b;
181619
- (_a = perfLogger) == null ? void 0 : _a.logStartScheduledOperation(operationId);
181620
181665
  self.pendingTimeouts.delete(operationId);
181621
181666
  if (self.logger) {
181622
181667
  self.logger.info(`Running: ${operationId}`);
181623
181668
  }
181624
181669
  cb();
181625
- (_b = perfLogger) == null ? void 0 : _b.logStopScheduledOperation();
181626
181670
  }
181627
181671
  };
181628
181672
  var GcTimer = class _GcTimer {
@@ -181638,9 +181682,7 @@ var GcTimer = class _GcTimer {
181638
181682
  this.timerId = this.host.setTimeout(_GcTimer.run, this.delay, this);
181639
181683
  }
181640
181684
  static run(self) {
181641
- var _a, _b;
181642
181685
  self.timerId = void 0;
181643
- (_a = perfLogger) == null ? void 0 : _a.logStartScheduledOperation("GC collect");
181644
181686
  const log = self.logger.hasLevel(2 /* requestTime */);
181645
181687
  const before = log && self.host.getMemoryUsage();
181646
181688
  self.host.gc();
@@ -181648,7 +181690,6 @@ var GcTimer = class _GcTimer {
181648
181690
  const after = self.host.getMemoryUsage();
181649
181691
  self.logger.perftrc(`GC::before ${before}, after ${after}`);
181650
181692
  }
181651
- (_b = perfLogger) == null ? void 0 : _b.logStopScheduledOperation();
181652
181693
  }
181653
181694
  };
181654
181695
  function getBaseConfigFileName(configFilePath) {
@@ -181682,7 +181723,7 @@ __export(ts_server_protocol_exports, {
181682
181723
  NewLineKind: () => NewLineKind2,
181683
181724
  OrganizeImportsMode: () => OrganizeImportsMode,
181684
181725
  PollingWatchKind: () => PollingWatchKind2,
181685
- ScriptTarget: () => ScriptTarget11,
181726
+ ScriptTarget: () => ScriptTarget10,
181686
181727
  SemicolonPreference: () => SemicolonPreference,
181687
181728
  WatchDirectoryKind: () => WatchDirectoryKind2,
181688
181729
  WatchFileKind: () => WatchFileKind2
@@ -181873,24 +181914,24 @@ var NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
181873
181914
  NewLineKind3["Lf"] = "Lf";
181874
181915
  return NewLineKind3;
181875
181916
  })(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 || {});
181917
+ var ScriptTarget10 = /* @__PURE__ */ ((ScriptTarget11) => {
181918
+ ScriptTarget11["ES3"] = "es3";
181919
+ ScriptTarget11["ES5"] = "es5";
181920
+ ScriptTarget11["ES6"] = "es6";
181921
+ ScriptTarget11["ES2015"] = "es2015";
181922
+ ScriptTarget11["ES2016"] = "es2016";
181923
+ ScriptTarget11["ES2017"] = "es2017";
181924
+ ScriptTarget11["ES2018"] = "es2018";
181925
+ ScriptTarget11["ES2019"] = "es2019";
181926
+ ScriptTarget11["ES2020"] = "es2020";
181927
+ ScriptTarget11["ES2021"] = "es2021";
181928
+ ScriptTarget11["ES2022"] = "es2022";
181929
+ ScriptTarget11["ES2023"] = "es2023";
181930
+ ScriptTarget11["ESNext"] = "esnext";
181931
+ ScriptTarget11["JSON"] = "json";
181932
+ ScriptTarget11["Latest"] = "esnext" /* ESNext */;
181933
+ return ScriptTarget11;
181934
+ })(ScriptTarget10 || {});
181894
181935
  {
181895
181936
  }
181896
181937
 
@@ -183375,9 +183416,8 @@ var Project3 = class _Project {
183375
183416
  * @returns: true if set of files in the project stays the same and false - otherwise.
183376
183417
  */
183377
183418
  updateGraph() {
183378
- var _a, _b, _c, _d;
183419
+ var _a, _b;
183379
183420
  (_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
183421
  this.resolutionCache.startRecordingFilesWithChangedResolutions();
183382
183422
  const hasNewProgram = this.updateGraphWorker();
183383
183423
  const hasAddedorRemovedFiles = this.hasAddedorRemovedFiles;
@@ -183405,8 +183445,7 @@ var Project3 = class _Project {
183405
183445
  if (isFirstProgramLoad) {
183406
183446
  this.getPackageJsonAutoImportProvider();
183407
183447
  }
183408
- (_c = perfLogger) == null ? void 0 : _c.logStopUpdateGraph();
183409
- (_d = tracing) == null ? void 0 : _d.pop();
183448
+ (_b = tracing) == null ? void 0 : _b.pop();
183410
183449
  return !hasNewProgram;
183411
183450
  }
183412
183451
  /** @internal */
@@ -185005,8 +185044,23 @@ function findProjectByName(projectName, projects) {
185005
185044
  }
185006
185045
  var noopConfigFileWatcher = { close: noop };
185007
185046
  function getConfigFileNameFromCache(info, cache) {
185008
- if (!cache || isAncestorConfigFileInfo(info)) return void 0;
185009
- return cache.get(info.path);
185047
+ if (!cache) return void 0;
185048
+ const configFileForOpenFile = cache.get(info.path);
185049
+ if (configFileForOpenFile === void 0) return void 0;
185050
+ if (!isAncestorConfigFileInfo(info)) {
185051
+ return isString(configFileForOpenFile) || !configFileForOpenFile ? configFileForOpenFile : (
185052
+ // direct result
185053
+ configFileForOpenFile.get(
185054
+ /*key*/
185055
+ false
185056
+ )
185057
+ );
185058
+ } else {
185059
+ return configFileForOpenFile && !isString(configFileForOpenFile) ? (
185060
+ // Map with fileName as key
185061
+ configFileForOpenFile.get(info.fileName)
185062
+ ) : void 0;
185063
+ }
185010
185064
  }
185011
185065
  function isOpenScriptInfo(infoOrFileNameOrConfig) {
185012
185066
  return !!infoOrFileNameOrConfig.containingProjects;
@@ -185020,13 +185074,17 @@ var ConfiguredProjectLoadKind = /* @__PURE__ */ ((ConfiguredProjectLoadKind2) =>
185020
185074
  ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Reload"] = 2] = "Reload";
185021
185075
  return ConfiguredProjectLoadKind2;
185022
185076
  })(ConfiguredProjectLoadKind || {});
185023
- function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, delayReloadedConfiguredProjects) {
185077
+ function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, searchOnlyPotentialSolution, delayReloadedConfiguredProjects) {
185024
185078
  while (true) {
185025
- if (!project.isInitialLoadPending() && (!project.getCompilerOptions().composite || project.getCompilerOptions().disableSolutionSearching)) return;
185079
+ if (!project.isInitialLoadPending() && (searchOnlyPotentialSolution && !project.getCompilerOptions().composite || // Currently disableSolutionSearching is shared for finding solution/project when
185080
+ // - loading solution for find all references
185081
+ // - trying to find default project
185082
+ project.getCompilerOptions().disableSolutionSearching)) return;
185026
185083
  const configFileName = project.projectService.getConfigFileNameForFile({
185027
185084
  fileName: project.getConfigFilePath(),
185028
185085
  path: info.path,
185029
- configFileInfo: true
185086
+ configFileInfo: true,
185087
+ isForDefaultProject: !searchOnlyPotentialSolution
185030
185088
  }, kind === 0 /* Find */);
185031
185089
  if (!configFileName) return;
185032
185090
  const ancestor = project.projectService.findCreateOrReloadConfiguredProject(
@@ -185034,11 +185092,11 @@ function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredCl
185034
185092
  kind,
185035
185093
  reason,
185036
185094
  allowDeferredClosed,
185037
- /*triggerFile*/
185038
- void 0,
185095
+ !searchOnlyPotentialSolution ? info.fileName : void 0,
185096
+ // Config Diag event for project if its for default project
185039
185097
  reloadedProjects,
185040
- /*delayLoad*/
185041
- true,
185098
+ searchOnlyPotentialSolution,
185099
+ // Delay load if we are searching for solution
185042
185100
  delayReloadedConfiguredProjects
185043
185101
  );
185044
185102
  if (!ancestor) return;
@@ -186139,7 +186197,7 @@ var _ProjectService = class _ProjectService {
186139
186197
  configFileExists(configFileName, canonicalConfigFilePath, info) {
186140
186198
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
186141
186199
  let openFilesImpactedByConfigFile;
186142
- if (this.openFiles.has(info.path) && !isAncestorConfigFileInfo(info)) {
186200
+ if (this.openFiles.has(info.path) && (!isAncestorConfigFileInfo(info) || info.isForDefaultProject)) {
186143
186201
  if (configFileExistenceInfo) (configFileExistenceInfo.openFilesImpactedByConfigFile ?? (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Set())).add(info.path);
186144
186202
  else (openFilesImpactedByConfigFile = /* @__PURE__ */ new Set()).add(info.path);
186145
186203
  }
@@ -186267,24 +186325,31 @@ var _ProjectService = class _ProjectService {
186267
186325
  let searchPath = asNormalizedPath(getDirectoryPath(info.fileName));
186268
186326
  const isSearchPathInProjectRoot = () => containsPath(projectRootPath, searchPath, this.currentDirectory, !this.host.useCaseSensitiveFileNames);
186269
186327
  const anySearchPathOk = !projectRootPath || !isSearchPathInProjectRoot();
186270
- let searchInDirectory = !isAncestorConfigFileInfo(info);
186328
+ let searchTsconfig = true;
186329
+ let searchJsconfig = true;
186330
+ if (isAncestorConfigFileInfo(info)) {
186331
+ if (endsWith(info.fileName, "tsconfig.json")) searchTsconfig = false;
186332
+ else searchTsconfig = searchJsconfig = false;
186333
+ }
186271
186334
  do {
186272
- if (searchInDirectory) {
186273
- const canonicalSearchPath = normalizedPathToPath(searchPath, this.currentDirectory, this.toCanonicalFileName);
186335
+ const canonicalSearchPath = normalizedPathToPath(searchPath, this.currentDirectory, this.toCanonicalFileName);
186336
+ if (searchTsconfig) {
186274
186337
  const tsconfigFileName = asNormalizedPath(combinePaths(searchPath, "tsconfig.json"));
186275
- let result = action(combinePaths(canonicalSearchPath, "tsconfig.json"), tsconfigFileName);
186338
+ const result = action(combinePaths(canonicalSearchPath, "tsconfig.json"), tsconfigFileName);
186276
186339
  if (result) return tsconfigFileName;
186340
+ }
186341
+ if (searchJsconfig) {
186277
186342
  const jsconfigFileName = asNormalizedPath(combinePaths(searchPath, "jsconfig.json"));
186278
- result = action(combinePaths(canonicalSearchPath, "jsconfig.json"), jsconfigFileName);
186343
+ const result = action(combinePaths(canonicalSearchPath, "jsconfig.json"), jsconfigFileName);
186279
186344
  if (result) return jsconfigFileName;
186280
- if (isNodeModulesDirectory(canonicalSearchPath)) {
186281
- break;
186282
- }
186345
+ }
186346
+ if (isNodeModulesDirectory(canonicalSearchPath)) {
186347
+ break;
186283
186348
  }
186284
186349
  const parentPath = asNormalizedPath(getDirectoryPath(searchPath));
186285
186350
  if (parentPath === searchPath) break;
186286
186351
  searchPath = parentPath;
186287
- searchInDirectory = true;
186352
+ searchTsconfig = searchJsconfig = true;
186288
186353
  } while (anySearchPathOk || isSearchPathInProjectRoot());
186289
186354
  return void 0;
186290
186355
  }
@@ -186307,8 +186372,19 @@ var _ProjectService = class _ProjectService {
186307
186372
  /** Caches the configFilename for script info or ancestor of open script info */
186308
186373
  setConfigFileNameForFileInCache(info, configFileName) {
186309
186374
  if (!this.openFiles.has(info.path)) return;
186310
- if (isAncestorConfigFileInfo(info)) return;
186311
- this.configFileForOpenFiles.set(info.path, configFileName || false);
186375
+ const config = configFileName || false;
186376
+ if (!isAncestorConfigFileInfo(info)) {
186377
+ this.configFileForOpenFiles.set(info.path, config);
186378
+ } else {
186379
+ let configFileForOpenFile = this.configFileForOpenFiles.get(info.path);
186380
+ if (!configFileForOpenFile || isString(configFileForOpenFile)) {
186381
+ this.configFileForOpenFiles.set(
186382
+ info.path,
186383
+ configFileForOpenFile = (/* @__PURE__ */ new Map()).set(false, configFileForOpenFile)
186384
+ );
186385
+ }
186386
+ configFileForOpenFile.set(info.fileName, config);
186387
+ }
186312
186388
  }
186313
186389
  /**
186314
186390
  * This function tries to search for a tsconfig.json for the given file.
@@ -187685,7 +187761,7 @@ Dynamic files must always be opened with service's current directory or service
187685
187761
  seenProjects
187686
187762
  };
187687
187763
  function tryFindDefaultConfiguredProject(project) {
187688
- return isDefaultProject(project) ? defaultProject : tryFindDefaultConfiguredProjectFromReferences(project);
187764
+ return isDefaultProject(project) ? defaultProject : tryFindDefaultConfiguredProjectFromReferences(project) ?? tryFindDefaultConfiguredProjectFromAncestor(project);
187689
187765
  }
187690
187766
  function isDefaultProject(project) {
187691
187767
  if (!tryAddToSet(seenProjects, project)) return;
@@ -187708,6 +187784,20 @@ Dynamic files must always be opened with service's current directory or service
187708
187784
  reloadedProjects
187709
187785
  );
187710
187786
  }
187787
+ function tryFindDefaultConfiguredProjectFromAncestor(project) {
187788
+ return forEachAncestorProject(
187789
+ // If not in referenced projects, try ancestors and its references
187790
+ info,
187791
+ project,
187792
+ tryFindDefaultConfiguredProject,
187793
+ kind,
187794
+ `Creating possible configured project for ${info.fileName} to open`,
187795
+ allowDeferredClosed,
187796
+ reloadedProjects,
187797
+ /*searchOnlyPotentialSolution*/
187798
+ false
187799
+ );
187800
+ }
187711
187801
  }
187712
187802
  tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(info, kind, reloadedProjects, delayReloadedConfiguredProjects) {
187713
187803
  const allowDeferredClosed = kind === 0 /* Find */;
@@ -187730,6 +187820,8 @@ Dynamic files must always be opened with service's current directory or service
187730
187820
  `Creating project possibly referencing default composite project ${defaultProject.getProjectName()} of open file ${info.fileName}`,
187731
187821
  allowDeferredClosed,
187732
187822
  reloadedProjects,
187823
+ /*searchOnlyPotentialSolution*/
187824
+ true,
187733
187825
  delayReloadedConfiguredProjects
187734
187826
  );
187735
187827
  }
@@ -189099,6 +189191,9 @@ var invalidSyntacticModeCommands = [
189099
189191
  var Session3 = class _Session {
189100
189192
  constructor(opts) {
189101
189193
  this.changeSeq = 0;
189194
+ // Minimum number of lines for attempting to use region diagnostics for a file.
189195
+ /** @internal */
189196
+ this.regionDiagLineCountThreshold = 500;
189102
189197
  this.handlers = new Map(Object.entries({
189103
189198
  // TODO(jakebailey): correctly type the handlers
189104
189199
  ["status" /* Status */]: () => {
@@ -189969,9 +190064,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
189969
190064
  this.writeMessage(msg);
189970
190065
  }
189971
190066
  writeMessage(msg) {
189972
- var _a;
189973
190067
  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
190068
  this.host.write(msgText);
189976
190069
  }
189977
190070
  event(body, eventName) {
@@ -190015,32 +190108,70 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
190015
190108
  }
190016
190109
  semanticCheck(file, project) {
190017
190110
  var _a, _b;
190111
+ const diagnosticsStartTime = this.hrtime();
190018
190112
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "semanticCheck", { file, configFilePath: project.canonicalConfigFilePath });
190019
190113
  const diags = isDeclarationFileInJSOnlyNonConfiguredProject(project, file) ? emptyArray2 : project.getLanguageService().getSemanticDiagnostics(file).filter((d) => !!d.file);
190020
- this.sendDiagnosticsEvent(file, project, diags, "semanticDiag");
190114
+ this.sendDiagnosticsEvent(file, project, diags, "semanticDiag", diagnosticsStartTime);
190021
190115
  (_b = tracing) == null ? void 0 : _b.pop();
190022
190116
  }
190023
190117
  syntacticCheck(file, project) {
190024
190118
  var _a, _b;
190119
+ const diagnosticsStartTime = this.hrtime();
190025
190120
  (_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");
190121
+ this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag", diagnosticsStartTime);
190027
190122
  (_b = tracing) == null ? void 0 : _b.pop();
190028
190123
  }
190029
190124
  suggestionCheck(file, project) {
190030
190125
  var _a, _b;
190126
+ const diagnosticsStartTime = this.hrtime();
190031
190127
  (_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");
190128
+ this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag", diagnosticsStartTime);
190033
190129
  (_b = tracing) == null ? void 0 : _b.pop();
190034
190130
  }
190035
- sendDiagnosticsEvent(file, project, diagnostics, kind) {
190131
+ regionSemanticCheck(file, project, ranges) {
190132
+ var _a, _b, _c;
190133
+ const diagnosticsStartTime = this.hrtime();
190134
+ (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "regionSemanticCheck", { file, configFilePath: project.canonicalConfigFilePath });
190135
+ let diagnosticsResult;
190136
+ if (!this.shouldDoRegionCheck(file) || !(diagnosticsResult = project.getLanguageService().getRegionSemanticDiagnostics(file, ranges))) {
190137
+ (_b = tracing) == null ? void 0 : _b.pop();
190138
+ return;
190139
+ }
190140
+ this.sendDiagnosticsEvent(file, project, diagnosticsResult.diagnostics, "regionSemanticDiag", diagnosticsStartTime, diagnosticsResult.spans);
190141
+ (_c = tracing) == null ? void 0 : _c.pop();
190142
+ return;
190143
+ }
190144
+ // We should only do the region-based semantic check if we think it would be
190145
+ // considerably faster than a whole-file semantic check.
190146
+ /** @internal */
190147
+ shouldDoRegionCheck(file) {
190148
+ var _a;
190149
+ const lineCount = (_a = this.projectService.getScriptInfoForNormalizedPath(file)) == null ? void 0 : _a.textStorage.getLineInfo().getLineCount();
190150
+ return !!(lineCount && lineCount >= this.regionDiagLineCountThreshold);
190151
+ }
190152
+ sendDiagnosticsEvent(file, project, diagnostics, kind, diagnosticsStartTime, spans) {
190036
190153
  try {
190037
- this.event({ file, diagnostics: diagnostics.map((diag2) => formatDiag(file, project, diag2)) }, kind);
190154
+ const scriptInfo = Debug.checkDefined(project.getScriptInfo(file));
190155
+ const duration = hrTimeToMilliseconds(this.hrtime(diagnosticsStartTime));
190156
+ const body = {
190157
+ file,
190158
+ diagnostics: diagnostics.map((diag2) => formatDiag(file, project, diag2)),
190159
+ spans: spans == null ? void 0 : spans.map((span) => toProtocolTextSpan(span, scriptInfo)),
190160
+ duration
190161
+ };
190162
+ this.event(
190163
+ body,
190164
+ kind
190165
+ );
190038
190166
  } catch (err) {
190039
190167
  this.logError(err, kind);
190040
190168
  }
190041
190169
  }
190042
190170
  /** It is the caller's responsibility to verify that `!this.suppressDiagnosticEvents`. */
190043
190171
  updateErrorCheck(next, checkList, ms, requireOpen = true) {
190172
+ if (checkList.length === 0) {
190173
+ return;
190174
+ }
190044
190175
  Debug.assert(!this.suppressDiagnosticEvents);
190045
190176
  const seq = this.changeSeq;
190046
190177
  const followMs = Math.min(ms, 200);
@@ -190048,20 +190179,36 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
190048
190179
  const goNext = () => {
190049
190180
  index++;
190050
190181
  if (checkList.length > index) {
190051
- next.delay("checkOne", followMs, checkOne);
190182
+ return next.delay("checkOne", followMs, checkOne);
190183
+ }
190184
+ };
190185
+ const doSemanticCheck = (fileName, project) => {
190186
+ this.semanticCheck(fileName, project);
190187
+ if (this.changeSeq !== seq) {
190188
+ return;
190189
+ }
190190
+ if (this.getPreferences(fileName).disableSuggestions) {
190191
+ return goNext();
190052
190192
  }
190193
+ next.immediate("suggestionCheck", () => {
190194
+ this.suggestionCheck(fileName, project);
190195
+ goNext();
190196
+ });
190053
190197
  };
190054
190198
  const checkOne = () => {
190055
190199
  if (this.changeSeq !== seq) {
190056
190200
  return;
190057
190201
  }
190202
+ let ranges;
190058
190203
  let item = checkList[index];
190059
190204
  if (isString(item)) {
190060
190205
  item = this.toPendingErrorCheck(item);
190061
- if (!item) {
190062
- goNext();
190063
- return;
190064
- }
190206
+ } else if ("ranges" in item) {
190207
+ ranges = item.ranges;
190208
+ item = this.toPendingErrorCheck(item.file);
190209
+ }
190210
+ if (!item) {
190211
+ return goNext();
190065
190212
  }
190066
190213
  const { fileName, project } = item;
190067
190214
  updateProjectIfDirty(project);
@@ -190073,23 +190220,21 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
190073
190220
  return;
190074
190221
  }
190075
190222
  if (project.projectService.serverMode !== 0 /* Semantic */) {
190076
- goNext();
190077
- return;
190223
+ return goNext();
190078
190224
  }
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();
190225
+ if (ranges) {
190226
+ return next.immediate("regionSemanticCheck", () => {
190227
+ const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(fileName);
190228
+ if (scriptInfo) {
190229
+ this.regionSemanticCheck(fileName, project, ranges.map((range) => this.getRange({ file: fileName, ...range }, scriptInfo)));
190230
+ }
190231
+ if (this.changeSeq !== seq) {
190232
+ return;
190233
+ }
190234
+ next.immediate("semanticCheck", () => doSemanticCheck(fileName, project));
190091
190235
  });
190092
- });
190236
+ }
190237
+ next.immediate("semanticCheck", () => doSemanticCheck(fileName, project));
190093
190238
  };
190094
190239
  if (checkList.length > index && this.changeSeq === seq) {
190095
190240
  next.delay("checkOne", ms, checkOne);
@@ -191168,12 +191313,12 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
191168
191313
  const project = this.projectService.tryGetDefaultProjectForFile(fileName);
191169
191314
  return project && { fileName, project };
191170
191315
  }
191171
- getDiagnostics(next, delay, fileNames) {
191316
+ getDiagnostics(next, delay, fileArgs) {
191172
191317
  if (this.suppressDiagnosticEvents) {
191173
191318
  return;
191174
191319
  }
191175
- if (fileNames.length > 0) {
191176
- this.updateErrorCheck(next, fileNames, delay);
191320
+ if (fileArgs.length > 0) {
191321
+ this.updateErrorCheck(next, fileArgs, delay);
191177
191322
  }
191178
191323
  }
191179
191324
  change(args) {
@@ -191809,7 +191954,7 @@ ${e.message}`;
191809
191954
  }
191810
191955
  }
191811
191956
  onMessage(message) {
191812
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
191957
+ var _a, _b, _c, _d, _e, _f, _g;
191813
191958
  this.gcTimer.scheduleCollect();
191814
191959
  this.performanceData = void 0;
191815
191960
  let start;
@@ -191825,8 +191970,7 @@ ${e.message}`;
191825
191970
  request = this.parseMessage(message);
191826
191971
  relevantFile = request.arguments && request.arguments.file ? request.arguments : void 0;
191827
191972
  (_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(
191973
+ (_b = tracing) == null ? void 0 : _b.push(
191830
191974
  tracing.Phase.Session,
191831
191975
  "executeCommand",
191832
191976
  { seq: request.seq, command: request.command },
@@ -191834,7 +191978,7 @@ ${e.message}`;
191834
191978
  true
191835
191979
  );
191836
191980
  const { response, responseRequired } = this.executeCommand(request);
191837
- (_d = tracing) == null ? void 0 : _d.pop();
191981
+ (_c = tracing) == null ? void 0 : _c.pop();
191838
191982
  if (this.logger.hasLevel(2 /* requestTime */)) {
191839
191983
  const elapsedTime = hrTimeToMilliseconds(this.hrtime(start)).toFixed(4);
191840
191984
  if (responseRequired) {
@@ -191843,8 +191987,7 @@ ${e.message}`;
191843
191987
  this.logger.perftrc(`${request.seq}::${request.command}: async elapsed time (in milliseconds) ${elapsedTime}`);
191844
191988
  }
191845
191989
  }
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 });
191990
+ (_d = tracing) == null ? void 0 : _d.instant(tracing.Phase.Session, "response", { seq: request.seq, command: request.command, success: !!response });
191848
191991
  if (response) {
191849
191992
  this.doOutput(
191850
191993
  response,
@@ -191865,10 +192008,9 @@ ${e.message}`;
191865
192008
  );
191866
192009
  }
191867
192010
  } catch (err) {
191868
- (_g = tracing) == null ? void 0 : _g.popAll();
192011
+ (_e = tracing) == null ? void 0 : _e.popAll();
191869
192012
  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 });
192013
+ (_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
192014
  this.doOutput(
191873
192015
  { canceled: true },
191874
192016
  request.command,
@@ -191879,8 +192021,7 @@ ${e.message}`;
191879
192021
  return;
191880
192022
  }
191881
192023
  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 });
192024
+ (_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
192025
  this.doOutput(
191885
192026
  /*info*/
191886
192027
  void 0,
@@ -193200,7 +193341,6 @@ if (typeof console !== "undefined") {
193200
193341
  canHaveJSDoc,
193201
193342
  canHaveLocals,
193202
193343
  canHaveModifiers,
193203
- canHaveModuleSpecifier,
193204
193344
  canHaveSymbol,
193205
193345
  canIncludeBindAndCheckDiagnostics,
193206
193346
  canJsonReportNoInputFiles,
@@ -193677,7 +193817,6 @@ if (typeof console !== "undefined") {
193677
193817
  getDefaultLibFilePath,
193678
193818
  getDefaultLikeExportInfo,
193679
193819
  getDefaultLikeExportNameFromDeclaration,
193680
- getDefaultResolutionModeForFileWorker,
193681
193820
  getDiagnosticText,
193682
193821
  getDiagnosticsWithinSpan,
193683
193822
  getDirectoryPath,
@@ -193708,7 +193847,6 @@ if (typeof console !== "undefined") {
193708
193847
  getEmitFlags,
193709
193848
  getEmitHelpers,
193710
193849
  getEmitModuleDetectionKind,
193711
- getEmitModuleFormatOfFileWorker,
193712
193850
  getEmitModuleKind,
193713
193851
  getEmitModuleResolutionKind,
193714
193852
  getEmitScriptTarget,
@@ -193759,7 +193897,6 @@ if (typeof console !== "undefined") {
193759
193897
  getIdentifierGeneratedImportReference,
193760
193898
  getIdentifierTypeArguments,
193761
193899
  getImmediatelyInvokedFunctionExpression,
193762
- getImpliedNodeFormatForEmitWorker,
193763
193900
  getImpliedNodeFormatForFile,
193764
193901
  getImpliedNodeFormatForFileWorker,
193765
193902
  getImportNeedsImportDefaultHelper,
@@ -193867,6 +194004,7 @@ if (typeof console !== "undefined") {
193867
194004
  getNameOfScriptTarget,
193868
194005
  getNameOrArgument,
193869
194006
  getNameTable,
194007
+ getNamesForExportedSymbol,
193870
194008
  getNamespaceDeclarationNode,
193871
194009
  getNewLineCharacter,
193872
194010
  getNewLineKind,
@@ -193883,6 +194021,7 @@ if (typeof console !== "undefined") {
193883
194021
  getNonAssignmentOperatorForCompoundAssignment,
193884
194022
  getNonAugmentationDeclaration,
193885
194023
  getNonDecoratorTokenPosOfNode,
194024
+ getNonIncrementalBuildInfoRoots,
193886
194025
  getNormalizedAbsolutePath,
193887
194026
  getNormalizedAbsolutePathWithoutRoot,
193888
194027
  getNormalizedPathComponents,
@@ -194118,7 +194257,6 @@ if (typeof console !== "undefined") {
194118
194257
  importDefaultHelper,
194119
194258
  importFromModuleSpecifier,
194120
194259
  importStarHelper,
194121
- importSyntaxAffectsModuleResolution,
194122
194260
  indexOfAnyCharCode,
194123
194261
  indexOfNode,
194124
194262
  indicesOf,
@@ -194594,6 +194732,7 @@ if (typeof console !== "undefined") {
194594
194732
  isNonExportDefaultModifier,
194595
194733
  isNonGlobalAmbientModule,
194596
194734
  isNonGlobalDeclaration,
194735
+ isNonIncrementalBuildInfo,
194597
194736
  isNonNullAccess,
194598
194737
  isNonNullChain,
194599
194738
  isNonNullExpression,
@@ -194706,6 +194845,7 @@ if (typeof console !== "undefined") {
194706
194845
  isSimpleParameter,
194707
194846
  isSimpleParameterList,
194708
194847
  isSingleOrDoubleQuote,
194848
+ isSourceElement,
194709
194849
  isSourceFile,
194710
194850
  isSourceFileFromLibrary,
194711
194851
  isSourceFileJS,
@@ -194839,7 +194979,6 @@ if (typeof console !== "undefined") {
194839
194979
  linkNamePart,
194840
194980
  linkPart,
194841
194981
  linkTextPart,
194842
- listFiles,
194843
194982
  loadModuleFromGlobalCache,
194844
194983
  loadWithModeAwareCache,
194845
194984
  makeIdentifierFromModuleName,
@@ -194918,6 +195057,7 @@ if (typeof console !== "undefined") {
194918
195057
  noopFileWatcher,
194919
195058
  normalizePath,
194920
195059
  normalizeSlashes,
195060
+ normalizeSpans,
194921
195061
  not,
194922
195062
  notImplemented,
194923
195063
  notImplementedResolver,
@@ -194969,7 +195109,6 @@ if (typeof console !== "undefined") {
194969
195109
  pathIsBareSpecifier,
194970
195110
  pathIsRelative,
194971
195111
  patternText,
194972
- perfLogger,
194973
195112
  performIncrementalCompilation,
194974
195113
  performance,
194975
195114
  plainJSErrors,
@@ -195121,6 +195260,7 @@ if (typeof console !== "undefined") {
195121
195260
  skipPartiallyEmittedExpressions,
195122
195261
  skipTrivia,
195123
195262
  skipTypeChecking,
195263
+ skipTypeCheckingIgnoringNoCheck,
195124
195264
  skipTypeParentheses,
195125
195265
  skipWhile,
195126
195266
  sliceAfter,
@@ -195177,7 +195317,10 @@ if (typeof console !== "undefined") {
195177
195317
  textOrKeywordPart,
195178
195318
  textPart,
195179
195319
  textRangeContainsPositionInclusive,
195320
+ textRangeContainsTextSpan,
195321
+ textRangeIntersectsWithTextSpan,
195180
195322
  textSpanContainsPosition,
195323
+ textSpanContainsTextRange,
195181
195324
  textSpanContainsTextSpan,
195182
195325
  textSpanEnd,
195183
195326
  textSpanIntersection,
@@ -195218,11 +195361,11 @@ if (typeof console !== "undefined") {
195218
195361
  transformESDecorators,
195219
195362
  transformESNext,
195220
195363
  transformGenerators,
195221
- transformImpliedNodeFormatDependentModule,
195222
195364
  transformJsx,
195223
195365
  transformLegacyDecorators,
195224
195366
  transformModule,
195225
195367
  transformNamedEvaluation,
195368
+ transformNodeModule,
195226
195369
  transformNodes,
195227
195370
  transformSystemModule,
195228
195371
  transformTypeScript,