@typescript-deploys/pr-build 5.4.0-pr-56794-2 → 5.4.0-pr-56785-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.4";
21
- var version = `${versionMajorMinor}.0-insiders.20231215`;
21
+ var version = `${versionMajorMinor}.0-insiders.20231218`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -3767,6 +3767,7 @@ var ModuleKind = /* @__PURE__ */ ((ModuleKind2) => {
3767
3767
  ModuleKind2[ModuleKind2["ESNext"] = 99] = "ESNext";
3768
3768
  ModuleKind2[ModuleKind2["Node16"] = 100] = "Node16";
3769
3769
  ModuleKind2[ModuleKind2["NodeNext"] = 199] = "NodeNext";
3770
+ ModuleKind2[ModuleKind2["Preserve"] = 200] = "Preserve";
3770
3771
  return ModuleKind2;
3771
3772
  })(ModuleKind || {});
3772
3773
  var ScriptKind = /* @__PURE__ */ ((ScriptKind3) => {
@@ -6004,7 +6005,7 @@ var Diagnostics = {
6004
6005
  await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, 1 /* Error */, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
6005
6006
  _0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
6006
6007
  _0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
6007
- Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, 1 /* Error */, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
6008
+ Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, 1 /* Error */, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
6008
6009
  An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, 1 /* Error */, "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379", "An import alias cannot reference a declaration that was exported using 'export type'."),
6009
6010
  An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, 1 /* Error */, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
6010
6011
  Unexpected_token_Did_you_mean_or_rbrace: diag(1381, 1 /* Error */, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
@@ -6055,7 +6056,7 @@ var Diagnostics = {
6055
6056
  File_redirects_to_file_0: diag(1429, 3 /* Message */, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
6056
6057
  The_file_is_in_the_program_because_Colon: diag(1430, 3 /* Message */, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
6057
6058
  for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1431, 1 /* Error */, "for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431", "'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
6058
- Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, 1 /* Error */, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
6059
+ Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, 1 /* Error */, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
6059
6060
  Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters: diag(1433, 1 /* Error */, "Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters_1433", "Neither decorators nor modifiers may be applied to 'this' parameters."),
6060
6061
  Unexpected_keyword_or_identifier: diag(1434, 1 /* Error */, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
6061
6062
  Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, 1 /* Error */, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
@@ -6638,9 +6639,9 @@ var Diagnostics = {
6638
6639
  Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers: diag(2818, 1 /* Error */, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),
6639
6640
  Namespace_name_cannot_be_0: diag(2819, 1 /* Error */, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
6640
6641
  Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, 1 /* Error */, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
6641
- Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, 1 /* Error */, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
6642
+ Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve: diag(2821, 1 /* Error */, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve_2821", "Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'."),
6642
6643
  Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, 1 /* Error */, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
6643
- Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2823, 1 /* Error */, "Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2823", "Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
6644
+ Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve: diag(2823, 1 /* Error */, "Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve_2823", "Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'."),
6644
6645
  Cannot_find_namespace_0_Did_you_mean_1: diag(2833, 1 /* Error */, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
6645
6646
  Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."),
6646
6647
  Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),
@@ -6660,7 +6661,7 @@ var Diagnostics = {
6660
6661
  The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined: diag(2851, 1 /* Error */, "The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_2851", "The initializer of an 'await using' declaration must be either an object with a '[Symbol.asyncDispose]()' or '[Symbol.dispose]()' method, or be 'null' or 'undefined'."),
6661
6662
  await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(2852, 1 /* Error */, "await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_2852", "'await using' statements are only allowed within async functions and at the top levels of modules."),
6662
6663
  await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(2853, 1 /* Error */, "await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853", "'await using' statements are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
6663
- Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
6664
+ Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
6664
6665
  Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super: diag(2855, 1 /* Error */, "Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855", "Class field '{0}' defined by the parent class is not accessible in the child class via super."),
6665
6666
  Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls: diag(2856, 1 /* Error */, "Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls_2856", "Import attributes are not allowed on statements that compile to CommonJS 'require' calls."),
6666
6667
  Import_attributes_cannot_be_used_with_type_only_imports_or_exports: diag(2857, 1 /* Error */, "Import_attributes_cannot_be_used_with_type_only_imports_or_exports_2857", "Import attributes cannot be used with type-only imports or exports."),
@@ -6673,6 +6674,8 @@ var Diagnostics = {
6673
6674
  A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types: diag(2864, 1 /* Error */, "A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types_2864", "A class cannot implement a primitive type like '{0}'. It can only implement other named object types."),
6674
6675
  Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2865, 1 /* Error */, "Import_0_conflicts_with_local_value_so_must_be_declared_with_a_type_only_import_when_isolatedModules_2865", "Import '{0}' conflicts with local value, so must be declared with a type-only import when 'isolatedModules' is enabled."),
6675
6676
  Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2866, 1 /* Error */, "Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_w_2866", "Import '{0}' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled."),
6677
+ Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun: diag(2867, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2867", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun`."),
6678
+ Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig: diag(2868, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2868", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun` and then add 'bun' to the types field in your tsconfig."),
6676
6679
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
6677
6680
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
6678
6681
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -6812,7 +6815,7 @@ var Diagnostics = {
6812
6815
  Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: diag(5068, 1 /* Error */, "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068", "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig."),
6813
6816
  Option_0_cannot_be_specified_without_specifying_option_1_or_option_2: diag(5069, 1 /* Error */, "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069", "Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'."),
6814
6817
  Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic: diag(5070, 1 /* Error */, "Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic_5070", "Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'."),
6815
- Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext: diag(5071, 1 /* Error */, "Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071", "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."),
6818
+ Option_resolveJsonModule_cannot_be_specified_when_module_is_set_to_none_system_or_umd: diag(5071, 1 /* Error */, "Option_resolveJsonModule_cannot_be_specified_when_module_is_set_to_none_system_or_umd_5071", "Option '--resolveJsonModule' cannot be specified when 'module' is set to 'none', 'system', or 'umd'."),
6816
6819
  Unknown_build_option_0: diag(5072, 1 /* Error */, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
6817
6820
  Build_option_0_requires_a_value_of_type_1: diag(5073, 1 /* Error */, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."),
6818
6821
  Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified: diag(5074, 1 /* Error */, "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option '--tsBuildInfoFile' is specified."),
@@ -6835,7 +6838,7 @@ var Diagnostics = {
6835
6838
  The_root_value_of_a_0_file_must_be_an_object: diag(5092, 1 /* Error */, "The_root_value_of_a_0_file_must_be_an_object_5092", "The root value of a '{0}' file must be an object."),
6836
6839
  Compiler_option_0_may_only_be_used_with_build: diag(5093, 1 /* Error */, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."),
6837
6840
  Compiler_option_0_may_not_be_used_with_build: diag(5094, 1 /* Error */, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."),
6838
- Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'es2015' or later."),
6841
+ Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later."),
6839
6842
  Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."),
6840
6843
  An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),
6841
6844
  Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
@@ -11544,13 +11547,13 @@ function packageIdToString(packageId) {
11544
11547
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
11545
11548
  return oldResolution === newResolution || oldResolution.resolvedTypeReferenceDirective === newResolution.resolvedTypeReferenceDirective || !!oldResolution.resolvedTypeReferenceDirective && !!newResolution.resolvedTypeReferenceDirective && oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName && !!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary && oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
11546
11549
  }
11547
- function hasChangesInResolutions(names, newSourceFile, newResolutions, getOldResolution, comparer, nameAndModeGetter) {
11550
+ function hasChangesInResolutions(names, newSourceFile, newResolutions, getOldResolution, comparer, nameAndModeGetter, compilerOptions) {
11548
11551
  Debug.assert(names.length === newResolutions.length);
11549
11552
  for (let i = 0; i < names.length; i++) {
11550
11553
  const newResolution = newResolutions[i];
11551
11554
  const entry = names[i];
11552
11555
  const name = nameAndModeGetter.getName(entry);
11553
- const mode = nameAndModeGetter.getMode(entry, newSourceFile);
11556
+ const mode = nameAndModeGetter.getMode(entry, newSourceFile, compilerOptions);
11554
11557
  const oldResolution = getOldResolution(name, mode);
11555
11558
  const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
11556
11559
  if (changed) {
@@ -16394,6 +16397,9 @@ var computedOptions = createComputedCompilerOptions({
16394
16397
  case 199 /* NodeNext */:
16395
16398
  moduleResolution = 99 /* NodeNext */;
16396
16399
  break;
16400
+ case 200 /* Preserve */:
16401
+ moduleResolution = 100 /* Bundler */;
16402
+ break;
16397
16403
  default:
16398
16404
  moduleResolution = 1 /* Classic */;
16399
16405
  break;
@@ -16423,6 +16429,7 @@ var computedOptions = createComputedCompilerOptions({
16423
16429
  switch (computedOptions.module.computeValue(compilerOptions)) {
16424
16430
  case 100 /* Node16 */:
16425
16431
  case 199 /* NodeNext */:
16432
+ case 200 /* Preserve */:
16426
16433
  return true;
16427
16434
  }
16428
16435
  return false;
@@ -16590,18 +16597,12 @@ function emitModuleKindIsNonNodeESM(moduleKind) {
16590
16597
  }
16591
16598
  function hasJsonModuleEmitEnabled(options) {
16592
16599
  switch (getEmitModuleKind(options)) {
16593
- case 1 /* CommonJS */:
16594
- case 2 /* AMD */:
16595
- case 5 /* ES2015 */:
16596
- case 6 /* ES2020 */:
16597
- case 7 /* ES2022 */:
16598
- case 99 /* ESNext */:
16599
- case 100 /* Node16 */:
16600
- case 199 /* NodeNext */:
16601
- return true;
16602
- default:
16600
+ case 0 /* None */:
16601
+ case 4 /* System */:
16602
+ case 3 /* UMD */:
16603
16603
  return false;
16604
16604
  }
16605
+ return true;
16605
16606
  }
16606
16607
  function unreachableCodeIsError(options) {
16607
16608
  return options.allowUnreachableCode === false;
@@ -16612,9 +16613,6 @@ function unusedLabelIsError(options) {
16612
16613
  function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
16613
16614
  return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
16614
16615
  }
16615
- function shouldResolveJsRequire(compilerOptions) {
16616
- return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
16617
- }
16618
16616
  function getStrictOptionValue(compilerOptions, flag) {
16619
16617
  return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
16620
16618
  }
@@ -16991,7 +16989,8 @@ function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtens
16991
16989
  return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false;
16992
16990
  }
16993
16991
  function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
16994
- if (preference === "js" || resolutionMode === 99 /* ESNext */) {
16992
+ const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
16993
+ if (preference === "js" || resolutionMode === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
16995
16994
  if (!shouldAllowImportingTsExtension(compilerOptions)) {
16996
16995
  return 2 /* JsExtension */;
16997
16996
  }
@@ -34360,7 +34359,8 @@ var moduleOptionDeclaration = {
34360
34359
  es2022: 7 /* ES2022 */,
34361
34360
  esnext: 99 /* ESNext */,
34362
34361
  node16: 100 /* Node16 */,
34363
- nodenext: 199 /* NodeNext */
34362
+ nodenext: 199 /* NodeNext */,
34363
+ preserve: 200 /* Preserve */
34364
34364
  })),
34365
34365
  affectsSourceFile: true,
34366
34366
  affectsModuleResolution: true,
@@ -37954,20 +37954,7 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
37954
37954
  } else {
37955
37955
  let moduleResolution = compilerOptions.moduleResolution;
37956
37956
  if (moduleResolution === void 0) {
37957
- switch (getEmitModuleKind(compilerOptions)) {
37958
- case 1 /* CommonJS */:
37959
- moduleResolution = 2 /* Node10 */;
37960
- break;
37961
- case 100 /* Node16 */:
37962
- moduleResolution = 3 /* Node16 */;
37963
- break;
37964
- case 199 /* NodeNext */:
37965
- moduleResolution = 99 /* NodeNext */;
37966
- break;
37967
- default:
37968
- moduleResolution = 1 /* Classic */;
37969
- break;
37970
- }
37957
+ moduleResolution = getEmitModuleResolutionKind(compilerOptions);
37971
37958
  if (traceEnabled) {
37972
37959
  trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]);
37973
37960
  }
@@ -42140,7 +42127,7 @@ function createBinder() {
42140
42127
  }
42141
42128
  if (!isBindingPattern(node.name)) {
42142
42129
  const possibleVariableDecl = node.kind === 260 /* VariableDeclaration */ ? node : node.parent.parent;
42143
- if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 32 /* Export */)) {
42130
+ if (isInJSFile(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 32 /* Export */)) {
42144
42131
  declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
42145
42132
  } else if (isBlockOrCatchScoped(node)) {
42146
42133
  bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
@@ -42669,7 +42656,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
42669
42656
  (reason) => {
42670
42657
  if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path)
42671
42658
  return void 0;
42672
- if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index))
42659
+ if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions))
42673
42660
  return void 0;
42674
42661
  const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
42675
42662
  return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
@@ -43390,8 +43377,7 @@ var intrinsicTypeKinds = new Map(Object.entries({
43390
43377
  Uppercase: 0 /* Uppercase */,
43391
43378
  Lowercase: 1 /* Lowercase */,
43392
43379
  Capitalize: 2 /* Capitalize */,
43393
- Uncapitalize: 3 /* Uncapitalize */,
43394
- NoInfer: 4 /* NoInfer */
43380
+ Uncapitalize: 3 /* Uncapitalize */
43395
43381
  }));
43396
43382
  var SymbolLinks = class {
43397
43383
  };
@@ -45806,7 +45792,7 @@ function createTypeChecker(host) {
45806
45792
  return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
45807
45793
  }
45808
45794
  function getUsageModeForExpression(usage) {
45809
- return isStringLiteralLike(usage) ? getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
45795
+ return isStringLiteralLike(usage) ? getModeForUsageLocation(getSourceFileOfNode(usage), usage, compilerOptions) : void 0;
45810
45796
  }
45811
45797
  function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
45812
45798
  return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
@@ -45817,7 +45803,7 @@ function createTypeChecker(host) {
45817
45803
  }
45818
45804
  function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
45819
45805
  const usageMode = file && getUsageModeForExpression(usage);
45820
- if (file && usageMode !== void 0) {
45806
+ if (file && usageMode !== void 0 && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
45821
45807
  const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
45822
45808
  if (usageMode === 99 /* ESNext */ || result) {
45823
45809
  return result;
@@ -46711,8 +46697,12 @@ function createTypeChecker(host) {
46711
46697
  return ambientModule;
46712
46698
  }
46713
46699
  const currentSourceFile = getSourceFileOfNode(location);
46714
- const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
46715
- const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
46700
+ const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isVariableDeclaration(location) && location.initializer && isRequireCall(
46701
+ location.initializer,
46702
+ /*requireStringLiteralLikeArgument*/
46703
+ true
46704
+ ) ? 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);
46705
+ const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier, compilerOptions) : currentSourceFile.impliedNodeFormat;
46716
46706
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
46717
46707
  const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
46718
46708
  const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
@@ -48245,8 +48235,7 @@ function createTypeChecker(host) {
48245
48235
  return visitAndTransformType(type, (type2) => conditionalTypeToTypeNode(type2));
48246
48236
  }
48247
48237
  if (type.flags & 33554432 /* Substitution */) {
48248
- const typeNode = typeToTypeNodeHelper(type.baseType, context);
48249
- return isNoInferType(type) ? factory.createTypeReferenceNode("NoInfer", [typeNode]) : typeNode;
48238
+ return typeToTypeNodeHelper(type.baseType, context);
48250
48239
  }
48251
48240
  return Debug.fail("Should be unreachable.");
48252
48241
  function conditionalTypeToTypeNode(type2) {
@@ -56150,11 +56139,8 @@ function createTypeChecker(host) {
56150
56139
  }
56151
56140
  function getTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
56152
56141
  const type = getDeclaredTypeOfSymbol(symbol);
56153
- if (type === intrinsicMarkerType) {
56154
- const typeKind = intrinsicTypeKinds.get(symbol.escapedName);
56155
- if (typeKind !== void 0 && typeArguments && typeArguments.length === 1) {
56156
- return typeKind === 4 /* NoInfer */ ? getNoInferType(typeArguments[0]) : getStringMappingType(symbol, typeArguments[0]);
56157
- }
56142
+ if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
56143
+ return getStringMappingType(symbol, typeArguments[0]);
56158
56144
  }
56159
56145
  const links = getSymbolLinks(symbol);
56160
56146
  const typeParameters = links.typeParameters;
@@ -56308,19 +56294,10 @@ function createTypeChecker(host) {
56308
56294
  }
56309
56295
  return links.resolvedJSDocType;
56310
56296
  }
56311
- function getNoInferType(type) {
56312
- return isNoInferTargetType(type) ? getOrCreateSubstitutionType(type, unknownType) : type;
56313
- }
56314
- function isNoInferTargetType(type) {
56315
- return !!(type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, isNoInferTargetType) || type.flags & 33554432 /* Substitution */ && !isNoInferType(type) && isNoInferTargetType(type.baseType) || type.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(type) || type.flags & (465829888 /* Instantiable */ & ~33554432 /* Substitution */) && !isPatternLiteralType(type));
56316
- }
56317
- function isNoInferType(type) {
56318
- return !!(type.flags & 33554432 /* Substitution */ && type.constraint.flags & 2 /* Unknown */);
56319
- }
56320
56297
  function getSubstitutionType(baseType, constraint) {
56321
- return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint);
56322
- }
56323
- function getOrCreateSubstitutionType(baseType, constraint) {
56298
+ if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
56299
+ return baseType;
56300
+ }
56324
56301
  const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
56325
56302
  const cached = substitutionTypes.get(id);
56326
56303
  if (cached) {
@@ -56333,7 +56310,7 @@ function createTypeChecker(host) {
56333
56310
  return result;
56334
56311
  }
56335
56312
  function getSubstitutionIntersection(substitutionType) {
56336
- return isNoInferType(substitutionType) ? substitutionType.baseType : getIntersectionType([substitutionType.constraint, substitutionType.baseType]);
56313
+ return getIntersectionType([substitutionType.constraint, substitutionType.baseType]);
56337
56314
  }
56338
56315
  function isUnaryTupleTypeNode(node) {
56339
56316
  return node.kind === 189 /* TupleType */ && node.elements.length === 1;
@@ -59591,9 +59568,6 @@ function createTypeChecker(host) {
59591
59568
  }
59592
59569
  if (flags & 33554432 /* Substitution */) {
59593
59570
  const newBaseType = instantiateType(type.baseType, mapper);
59594
- if (isNoInferType(type)) {
59595
- return getNoInferType(newBaseType);
59596
- }
59597
59571
  const newConstraint = instantiateType(type.constraint, mapper);
59598
59572
  if (newBaseType.flags & 8650752 /* TypeVariable */ && isGenericType(newConstraint)) {
59599
59573
  return getSubstitutionType(newBaseType, newConstraint);
@@ -64344,7 +64318,7 @@ function createTypeChecker(host) {
64344
64318
  let expandingFlags = 0 /* None */;
64345
64319
  inferFromTypes(originalSource, originalTarget);
64346
64320
  function inferFromTypes(source, target) {
64347
- if (!couldContainTypeVariables(target) || isNoInferType(target)) {
64321
+ if (!couldContainTypeVariables(target)) {
64348
64322
  return;
64349
64323
  }
64350
64324
  if (source === wildcardType || source === blockedStringType) {
@@ -64393,9 +64367,6 @@ function createTypeChecker(host) {
64393
64367
  }
64394
64368
  }
64395
64369
  if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
64396
- if (isNoInferType(target)) {
64397
- return;
64398
- }
64399
64370
  target = getActualTypeVariable(target);
64400
64371
  }
64401
64372
  if (target.flags & 8650752 /* TypeVariable */) {
@@ -65024,6 +64995,8 @@ function createTypeChecker(host) {
65024
64995
  case "Buffer":
65025
64996
  case "module":
65026
64997
  return compilerOptions.types ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode;
64998
+ case "Bun":
64999
+ return compilerOptions.types ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun;
65027
65000
  case "Map":
65028
65001
  case "Set":
65029
65002
  case "Promise":
@@ -69605,7 +69578,12 @@ function createTypeChecker(host) {
69605
69578
  }
69606
69579
  const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
69607
69580
  const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
69608
- const mod = resolveExternalModule(location, runtimeImportSpecifier, errorMessage, location);
69581
+ const jsxImportIndex = compilerOptions.importHelpers ? 1 : 0;
69582
+ const specifier = file == null ? void 0 : file.imports[jsxImportIndex];
69583
+ if (specifier) {
69584
+ Debug.assert(nodeIsSynthesized(specifier) && specifier.text === runtimeImportSpecifier, `Expected sourceFile.imports[${jsxImportIndex}] to be the synthesized JSX runtime import`);
69585
+ }
69586
+ const mod = resolveExternalModule(specifier || location, runtimeImportSpecifier, errorMessage, location);
69609
69587
  const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
69610
69588
  if (links) {
69611
69589
  links.jsxImplicitImportContainer = result || false;
@@ -72646,7 +72624,7 @@ function createTypeChecker(host) {
72646
72624
  return anyType;
72647
72625
  }
72648
72626
  }
72649
- if (isInJSFile(node) && shouldResolveJsRequire(compilerOptions) && isCommonJsRequire(node)) {
72627
+ if (isInJSFile(node) && isCommonJsRequire(node)) {
72650
72628
  return resolveExternalModuleTypeByLiteral(node.arguments[0]);
72651
72629
  }
72652
72630
  const returnType = getReturnTypeOfSignature(signature);
@@ -74298,13 +74276,14 @@ function createTypeChecker(host) {
74298
74276
  }
74299
74277
  case 7 /* ES2022 */:
74300
74278
  case 99 /* ESNext */:
74279
+ case 200 /* Preserve */:
74301
74280
  case 4 /* System */:
74302
74281
  if (languageVersion >= 4 /* ES2017 */) {
74303
74282
  break;
74304
74283
  }
74305
74284
  default:
74306
74285
  span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
74307
- const message = isAwaitExpression(node) ? Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher : Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher;
74286
+ const message = isAwaitExpression(node) ? Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher : Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher;
74308
74287
  diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message));
74309
74288
  hasError = true;
74310
74289
  break;
@@ -80812,8 +80791,8 @@ function createTypeChecker(host) {
80812
80791
  return;
80813
80792
  }
80814
80793
  const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
80815
- if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */) {
80816
- 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_or_nodenext : 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_or_nodenext;
80794
+ if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
80795
+ 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;
80817
80796
  return grammarErrorOnNode(node, message);
80818
80797
  }
80819
80798
  if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
@@ -80882,7 +80861,7 @@ function createTypeChecker(host) {
80882
80861
  grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
80883
80862
  }
80884
80863
  } else {
80885
- if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
80864
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
80886
80865
  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);
80887
80866
  }
80888
80867
  }
@@ -81117,7 +81096,7 @@ function createTypeChecker(host) {
81117
81096
  grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
81118
81097
  }
81119
81098
  if (node.isExportEquals) {
81120
- if (moduleKind >= 5 /* ES2015 */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
81099
+ 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 */)) {
81121
81100
  grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
81122
81101
  } else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
81123
81102
  grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
@@ -82109,7 +82088,7 @@ function createTypeChecker(host) {
82109
82088
  return void 0;
82110
82089
  case 11 /* StringLiteral */:
82111
82090
  case 15 /* NoSubstitutionTemplateLiteral */:
82112
- if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 272 /* ImportDeclaration */ || node.parent.kind === 278 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */ && isRequireCall(
82091
+ if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 272 /* ImportDeclaration */ || node.parent.kind === 278 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || (isInJSFile(node) && isRequireCall(
82113
82092
  node.parent,
82114
82093
  /*requireStringLiteralLikeArgument*/
82115
82094
  false
@@ -84165,7 +84144,7 @@ function createTypeChecker(host) {
84165
84144
  }
84166
84145
  default:
84167
84146
  diagnostics.add(
84168
- createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher)
84147
+ createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher)
84169
84148
  );
84170
84149
  break;
84171
84150
  }
@@ -107389,7 +107368,7 @@ function transformECMAScriptModule(context) {
107389
107368
  setTextRange(factory2.createNodeArray(insertStatementsAfterCustomPrologue(result.statements.slice(), importRequireStatements)), result.statements)
107390
107369
  );
107391
107370
  }
107392
- if (!isExternalModule(node) || some(result.statements, isExternalModuleIndicator)) {
107371
+ if (!isExternalModule(node) || getEmitModuleKind(compilerOptions) === 200 /* Preserve */ || some(result.statements, isExternalModuleIndicator)) {
107393
107372
  return result;
107394
107373
  }
107395
107374
  return factory2.updateSourceFile(
@@ -107432,6 +107411,14 @@ function transformECMAScriptModule(context) {
107432
107411
  if (moduleName) {
107433
107412
  args.push(moduleName);
107434
107413
  }
107414
+ if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
107415
+ return factory2.createCallExpression(
107416
+ factory2.createIdentifier("require"),
107417
+ /*typeArguments*/
107418
+ void 0,
107419
+ args
107420
+ );
107421
+ }
107435
107422
  if (!importRequireStatements) {
107436
107423
  const createRequireName = factory2.createUniqueName("_createRequire", 16 /* Optimistic */ | 32 /* FileLevel */);
107437
107424
  const importStatement = factory2.createImportDeclaration(
@@ -107546,7 +107533,25 @@ function transformECMAScriptModule(context) {
107546
107533
  return statements;
107547
107534
  }
107548
107535
  function visitExportAssignment(node) {
107549
- return node.isExportEquals ? void 0 : node;
107536
+ if (node.isExportEquals) {
107537
+ if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
107538
+ const statement = setOriginalNode(
107539
+ factory2.createExpressionStatement(
107540
+ factory2.createAssignment(
107541
+ factory2.createPropertyAccessExpression(
107542
+ factory2.createIdentifier("module"),
107543
+ "exports"
107544
+ ),
107545
+ node.expression
107546
+ )
107547
+ ),
107548
+ node
107549
+ );
107550
+ return statement;
107551
+ }
107552
+ return void 0;
107553
+ }
107554
+ return node;
107550
107555
  }
107551
107556
  function visitExportDeclaration(node) {
107552
107557
  if (compilerOptions.module !== void 0 && compilerOptions.module > 5 /* ES2015 */) {
@@ -109916,6 +109921,7 @@ function getModuleTransformer(moduleKind) {
109916
109921
  case 7 /* ES2022 */:
109917
109922
  case 6 /* ES2020 */:
109918
109923
  case 5 /* ES2015 */:
109924
+ case 200 /* Preserve */:
109919
109925
  return transformECMAScriptModule;
109920
109926
  case 4 /* System */:
109921
109927
  return transformSystemModule;
@@ -116676,8 +116682,8 @@ function flattenDiagnosticMessageText(diag2, newLine, indent2 = 0) {
116676
116682
  function getModeForFileReference(ref, containingFileMode) {
116677
116683
  return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
116678
116684
  }
116679
- function getModeForResolutionAtIndex(file, index) {
116680
- return getModeForUsageLocation(file, getModuleNameStringLiteralAt(file, index));
116685
+ function getModeForResolutionAtIndex(file, index, compilerOptions) {
116686
+ return getModeForUsageLocation(file, getModuleNameStringLiteralAt(file, index), compilerOptions);
116681
116687
  }
116682
116688
  function isExclusivelyTypeOnlyImportOrExport(decl) {
116683
116689
  var _a;
@@ -116689,7 +116695,7 @@ function isExclusivelyTypeOnlyImportOrExport(decl) {
116689
116695
  }
116690
116696
  return false;
116691
116697
  }
116692
- function getModeForUsageLocation(file, usage) {
116698
+ function getModeForUsageLocation(file, usage, compilerOptions) {
116693
116699
  var _a;
116694
116700
  if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
116695
116701
  const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
@@ -116706,6 +116712,13 @@ function getModeForUsageLocation(file, usage) {
116706
116712
  return override;
116707
116713
  }
116708
116714
  }
116715
+ if (getEmitModuleResolutionKind(compilerOptions) === 100 /* Bundler */) {
116716
+ return usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(
116717
+ usage.parent,
116718
+ /*requireStringLiteralLikeArgument*/
116719
+ false
116720
+ ) ? 1 /* CommonJS */ : 99 /* ESNext */;
116721
+ }
116709
116722
  if (file.impliedNodeFormat === void 0)
116710
116723
  return void 0;
116711
116724
  if (file.impliedNodeFormat !== 99 /* ESNext */) {
@@ -116751,7 +116764,7 @@ function getModuleResolutionName(literal) {
116751
116764
  }
116752
116765
  var moduleResolutionNameAndModeGetter = {
116753
116766
  getName: getModuleResolutionName,
116754
- getMode: (entry, file) => getModeForUsageLocation(file, entry)
116767
+ getMode: (entry, file, compilerOptions) => getModeForUsageLocation(file, entry, compilerOptions)
116755
116768
  };
116756
116769
  function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
116757
116770
  return {
@@ -116796,7 +116809,7 @@ function loadWithModeAwareCache(entries, containingFile, redirectedReference, op
116796
116809
  const loader = createLoader(containingFile, redirectedReference, options, host, resolutionCache);
116797
116810
  for (const entry of entries) {
116798
116811
  const name = loader.nameAndMode.getName(entry);
116799
- const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
116812
+ const mode = loader.nameAndMode.getMode(entry, containingSourceFile, options);
116800
116813
  const key = createModeAwareCacheKey(name, mode);
116801
116814
  let result = cache.get(key);
116802
116815
  if (!result) {
@@ -116882,7 +116895,7 @@ function getReferencedFileLocation(program, ref) {
116882
116895
  switch (kind) {
116883
116896
  case 3 /* Import */:
116884
116897
  const importLiteral = getModuleNameStringLiteralAt(file, index);
116885
- packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.packageId;
116898
+ packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text, getModeForResolutionAtIndex(file, index, program.getCompilerOptions()))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.packageId;
116886
116899
  if (importLiteral.pos === -1)
116887
116900
  return { file, packageId, text: importLiteral.text };
116888
116901
  pos = skipTrivia(file.text, importLiteral.pos);
@@ -117642,7 +117655,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117642
117655
  for (let i = 0; i < moduleNames.length; i++) {
117643
117656
  const moduleName = moduleNames[i];
117644
117657
  if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
117645
- const mode = getModeForUsageLocation(file, moduleName);
117658
+ const mode = getModeForUsageLocation(file, moduleName, options);
117646
117659
  const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, mode);
117647
117660
  if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
117648
117661
  if (isTraceEnabled(options, host)) {
@@ -117691,7 +117704,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117691
117704
  return result;
117692
117705
  function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
117693
117706
  var _a2;
117694
- const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
117707
+ const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation(file, moduleName, oldProgram.getCompilerOptions()))) == null ? void 0 : _a2.resolvedModule;
117695
117708
  const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
117696
117709
  if (resolutionToFile && resolvedFile) {
117697
117710
  return false;
@@ -117913,7 +117926,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117913
117926
  resolutions,
117914
117927
  (name, mode) => oldProgram.getResolvedModule(newSourceFile, name, mode),
117915
117928
  moduleResolutionIsEqualTo,
117916
- moduleResolutionNameAndModeGetter
117929
+ moduleResolutionNameAndModeGetter,
117930
+ oldProgram.getCompilerOptions()
117917
117931
  );
117918
117932
  if (resolutionsChanged)
117919
117933
  structureIsReused = 1 /* SafeModules */;
@@ -117926,7 +117940,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117926
117940
  typeReferenceResolutions,
117927
117941
  (name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedTypeReferenceDirective(newSourceFile, name, mode),
117928
117942
  typeDirectiveIsEqualTo,
117929
- typeReferenceResolutionNameAndModeGetter
117943
+ typeReferenceResolutionNameAndModeGetter,
117944
+ oldProgram.getCompilerOptions()
117930
117945
  );
117931
117946
  if (typeReferenceResolutionsChanged)
117932
117947
  structureIsReused = 1 /* SafeModules */;
@@ -118593,8 +118608,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118593
118608
  false
118594
118609
  );
118595
118610
  }
118596
- const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options);
118597
- if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
118611
+ if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || isJavaScriptFile) {
118598
118612
  collectDynamicImportOrRequireCalls(file);
118599
118613
  }
118600
118614
  file.imports = imports || emptyArray;
@@ -118643,7 +118657,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118643
118657
  const r = /import|require/g;
118644
118658
  while (r.exec(file2.text) !== null) {
118645
118659
  const node = getNodeAtPosition(file2, r.lastIndex);
118646
- if (shouldProcessRequires && isRequireCall(
118660
+ if (isJavaScriptFile && isRequireCall(
118647
118661
  node,
118648
118662
  /*requireStringLiteralLikeArgument*/
118649
118663
  true
@@ -119204,7 +119218,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119204
119218
  for (let index = 0; index < moduleNames.length; index++) {
119205
119219
  const resolution = resolutions[index].resolvedModule;
119206
119220
  const moduleName = moduleNames[index].text;
119207
- const mode = getModeForUsageLocation(file, moduleNames[index]);
119221
+ const mode = getModeForUsageLocation(file, moduleNames[index], optionsForFile);
119208
119222
  resolutionsInFile.set(moduleName, mode, resolutions[index]);
119209
119223
  addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
119210
119224
  if (!resolution) {
@@ -119484,7 +119498,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119484
119498
  if (getEmitModuleResolutionKind(options) === 1 /* Classic */) {
119485
119499
  createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic, "resolveJsonModule");
119486
119500
  } else if (!hasJsonModuleEmitEnabled(options)) {
119487
- createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext, "resolveJsonModule", "module");
119501
+ createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_module_is_set_to_none_system_or_umd, "resolveJsonModule", "module");
119488
119502
  }
119489
119503
  }
119490
119504
  if (options.outDir || // there is --outDir specified
@@ -119548,7 +119562,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119548
119562
  }
119549
119563
  }
119550
119564
  if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
119551
- createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "preserveValueImports");
119565
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "preserveValueImports");
119552
119566
  }
119553
119567
  const moduleKind = getEmitModuleKind(options);
119554
119568
  if (options.verbatimModuleSyntax) {
@@ -119575,8 +119589,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119575
119589
  if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
119576
119590
  createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
119577
119591
  }
119578
- if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind)) {
119579
- createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "bundler");
119592
+ if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind) && moduleKind !== 200 /* Preserve */) {
119593
+ createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "bundler");
119580
119594
  }
119581
119595
  if (ModuleKind[moduleKind] && (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && !(3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) {
119582
119596
  const moduleKindName = ModuleKind[moduleKind];
@@ -122513,7 +122527,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122513
122527
  const seenNamesInFile = createModeAwareCache();
122514
122528
  for (const entry of entries) {
122515
122529
  const name = loader.nameAndMode.getName(entry);
122516
- const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
122530
+ const mode = loader.nameAndMode.getMode(entry, containingSourceFile, options);
122517
122531
  let resolution = resolutionsInFile.get(name, mode);
122518
122532
  if (!seenNamesInFile.has(name, mode) && (allModuleAndTypeResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
122519
122533
  hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
@@ -122554,7 +122568,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122554
122568
  reusedNames == null ? void 0 : reusedNames.forEach(
122555
122569
  (entry) => seenNamesInFile.set(
122556
122570
  loader.nameAndMode.getName(entry),
122557
- loader.nameAndMode.getMode(entry, containingSourceFile),
122571
+ loader.nameAndMode.getMode(entry, containingSourceFile, options),
122558
122572
  true
122559
122573
  )
122560
122574
  );