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/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220504";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -5276,10 +5276,11 @@ var ts;
|
|
|
5276
5276
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5277
5277
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5278
5278
|
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
|
|
5279
|
-
// to better support ecmascript modules and their use within node - more features are still being added
|
|
5280
|
-
//
|
|
5281
|
-
// version-
|
|
5282
|
-
|
|
5279
|
+
// to better support ecmascript modules and their use within node - however more features are still being added.
|
|
5280
|
+
// TypeScript's Node ESM support was introduced after Node 12 went end-of-life, and Node 14 is the earliest stable
|
|
5281
|
+
// version that supports both pattern trailers - *but*, Node 16 is the first version that also supports ECMASCript 2022.
|
|
5282
|
+
// In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target
|
|
5283
|
+
ModuleResolutionKind[ModuleResolutionKind["Node16"] = 3] = "Node16";
|
|
5283
5284
|
ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
|
|
5284
5285
|
})(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
|
|
5285
5286
|
var ModuleDetectionKind;
|
|
@@ -5289,7 +5290,7 @@ var ts;
|
|
|
5289
5290
|
*/
|
|
5290
5291
|
ModuleDetectionKind[ModuleDetectionKind["Legacy"] = 1] = "Legacy";
|
|
5291
5292
|
/**
|
|
5292
|
-
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution:
|
|
5293
|
+
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node16+
|
|
5293
5294
|
*/
|
|
5294
5295
|
ModuleDetectionKind[ModuleDetectionKind["Auto"] = 2] = "Auto";
|
|
5295
5296
|
/**
|
|
@@ -5334,8 +5335,8 @@ var ts;
|
|
|
5334
5335
|
ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
|
|
5335
5336
|
ModuleKind[ModuleKind["ES2022"] = 7] = "ES2022";
|
|
5336
5337
|
ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
|
|
5337
|
-
//
|
|
5338
|
-
ModuleKind[ModuleKind["
|
|
5338
|
+
// Node16+ is an amalgam of commonjs (albeit updated) and es2022+, and represents a distinct module system from es2020/esnext
|
|
5339
|
+
ModuleKind[ModuleKind["Node16"] = 100] = "Node16";
|
|
5339
5340
|
ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
|
|
5340
5341
|
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
|
|
5341
5342
|
var JsxEmit;
|
|
@@ -8257,6 +8258,7 @@ var ts;
|
|
|
8257
8258
|
_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"),
|
|
8258
8259
|
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."),
|
|
8259
8260
|
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."),
|
|
8261
|
+
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."),
|
|
8260
8262
|
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."),
|
|
8261
8263
|
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."),
|
|
8262
8264
|
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."),
|
|
@@ -8268,8 +8270,8 @@ var ts;
|
|
|
8268
8270
|
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."),
|
|
8269
8271
|
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."),
|
|
8270
8272
|
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."),
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
+
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'."),
|
|
8274
|
+
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'."),
|
|
8273
8275
|
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."),
|
|
8274
8276
|
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."),
|
|
8275
8277
|
String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
|
@@ -8286,7 +8288,7 @@ var ts;
|
|
|
8286
8288
|
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."),
|
|
8287
8289
|
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}')'?"),
|
|
8288
8290
|
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
8289
|
-
|
|
8291
|
+
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'."),
|
|
8290
8292
|
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
8291
8293
|
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."),
|
|
8292
8294
|
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."),
|
|
@@ -8317,7 +8319,7 @@ var ts;
|
|
|
8317
8319
|
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."),
|
|
8318
8320
|
_0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
8319
8321
|
_0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
8320
|
-
|
|
8322
|
+
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."),
|
|
8321
8323
|
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'."),
|
|
8322
8324
|
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'."),
|
|
8323
8325
|
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 `}`?"),
|
|
@@ -8369,7 +8371,7 @@ var ts;
|
|
|
8369
8371
|
File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
8370
8372
|
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:"),
|
|
8371
8373
|
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."),
|
|
8372
|
-
|
|
8374
|
+
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."),
|
|
8373
8375
|
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."),
|
|
8374
8376
|
Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
8375
8377
|
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}'?"),
|
|
@@ -8387,7 +8389,7 @@ var ts;
|
|
|
8387
8389
|
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."),
|
|
8388
8390
|
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"),
|
|
8389
8391
|
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"),
|
|
8390
|
-
|
|
8392
|
+
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`."),
|
|
8391
8393
|
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`."),
|
|
8392
8394
|
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."),
|
|
8393
8395
|
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."),
|
|
@@ -8398,7 +8400,7 @@ var ts;
|
|
|
8398
8400
|
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."),
|
|
8399
8401
|
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."),
|
|
8400
8402
|
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."),
|
|
8401
|
-
|
|
8403
|
+
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."),
|
|
8402
8404
|
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."),
|
|
8403
8405
|
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."),
|
|
8404
8406
|
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),
|
|
@@ -8884,8 +8886,8 @@ var ts;
|
|
|
8884
8886
|
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'."),
|
|
8885
8887
|
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."),
|
|
8886
8888
|
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}'?"),
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
+
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."),
|
|
8890
|
+
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}'?"),
|
|
8889
8891
|
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."),
|
|
8890
8892
|
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."),
|
|
8891
8893
|
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."),
|
|
@@ -9551,7 +9553,6 @@ var ts;
|
|
|
9551
9553
|
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."),
|
|
9552
9554
|
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."),
|
|
9553
9555
|
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."),
|
|
9554
|
-
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."),
|
|
9555
9556
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9556
9557
|
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."),
|
|
9557
9558
|
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."),
|
|
@@ -14844,7 +14845,7 @@ var ts;
|
|
|
14844
14845
|
}
|
|
14845
14846
|
ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
|
|
14846
14847
|
function isCommonJSContainingModuleKind(kind) {
|
|
14847
|
-
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.
|
|
14848
|
+
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node16 || kind === ts.ModuleKind.NodeNext;
|
|
14848
14849
|
}
|
|
14849
14850
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
14850
14851
|
return ts.isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator);
|
|
@@ -20012,7 +20013,7 @@ var ts;
|
|
|
20012
20013
|
file.externalModuleIndicator = ts.isFileProbablyExternalModule(file);
|
|
20013
20014
|
};
|
|
20014
20015
|
case ts.ModuleDetectionKind.Auto:
|
|
20015
|
-
// If module is nodenext or
|
|
20016
|
+
// If module is nodenext or node16, all esm format files are modules
|
|
20016
20017
|
// If jsx is react-jsx or react-jsxdev then jsx tags force module-ness
|
|
20017
20018
|
// otherwise, the presence of import or export statments (or import.meta) implies module-ness
|
|
20018
20019
|
var checks = [ts.isFileProbablyExternalModule];
|
|
@@ -20020,7 +20021,7 @@ var ts;
|
|
|
20020
20021
|
checks.push(isFileModuleFromUsingJSXTag);
|
|
20021
20022
|
}
|
|
20022
20023
|
var moduleKind = getEmitModuleKind(options);
|
|
20023
|
-
if (moduleKind === ts.ModuleKind.
|
|
20024
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
20024
20025
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
20025
20026
|
}
|
|
20026
20027
|
var combined_1 = ts.or.apply(void 0, checks);
|
|
@@ -20031,7 +20032,7 @@ var ts;
|
|
|
20031
20032
|
ts.getSetExternalModuleIndicator = getSetExternalModuleIndicator;
|
|
20032
20033
|
function getEmitScriptTarget(compilerOptions) {
|
|
20033
20034
|
return compilerOptions.target ||
|
|
20034
|
-
(compilerOptions.module === ts.ModuleKind.
|
|
20035
|
+
(compilerOptions.module === ts.ModuleKind.Node16 && 9 /* ES2022 */) ||
|
|
20035
20036
|
(compilerOptions.module === ts.ModuleKind.NodeNext && 99 /* ESNext */) ||
|
|
20036
20037
|
0 /* ES3 */;
|
|
20037
20038
|
}
|
|
@@ -20049,8 +20050,8 @@ var ts;
|
|
|
20049
20050
|
case ts.ModuleKind.CommonJS:
|
|
20050
20051
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
20051
20052
|
break;
|
|
20052
|
-
case ts.ModuleKind.
|
|
20053
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
20053
|
+
case ts.ModuleKind.Node16:
|
|
20054
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
20054
20055
|
break;
|
|
20055
20056
|
case ts.ModuleKind.NodeNext:
|
|
20056
20057
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -20075,7 +20076,7 @@ var ts;
|
|
|
20075
20076
|
case ts.ModuleKind.ES2020:
|
|
20076
20077
|
case ts.ModuleKind.ES2022:
|
|
20077
20078
|
case ts.ModuleKind.ESNext:
|
|
20078
|
-
case ts.ModuleKind.
|
|
20079
|
+
case ts.ModuleKind.Node16:
|
|
20079
20080
|
case ts.ModuleKind.NodeNext:
|
|
20080
20081
|
return true;
|
|
20081
20082
|
default:
|
|
@@ -20100,7 +20101,7 @@ var ts;
|
|
|
20100
20101
|
return compilerOptions.esModuleInterop;
|
|
20101
20102
|
}
|
|
20102
20103
|
switch (getEmitModuleKind(compilerOptions)) {
|
|
20103
|
-
case ts.ModuleKind.
|
|
20104
|
+
case ts.ModuleKind.Node16:
|
|
20104
20105
|
case ts.ModuleKind.NodeNext:
|
|
20105
20106
|
return true;
|
|
20106
20107
|
}
|
|
@@ -39306,7 +39307,7 @@ var ts;
|
|
|
39306
39307
|
es2020: ts.ModuleKind.ES2020,
|
|
39307
39308
|
es2022: ts.ModuleKind.ES2022,
|
|
39308
39309
|
esnext: ts.ModuleKind.ESNext,
|
|
39309
|
-
|
|
39310
|
+
node16: ts.ModuleKind.Node16,
|
|
39310
39311
|
nodenext: ts.ModuleKind.NodeNext,
|
|
39311
39312
|
})),
|
|
39312
39313
|
affectsModuleResolution: true,
|
|
@@ -39660,7 +39661,7 @@ var ts;
|
|
|
39660
39661
|
type: new ts.Map(ts.getEntries({
|
|
39661
39662
|
node: ts.ModuleResolutionKind.NodeJs,
|
|
39662
39663
|
classic: ts.ModuleResolutionKind.Classic,
|
|
39663
|
-
|
|
39664
|
+
node16: ts.ModuleResolutionKind.Node16,
|
|
39664
39665
|
nodenext: ts.ModuleResolutionKind.NodeNext,
|
|
39665
39666
|
})),
|
|
39666
39667
|
affectsModuleResolution: true,
|
|
@@ -40136,7 +40137,7 @@ var ts;
|
|
|
40136
40137
|
affectsModuleResolution: true,
|
|
40137
40138
|
description: ts.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
40138
40139
|
category: ts.Diagnostics.Language_and_Environment,
|
|
40139
|
-
defaultValueDescription: ts.Diagnostics.
|
|
40140
|
+
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,
|
|
40140
40141
|
}
|
|
40141
40142
|
];
|
|
40142
40143
|
/* @internal */
|
|
@@ -42372,9 +42373,9 @@ var ts;
|
|
|
42372
42373
|
// set in a non-modal module resolution setting here. Do note that our behavior is not particularly well defined when these mode-overriding imports
|
|
42373
42374
|
// 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,
|
|
42374
42375
|
// 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
|
|
42375
|
-
// resolution" should be (`
|
|
42376
|
+
// resolution" should be (`node16`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
|
|
42376
42377
|
// context should _probably_ be an error - and that should likely be handled by the `Program` (which is what we do).
|
|
42377
|
-
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42378
|
+
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
|
|
42378
42379
|
features |= NodeResolutionFeatures.EsmMode;
|
|
42379
42380
|
}
|
|
42380
42381
|
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
@@ -42463,7 +42464,7 @@ var ts;
|
|
|
42463
42464
|
}
|
|
42464
42465
|
ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
|
|
42465
42466
|
function getDefaultNodeResolutionFeatures(options) {
|
|
42466
|
-
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42467
|
+
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default :
|
|
42467
42468
|
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
42468
42469
|
NodeResolutionFeatures.None;
|
|
42469
42470
|
}
|
|
@@ -42821,8 +42822,8 @@ var ts;
|
|
|
42821
42822
|
case ts.ModuleKind.CommonJS:
|
|
42822
42823
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
42823
42824
|
break;
|
|
42824
|
-
case ts.ModuleKind.
|
|
42825
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
42825
|
+
case ts.ModuleKind.Node16:
|
|
42826
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
42826
42827
|
break;
|
|
42827
42828
|
case ts.ModuleKind.NodeNext:
|
|
42828
42829
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -42842,8 +42843,8 @@ var ts;
|
|
|
42842
42843
|
}
|
|
42843
42844
|
ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
|
|
42844
42845
|
switch (moduleResolution) {
|
|
42845
|
-
case ts.ModuleResolutionKind.
|
|
42846
|
-
result =
|
|
42846
|
+
case ts.ModuleResolutionKind.Node16:
|
|
42847
|
+
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
42847
42848
|
break;
|
|
42848
42849
|
case ts.ModuleResolutionKind.NodeNext:
|
|
42849
42850
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43077,15 +43078,15 @@ var ts;
|
|
|
43077
43078
|
// respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
|
|
43078
43079
|
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
43079
43080
|
// allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
|
|
43080
|
-
// not
|
|
43081
|
+
// not supported in node 12 - https://github.com/nodejs/Release/issues/690
|
|
43081
43082
|
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
43082
43083
|
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
43083
|
-
NodeResolutionFeatures[NodeResolutionFeatures["
|
|
43084
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Node16Default"] = 30] = "Node16Default";
|
|
43084
43085
|
NodeResolutionFeatures[NodeResolutionFeatures["NodeNextDefault"] = 30] = "NodeNextDefault";
|
|
43085
43086
|
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
43086
43087
|
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
43087
|
-
function
|
|
43088
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.
|
|
43088
|
+
function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43089
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node16Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43089
43090
|
}
|
|
43090
43091
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43091
43092
|
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43125,7 +43126,7 @@ var ts;
|
|
|
43125
43126
|
var _a, _b;
|
|
43126
43127
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
43127
43128
|
var failedLookupLocations = [];
|
|
43128
|
-
// conditions are only used by the
|
|
43129
|
+
// conditions are only used by the node16/nodenext resolver - there's no priority order in the list,
|
|
43129
43130
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43130
43131
|
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43131
43132
|
if (compilerOptions.noDtsResolution) {
|
|
@@ -48512,7 +48513,7 @@ var ts;
|
|
|
48512
48513
|
var enumRelation = new ts.Map();
|
|
48513
48514
|
var builtinGlobals = ts.createSymbolTable();
|
|
48514
48515
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
48515
|
-
// Extensions suggested for path imports when module resolution is
|
|
48516
|
+
// Extensions suggested for path imports when module resolution is node16 or higher.
|
|
48516
48517
|
// The first element of each tuple is the extension a file has.
|
|
48517
48518
|
// The second element of each tuple is the extension that should be used in a path import.
|
|
48518
48519
|
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
@@ -50801,7 +50802,7 @@ var ts;
|
|
|
50801
50802
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
50802
50803
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
50803
50804
|
}
|
|
50804
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
50805
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
50805
50806
|
var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
|
|
50806
50807
|
var overrideClauseHost = ts.findAncestor(location, function (l) { return ts.isImportTypeNode(l) || ts.isExportDeclaration(l) || ts.isImportDeclaration(l); });
|
|
50807
50808
|
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;
|
|
@@ -50810,9 +50811,6 @@ var ts;
|
|
|
50810
50811
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
|
|
50811
50812
|
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);
|
|
50812
50813
|
}
|
|
50813
|
-
if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
|
|
50814
|
-
error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
|
|
50815
|
-
}
|
|
50816
50814
|
}
|
|
50817
50815
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
50818
50816
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -50865,7 +50863,7 @@ var ts;
|
|
|
50865
50863
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
50866
50864
|
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
50867
50865
|
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
50868
|
-
var
|
|
50866
|
+
var resolutionIsNode16OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node16 ||
|
|
50869
50867
|
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
50870
50868
|
if (tsExtension) {
|
|
50871
50869
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
@@ -50886,17 +50884,17 @@ var ts;
|
|
|
50886
50884
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
50887
50885
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
50888
50886
|
}
|
|
50889
|
-
else if (mode === ts.ModuleKind.ESNext &&
|
|
50887
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
50890
50888
|
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
50891
50889
|
var suggestedExt = (_h = suggestedExtensions.find(function (_a) {
|
|
50892
50890
|
var actualExt = _a[0], _importExt = _a[1];
|
|
50893
50891
|
return host.fileExists(absoluteRef_1 + actualExt);
|
|
50894
50892
|
})) === null || _h === void 0 ? void 0 : _h[1];
|
|
50895
50893
|
if (suggestedExt) {
|
|
50896
|
-
error(errorNode, ts.Diagnostics.
|
|
50894
|
+
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);
|
|
50897
50895
|
}
|
|
50898
50896
|
else {
|
|
50899
|
-
error(errorNode, ts.Diagnostics.
|
|
50897
|
+
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);
|
|
50900
50898
|
}
|
|
50901
50899
|
}
|
|
50902
50900
|
else {
|
|
@@ -53218,7 +53216,7 @@ var ts;
|
|
|
53218
53216
|
var targetFile = ts.getSourceFileOfModule(chain[0]);
|
|
53219
53217
|
var specifier = void 0;
|
|
53220
53218
|
var assertion = void 0;
|
|
53221
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53219
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53222
53220
|
// An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion
|
|
53223
53221
|
if ((targetFile === null || targetFile === void 0 ? void 0 : targetFile.impliedNodeFormat) === ts.ModuleKind.ESNext && targetFile.impliedNodeFormat !== (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat)) {
|
|
53224
53222
|
specifier = getSpecifierForModuleSymbol(chain[0], context, ts.ModuleKind.ESNext);
|
|
@@ -53232,7 +53230,7 @@ var ts;
|
|
|
53232
53230
|
}
|
|
53233
53231
|
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
|
|
53234
53232
|
var oldSpecifier = specifier;
|
|
53235
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53233
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53236
53234
|
// We might be able to write a portable import type using a mode override; try specifier generation again, but with a different mode set
|
|
53237
53235
|
var swappedMode = (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat) === ts.ModuleKind.ESNext ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
53238
53236
|
specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
|
|
@@ -71197,7 +71195,7 @@ var ts;
|
|
|
71197
71195
|
if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
71198
71196
|
var parent = declaration.parent.parent;
|
|
71199
71197
|
if (parent.kind === 254 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 164 /* Parameter */) {
|
|
71200
|
-
var links = getNodeLinks(
|
|
71198
|
+
var links = getNodeLinks(parent);
|
|
71201
71199
|
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
71202
71200
|
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
71203
71201
|
var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
|
|
@@ -77060,13 +77058,13 @@ var ts;
|
|
|
77060
77058
|
}
|
|
77061
77059
|
}
|
|
77062
77060
|
function checkImportMetaProperty(node) {
|
|
77063
|
-
if (moduleKind === ts.ModuleKind.
|
|
77061
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
77064
77062
|
if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
77065
77063
|
error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
77066
77064
|
}
|
|
77067
77065
|
}
|
|
77068
77066
|
else if (moduleKind < ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.System) {
|
|
77069
|
-
error(node, ts.Diagnostics.
|
|
77067
|
+
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
|
|
77070
77068
|
}
|
|
77071
77069
|
var file = ts.getSourceFileOfNode(node);
|
|
77072
77070
|
ts.Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -78017,15 +78015,30 @@ var ts;
|
|
|
78017
78015
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
78018
78016
|
var span = void 0;
|
|
78019
78017
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
78020
|
-
|
|
78021
|
-
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
78018
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78022
78019
|
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);
|
|
78023
78020
|
diagnostics.add(diagnostic);
|
|
78024
78021
|
}
|
|
78025
|
-
|
|
78026
|
-
|
|
78027
|
-
|
|
78028
|
-
|
|
78022
|
+
switch (moduleKind) {
|
|
78023
|
+
case ts.ModuleKind.Node16:
|
|
78024
|
+
case ts.ModuleKind.NodeNext:
|
|
78025
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
78026
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78027
|
+
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));
|
|
78028
|
+
break;
|
|
78029
|
+
}
|
|
78030
|
+
// fallthrough
|
|
78031
|
+
case ts.ModuleKind.ES2022:
|
|
78032
|
+
case ts.ModuleKind.ESNext:
|
|
78033
|
+
case ts.ModuleKind.System:
|
|
78034
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
78035
|
+
break;
|
|
78036
|
+
}
|
|
78037
|
+
// fallthrough
|
|
78038
|
+
default:
|
|
78039
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78040
|
+
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));
|
|
78041
|
+
break;
|
|
78029
78042
|
}
|
|
78030
78043
|
}
|
|
78031
78044
|
}
|
|
@@ -80467,8 +80480,8 @@ var ts;
|
|
|
80467
80480
|
if (node.assertions) {
|
|
80468
80481
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80469
80482
|
if (override) {
|
|
80470
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
80471
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80483
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80484
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80472
80485
|
}
|
|
80473
80486
|
}
|
|
80474
80487
|
}
|
|
@@ -81918,7 +81931,7 @@ var ts;
|
|
|
81918
81931
|
}
|
|
81919
81932
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
81920
81933
|
// No need to check for require or exports for ES6 modules and later
|
|
81921
|
-
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.
|
|
81934
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node16 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
81922
81935
|
return;
|
|
81923
81936
|
}
|
|
81924
81937
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -84838,8 +84851,8 @@ var ts;
|
|
|
84838
84851
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
84839
84852
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
84840
84853
|
if (validForTypeAssertions && override) {
|
|
84841
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
84842
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
84854
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
84855
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
84843
84856
|
}
|
|
84844
84857
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
84845
84858
|
}
|
|
@@ -88026,8 +88039,24 @@ var ts;
|
|
|
88026
88039
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
88027
88040
|
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));
|
|
88028
88041
|
}
|
|
88029
|
-
|
|
88030
|
-
|
|
88042
|
+
switch (moduleKind) {
|
|
88043
|
+
case ts.ModuleKind.Node16:
|
|
88044
|
+
case ts.ModuleKind.NodeNext:
|
|
88045
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
88046
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
|
|
88047
|
+
break;
|
|
88048
|
+
}
|
|
88049
|
+
// fallthrough
|
|
88050
|
+
case ts.ModuleKind.ES2022:
|
|
88051
|
+
case ts.ModuleKind.ESNext:
|
|
88052
|
+
case ts.ModuleKind.System:
|
|
88053
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
88054
|
+
break;
|
|
88055
|
+
}
|
|
88056
|
+
// fallthrough
|
|
88057
|
+
default:
|
|
88058
|
+
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));
|
|
88059
|
+
break;
|
|
88031
88060
|
}
|
|
88032
88061
|
}
|
|
88033
88062
|
}
|
|
@@ -88722,7 +88751,7 @@ var ts;
|
|
|
88722
88751
|
}
|
|
88723
88752
|
function checkGrammarImportCallExpression(node) {
|
|
88724
88753
|
if (moduleKind === ts.ModuleKind.ES2015) {
|
|
88725
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
88754
|
+
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);
|
|
88726
88755
|
}
|
|
88727
88756
|
if (node.typeArguments) {
|
|
88728
88757
|
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);
|
|
@@ -88733,7 +88762,7 @@ var ts;
|
|
|
88733
88762
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
88734
88763
|
if (nodeArguments.length > 1) {
|
|
88735
88764
|
var assertionArgument = nodeArguments[1];
|
|
88736
|
-
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.
|
|
88765
|
+
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
|
|
88737
88766
|
}
|
|
88738
88767
|
}
|
|
88739
88768
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
@@ -108999,7 +109028,7 @@ var ts;
|
|
|
108999
109028
|
return ts.transformECMAScriptModule;
|
|
109000
109029
|
case ts.ModuleKind.System:
|
|
109001
109030
|
return ts.transformSystemModule;
|
|
109002
|
-
case ts.ModuleKind.
|
|
109031
|
+
case ts.ModuleKind.Node16:
|
|
109003
109032
|
case ts.ModuleKind.NodeNext:
|
|
109004
109033
|
return ts.transformNodeModule;
|
|
109005
109034
|
default:
|
|
@@ -116022,7 +116051,7 @@ var ts;
|
|
|
116022
116051
|
*/
|
|
116023
116052
|
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
116024
116053
|
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
116025
|
-
case ts.ModuleResolutionKind.
|
|
116054
|
+
case ts.ModuleResolutionKind.Node16:
|
|
116026
116055
|
case ts.ModuleResolutionKind.NodeNext:
|
|
116027
116056
|
return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
|
|
116028
116057
|
ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
|
|
@@ -116321,7 +116350,7 @@ var ts;
|
|
|
116321
116350
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
116322
116351
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
116323
116352
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
116324
|
-
// under
|
|
116353
|
+
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
|
|
116325
116354
|
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 });
|
|
116326
116355
|
}
|
|
116327
116356
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -117974,8 +118003,8 @@ var ts;
|
|
|
117974
118003
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
117975
118004
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
117976
118005
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
117977
|
-
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
117978
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118006
|
+
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118007
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
117979
118008
|
}
|
|
117980
118009
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
117981
118010
|
}
|
|
@@ -118337,7 +118366,7 @@ var ts;
|
|
|
118337
118366
|
}
|
|
118338
118367
|
if (options.resolveJsonModule) {
|
|
118339
118368
|
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
118340
|
-
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
118369
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 &&
|
|
118341
118370
|
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118342
118371
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
118343
118372
|
}
|
|
@@ -121477,7 +121506,7 @@ var ts;
|
|
|
121477
121506
|
}
|
|
121478
121507
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
121479
121508
|
var _a;
|
|
121480
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
121509
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16
|
|
121481
121510
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
121482
121511
|
return false;
|
|
121483
121512
|
}
|
|
@@ -122062,7 +122091,7 @@ var ts;
|
|
|
122062
122091
|
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
122063
122092
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
122064
122093
|
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
122065
|
-
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
122094
|
+
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
122066
122095
|
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
122067
122096
|
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
122068
122097
|
// usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
|
|
@@ -127259,11 +127288,11 @@ var ts;
|
|
|
127259
127288
|
}
|
|
127260
127289
|
ts.getModuleSpecifierResolverHost = getModuleSpecifierResolverHost;
|
|
127261
127290
|
function moduleResolutionRespectsExports(moduleResolution) {
|
|
127262
|
-
return moduleResolution >= ts.ModuleResolutionKind.
|
|
127291
|
+
return moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127263
127292
|
}
|
|
127264
127293
|
ts.moduleResolutionRespectsExports = moduleResolutionRespectsExports;
|
|
127265
127294
|
function moduleResolutionUsesNodeModules(moduleResolution) {
|
|
127266
|
-
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.
|
|
127295
|
+
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127267
127296
|
}
|
|
127268
127297
|
ts.moduleResolutionUsesNodeModules = moduleResolutionUsesNodeModules;
|
|
127269
127298
|
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
|
|
@@ -130587,11 +130616,11 @@ var ts;
|
|
|
130587
130616
|
}
|
|
130588
130617
|
function isEmitResolutionKindUsingNodeModules(compilerOptions) {
|
|
130589
130618
|
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ||
|
|
130590
|
-
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
130619
|
+
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
130591
130620
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
130592
130621
|
}
|
|
130593
130622
|
function isEmitModuleResolutionRespectingExportMaps(compilerOptions) {
|
|
130594
|
-
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
130623
|
+
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
130595
130624
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
130596
130625
|
}
|
|
130597
130626
|
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
@@ -133140,7 +133169,7 @@ var ts;
|
|
|
133140
133169
|
return;
|
|
133141
133170
|
}
|
|
133142
133171
|
// Do a relatively cheap check to bail early if all re-exports are non-importable
|
|
133143
|
-
// due to file location or package.json dependency filtering. For non-
|
|
133172
|
+
// due to file location or package.json dependency filtering. For non-node16+
|
|
133144
133173
|
// module resolution modes, getting past this point guarantees that we'll be
|
|
133145
133174
|
// able to generate a suitable module specifier, so we can safely show a completion,
|
|
133146
133175
|
// even if we defer computing the module specifier.
|
|
@@ -133148,7 +133177,7 @@ var ts;
|
|
|
133148
133177
|
if (!firstImportableExportInfo) {
|
|
133149
133178
|
return;
|
|
133150
133179
|
}
|
|
133151
|
-
// In
|
|
133180
|
+
// In node16+, module specifier resolution can fail due to modules being blocked
|
|
133152
133181
|
// by package.json `exports`. If that happens, don't show a completion item.
|
|
133153
133182
|
// N.B. in this resolution mode we always try to resolve module specifiers here,
|
|
133154
133183
|
// because we have to know now if it's going to fail so we can omit the completion
|
|
@@ -138743,7 +138772,7 @@ var ts;
|
|
|
138743
138772
|
(function (ts) {
|
|
138744
138773
|
var GoToDefinition;
|
|
138745
138774
|
(function (GoToDefinition) {
|
|
138746
|
-
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly) {
|
|
138775
|
+
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
138747
138776
|
var _a;
|
|
138748
138777
|
var _b;
|
|
138749
138778
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
@@ -138768,7 +138797,7 @@ var ts;
|
|
|
138768
138797
|
}
|
|
138769
138798
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
138770
138799
|
var classDecl = node.parent.parent;
|
|
138771
|
-
var _c = getSymbol(classDecl, typeChecker), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
138800
|
+
var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
138772
138801
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
138773
138802
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
138774
138803
|
var sourceFile_1 = node.getSourceFile();
|
|
@@ -138778,14 +138807,14 @@ var ts;
|
|
|
138778
138807
|
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
|
|
138779
138808
|
});
|
|
138780
138809
|
}
|
|
138781
|
-
var _d = getSymbol(node, typeChecker), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
138810
|
+
var _d = getSymbol(node, typeChecker, stopAtAlias), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
138782
138811
|
var fallbackNode = node;
|
|
138783
138812
|
if (searchOtherFilesOnly && failedAliasResolution) {
|
|
138784
138813
|
// We couldn't resolve the specific import, try on the module specifier.
|
|
138785
138814
|
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); });
|
|
138786
138815
|
var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
|
|
138787
138816
|
if (moduleSpecifier) {
|
|
138788
|
-
(_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
138817
|
+
(_a = getSymbol(moduleSpecifier, typeChecker, stopAtAlias), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
138789
138818
|
fallbackNode = moduleSpecifier;
|
|
138790
138819
|
}
|
|
138791
138820
|
}
|
|
@@ -138959,7 +138988,7 @@ var ts;
|
|
|
138959
138988
|
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
138960
138989
|
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
|
|
138961
138990
|
}
|
|
138962
|
-
var _a = getSymbol(node, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
138991
|
+
var _a = getSymbol(node, typeChecker, /*stopAtAlias*/ false), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
138963
138992
|
if (!symbol)
|
|
138964
138993
|
return undefined;
|
|
138965
138994
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
@@ -139010,14 +139039,14 @@ var ts;
|
|
|
139010
139039
|
function getDefinitionInfoForIndexSignatures(node, checker) {
|
|
139011
139040
|
return ts.mapDefined(checker.getIndexInfosAtLocation(node), function (info) { return info.declaration && createDefinitionFromSignatureDeclaration(checker, info.declaration); });
|
|
139012
139041
|
}
|
|
139013
|
-
function getSymbol(node, checker) {
|
|
139042
|
+
function getSymbol(node, checker, stopAtAlias) {
|
|
139014
139043
|
var symbol = checker.getSymbolAtLocation(node);
|
|
139015
139044
|
// If this is an alias, and the request came at the declaration location
|
|
139016
139045
|
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
|
139017
139046
|
// import {A, B} from "mod";
|
|
139018
139047
|
// to jump to the implementation directly.
|
|
139019
139048
|
var failedAliasResolution = false;
|
|
139020
|
-
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139049
|
+
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && !stopAtAlias && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139021
139050
|
var aliased = checker.getAliasedSymbol(symbol);
|
|
139022
139051
|
if (aliased.declarations) {
|
|
139023
139052
|
return { symbol: aliased };
|
|
@@ -152610,7 +152639,7 @@ var ts;
|
|
|
152610
152639
|
case ts.ModuleKind.None:
|
|
152611
152640
|
// Fall back to the `import * as ns` style import.
|
|
152612
152641
|
return 2 /* Namespace */;
|
|
152613
|
-
case ts.ModuleKind.
|
|
152642
|
+
case ts.ModuleKind.Node16:
|
|
152614
152643
|
case ts.ModuleKind.NodeNext:
|
|
152615
152644
|
return importingFile.impliedNodeFormat === ts.ModuleKind.ESNext ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
152616
152645
|
default:
|
|
@@ -154523,8 +154552,8 @@ var ts;
|
|
|
154523
154552
|
(function (codefix) {
|
|
154524
154553
|
codefix.registerCodeFix({
|
|
154525
154554
|
errorCodes: [
|
|
154526
|
-
ts.Diagnostics.
|
|
154527
|
-
ts.Diagnostics.
|
|
154555
|
+
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,
|
|
154556
|
+
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,
|
|
154528
154557
|
],
|
|
154529
154558
|
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
154530
154559
|
var compilerOptions = context.program.getCompilerOptions();
|
|
@@ -164407,9 +164436,9 @@ var ts;
|
|
|
164407
164436
|
}
|
|
164408
164437
|
}
|
|
164409
164438
|
/// Goto definition
|
|
164410
|
-
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly) {
|
|
164439
|
+
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly, stopAtAlias) {
|
|
164411
164440
|
synchronizeHostData();
|
|
164412
|
-
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
|
|
164441
|
+
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly, stopAtAlias);
|
|
164413
164442
|
}
|
|
164414
164443
|
function getDefinitionAndBoundSpan(fileName, position) {
|
|
164415
164444
|
synchronizeHostData();
|
|
@@ -174359,7 +174388,8 @@ var ts;
|
|
|
174359
174388
|
var providePrefixAndSuffixTextForRename = _a.providePrefixAndSuffixTextForRename;
|
|
174360
174389
|
var outputs = [];
|
|
174361
174390
|
var seen = createDocumentSpanSet();
|
|
174362
|
-
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174391
|
+
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174392
|
+
/*isForRename*/ true, function (project, location, tryAddToTodo) {
|
|
174363
174393
|
var projectOutputs = project.getLanguageService().findRenameLocations(location.fileName, location.pos, findInStrings, findInComments, providePrefixAndSuffixTextForRename);
|
|
174364
174394
|
if (projectOutputs) {
|
|
174365
174395
|
for (var _i = 0, projectOutputs_1 = projectOutputs; _i < projectOutputs_1.length; _i++) {
|
|
@@ -174373,14 +174403,15 @@ var ts;
|
|
|
174373
174403
|
});
|
|
174374
174404
|
return outputs;
|
|
174375
174405
|
}
|
|
174376
|
-
function getDefinitionLocation(defaultProject, initialLocation) {
|
|
174377
|
-
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos);
|
|
174406
|
+
function getDefinitionLocation(defaultProject, initialLocation, isForRename) {
|
|
174407
|
+
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, isForRename);
|
|
174378
174408
|
var info = infos && ts.firstOrUndefined(infos);
|
|
174379
174409
|
return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
|
|
174380
174410
|
}
|
|
174381
174411
|
function combineProjectOutputForReferences(projects, defaultProject, initialLocation, logger) {
|
|
174382
174412
|
var outputs = [];
|
|
174383
|
-
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174413
|
+
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174414
|
+
/*isForRename*/ false, function (project, location, getMappedLocation) {
|
|
174384
174415
|
logger.info("Finding references to " + location.fileName + " position " + location.pos + " in project " + project.getProjectName());
|
|
174385
174416
|
var projectOutputs = project.getLanguageService().findReferences(location.fileName, location.pos);
|
|
174386
174417
|
if (projectOutputs) {
|
|
@@ -174427,7 +174458,7 @@ var ts;
|
|
|
174427
174458
|
});
|
|
174428
174459
|
}
|
|
174429
174460
|
}
|
|
174430
|
-
function combineProjectOutputWorker(projects, defaultProject, initialLocation, cb) {
|
|
174461
|
+
function combineProjectOutputWorker(projects, defaultProject, initialLocation, isForRename, cb) {
|
|
174431
174462
|
var projectService = defaultProject.projectService;
|
|
174432
174463
|
var toDo;
|
|
174433
174464
|
var seenProjects = new ts.Set();
|
|
@@ -174438,7 +174469,7 @@ var ts;
|
|
|
174438
174469
|
});
|
|
174439
174470
|
// After initial references are collected, go over every other project and see if it has a reference for the symbol definition.
|
|
174440
174471
|
if (initialLocation) {
|
|
174441
|
-
var defaultDefinition_1 = getDefinitionLocation(defaultProject, initialLocation);
|
|
174472
|
+
var defaultDefinition_1 = getDefinitionLocation(defaultProject, initialLocation, isForRename);
|
|
174442
174473
|
if (defaultDefinition_1) {
|
|
174443
174474
|
var getGeneratedDefinition_1 = ts.memoize(function () { return defaultProject.isSourceOfProjectReferenceRedirect(defaultDefinition_1.fileName) ?
|
|
174444
174475
|
defaultDefinition_1 :
|
|
@@ -175494,7 +175525,7 @@ var ts;
|
|
|
175494
175525
|
definitions === null || definitions === void 0 ? void 0 : definitions.forEach(function (d) { return definitionSet_1.add(d); });
|
|
175495
175526
|
var noDtsProject = project.getNoDtsResolutionProject([file]);
|
|
175496
175527
|
var ls = noDtsProject.getLanguageService();
|
|
175497
|
-
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; });
|
|
175528
|
+
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; });
|
|
175498
175529
|
if (ts.some(jsDefinitions)) {
|
|
175499
175530
|
for (var _i = 0, jsDefinitions_1 = jsDefinitions; _i < jsDefinitions_1.length; _i++) {
|
|
175500
175531
|
var jsDefinition = jsDefinitions_1[_i];
|
|
@@ -175542,7 +175573,7 @@ var ts;
|
|
|
175542
175573
|
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions);
|
|
175543
175574
|
if (!packageJson)
|
|
175544
175575
|
return undefined;
|
|
175545
|
-
// Use fake options instead of actual compiler options to avoid following export map if the project uses
|
|
175576
|
+
// Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext -
|
|
175546
175577
|
// Mapping from an export map entry across packages is out of scope for now. Returned entrypoints will only be what can be
|
|
175547
175578
|
// resolved from the package root under --moduleResolution node
|
|
175548
175579
|
var entrypoints = ts.getEntrypointsFromPackageJsonInfo(packageJson, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, project, project.getModuleResolutionCache());
|
|
@@ -175579,7 +175610,7 @@ var ts;
|
|
|
175579
175610
|
var _a;
|
|
175580
175611
|
if (nameInChain === initialNode)
|
|
175581
175612
|
return undefined;
|
|
175582
|
-
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 ({
|
|
175613
|
+
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 ({
|
|
175583
175614
|
fileName: d.fileName,
|
|
175584
175615
|
name: ts.getTextOfIdentifierOrLiteral(initialNode)
|
|
175585
175616
|
}); });
|