typescript 4.7.0-dev.20220503 → 4.7.0-dev.20220504
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 +91 -67
- package/lib/tsserver.js +136 -105
- package/lib/tsserverlibrary.d.ts +7 -7
- package/lib/tsserverlibrary.js +136 -105
- package/lib/typescript.d.ts +7 -7
- package/lib/typescript.js +125 -96
- package/lib/typescriptServices.d.ts +7 -7
- package/lib/typescriptServices.js +125 -96
- package/lib/typingsInstaller.js +107 -78
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220504";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -5265,10 +5265,11 @@ var ts;
|
|
|
5265
5265
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5266
5266
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5267
5267
|
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
|
|
5268
|
-
// to better support ecmascript modules and their use within node - more features are still being added
|
|
5269
|
-
//
|
|
5270
|
-
// version-
|
|
5271
|
-
|
|
5268
|
+
// to better support ecmascript modules and their use within node - however more features are still being added.
|
|
5269
|
+
// TypeScript's Node ESM support was introduced after Node 12 went end-of-life, and Node 14 is the earliest stable
|
|
5270
|
+
// version that supports both pattern trailers - *but*, Node 16 is the first version that also supports ECMASCript 2022.
|
|
5271
|
+
// In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target
|
|
5272
|
+
ModuleResolutionKind[ModuleResolutionKind["Node16"] = 3] = "Node16";
|
|
5272
5273
|
ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
|
|
5273
5274
|
})(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
|
|
5274
5275
|
var ModuleDetectionKind;
|
|
@@ -5278,7 +5279,7 @@ var ts;
|
|
|
5278
5279
|
*/
|
|
5279
5280
|
ModuleDetectionKind[ModuleDetectionKind["Legacy"] = 1] = "Legacy";
|
|
5280
5281
|
/**
|
|
5281
|
-
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution:
|
|
5282
|
+
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node16+
|
|
5282
5283
|
*/
|
|
5283
5284
|
ModuleDetectionKind[ModuleDetectionKind["Auto"] = 2] = "Auto";
|
|
5284
5285
|
/**
|
|
@@ -5323,8 +5324,8 @@ var ts;
|
|
|
5323
5324
|
ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
|
|
5324
5325
|
ModuleKind[ModuleKind["ES2022"] = 7] = "ES2022";
|
|
5325
5326
|
ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
|
|
5326
|
-
//
|
|
5327
|
-
ModuleKind[ModuleKind["
|
|
5327
|
+
// Node16+ is an amalgam of commonjs (albeit updated) and es2022+, and represents a distinct module system from es2020/esnext
|
|
5328
|
+
ModuleKind[ModuleKind["Node16"] = 100] = "Node16";
|
|
5328
5329
|
ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
|
|
5329
5330
|
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
|
|
5330
5331
|
var JsxEmit;
|
|
@@ -8246,6 +8247,7 @@ var ts;
|
|
|
8246
8247
|
_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"),
|
|
8247
8248
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
8248
8249
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.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."),
|
|
8250
|
+
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.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."),
|
|
8249
8251
|
Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
|
|
8250
8252
|
The_body_of_an_if_statement_cannot_be_the_empty_statement: diag(1313, ts.DiagnosticCategory.Error, "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", "The body of an 'if' statement cannot be the empty statement."),
|
|
8251
8253
|
Global_module_exports_may_only_appear_in_module_files: diag(1314, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_in_module_files_1314", "Global module exports may only appear in module files."),
|
|
@@ -8257,8 +8259,8 @@ var ts;
|
|
|
8257
8259
|
Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, ts.DiagnosticCategory.Error, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
8258
8260
|
Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts.DiagnosticCategory.Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
|
|
8259
8261
|
Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, ts.DiagnosticCategory.Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
+
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."),
|
|
8263
|
+
Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nod_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'."),
|
|
8262
8264
|
Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
|
|
8263
8265
|
This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
|
|
8264
8266
|
String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
|
@@ -8275,7 +8277,7 @@ var ts;
|
|
|
8275
8277
|
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
|
|
8276
8278
|
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
|
|
8277
8279
|
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
8278
|
-
|
|
8280
|
+
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),
|
|
8279
8281
|
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
8280
8282
|
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
|
|
8281
8283
|
This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
|
|
@@ -8306,7 +8308,7 @@ var ts;
|
|
|
8306
8308
|
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, ts.DiagnosticCategory.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."),
|
|
8307
8309
|
_0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
8308
8310
|
_0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
8309
|
-
|
|
8311
|
+
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, ts.DiagnosticCategory.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."),
|
|
8310
8312
|
An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, ts.DiagnosticCategory.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'."),
|
|
8311
8313
|
An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, ts.DiagnosticCategory.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'."),
|
|
8312
8314
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
@@ -8358,7 +8360,7 @@ var ts;
|
|
|
8358
8360
|
File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
8359
8361
|
The_file_is_in_the_program_because_Colon: diag(1430, ts.DiagnosticCategory.Message, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
|
|
8360
8362
|
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, ts.DiagnosticCategory.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."),
|
|
8361
|
-
|
|
8363
|
+
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, ts.DiagnosticCategory.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."),
|
|
8362
8364
|
Decorators_may_not_be_applied_to_this_parameters: diag(1433, ts.DiagnosticCategory.Error, "Decorators_may_not_be_applied_to_this_parameters_1433", "Decorators may not be applied to 'this' parameters."),
|
|
8363
8365
|
Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
8364
8366
|
Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, ts.DiagnosticCategory.Error, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
|
|
@@ -8376,7 +8378,7 @@ var ts;
|
|
|
8376
8378
|
Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, ts.DiagnosticCategory.Message, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."),
|
|
8377
8379
|
Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments: diag(1450, ts.DiagnosticCategory.Message, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional assertion as arguments"),
|
|
8378
8380
|
Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression: diag(1451, ts.DiagnosticCategory.Error, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),
|
|
8379
|
-
|
|
8381
|
+
Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext: diag(1452, ts.DiagnosticCategory.Error, "Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452", "Resolution modes are only supported when `moduleResolution` is `node16` or `nodenext`."),
|
|
8380
8382
|
resolution_mode_should_be_either_require_or_import: diag(1453, ts.DiagnosticCategory.Error, "resolution_mode_should_be_either_require_or_import_1453", "`resolution-mode` should be either `require` or `import`."),
|
|
8381
8383
|
resolution_mode_can_only_be_set_for_type_only_imports: diag(1454, ts.DiagnosticCategory.Error, "resolution_mode_can_only_be_set_for_type_only_imports_1454", "`resolution-mode` can only be set for type-only imports."),
|
|
8382
8384
|
resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, ts.DiagnosticCategory.Error, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
|
|
@@ -8387,7 +8389,7 @@ var ts;
|
|
|
8387
8389
|
An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
|
|
8388
8390
|
An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
|
|
8389
8391
|
Control_what_method_is_used_to_detect_module_format_JS_files: diag(1475, ts.DiagnosticCategory.Message, "Control_what_method_is_used_to_detect_module_format_JS_files_1475", "Control what method is used to detect module-format JS files."),
|
|
8390
|
-
|
|
8392
|
+
auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
|
|
8391
8393
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
8392
8394
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
8393
8395
|
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
@@ -8873,8 +8875,8 @@ var ts;
|
|
|
8873
8875
|
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, ts.DiagnosticCategory.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'."),
|
|
8874
8876
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
8875
8877
|
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
8876
|
-
|
|
8877
|
-
|
|
8878
|
+
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, ts.DiagnosticCategory.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."),
|
|
8879
|
+
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.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}'?"),
|
|
8878
8880
|
Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
|
|
8879
8881
|
Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
|
|
8880
8882
|
All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
|
|
@@ -9540,7 +9542,6 @@ var ts;
|
|
|
9540
9542
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead: diag(7059, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),
|
|
9541
9543
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint: diag(7060, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),
|
|
9542
9544
|
A_mapped_type_may_not_declare_properties_or_methods: diag(7061, ts.DiagnosticCategory.Error, "A_mapped_type_may_not_declare_properties_or_methods_7061", "A mapped type may not declare properties or methods."),
|
|
9543
|
-
JSON_imports_are_experimental_in_ES_module_mode_imports: diag(7062, ts.DiagnosticCategory.Error, "JSON_imports_are_experimental_in_ES_module_mode_imports_7062", "JSON imports are experimental in ES module mode imports."),
|
|
9544
9545
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9545
9546
|
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
|
|
9546
9547
|
import_can_only_be_used_in_TypeScript_files: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."),
|
|
@@ -14833,7 +14834,7 @@ var ts;
|
|
|
14833
14834
|
}
|
|
14834
14835
|
ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
|
|
14835
14836
|
function isCommonJSContainingModuleKind(kind) {
|
|
14836
|
-
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.
|
|
14837
|
+
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node16 || kind === ts.ModuleKind.NodeNext;
|
|
14837
14838
|
}
|
|
14838
14839
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
14839
14840
|
return ts.isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator);
|
|
@@ -20001,7 +20002,7 @@ var ts;
|
|
|
20001
20002
|
file.externalModuleIndicator = ts.isFileProbablyExternalModule(file);
|
|
20002
20003
|
};
|
|
20003
20004
|
case ts.ModuleDetectionKind.Auto:
|
|
20004
|
-
// If module is nodenext or
|
|
20005
|
+
// If module is nodenext or node16, all esm format files are modules
|
|
20005
20006
|
// If jsx is react-jsx or react-jsxdev then jsx tags force module-ness
|
|
20006
20007
|
// otherwise, the presence of import or export statments (or import.meta) implies module-ness
|
|
20007
20008
|
var checks = [ts.isFileProbablyExternalModule];
|
|
@@ -20009,7 +20010,7 @@ var ts;
|
|
|
20009
20010
|
checks.push(isFileModuleFromUsingJSXTag);
|
|
20010
20011
|
}
|
|
20011
20012
|
var moduleKind = getEmitModuleKind(options);
|
|
20012
|
-
if (moduleKind === ts.ModuleKind.
|
|
20013
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
20013
20014
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
20014
20015
|
}
|
|
20015
20016
|
var combined_1 = ts.or.apply(void 0, checks);
|
|
@@ -20020,7 +20021,7 @@ var ts;
|
|
|
20020
20021
|
ts.getSetExternalModuleIndicator = getSetExternalModuleIndicator;
|
|
20021
20022
|
function getEmitScriptTarget(compilerOptions) {
|
|
20022
20023
|
return compilerOptions.target ||
|
|
20023
|
-
(compilerOptions.module === ts.ModuleKind.
|
|
20024
|
+
(compilerOptions.module === ts.ModuleKind.Node16 && 9 /* ES2022 */) ||
|
|
20024
20025
|
(compilerOptions.module === ts.ModuleKind.NodeNext && 99 /* ESNext */) ||
|
|
20025
20026
|
0 /* ES3 */;
|
|
20026
20027
|
}
|
|
@@ -20038,8 +20039,8 @@ var ts;
|
|
|
20038
20039
|
case ts.ModuleKind.CommonJS:
|
|
20039
20040
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
20040
20041
|
break;
|
|
20041
|
-
case ts.ModuleKind.
|
|
20042
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
20042
|
+
case ts.ModuleKind.Node16:
|
|
20043
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
20043
20044
|
break;
|
|
20044
20045
|
case ts.ModuleKind.NodeNext:
|
|
20045
20046
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -20064,7 +20065,7 @@ var ts;
|
|
|
20064
20065
|
case ts.ModuleKind.ES2020:
|
|
20065
20066
|
case ts.ModuleKind.ES2022:
|
|
20066
20067
|
case ts.ModuleKind.ESNext:
|
|
20067
|
-
case ts.ModuleKind.
|
|
20068
|
+
case ts.ModuleKind.Node16:
|
|
20068
20069
|
case ts.ModuleKind.NodeNext:
|
|
20069
20070
|
return true;
|
|
20070
20071
|
default:
|
|
@@ -20089,7 +20090,7 @@ var ts;
|
|
|
20089
20090
|
return compilerOptions.esModuleInterop;
|
|
20090
20091
|
}
|
|
20091
20092
|
switch (getEmitModuleKind(compilerOptions)) {
|
|
20092
|
-
case ts.ModuleKind.
|
|
20093
|
+
case ts.ModuleKind.Node16:
|
|
20093
20094
|
case ts.ModuleKind.NodeNext:
|
|
20094
20095
|
return true;
|
|
20095
20096
|
}
|
|
@@ -39295,7 +39296,7 @@ var ts;
|
|
|
39295
39296
|
es2020: ts.ModuleKind.ES2020,
|
|
39296
39297
|
es2022: ts.ModuleKind.ES2022,
|
|
39297
39298
|
esnext: ts.ModuleKind.ESNext,
|
|
39298
|
-
|
|
39299
|
+
node16: ts.ModuleKind.Node16,
|
|
39299
39300
|
nodenext: ts.ModuleKind.NodeNext,
|
|
39300
39301
|
})),
|
|
39301
39302
|
affectsModuleResolution: true,
|
|
@@ -39649,7 +39650,7 @@ var ts;
|
|
|
39649
39650
|
type: new ts.Map(ts.getEntries({
|
|
39650
39651
|
node: ts.ModuleResolutionKind.NodeJs,
|
|
39651
39652
|
classic: ts.ModuleResolutionKind.Classic,
|
|
39652
|
-
|
|
39653
|
+
node16: ts.ModuleResolutionKind.Node16,
|
|
39653
39654
|
nodenext: ts.ModuleResolutionKind.NodeNext,
|
|
39654
39655
|
})),
|
|
39655
39656
|
affectsModuleResolution: true,
|
|
@@ -40125,7 +40126,7 @@ var ts;
|
|
|
40125
40126
|
affectsModuleResolution: true,
|
|
40126
40127
|
description: ts.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
40127
40128
|
category: ts.Diagnostics.Language_and_Environment,
|
|
40128
|
-
defaultValueDescription: ts.Diagnostics.
|
|
40129
|
+
defaultValueDescription: ts.Diagnostics.auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules,
|
|
40129
40130
|
}
|
|
40130
40131
|
];
|
|
40131
40132
|
/* @internal */
|
|
@@ -42361,9 +42362,9 @@ var ts;
|
|
|
42361
42362
|
// set in a non-modal module resolution setting here. Do note that our behavior is not particularly well defined when these mode-overriding imports
|
|
42362
42363
|
// are present in a non-modal project; while in theory we'd like to either ignore the mode or provide faithful modern resolution, depending on what we feel is best,
|
|
42363
42364
|
// in practice, not every cache has the options available to intelligently make the choice to ignore the mode request, and it's unclear how modern "faithful modern
|
|
42364
|
-
// resolution" should be (`
|
|
42365
|
+
// resolution" should be (`node16`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
|
|
42365
42366
|
// context should _probably_ be an error - and that should likely be handled by the `Program` (which is what we do).
|
|
42366
|
-
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42367
|
+
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
|
|
42367
42368
|
features |= NodeResolutionFeatures.EsmMode;
|
|
42368
42369
|
}
|
|
42369
42370
|
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
@@ -42452,7 +42453,7 @@ var ts;
|
|
|
42452
42453
|
}
|
|
42453
42454
|
ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
|
|
42454
42455
|
function getDefaultNodeResolutionFeatures(options) {
|
|
42455
|
-
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42456
|
+
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default :
|
|
42456
42457
|
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
42457
42458
|
NodeResolutionFeatures.None;
|
|
42458
42459
|
}
|
|
@@ -42810,8 +42811,8 @@ var ts;
|
|
|
42810
42811
|
case ts.ModuleKind.CommonJS:
|
|
42811
42812
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
42812
42813
|
break;
|
|
42813
|
-
case ts.ModuleKind.
|
|
42814
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
42814
|
+
case ts.ModuleKind.Node16:
|
|
42815
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
42815
42816
|
break;
|
|
42816
42817
|
case ts.ModuleKind.NodeNext:
|
|
42817
42818
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -42831,8 +42832,8 @@ var ts;
|
|
|
42831
42832
|
}
|
|
42832
42833
|
ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
|
|
42833
42834
|
switch (moduleResolution) {
|
|
42834
|
-
case ts.ModuleResolutionKind.
|
|
42835
|
-
result =
|
|
42835
|
+
case ts.ModuleResolutionKind.Node16:
|
|
42836
|
+
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
42836
42837
|
break;
|
|
42837
42838
|
case ts.ModuleResolutionKind.NodeNext:
|
|
42838
42839
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43066,15 +43067,15 @@ var ts;
|
|
|
43066
43067
|
// respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
|
|
43067
43068
|
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
43068
43069
|
// allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
|
|
43069
|
-
// not
|
|
43070
|
+
// not supported in node 12 - https://github.com/nodejs/Release/issues/690
|
|
43070
43071
|
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
43071
43072
|
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
43072
|
-
NodeResolutionFeatures[NodeResolutionFeatures["
|
|
43073
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Node16Default"] = 30] = "Node16Default";
|
|
43073
43074
|
NodeResolutionFeatures[NodeResolutionFeatures["NodeNextDefault"] = 30] = "NodeNextDefault";
|
|
43074
43075
|
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
43075
43076
|
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
43076
|
-
function
|
|
43077
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.
|
|
43077
|
+
function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43078
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node16Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43078
43079
|
}
|
|
43079
43080
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43080
43081
|
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43114,7 +43115,7 @@ var ts;
|
|
|
43114
43115
|
var _a, _b;
|
|
43115
43116
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
43116
43117
|
var failedLookupLocations = [];
|
|
43117
|
-
// conditions are only used by the
|
|
43118
|
+
// conditions are only used by the node16/nodenext resolver - there's no priority order in the list,
|
|
43118
43119
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43119
43120
|
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43120
43121
|
if (compilerOptions.noDtsResolution) {
|
|
@@ -48501,7 +48502,7 @@ var ts;
|
|
|
48501
48502
|
var enumRelation = new ts.Map();
|
|
48502
48503
|
var builtinGlobals = ts.createSymbolTable();
|
|
48503
48504
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
48504
|
-
// Extensions suggested for path imports when module resolution is
|
|
48505
|
+
// Extensions suggested for path imports when module resolution is node16 or higher.
|
|
48505
48506
|
// The first element of each tuple is the extension a file has.
|
|
48506
48507
|
// The second element of each tuple is the extension that should be used in a path import.
|
|
48507
48508
|
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
@@ -50790,7 +50791,7 @@ var ts;
|
|
|
50790
50791
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
50791
50792
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
50792
50793
|
}
|
|
50793
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
50794
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
50794
50795
|
var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
|
|
50795
50796
|
var overrideClauseHost = ts.findAncestor(location, function (l) { return ts.isImportTypeNode(l) || ts.isExportDeclaration(l) || ts.isImportDeclaration(l); });
|
|
50796
50797
|
var overrideClause = overrideClauseHost && ts.isImportTypeNode(overrideClauseHost) ? (_g = overrideClauseHost.assertions) === null || _g === void 0 ? void 0 : _g.assertClause : overrideClauseHost === null || overrideClauseHost === void 0 ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -50799,9 +50800,6 @@ var ts;
|
|
|
50799
50800
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
|
|
50800
50801
|
error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
|
|
50801
50802
|
}
|
|
50802
|
-
if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
|
|
50803
|
-
error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
|
|
50804
|
-
}
|
|
50805
50803
|
}
|
|
50806
50804
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
50807
50805
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -50854,7 +50852,7 @@ var ts;
|
|
|
50854
50852
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
50855
50853
|
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
50856
50854
|
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
50857
|
-
var
|
|
50855
|
+
var resolutionIsNode16OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node16 ||
|
|
50858
50856
|
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
50859
50857
|
if (tsExtension) {
|
|
50860
50858
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
@@ -50875,17 +50873,17 @@ var ts;
|
|
|
50875
50873
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
50876
50874
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
50877
50875
|
}
|
|
50878
|
-
else if (mode === ts.ModuleKind.ESNext &&
|
|
50876
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
50879
50877
|
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
50880
50878
|
var suggestedExt = (_h = suggestedExtensions.find(function (_a) {
|
|
50881
50879
|
var actualExt = _a[0], _importExt = _a[1];
|
|
50882
50880
|
return host.fileExists(absoluteRef_1 + actualExt);
|
|
50883
50881
|
})) === null || _h === void 0 ? void 0 : _h[1];
|
|
50884
50882
|
if (suggestedExt) {
|
|
50885
|
-
error(errorNode, ts.Diagnostics.
|
|
50883
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
50886
50884
|
}
|
|
50887
50885
|
else {
|
|
50888
|
-
error(errorNode, ts.Diagnostics.
|
|
50886
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
50889
50887
|
}
|
|
50890
50888
|
}
|
|
50891
50889
|
else {
|
|
@@ -53207,7 +53205,7 @@ var ts;
|
|
|
53207
53205
|
var targetFile = ts.getSourceFileOfModule(chain[0]);
|
|
53208
53206
|
var specifier = void 0;
|
|
53209
53207
|
var assertion = void 0;
|
|
53210
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53208
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53211
53209
|
// An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion
|
|
53212
53210
|
if ((targetFile === null || targetFile === void 0 ? void 0 : targetFile.impliedNodeFormat) === ts.ModuleKind.ESNext && targetFile.impliedNodeFormat !== (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat)) {
|
|
53213
53211
|
specifier = getSpecifierForModuleSymbol(chain[0], context, ts.ModuleKind.ESNext);
|
|
@@ -53221,7 +53219,7 @@ var ts;
|
|
|
53221
53219
|
}
|
|
53222
53220
|
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
|
|
53223
53221
|
var oldSpecifier = specifier;
|
|
53224
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53222
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53225
53223
|
// We might be able to write a portable import type using a mode override; try specifier generation again, but with a different mode set
|
|
53226
53224
|
var swappedMode = (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat) === ts.ModuleKind.ESNext ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
53227
53225
|
specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
|
|
@@ -71186,7 +71184,7 @@ var ts;
|
|
|
71186
71184
|
if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
71187
71185
|
var parent = declaration.parent.parent;
|
|
71188
71186
|
if (parent.kind === 254 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 164 /* Parameter */) {
|
|
71189
|
-
var links = getNodeLinks(
|
|
71187
|
+
var links = getNodeLinks(parent);
|
|
71190
71188
|
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
71191
71189
|
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
71192
71190
|
var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
|
|
@@ -77049,13 +77047,13 @@ var ts;
|
|
|
77049
77047
|
}
|
|
77050
77048
|
}
|
|
77051
77049
|
function checkImportMetaProperty(node) {
|
|
77052
|
-
if (moduleKind === ts.ModuleKind.
|
|
77050
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
77053
77051
|
if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
77054
77052
|
error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
77055
77053
|
}
|
|
77056
77054
|
}
|
|
77057
77055
|
else if (moduleKind < ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.System) {
|
|
77058
|
-
error(node, ts.Diagnostics.
|
|
77056
|
+
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
|
|
77059
77057
|
}
|
|
77060
77058
|
var file = ts.getSourceFileOfNode(node);
|
|
77061
77059
|
ts.Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -78006,15 +78004,30 @@ var ts;
|
|
|
78006
78004
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
78007
78005
|
var span = void 0;
|
|
78008
78006
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
78009
|
-
|
|
78010
|
-
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
78007
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78011
78008
|
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.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);
|
|
78012
78009
|
diagnostics.add(diagnostic);
|
|
78013
78010
|
}
|
|
78014
|
-
|
|
78015
|
-
|
|
78016
|
-
|
|
78017
|
-
|
|
78011
|
+
switch (moduleKind) {
|
|
78012
|
+
case ts.ModuleKind.Node16:
|
|
78013
|
+
case ts.ModuleKind.NodeNext:
|
|
78014
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
78015
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78016
|
+
diagnostics.add(ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
|
|
78017
|
+
break;
|
|
78018
|
+
}
|
|
78019
|
+
// fallthrough
|
|
78020
|
+
case ts.ModuleKind.ES2022:
|
|
78021
|
+
case ts.ModuleKind.ESNext:
|
|
78022
|
+
case ts.ModuleKind.System:
|
|
78023
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
78024
|
+
break;
|
|
78025
|
+
}
|
|
78026
|
+
// fallthrough
|
|
78027
|
+
default:
|
|
78028
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78029
|
+
diagnostics.add(ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.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));
|
|
78030
|
+
break;
|
|
78018
78031
|
}
|
|
78019
78032
|
}
|
|
78020
78033
|
}
|
|
@@ -80456,8 +80469,8 @@ var ts;
|
|
|
80456
80469
|
if (node.assertions) {
|
|
80457
80470
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80458
80471
|
if (override) {
|
|
80459
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
80460
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80472
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80473
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80461
80474
|
}
|
|
80462
80475
|
}
|
|
80463
80476
|
}
|
|
@@ -81907,7 +81920,7 @@ var ts;
|
|
|
81907
81920
|
}
|
|
81908
81921
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
81909
81922
|
// No need to check for require or exports for ES6 modules and later
|
|
81910
|
-
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.
|
|
81923
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node16 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
81911
81924
|
return;
|
|
81912
81925
|
}
|
|
81913
81926
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -84827,8 +84840,8 @@ var ts;
|
|
|
84827
84840
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
84828
84841
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
84829
84842
|
if (validForTypeAssertions && override) {
|
|
84830
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
84831
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
84843
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
84844
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
84832
84845
|
}
|
|
84833
84846
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
84834
84847
|
}
|
|
@@ -88015,8 +88028,24 @@ var ts;
|
|
|
88015
88028
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
88016
88029
|
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.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));
|
|
88017
88030
|
}
|
|
88018
|
-
|
|
88019
|
-
|
|
88031
|
+
switch (moduleKind) {
|
|
88032
|
+
case ts.ModuleKind.Node16:
|
|
88033
|
+
case ts.ModuleKind.NodeNext:
|
|
88034
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
88035
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
|
|
88036
|
+
break;
|
|
88037
|
+
}
|
|
88038
|
+
// fallthrough
|
|
88039
|
+
case ts.ModuleKind.ES2022:
|
|
88040
|
+
case ts.ModuleKind.ESNext:
|
|
88041
|
+
case ts.ModuleKind.System:
|
|
88042
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
88043
|
+
break;
|
|
88044
|
+
}
|
|
88045
|
+
// fallthrough
|
|
88046
|
+
default:
|
|
88047
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.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));
|
|
88048
|
+
break;
|
|
88020
88049
|
}
|
|
88021
88050
|
}
|
|
88022
88051
|
}
|
|
@@ -88711,7 +88740,7 @@ var ts;
|
|
|
88711
88740
|
}
|
|
88712
88741
|
function checkGrammarImportCallExpression(node) {
|
|
88713
88742
|
if (moduleKind === ts.ModuleKind.ES2015) {
|
|
88714
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
88743
|
+
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext);
|
|
88715
88744
|
}
|
|
88716
88745
|
if (node.typeArguments) {
|
|
88717
88746
|
return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
|
|
@@ -88722,7 +88751,7 @@ var ts;
|
|
|
88722
88751
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
88723
88752
|
if (nodeArguments.length > 1) {
|
|
88724
88753
|
var assertionArgument = nodeArguments[1];
|
|
88725
|
-
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.
|
|
88754
|
+
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
|
|
88726
88755
|
}
|
|
88727
88756
|
}
|
|
88728
88757
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
@@ -108988,7 +109017,7 @@ var ts;
|
|
|
108988
109017
|
return ts.transformECMAScriptModule;
|
|
108989
109018
|
case ts.ModuleKind.System:
|
|
108990
109019
|
return ts.transformSystemModule;
|
|
108991
|
-
case ts.ModuleKind.
|
|
109020
|
+
case ts.ModuleKind.Node16:
|
|
108992
109021
|
case ts.ModuleKind.NodeNext:
|
|
108993
109022
|
return ts.transformNodeModule;
|
|
108994
109023
|
default:
|
|
@@ -116011,7 +116040,7 @@ var ts;
|
|
|
116011
116040
|
*/
|
|
116012
116041
|
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
116013
116042
|
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
116014
|
-
case ts.ModuleResolutionKind.
|
|
116043
|
+
case ts.ModuleResolutionKind.Node16:
|
|
116015
116044
|
case ts.ModuleResolutionKind.NodeNext:
|
|
116016
116045
|
return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
|
|
116017
116046
|
ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
|
|
@@ -116310,7 +116339,7 @@ var ts;
|
|
|
116310
116339
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
116311
116340
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
116312
116341
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
116313
|
-
// under
|
|
116342
|
+
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
|
|
116314
116343
|
processTypeReferenceDirective(typeReferences[i], /*mode*/ undefined, resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_c = resolutions[i]) === null || _c === void 0 ? void 0 : _c.packageId });
|
|
116315
116344
|
}
|
|
116316
116345
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -117963,8 +117992,8 @@ var ts;
|
|
|
117963
117992
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
117964
117993
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
117965
117994
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
117966
|
-
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
117967
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
117995
|
+
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
117996
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
117968
117997
|
}
|
|
117969
117998
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
117970
117999
|
}
|
|
@@ -118326,7 +118355,7 @@ var ts;
|
|
|
118326
118355
|
}
|
|
118327
118356
|
if (options.resolveJsonModule) {
|
|
118328
118357
|
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
118329
|
-
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
118358
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 &&
|
|
118330
118359
|
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118331
118360
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
118332
118361
|
}
|
|
@@ -121466,7 +121495,7 @@ var ts;
|
|
|
121466
121495
|
}
|
|
121467
121496
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
121468
121497
|
var _a;
|
|
121469
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
121498
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16
|
|
121470
121499
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
121471
121500
|
return false;
|
|
121472
121501
|
}
|
|
@@ -122051,7 +122080,7 @@ var ts;
|
|
|
122051
122080
|
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
122052
122081
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
122053
122082
|
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
122054
|
-
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
122083
|
+
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
122055
122084
|
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
122056
122085
|
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
122057
122086
|
// usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
|