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/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220504";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -5470,10 +5470,11 @@ var ts;
|
|
|
5470
5470
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5471
5471
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5472
5472
|
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
|
|
5473
|
-
// to better support ecmascript modules and their use within node - more features are still being added
|
|
5474
|
-
//
|
|
5475
|
-
// version-
|
|
5476
|
-
|
|
5473
|
+
// to better support ecmascript modules and their use within node - however more features are still being added.
|
|
5474
|
+
// TypeScript's Node ESM support was introduced after Node 12 went end-of-life, and Node 14 is the earliest stable
|
|
5475
|
+
// version that supports both pattern trailers - *but*, Node 16 is the first version that also supports ECMASCript 2022.
|
|
5476
|
+
// In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target
|
|
5477
|
+
ModuleResolutionKind[ModuleResolutionKind["Node16"] = 3] = "Node16";
|
|
5477
5478
|
ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
|
|
5478
5479
|
})(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
|
|
5479
5480
|
var ModuleDetectionKind;
|
|
@@ -5483,7 +5484,7 @@ var ts;
|
|
|
5483
5484
|
*/
|
|
5484
5485
|
ModuleDetectionKind[ModuleDetectionKind["Legacy"] = 1] = "Legacy";
|
|
5485
5486
|
/**
|
|
5486
|
-
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution:
|
|
5487
|
+
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node16+
|
|
5487
5488
|
*/
|
|
5488
5489
|
ModuleDetectionKind[ModuleDetectionKind["Auto"] = 2] = "Auto";
|
|
5489
5490
|
/**
|
|
@@ -5528,8 +5529,8 @@ var ts;
|
|
|
5528
5529
|
ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
|
|
5529
5530
|
ModuleKind[ModuleKind["ES2022"] = 7] = "ES2022";
|
|
5530
5531
|
ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
|
|
5531
|
-
//
|
|
5532
|
-
ModuleKind[ModuleKind["
|
|
5532
|
+
// Node16+ is an amalgam of commonjs (albeit updated) and es2022+, and represents a distinct module system from es2020/esnext
|
|
5533
|
+
ModuleKind[ModuleKind["Node16"] = 100] = "Node16";
|
|
5533
5534
|
ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
|
|
5534
5535
|
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
|
|
5535
5536
|
var JsxEmit;
|
|
@@ -8451,6 +8452,7 @@ var ts;
|
|
|
8451
8452
|
_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"),
|
|
8452
8453
|
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."),
|
|
8453
8454
|
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."),
|
|
8455
|
+
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."),
|
|
8454
8456
|
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."),
|
|
8455
8457
|
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."),
|
|
8456
8458
|
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."),
|
|
@@ -8462,8 +8464,8 @@ var ts;
|
|
|
8462
8464
|
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."),
|
|
8463
8465
|
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."),
|
|
8464
8466
|
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."),
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
+
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'."),
|
|
8468
|
+
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'."),
|
|
8467
8469
|
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."),
|
|
8468
8470
|
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."),
|
|
8469
8471
|
String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
|
@@ -8480,7 +8482,7 @@ var ts;
|
|
|
8480
8482
|
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."),
|
|
8481
8483
|
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}')'?"),
|
|
8482
8484
|
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
8483
|
-
|
|
8485
|
+
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'."),
|
|
8484
8486
|
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
8485
8487
|
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."),
|
|
8486
8488
|
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."),
|
|
@@ -8511,7 +8513,7 @@ var ts;
|
|
|
8511
8513
|
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."),
|
|
8512
8514
|
_0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
8513
8515
|
_0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
8514
|
-
|
|
8516
|
+
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."),
|
|
8515
8517
|
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'."),
|
|
8516
8518
|
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'."),
|
|
8517
8519
|
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 `}`?"),
|
|
@@ -8563,7 +8565,7 @@ var ts;
|
|
|
8563
8565
|
File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
8564
8566
|
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:"),
|
|
8565
8567
|
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."),
|
|
8566
|
-
|
|
8568
|
+
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."),
|
|
8567
8569
|
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."),
|
|
8568
8570
|
Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
8569
8571
|
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}'?"),
|
|
@@ -8581,7 +8583,7 @@ var ts;
|
|
|
8581
8583
|
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."),
|
|
8582
8584
|
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"),
|
|
8583
8585
|
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"),
|
|
8584
|
-
|
|
8586
|
+
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`."),
|
|
8585
8587
|
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`."),
|
|
8586
8588
|
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."),
|
|
8587
8589
|
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."),
|
|
@@ -8592,7 +8594,7 @@ var ts;
|
|
|
8592
8594
|
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."),
|
|
8593
8595
|
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."),
|
|
8594
8596
|
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."),
|
|
8595
|
-
|
|
8597
|
+
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."),
|
|
8596
8598
|
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."),
|
|
8597
8599
|
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."),
|
|
8598
8600
|
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),
|
|
@@ -9078,8 +9080,8 @@ var ts;
|
|
|
9078
9080
|
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'."),
|
|
9079
9081
|
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."),
|
|
9080
9082
|
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}'?"),
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
+
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."),
|
|
9084
|
+
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}'?"),
|
|
9083
9085
|
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."),
|
|
9084
9086
|
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."),
|
|
9085
9087
|
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."),
|
|
@@ -9745,7 +9747,6 @@ var ts;
|
|
|
9745
9747
|
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."),
|
|
9746
9748
|
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."),
|
|
9747
9749
|
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."),
|
|
9748
|
-
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."),
|
|
9749
9750
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9750
9751
|
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."),
|
|
9751
9752
|
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."),
|
|
@@ -15038,7 +15039,7 @@ var ts;
|
|
|
15038
15039
|
}
|
|
15039
15040
|
ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
|
|
15040
15041
|
function isCommonJSContainingModuleKind(kind) {
|
|
15041
|
-
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.
|
|
15042
|
+
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node16 || kind === ts.ModuleKind.NodeNext;
|
|
15042
15043
|
}
|
|
15043
15044
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
15044
15045
|
return ts.isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator);
|
|
@@ -20206,7 +20207,7 @@ var ts;
|
|
|
20206
20207
|
file.externalModuleIndicator = ts.isFileProbablyExternalModule(file);
|
|
20207
20208
|
};
|
|
20208
20209
|
case ts.ModuleDetectionKind.Auto:
|
|
20209
|
-
// If module is nodenext or
|
|
20210
|
+
// If module is nodenext or node16, all esm format files are modules
|
|
20210
20211
|
// If jsx is react-jsx or react-jsxdev then jsx tags force module-ness
|
|
20211
20212
|
// otherwise, the presence of import or export statments (or import.meta) implies module-ness
|
|
20212
20213
|
var checks = [ts.isFileProbablyExternalModule];
|
|
@@ -20214,7 +20215,7 @@ var ts;
|
|
|
20214
20215
|
checks.push(isFileModuleFromUsingJSXTag);
|
|
20215
20216
|
}
|
|
20216
20217
|
var moduleKind = getEmitModuleKind(options);
|
|
20217
|
-
if (moduleKind === ts.ModuleKind.
|
|
20218
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
20218
20219
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
20219
20220
|
}
|
|
20220
20221
|
var combined_1 = ts.or.apply(void 0, checks);
|
|
@@ -20225,7 +20226,7 @@ var ts;
|
|
|
20225
20226
|
ts.getSetExternalModuleIndicator = getSetExternalModuleIndicator;
|
|
20226
20227
|
function getEmitScriptTarget(compilerOptions) {
|
|
20227
20228
|
return compilerOptions.target ||
|
|
20228
|
-
(compilerOptions.module === ts.ModuleKind.
|
|
20229
|
+
(compilerOptions.module === ts.ModuleKind.Node16 && 9 /* ES2022 */) ||
|
|
20229
20230
|
(compilerOptions.module === ts.ModuleKind.NodeNext && 99 /* ESNext */) ||
|
|
20230
20231
|
0 /* ES3 */;
|
|
20231
20232
|
}
|
|
@@ -20243,8 +20244,8 @@ var ts;
|
|
|
20243
20244
|
case ts.ModuleKind.CommonJS:
|
|
20244
20245
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
20245
20246
|
break;
|
|
20246
|
-
case ts.ModuleKind.
|
|
20247
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
20247
|
+
case ts.ModuleKind.Node16:
|
|
20248
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
20248
20249
|
break;
|
|
20249
20250
|
case ts.ModuleKind.NodeNext:
|
|
20250
20251
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -20269,7 +20270,7 @@ var ts;
|
|
|
20269
20270
|
case ts.ModuleKind.ES2020:
|
|
20270
20271
|
case ts.ModuleKind.ES2022:
|
|
20271
20272
|
case ts.ModuleKind.ESNext:
|
|
20272
|
-
case ts.ModuleKind.
|
|
20273
|
+
case ts.ModuleKind.Node16:
|
|
20273
20274
|
case ts.ModuleKind.NodeNext:
|
|
20274
20275
|
return true;
|
|
20275
20276
|
default:
|
|
@@ -20294,7 +20295,7 @@ var ts;
|
|
|
20294
20295
|
return compilerOptions.esModuleInterop;
|
|
20295
20296
|
}
|
|
20296
20297
|
switch (getEmitModuleKind(compilerOptions)) {
|
|
20297
|
-
case ts.ModuleKind.
|
|
20298
|
+
case ts.ModuleKind.Node16:
|
|
20298
20299
|
case ts.ModuleKind.NodeNext:
|
|
20299
20300
|
return true;
|
|
20300
20301
|
}
|
|
@@ -39500,7 +39501,7 @@ var ts;
|
|
|
39500
39501
|
es2020: ts.ModuleKind.ES2020,
|
|
39501
39502
|
es2022: ts.ModuleKind.ES2022,
|
|
39502
39503
|
esnext: ts.ModuleKind.ESNext,
|
|
39503
|
-
|
|
39504
|
+
node16: ts.ModuleKind.Node16,
|
|
39504
39505
|
nodenext: ts.ModuleKind.NodeNext,
|
|
39505
39506
|
})),
|
|
39506
39507
|
affectsModuleResolution: true,
|
|
@@ -39854,7 +39855,7 @@ var ts;
|
|
|
39854
39855
|
type: new ts.Map(ts.getEntries({
|
|
39855
39856
|
node: ts.ModuleResolutionKind.NodeJs,
|
|
39856
39857
|
classic: ts.ModuleResolutionKind.Classic,
|
|
39857
|
-
|
|
39858
|
+
node16: ts.ModuleResolutionKind.Node16,
|
|
39858
39859
|
nodenext: ts.ModuleResolutionKind.NodeNext,
|
|
39859
39860
|
})),
|
|
39860
39861
|
affectsModuleResolution: true,
|
|
@@ -40330,7 +40331,7 @@ var ts;
|
|
|
40330
40331
|
affectsModuleResolution: true,
|
|
40331
40332
|
description: ts.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
40332
40333
|
category: ts.Diagnostics.Language_and_Environment,
|
|
40333
|
-
defaultValueDescription: ts.Diagnostics.
|
|
40334
|
+
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,
|
|
40334
40335
|
}
|
|
40335
40336
|
];
|
|
40336
40337
|
/* @internal */
|
|
@@ -42566,9 +42567,9 @@ var ts;
|
|
|
42566
42567
|
// set in a non-modal module resolution setting here. Do note that our behavior is not particularly well defined when these mode-overriding imports
|
|
42567
42568
|
// 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,
|
|
42568
42569
|
// 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
|
|
42569
|
-
// resolution" should be (`
|
|
42570
|
+
// resolution" should be (`node16`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
|
|
42570
42571
|
// context should _probably_ be an error - and that should likely be handled by the `Program` (which is what we do).
|
|
42571
|
-
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42572
|
+
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
|
|
42572
42573
|
features |= NodeResolutionFeatures.EsmMode;
|
|
42573
42574
|
}
|
|
42574
42575
|
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
@@ -42657,7 +42658,7 @@ var ts;
|
|
|
42657
42658
|
}
|
|
42658
42659
|
ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
|
|
42659
42660
|
function getDefaultNodeResolutionFeatures(options) {
|
|
42660
|
-
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42661
|
+
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default :
|
|
42661
42662
|
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
42662
42663
|
NodeResolutionFeatures.None;
|
|
42663
42664
|
}
|
|
@@ -43015,8 +43016,8 @@ var ts;
|
|
|
43015
43016
|
case ts.ModuleKind.CommonJS:
|
|
43016
43017
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
43017
43018
|
break;
|
|
43018
|
-
case ts.ModuleKind.
|
|
43019
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
43019
|
+
case ts.ModuleKind.Node16:
|
|
43020
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
43020
43021
|
break;
|
|
43021
43022
|
case ts.ModuleKind.NodeNext:
|
|
43022
43023
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -43036,8 +43037,8 @@ var ts;
|
|
|
43036
43037
|
}
|
|
43037
43038
|
ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
|
|
43038
43039
|
switch (moduleResolution) {
|
|
43039
|
-
case ts.ModuleResolutionKind.
|
|
43040
|
-
result =
|
|
43040
|
+
case ts.ModuleResolutionKind.Node16:
|
|
43041
|
+
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43041
43042
|
break;
|
|
43042
43043
|
case ts.ModuleResolutionKind.NodeNext:
|
|
43043
43044
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43271,15 +43272,15 @@ var ts;
|
|
|
43271
43272
|
// respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
|
|
43272
43273
|
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
43273
43274
|
// allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
|
|
43274
|
-
// not
|
|
43275
|
+
// not supported in node 12 - https://github.com/nodejs/Release/issues/690
|
|
43275
43276
|
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
43276
43277
|
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
43277
|
-
NodeResolutionFeatures[NodeResolutionFeatures["
|
|
43278
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Node16Default"] = 30] = "Node16Default";
|
|
43278
43279
|
NodeResolutionFeatures[NodeResolutionFeatures["NodeNextDefault"] = 30] = "NodeNextDefault";
|
|
43279
43280
|
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
43280
43281
|
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
43281
|
-
function
|
|
43282
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.
|
|
43282
|
+
function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43283
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node16Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43283
43284
|
}
|
|
43284
43285
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43285
43286
|
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43319,7 +43320,7 @@ var ts;
|
|
|
43319
43320
|
var _a, _b;
|
|
43320
43321
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
43321
43322
|
var failedLookupLocations = [];
|
|
43322
|
-
// conditions are only used by the
|
|
43323
|
+
// conditions are only used by the node16/nodenext resolver - there's no priority order in the list,
|
|
43323
43324
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43324
43325
|
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43325
43326
|
if (compilerOptions.noDtsResolution) {
|
|
@@ -48706,7 +48707,7 @@ var ts;
|
|
|
48706
48707
|
var enumRelation = new ts.Map();
|
|
48707
48708
|
var builtinGlobals = ts.createSymbolTable();
|
|
48708
48709
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
48709
|
-
// Extensions suggested for path imports when module resolution is
|
|
48710
|
+
// Extensions suggested for path imports when module resolution is node16 or higher.
|
|
48710
48711
|
// The first element of each tuple is the extension a file has.
|
|
48711
48712
|
// The second element of each tuple is the extension that should be used in a path import.
|
|
48712
48713
|
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
@@ -50995,7 +50996,7 @@ var ts;
|
|
|
50995
50996
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
50996
50997
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
50997
50998
|
}
|
|
50998
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
50999
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
50999
51000
|
var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
|
|
51000
51001
|
var overrideClauseHost = ts.findAncestor(location, function (l) { return ts.isImportTypeNode(l) || ts.isExportDeclaration(l) || ts.isImportDeclaration(l); });
|
|
51001
51002
|
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;
|
|
@@ -51004,9 +51005,6 @@ var ts;
|
|
|
51004
51005
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
|
|
51005
51006
|
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);
|
|
51006
51007
|
}
|
|
51007
|
-
if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
|
|
51008
|
-
error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
|
|
51009
|
-
}
|
|
51010
51008
|
}
|
|
51011
51009
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
51012
51010
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -51059,7 +51057,7 @@ var ts;
|
|
|
51059
51057
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
51060
51058
|
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
51061
51059
|
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
51062
|
-
var
|
|
51060
|
+
var resolutionIsNode16OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node16 ||
|
|
51063
51061
|
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
51064
51062
|
if (tsExtension) {
|
|
51065
51063
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
@@ -51080,17 +51078,17 @@ var ts;
|
|
|
51080
51078
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
51081
51079
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
51082
51080
|
}
|
|
51083
|
-
else if (mode === ts.ModuleKind.ESNext &&
|
|
51081
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
51084
51082
|
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
51085
51083
|
var suggestedExt = (_h = suggestedExtensions.find(function (_a) {
|
|
51086
51084
|
var actualExt = _a[0], _importExt = _a[1];
|
|
51087
51085
|
return host.fileExists(absoluteRef_1 + actualExt);
|
|
51088
51086
|
})) === null || _h === void 0 ? void 0 : _h[1];
|
|
51089
51087
|
if (suggestedExt) {
|
|
51090
|
-
error(errorNode, ts.Diagnostics.
|
|
51088
|
+
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);
|
|
51091
51089
|
}
|
|
51092
51090
|
else {
|
|
51093
|
-
error(errorNode, ts.Diagnostics.
|
|
51091
|
+
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);
|
|
51094
51092
|
}
|
|
51095
51093
|
}
|
|
51096
51094
|
else {
|
|
@@ -53412,7 +53410,7 @@ var ts;
|
|
|
53412
53410
|
var targetFile = ts.getSourceFileOfModule(chain[0]);
|
|
53413
53411
|
var specifier = void 0;
|
|
53414
53412
|
var assertion = void 0;
|
|
53415
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53413
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53416
53414
|
// An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion
|
|
53417
53415
|
if ((targetFile === null || targetFile === void 0 ? void 0 : targetFile.impliedNodeFormat) === ts.ModuleKind.ESNext && targetFile.impliedNodeFormat !== (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat)) {
|
|
53418
53416
|
specifier = getSpecifierForModuleSymbol(chain[0], context, ts.ModuleKind.ESNext);
|
|
@@ -53426,7 +53424,7 @@ var ts;
|
|
|
53426
53424
|
}
|
|
53427
53425
|
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
|
|
53428
53426
|
var oldSpecifier = specifier;
|
|
53429
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53427
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53430
53428
|
// We might be able to write a portable import type using a mode override; try specifier generation again, but with a different mode set
|
|
53431
53429
|
var swappedMode = (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat) === ts.ModuleKind.ESNext ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
53432
53430
|
specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
|
|
@@ -71391,7 +71389,7 @@ var ts;
|
|
|
71391
71389
|
if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
71392
71390
|
var parent = declaration.parent.parent;
|
|
71393
71391
|
if (parent.kind === 254 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 164 /* Parameter */) {
|
|
71394
|
-
var links = getNodeLinks(
|
|
71392
|
+
var links = getNodeLinks(parent);
|
|
71395
71393
|
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
71396
71394
|
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
71397
71395
|
var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
|
|
@@ -77254,13 +77252,13 @@ var ts;
|
|
|
77254
77252
|
}
|
|
77255
77253
|
}
|
|
77256
77254
|
function checkImportMetaProperty(node) {
|
|
77257
|
-
if (moduleKind === ts.ModuleKind.
|
|
77255
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
77258
77256
|
if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
77259
77257
|
error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
77260
77258
|
}
|
|
77261
77259
|
}
|
|
77262
77260
|
else if (moduleKind < ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.System) {
|
|
77263
|
-
error(node, ts.Diagnostics.
|
|
77261
|
+
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
|
|
77264
77262
|
}
|
|
77265
77263
|
var file = ts.getSourceFileOfNode(node);
|
|
77266
77264
|
ts.Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -78211,15 +78209,30 @@ var ts;
|
|
|
78211
78209
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
78212
78210
|
var span = void 0;
|
|
78213
78211
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
78214
|
-
|
|
78215
|
-
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
78212
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78216
78213
|
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);
|
|
78217
78214
|
diagnostics.add(diagnostic);
|
|
78218
78215
|
}
|
|
78219
|
-
|
|
78220
|
-
|
|
78221
|
-
|
|
78222
|
-
|
|
78216
|
+
switch (moduleKind) {
|
|
78217
|
+
case ts.ModuleKind.Node16:
|
|
78218
|
+
case ts.ModuleKind.NodeNext:
|
|
78219
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
78220
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78221
|
+
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));
|
|
78222
|
+
break;
|
|
78223
|
+
}
|
|
78224
|
+
// fallthrough
|
|
78225
|
+
case ts.ModuleKind.ES2022:
|
|
78226
|
+
case ts.ModuleKind.ESNext:
|
|
78227
|
+
case ts.ModuleKind.System:
|
|
78228
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
78229
|
+
break;
|
|
78230
|
+
}
|
|
78231
|
+
// fallthrough
|
|
78232
|
+
default:
|
|
78233
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78234
|
+
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));
|
|
78235
|
+
break;
|
|
78223
78236
|
}
|
|
78224
78237
|
}
|
|
78225
78238
|
}
|
|
@@ -80661,8 +80674,8 @@ var ts;
|
|
|
80661
80674
|
if (node.assertions) {
|
|
80662
80675
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80663
80676
|
if (override) {
|
|
80664
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
80665
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80677
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80678
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80666
80679
|
}
|
|
80667
80680
|
}
|
|
80668
80681
|
}
|
|
@@ -82112,7 +82125,7 @@ var ts;
|
|
|
82112
82125
|
}
|
|
82113
82126
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
82114
82127
|
// No need to check for require or exports for ES6 modules and later
|
|
82115
|
-
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.
|
|
82128
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node16 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
82116
82129
|
return;
|
|
82117
82130
|
}
|
|
82118
82131
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -85032,8 +85045,8 @@ var ts;
|
|
|
85032
85045
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
85033
85046
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85034
85047
|
if (validForTypeAssertions && override) {
|
|
85035
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
85036
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85048
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85049
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85037
85050
|
}
|
|
85038
85051
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
85039
85052
|
}
|
|
@@ -88220,8 +88233,24 @@ var ts;
|
|
|
88220
88233
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
88221
88234
|
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));
|
|
88222
88235
|
}
|
|
88223
|
-
|
|
88224
|
-
|
|
88236
|
+
switch (moduleKind) {
|
|
88237
|
+
case ts.ModuleKind.Node16:
|
|
88238
|
+
case ts.ModuleKind.NodeNext:
|
|
88239
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
88240
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
|
|
88241
|
+
break;
|
|
88242
|
+
}
|
|
88243
|
+
// fallthrough
|
|
88244
|
+
case ts.ModuleKind.ES2022:
|
|
88245
|
+
case ts.ModuleKind.ESNext:
|
|
88246
|
+
case ts.ModuleKind.System:
|
|
88247
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
88248
|
+
break;
|
|
88249
|
+
}
|
|
88250
|
+
// fallthrough
|
|
88251
|
+
default:
|
|
88252
|
+
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));
|
|
88253
|
+
break;
|
|
88225
88254
|
}
|
|
88226
88255
|
}
|
|
88227
88256
|
}
|
|
@@ -88916,7 +88945,7 @@ var ts;
|
|
|
88916
88945
|
}
|
|
88917
88946
|
function checkGrammarImportCallExpression(node) {
|
|
88918
88947
|
if (moduleKind === ts.ModuleKind.ES2015) {
|
|
88919
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
88948
|
+
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);
|
|
88920
88949
|
}
|
|
88921
88950
|
if (node.typeArguments) {
|
|
88922
88951
|
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);
|
|
@@ -88927,7 +88956,7 @@ var ts;
|
|
|
88927
88956
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
88928
88957
|
if (nodeArguments.length > 1) {
|
|
88929
88958
|
var assertionArgument = nodeArguments[1];
|
|
88930
|
-
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.
|
|
88959
|
+
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
|
|
88931
88960
|
}
|
|
88932
88961
|
}
|
|
88933
88962
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
@@ -109193,7 +109222,7 @@ var ts;
|
|
|
109193
109222
|
return ts.transformECMAScriptModule;
|
|
109194
109223
|
case ts.ModuleKind.System:
|
|
109195
109224
|
return ts.transformSystemModule;
|
|
109196
|
-
case ts.ModuleKind.
|
|
109225
|
+
case ts.ModuleKind.Node16:
|
|
109197
109226
|
case ts.ModuleKind.NodeNext:
|
|
109198
109227
|
return ts.transformNodeModule;
|
|
109199
109228
|
default:
|
|
@@ -116216,7 +116245,7 @@ var ts;
|
|
|
116216
116245
|
*/
|
|
116217
116246
|
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
116218
116247
|
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
116219
|
-
case ts.ModuleResolutionKind.
|
|
116248
|
+
case ts.ModuleResolutionKind.Node16:
|
|
116220
116249
|
case ts.ModuleResolutionKind.NodeNext:
|
|
116221
116250
|
return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
|
|
116222
116251
|
ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
|
|
@@ -116515,7 +116544,7 @@ var ts;
|
|
|
116515
116544
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
116516
116545
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
116517
116546
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
116518
|
-
// under
|
|
116547
|
+
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
|
|
116519
116548
|
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 });
|
|
116520
116549
|
}
|
|
116521
116550
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -118168,8 +118197,8 @@ var ts;
|
|
|
118168
118197
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
118169
118198
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
118170
118199
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
118171
|
-
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
118172
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118200
|
+
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118201
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
118173
118202
|
}
|
|
118174
118203
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
118175
118204
|
}
|
|
@@ -118531,7 +118560,7 @@ var ts;
|
|
|
118531
118560
|
}
|
|
118532
118561
|
if (options.resolveJsonModule) {
|
|
118533
118562
|
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
118534
|
-
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
118563
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 &&
|
|
118535
118564
|
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118536
118565
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
118537
118566
|
}
|
|
@@ -121671,7 +121700,7 @@ var ts;
|
|
|
121671
121700
|
}
|
|
121672
121701
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
121673
121702
|
var _a;
|
|
121674
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
121703
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16
|
|
121675
121704
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
121676
121705
|
return false;
|
|
121677
121706
|
}
|
|
@@ -122256,7 +122285,7 @@ var ts;
|
|
|
122256
122285
|
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
122257
122286
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
122258
122287
|
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
122259
|
-
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
122288
|
+
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
122260
122289
|
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
122261
122290
|
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
122262
122291
|
// usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
|
|
@@ -127870,11 +127899,11 @@ var ts;
|
|
|
127870
127899
|
}
|
|
127871
127900
|
ts.getModuleSpecifierResolverHost = getModuleSpecifierResolverHost;
|
|
127872
127901
|
function moduleResolutionRespectsExports(moduleResolution) {
|
|
127873
|
-
return moduleResolution >= ts.ModuleResolutionKind.
|
|
127902
|
+
return moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127874
127903
|
}
|
|
127875
127904
|
ts.moduleResolutionRespectsExports = moduleResolutionRespectsExports;
|
|
127876
127905
|
function moduleResolutionUsesNodeModules(moduleResolution) {
|
|
127877
|
-
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.
|
|
127906
|
+
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127878
127907
|
}
|
|
127879
127908
|
ts.moduleResolutionUsesNodeModules = moduleResolutionUsesNodeModules;
|
|
127880
127909
|
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
|
|
@@ -131198,11 +131227,11 @@ var ts;
|
|
|
131198
131227
|
}
|
|
131199
131228
|
function isEmitResolutionKindUsingNodeModules(compilerOptions) {
|
|
131200
131229
|
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ||
|
|
131201
|
-
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
131230
|
+
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
131202
131231
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
131203
131232
|
}
|
|
131204
131233
|
function isEmitModuleResolutionRespectingExportMaps(compilerOptions) {
|
|
131205
|
-
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
131234
|
+
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
131206
131235
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
131207
131236
|
}
|
|
131208
131237
|
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
@@ -133751,7 +133780,7 @@ var ts;
|
|
|
133751
133780
|
return;
|
|
133752
133781
|
}
|
|
133753
133782
|
// Do a relatively cheap check to bail early if all re-exports are non-importable
|
|
133754
|
-
// due to file location or package.json dependency filtering. For non-
|
|
133783
|
+
// due to file location or package.json dependency filtering. For non-node16+
|
|
133755
133784
|
// module resolution modes, getting past this point guarantees that we'll be
|
|
133756
133785
|
// able to generate a suitable module specifier, so we can safely show a completion,
|
|
133757
133786
|
// even if we defer computing the module specifier.
|
|
@@ -133759,7 +133788,7 @@ var ts;
|
|
|
133759
133788
|
if (!firstImportableExportInfo) {
|
|
133760
133789
|
return;
|
|
133761
133790
|
}
|
|
133762
|
-
// In
|
|
133791
|
+
// In node16+, module specifier resolution can fail due to modules being blocked
|
|
133763
133792
|
// by package.json `exports`. If that happens, don't show a completion item.
|
|
133764
133793
|
// N.B. in this resolution mode we always try to resolve module specifiers here,
|
|
133765
133794
|
// because we have to know now if it's going to fail so we can omit the completion
|
|
@@ -139354,7 +139383,7 @@ var ts;
|
|
|
139354
139383
|
(function (ts) {
|
|
139355
139384
|
var GoToDefinition;
|
|
139356
139385
|
(function (GoToDefinition) {
|
|
139357
|
-
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly) {
|
|
139386
|
+
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
139358
139387
|
var _a;
|
|
139359
139388
|
var _b;
|
|
139360
139389
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
@@ -139379,7 +139408,7 @@ var ts;
|
|
|
139379
139408
|
}
|
|
139380
139409
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
139381
139410
|
var classDecl = node.parent.parent;
|
|
139382
|
-
var _c = getSymbol(classDecl, typeChecker), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
139411
|
+
var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
139383
139412
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
139384
139413
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
139385
139414
|
var sourceFile_1 = node.getSourceFile();
|
|
@@ -139389,14 +139418,14 @@ var ts;
|
|
|
139389
139418
|
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
|
|
139390
139419
|
});
|
|
139391
139420
|
}
|
|
139392
|
-
var _d = getSymbol(node, typeChecker), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
139421
|
+
var _d = getSymbol(node, typeChecker, stopAtAlias), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
139393
139422
|
var fallbackNode = node;
|
|
139394
139423
|
if (searchOtherFilesOnly && failedAliasResolution) {
|
|
139395
139424
|
// We couldn't resolve the specific import, try on the module specifier.
|
|
139396
139425
|
var importDeclaration = ts.forEach(__spreadArray([node], (symbol === null || symbol === void 0 ? void 0 : symbol.declarations) || ts.emptyArray, true), function (n) { return ts.findAncestor(n, ts.isAnyImportOrBareOrAccessedRequire); });
|
|
139397
139426
|
var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
|
|
139398
139427
|
if (moduleSpecifier) {
|
|
139399
|
-
(_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
139428
|
+
(_a = getSymbol(moduleSpecifier, typeChecker, stopAtAlias), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
139400
139429
|
fallbackNode = moduleSpecifier;
|
|
139401
139430
|
}
|
|
139402
139431
|
}
|
|
@@ -139570,7 +139599,7 @@ var ts;
|
|
|
139570
139599
|
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
139571
139600
|
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
|
|
139572
139601
|
}
|
|
139573
|
-
var _a = getSymbol(node, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
139602
|
+
var _a = getSymbol(node, typeChecker, /*stopAtAlias*/ false), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
139574
139603
|
if (!symbol)
|
|
139575
139604
|
return undefined;
|
|
139576
139605
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
@@ -139621,14 +139650,14 @@ var ts;
|
|
|
139621
139650
|
function getDefinitionInfoForIndexSignatures(node, checker) {
|
|
139622
139651
|
return ts.mapDefined(checker.getIndexInfosAtLocation(node), function (info) { return info.declaration && createDefinitionFromSignatureDeclaration(checker, info.declaration); });
|
|
139623
139652
|
}
|
|
139624
|
-
function getSymbol(node, checker) {
|
|
139653
|
+
function getSymbol(node, checker, stopAtAlias) {
|
|
139625
139654
|
var symbol = checker.getSymbolAtLocation(node);
|
|
139626
139655
|
// If this is an alias, and the request came at the declaration location
|
|
139627
139656
|
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
|
139628
139657
|
// import {A, B} from "mod";
|
|
139629
139658
|
// to jump to the implementation directly.
|
|
139630
139659
|
var failedAliasResolution = false;
|
|
139631
|
-
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139660
|
+
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && !stopAtAlias && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139632
139661
|
var aliased = checker.getAliasedSymbol(symbol);
|
|
139633
139662
|
if (aliased.declarations) {
|
|
139634
139663
|
return { symbol: aliased };
|
|
@@ -153221,7 +153250,7 @@ var ts;
|
|
|
153221
153250
|
case ts.ModuleKind.None:
|
|
153222
153251
|
// Fall back to the `import * as ns` style import.
|
|
153223
153252
|
return 2 /* Namespace */;
|
|
153224
|
-
case ts.ModuleKind.
|
|
153253
|
+
case ts.ModuleKind.Node16:
|
|
153225
153254
|
case ts.ModuleKind.NodeNext:
|
|
153226
153255
|
return importingFile.impliedNodeFormat === ts.ModuleKind.ESNext ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
153227
153256
|
default:
|
|
@@ -155134,8 +155163,8 @@ var ts;
|
|
|
155134
155163
|
(function (codefix) {
|
|
155135
155164
|
codefix.registerCodeFix({
|
|
155136
155165
|
errorCodes: [
|
|
155137
|
-
ts.Diagnostics.
|
|
155138
|
-
ts.Diagnostics.
|
|
155166
|
+
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.code,
|
|
155167
|
+
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.code,
|
|
155139
155168
|
],
|
|
155140
155169
|
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
155141
155170
|
var compilerOptions = context.program.getCompilerOptions();
|
|
@@ -165018,9 +165047,9 @@ var ts;
|
|
|
165018
165047
|
}
|
|
165019
165048
|
}
|
|
165020
165049
|
/// Goto definition
|
|
165021
|
-
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly) {
|
|
165050
|
+
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly, stopAtAlias) {
|
|
165022
165051
|
synchronizeHostData();
|
|
165023
|
-
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
|
|
165052
|
+
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly, stopAtAlias);
|
|
165024
165053
|
}
|
|
165025
165054
|
function getDefinitionAndBoundSpan(fileName, position) {
|
|
165026
165055
|
synchronizeHostData();
|
|
@@ -174553,7 +174582,8 @@ var ts;
|
|
|
174553
174582
|
var providePrefixAndSuffixTextForRename = _a.providePrefixAndSuffixTextForRename;
|
|
174554
174583
|
var outputs = [];
|
|
174555
174584
|
var seen = createDocumentSpanSet();
|
|
174556
|
-
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174585
|
+
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174586
|
+
/*isForRename*/ true, function (project, location, tryAddToTodo) {
|
|
174557
174587
|
var projectOutputs = project.getLanguageService().findRenameLocations(location.fileName, location.pos, findInStrings, findInComments, providePrefixAndSuffixTextForRename);
|
|
174558
174588
|
if (projectOutputs) {
|
|
174559
174589
|
for (var _i = 0, projectOutputs_1 = projectOutputs; _i < projectOutputs_1.length; _i++) {
|
|
@@ -174567,14 +174597,15 @@ var ts;
|
|
|
174567
174597
|
});
|
|
174568
174598
|
return outputs;
|
|
174569
174599
|
}
|
|
174570
|
-
function getDefinitionLocation(defaultProject, initialLocation) {
|
|
174571
|
-
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos);
|
|
174600
|
+
function getDefinitionLocation(defaultProject, initialLocation, isForRename) {
|
|
174601
|
+
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, isForRename);
|
|
174572
174602
|
var info = infos && ts.firstOrUndefined(infos);
|
|
174573
174603
|
return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
|
|
174574
174604
|
}
|
|
174575
174605
|
function combineProjectOutputForReferences(projects, defaultProject, initialLocation, logger) {
|
|
174576
174606
|
var outputs = [];
|
|
174577
|
-
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174607
|
+
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174608
|
+
/*isForRename*/ false, function (project, location, getMappedLocation) {
|
|
174578
174609
|
logger.info("Finding references to " + location.fileName + " position " + location.pos + " in project " + project.getProjectName());
|
|
174579
174610
|
var projectOutputs = project.getLanguageService().findReferences(location.fileName, location.pos);
|
|
174580
174611
|
if (projectOutputs) {
|
|
@@ -174621,7 +174652,7 @@ var ts;
|
|
|
174621
174652
|
});
|
|
174622
174653
|
}
|
|
174623
174654
|
}
|
|
174624
|
-
function combineProjectOutputWorker(projects, defaultProject, initialLocation, cb) {
|
|
174655
|
+
function combineProjectOutputWorker(projects, defaultProject, initialLocation, isForRename, cb) {
|
|
174625
174656
|
var projectService = defaultProject.projectService;
|
|
174626
174657
|
var toDo;
|
|
174627
174658
|
var seenProjects = new ts.Set();
|
|
@@ -174632,7 +174663,7 @@ var ts;
|
|
|
174632
174663
|
});
|
|
174633
174664
|
// After initial references are collected, go over every other project and see if it has a reference for the symbol definition.
|
|
174634
174665
|
if (initialLocation) {
|
|
174635
|
-
var defaultDefinition_1 = getDefinitionLocation(defaultProject, initialLocation);
|
|
174666
|
+
var defaultDefinition_1 = getDefinitionLocation(defaultProject, initialLocation, isForRename);
|
|
174636
174667
|
if (defaultDefinition_1) {
|
|
174637
174668
|
var getGeneratedDefinition_1 = ts.memoize(function () { return defaultProject.isSourceOfProjectReferenceRedirect(defaultDefinition_1.fileName) ?
|
|
174638
174669
|
defaultDefinition_1 :
|
|
@@ -175688,7 +175719,7 @@ var ts;
|
|
|
175688
175719
|
definitions === null || definitions === void 0 ? void 0 : definitions.forEach(function (d) { return definitionSet_1.add(d); });
|
|
175689
175720
|
var noDtsProject = project.getNoDtsResolutionProject([file]);
|
|
175690
175721
|
var ls = noDtsProject.getLanguageService();
|
|
175691
|
-
var jsDefinitions = (_a = ls.getDefinitionAtPosition(file, position, /*searchOtherFilesOnly*/ true)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file; });
|
|
175722
|
+
var jsDefinitions = (_a = ls.getDefinitionAtPosition(file, position, /*searchOtherFilesOnly*/ true, /*stopAtAlias*/ false)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file; });
|
|
175692
175723
|
if (ts.some(jsDefinitions)) {
|
|
175693
175724
|
for (var _i = 0, jsDefinitions_1 = jsDefinitions; _i < jsDefinitions_1.length; _i++) {
|
|
175694
175725
|
var jsDefinition = jsDefinitions_1[_i];
|
|
@@ -175736,7 +175767,7 @@ var ts;
|
|
|
175736
175767
|
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions);
|
|
175737
175768
|
if (!packageJson)
|
|
175738
175769
|
return undefined;
|
|
175739
|
-
// Use fake options instead of actual compiler options to avoid following export map if the project uses
|
|
175770
|
+
// Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext -
|
|
175740
175771
|
// Mapping from an export map entry across packages is out of scope for now. Returned entrypoints will only be what can be
|
|
175741
175772
|
// resolved from the package root under --moduleResolution node
|
|
175742
175773
|
var entrypoints = ts.getEntrypointsFromPackageJsonInfo(packageJson, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, project, project.getModuleResolutionCache());
|
|
@@ -175773,7 +175804,7 @@ var ts;
|
|
|
175773
175804
|
var _a;
|
|
175774
175805
|
if (nameInChain === initialNode)
|
|
175775
175806
|
return undefined;
|
|
175776
|
-
var candidates = (_a = ls.getDefinitionAtPosition(file, nameInChain.getStart(), /*searchOtherFilesOnly*/ true)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file && d.isAmbient; }).map(function (d) { return ({
|
|
175807
|
+
var candidates = (_a = ls.getDefinitionAtPosition(file, nameInChain.getStart(), /*searchOtherFilesOnly*/ true, /*stopAtAlias*/ false)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file && d.isAmbient; }).map(function (d) { return ({
|
|
175777
175808
|
fileName: d.fileName,
|
|
175778
175809
|
name: ts.getTextOfIdentifierOrLiteral(initialNode)
|
|
175779
175810
|
}); });
|