typescript 4.7.0-dev.20220503 → 4.7.0-dev.20220506
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/lib.es2022.d.ts +1 -0
- package/lib/lib.es2022.intl.d.ts +111 -0
- package/lib/lib.es5.d.ts +2 -2
- package/lib/tsc.js +306 -133
- package/lib/tsserver.js +426 -206
- package/lib/tsserverlibrary.d.ts +7 -7
- package/lib/tsserverlibrary.js +426 -206
- package/lib/typescript.d.ts +7 -7
- package/lib/typescript.js +411 -194
- package/lib/typescriptServices.d.ts +7 -7
- package/lib/typescriptServices.js +411 -194
- package/lib/typingsInstaller.js +365 -158
- 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.20220506";
|
|
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),
|
|
@@ -8601,6 +8603,8 @@ var ts;
|
|
|
8601
8603
|
Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
8602
8604
|
The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
|
|
8603
8605
|
The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
|
|
8606
|
+
The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
|
|
8607
|
+
The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
|
|
8604
8608
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
8605
8609
|
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
8606
8610
|
Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
|
|
@@ -9078,8 +9082,8 @@ var ts;
|
|
|
9078
9082
|
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
9083
|
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
9084
|
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
|
-
|
|
9085
|
+
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."),
|
|
9086
|
+
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
9087
|
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
9088
|
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
9089
|
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 +9749,6 @@ var ts;
|
|
|
9745
9749
|
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
9750
|
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
9751
|
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
9752
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9750
9753
|
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
9754
|
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 +15041,7 @@ var ts;
|
|
|
15038
15041
|
}
|
|
15039
15042
|
ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
|
|
15040
15043
|
function isCommonJSContainingModuleKind(kind) {
|
|
15041
|
-
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.
|
|
15044
|
+
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node16 || kind === ts.ModuleKind.NodeNext;
|
|
15042
15045
|
}
|
|
15043
15046
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
15044
15047
|
return ts.isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator);
|
|
@@ -18427,6 +18430,16 @@ var ts;
|
|
|
18427
18430
|
".d.ts" /* Dts */;
|
|
18428
18431
|
}
|
|
18429
18432
|
ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
|
|
18433
|
+
/**
|
|
18434
|
+
* This function is an inverse of `getDeclarationEmitExtensionForPath`.
|
|
18435
|
+
*/
|
|
18436
|
+
function getPossibleOriginalInputExtensionForExtension(path) {
|
|
18437
|
+
return ts.fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] :
|
|
18438
|
+
ts.fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] :
|
|
18439
|
+
ts.fileExtensionIsOneOf(path, [".json.d.ts"]) ? [".json" /* Json */] :
|
|
18440
|
+
[".tsx" /* Tsx */, ".ts" /* Ts */, ".jsx" /* Jsx */, ".js" /* Js */];
|
|
18441
|
+
}
|
|
18442
|
+
ts.getPossibleOriginalInputExtensionForExtension = getPossibleOriginalInputExtensionForExtension;
|
|
18430
18443
|
function outFile(options) {
|
|
18431
18444
|
return options.outFile || options.out;
|
|
18432
18445
|
}
|
|
@@ -20206,7 +20219,7 @@ var ts;
|
|
|
20206
20219
|
file.externalModuleIndicator = ts.isFileProbablyExternalModule(file);
|
|
20207
20220
|
};
|
|
20208
20221
|
case ts.ModuleDetectionKind.Auto:
|
|
20209
|
-
// If module is nodenext or
|
|
20222
|
+
// If module is nodenext or node16, all esm format files are modules
|
|
20210
20223
|
// If jsx is react-jsx or react-jsxdev then jsx tags force module-ness
|
|
20211
20224
|
// otherwise, the presence of import or export statments (or import.meta) implies module-ness
|
|
20212
20225
|
var checks = [ts.isFileProbablyExternalModule];
|
|
@@ -20214,7 +20227,7 @@ var ts;
|
|
|
20214
20227
|
checks.push(isFileModuleFromUsingJSXTag);
|
|
20215
20228
|
}
|
|
20216
20229
|
var moduleKind = getEmitModuleKind(options);
|
|
20217
|
-
if (moduleKind === ts.ModuleKind.
|
|
20230
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
20218
20231
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
20219
20232
|
}
|
|
20220
20233
|
var combined_1 = ts.or.apply(void 0, checks);
|
|
@@ -20225,7 +20238,7 @@ var ts;
|
|
|
20225
20238
|
ts.getSetExternalModuleIndicator = getSetExternalModuleIndicator;
|
|
20226
20239
|
function getEmitScriptTarget(compilerOptions) {
|
|
20227
20240
|
return compilerOptions.target ||
|
|
20228
|
-
(compilerOptions.module === ts.ModuleKind.
|
|
20241
|
+
(compilerOptions.module === ts.ModuleKind.Node16 && 9 /* ES2022 */) ||
|
|
20229
20242
|
(compilerOptions.module === ts.ModuleKind.NodeNext && 99 /* ESNext */) ||
|
|
20230
20243
|
0 /* ES3 */;
|
|
20231
20244
|
}
|
|
@@ -20243,8 +20256,8 @@ var ts;
|
|
|
20243
20256
|
case ts.ModuleKind.CommonJS:
|
|
20244
20257
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
20245
20258
|
break;
|
|
20246
|
-
case ts.ModuleKind.
|
|
20247
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
20259
|
+
case ts.ModuleKind.Node16:
|
|
20260
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
20248
20261
|
break;
|
|
20249
20262
|
case ts.ModuleKind.NodeNext:
|
|
20250
20263
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -20269,7 +20282,7 @@ var ts;
|
|
|
20269
20282
|
case ts.ModuleKind.ES2020:
|
|
20270
20283
|
case ts.ModuleKind.ES2022:
|
|
20271
20284
|
case ts.ModuleKind.ESNext:
|
|
20272
|
-
case ts.ModuleKind.
|
|
20285
|
+
case ts.ModuleKind.Node16:
|
|
20273
20286
|
case ts.ModuleKind.NodeNext:
|
|
20274
20287
|
return true;
|
|
20275
20288
|
default:
|
|
@@ -20294,7 +20307,7 @@ var ts;
|
|
|
20294
20307
|
return compilerOptions.esModuleInterop;
|
|
20295
20308
|
}
|
|
20296
20309
|
switch (getEmitModuleKind(compilerOptions)) {
|
|
20297
|
-
case ts.ModuleKind.
|
|
20310
|
+
case ts.ModuleKind.Node16:
|
|
20298
20311
|
case ts.ModuleKind.NodeNext:
|
|
20299
20312
|
return true;
|
|
20300
20313
|
}
|
|
@@ -26376,7 +26389,7 @@ var ts;
|
|
|
26376
26389
|
return node;
|
|
26377
26390
|
}
|
|
26378
26391
|
function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
|
|
26379
|
-
var node = baseFactory.createBaseSourceFileNode(305 /* SourceFile */);
|
|
26392
|
+
var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SourceFile */));
|
|
26380
26393
|
for (var p in source) {
|
|
26381
26394
|
if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p))
|
|
26382
26395
|
continue;
|
|
@@ -31501,7 +31514,7 @@ var ts;
|
|
|
31501
31514
|
initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, 1 /* JS */);
|
|
31502
31515
|
// Prime the scanner.
|
|
31503
31516
|
nextToken();
|
|
31504
|
-
var entityName = parseEntityName(/*allowReservedWords*/ true
|
|
31517
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true);
|
|
31505
31518
|
var isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
|
|
31506
31519
|
clearState();
|
|
31507
31520
|
return isInvalid ? entityName : undefined;
|
|
@@ -33101,7 +33114,7 @@ var ts;
|
|
|
33101
33114
|
}
|
|
33102
33115
|
return createMissingList();
|
|
33103
33116
|
}
|
|
33104
|
-
function parseEntityName(allowReservedWords,
|
|
33117
|
+
function parseEntityName(allowReservedWords, diagnosticMessage) {
|
|
33105
33118
|
var pos = getNodePos();
|
|
33106
33119
|
var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage);
|
|
33107
33120
|
var dotPos = getNodePos();
|
|
@@ -33112,7 +33125,7 @@ var ts;
|
|
|
33112
33125
|
break;
|
|
33113
33126
|
}
|
|
33114
33127
|
dotPos = getNodePos();
|
|
33115
|
-
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, allowPrivateIdentifiers)), pos);
|
|
33128
|
+
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, /* allowPrivateIdentifiers */ false)), pos);
|
|
33116
33129
|
}
|
|
33117
33130
|
return entity;
|
|
33118
33131
|
}
|
|
@@ -33245,7 +33258,7 @@ var ts;
|
|
|
33245
33258
|
}
|
|
33246
33259
|
// TYPES
|
|
33247
33260
|
function parseEntityNameOfTypeReference() {
|
|
33248
|
-
return parseEntityName(/*allowReservedWords*/ true,
|
|
33261
|
+
return parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
|
|
33249
33262
|
}
|
|
33250
33263
|
function parseTypeArgumentsOfTypeReference() {
|
|
33251
33264
|
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
|
|
@@ -33378,7 +33391,7 @@ var ts;
|
|
|
33378
33391
|
function parseTypeQuery() {
|
|
33379
33392
|
var pos = getNodePos();
|
|
33380
33393
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33381
|
-
var entityName = parseEntityName(/*allowReservedWords*/ true
|
|
33394
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true);
|
|
33382
33395
|
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33383
33396
|
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33384
33397
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
@@ -34346,10 +34359,10 @@ var ts;
|
|
|
34346
34359
|
setDecoratorContext(/*val*/ false);
|
|
34347
34360
|
}
|
|
34348
34361
|
var pos = getNodePos();
|
|
34349
|
-
var expr = parseAssignmentExpressionOrHigher(
|
|
34362
|
+
var expr = parseAssignmentExpressionOrHigher();
|
|
34350
34363
|
var operatorToken;
|
|
34351
34364
|
while ((operatorToken = parseOptionalToken(27 /* CommaToken */))) {
|
|
34352
|
-
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(
|
|
34365
|
+
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
|
|
34353
34366
|
}
|
|
34354
34367
|
if (saveDecoratorContext) {
|
|
34355
34368
|
setDecoratorContext(/*val*/ true);
|
|
@@ -34357,9 +34370,9 @@ var ts;
|
|
|
34357
34370
|
return expr;
|
|
34358
34371
|
}
|
|
34359
34372
|
function parseInitializer() {
|
|
34360
|
-
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher(
|
|
34373
|
+
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
34361
34374
|
}
|
|
34362
|
-
function parseAssignmentExpressionOrHigher(
|
|
34375
|
+
function parseAssignmentExpressionOrHigher() {
|
|
34363
34376
|
// AssignmentExpression[in,yield]:
|
|
34364
34377
|
// 1) ConditionalExpression[?in,?yield]
|
|
34365
34378
|
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
|
|
@@ -34385,7 +34398,7 @@ var ts;
|
|
|
34385
34398
|
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
|
|
34386
34399
|
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
|
|
34387
34400
|
// with AssignmentExpression if we see one.
|
|
34388
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(
|
|
34401
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
34389
34402
|
if (arrowExpression) {
|
|
34390
34403
|
return arrowExpression;
|
|
34391
34404
|
}
|
|
@@ -34404,7 +34417,7 @@ var ts;
|
|
|
34404
34417
|
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
|
|
34405
34418
|
// identifier and the current token is an arrow.
|
|
34406
34419
|
if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
|
|
34407
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
34420
|
+
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
|
|
34408
34421
|
}
|
|
34409
34422
|
// Now see if we might be in cases '2' or '3'.
|
|
34410
34423
|
// If the expression was a LHS expression, and we have an assignment operator, then
|
|
@@ -34413,7 +34426,7 @@ var ts;
|
|
|
34413
34426
|
// Note: we call reScanGreaterToken so that we get an appropriately merged token
|
|
34414
34427
|
// for cases like `> > =` becoming `>>=`
|
|
34415
34428
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
34416
|
-
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(
|
|
34429
|
+
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
|
|
34417
34430
|
}
|
|
34418
34431
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34419
34432
|
return parseConditionalExpressionRest(expr, pos);
|
|
@@ -34456,7 +34469,7 @@ var ts;
|
|
|
34456
34469
|
nextToken();
|
|
34457
34470
|
if (!scanner.hasPrecedingLineBreak() &&
|
|
34458
34471
|
(token() === 41 /* AsteriskToken */ || isStartOfExpression())) {
|
|
34459
|
-
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher(
|
|
34472
|
+
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher()), pos);
|
|
34460
34473
|
}
|
|
34461
34474
|
else {
|
|
34462
34475
|
// if the next token is not on the same line as yield. or we don't have an '*' or
|
|
@@ -34464,7 +34477,7 @@ var ts;
|
|
|
34464
34477
|
return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
|
|
34465
34478
|
}
|
|
34466
34479
|
}
|
|
34467
|
-
function parseSimpleArrowFunctionExpression(pos, identifier,
|
|
34480
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
34468
34481
|
ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
34469
34482
|
var parameter = factory.createParameterDeclaration(
|
|
34470
34483
|
/*decorators*/ undefined,
|
|
@@ -34476,11 +34489,11 @@ var ts;
|
|
|
34476
34489
|
finishNode(parameter, identifier.pos);
|
|
34477
34490
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
34478
34491
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
34479
|
-
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier
|
|
34492
|
+
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
|
|
34480
34493
|
var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
|
|
34481
34494
|
return addJSDocComment(finishNode(node, pos));
|
|
34482
34495
|
}
|
|
34483
|
-
function tryParseParenthesizedArrowFunctionExpression(
|
|
34496
|
+
function tryParseParenthesizedArrowFunctionExpression() {
|
|
34484
34497
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
34485
34498
|
if (triState === 0 /* False */) {
|
|
34486
34499
|
// It's definitely not a parenthesized arrow function expression.
|
|
@@ -34491,8 +34504,8 @@ var ts;
|
|
|
34491
34504
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34492
34505
|
// expression instead.
|
|
34493
34506
|
return triState === 1 /* True */ ?
|
|
34494
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true
|
|
34495
|
-
tryParse(
|
|
34507
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
|
|
34508
|
+
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
34496
34509
|
}
|
|
34497
34510
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
34498
34511
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
@@ -34622,25 +34635,25 @@ var ts;
|
|
|
34622
34635
|
return 2 /* Unknown */;
|
|
34623
34636
|
}
|
|
34624
34637
|
}
|
|
34625
|
-
function parsePossibleParenthesizedArrowFunctionExpression(
|
|
34638
|
+
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
34626
34639
|
var tokenPos = scanner.getTokenPos();
|
|
34627
34640
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
34628
34641
|
return undefined;
|
|
34629
34642
|
}
|
|
34630
|
-
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false
|
|
34643
|
+
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
|
|
34631
34644
|
if (!result) {
|
|
34632
34645
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
34633
34646
|
}
|
|
34634
34647
|
return result;
|
|
34635
34648
|
}
|
|
34636
|
-
function tryParseAsyncSimpleArrowFunctionExpression(
|
|
34649
|
+
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
34637
34650
|
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
|
|
34638
34651
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34639
34652
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
34640
34653
|
var pos = getNodePos();
|
|
34641
34654
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
34642
34655
|
var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
34643
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
34656
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
34644
34657
|
}
|
|
34645
34658
|
}
|
|
34646
34659
|
return undefined;
|
|
@@ -34664,7 +34677,7 @@ var ts;
|
|
|
34664
34677
|
}
|
|
34665
34678
|
return 0 /* False */;
|
|
34666
34679
|
}
|
|
34667
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity
|
|
34680
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
34668
34681
|
var pos = getNodePos();
|
|
34669
34682
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
34670
34683
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -34699,23 +34712,6 @@ var ts;
|
|
|
34699
34712
|
return undefined;
|
|
34700
34713
|
}
|
|
34701
34714
|
}
|
|
34702
|
-
// Given:
|
|
34703
|
-
// x ? y => ({ y }) : z => ({ z })
|
|
34704
|
-
// We try to parse the body of the first arrow function by looking at:
|
|
34705
|
-
// ({ y }) : z => ({ z })
|
|
34706
|
-
// This is a valid arrow function with "z" as the return type.
|
|
34707
|
-
//
|
|
34708
|
-
// But, if we're in the true side of a conditional expression, this colon
|
|
34709
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34710
|
-
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34711
|
-
//
|
|
34712
|
-
// For example,
|
|
34713
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34714
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34715
|
-
// be an arrow expression, so we allow a return type.
|
|
34716
|
-
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34717
|
-
return undefined;
|
|
34718
|
-
}
|
|
34719
34715
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34720
34716
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34721
34717
|
return undefined;
|
|
@@ -34744,12 +34740,12 @@ var ts;
|
|
|
34744
34740
|
var lastToken = token();
|
|
34745
34741
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
34746
34742
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34747
|
-
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier)
|
|
34743
|
+
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
|
|
34748
34744
|
: parseIdentifier();
|
|
34749
34745
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34750
34746
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34751
34747
|
}
|
|
34752
|
-
function parseArrowFunctionExpressionBody(isAsync
|
|
34748
|
+
function parseArrowFunctionExpressionBody(isAsync) {
|
|
34753
34749
|
if (token() === 18 /* OpenBraceToken */) {
|
|
34754
34750
|
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
|
|
34755
34751
|
}
|
|
@@ -34777,8 +34773,8 @@ var ts;
|
|
|
34777
34773
|
var savedTopLevel = topLevel;
|
|
34778
34774
|
topLevel = false;
|
|
34779
34775
|
var node = isAsync
|
|
34780
|
-
? doInAwaitContext(
|
|
34781
|
-
: doOutsideOfAwaitContext(
|
|
34776
|
+
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
34777
|
+
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
34782
34778
|
topLevel = savedTopLevel;
|
|
34783
34779
|
return node;
|
|
34784
34780
|
}
|
|
@@ -34791,8 +34787,8 @@ var ts;
|
|
|
34791
34787
|
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
|
|
34792
34788
|
// we do not that for the 'whenFalse' part.
|
|
34793
34789
|
var colonToken;
|
|
34794
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext,
|
|
34795
|
-
? parseAssignmentExpressionOrHigher(
|
|
34790
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34791
|
+
? parseAssignmentExpressionOrHigher()
|
|
34796
34792
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34797
34793
|
}
|
|
34798
34794
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -35684,13 +35680,13 @@ var ts;
|
|
|
35684
35680
|
function parseSpreadElement() {
|
|
35685
35681
|
var pos = getNodePos();
|
|
35686
35682
|
parseExpected(25 /* DotDotDotToken */);
|
|
35687
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
35683
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
35688
35684
|
return finishNode(factory.createSpreadElement(expression), pos);
|
|
35689
35685
|
}
|
|
35690
35686
|
function parseArgumentOrArrayLiteralElement() {
|
|
35691
35687
|
return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
|
|
35692
35688
|
token() === 27 /* CommaToken */ ? finishNode(factory.createOmittedExpression(), getNodePos()) :
|
|
35693
|
-
parseAssignmentExpressionOrHigher(
|
|
35689
|
+
parseAssignmentExpressionOrHigher();
|
|
35694
35690
|
}
|
|
35695
35691
|
function parseArgumentExpression() {
|
|
35696
35692
|
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
|
|
@@ -35708,7 +35704,7 @@ var ts;
|
|
|
35708
35704
|
var pos = getNodePos();
|
|
35709
35705
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35710
35706
|
if (parseOptionalToken(25 /* DotDotDotToken */)) {
|
|
35711
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
35707
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
35712
35708
|
return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
|
|
35713
35709
|
}
|
|
35714
35710
|
var decorators = parseDecorators();
|
|
@@ -35737,7 +35733,7 @@ var ts;
|
|
|
35737
35733
|
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58 /* ColonToken */);
|
|
35738
35734
|
if (isShorthandPropertyAssignment) {
|
|
35739
35735
|
var equalsToken = parseOptionalToken(63 /* EqualsToken */);
|
|
35740
|
-
var objectAssignmentInitializer = equalsToken ? allowInAnd(
|
|
35736
|
+
var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
|
|
35741
35737
|
node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
|
|
35742
35738
|
// Save equals token for error reporting.
|
|
35743
35739
|
// TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful.
|
|
@@ -35745,7 +35741,7 @@ var ts;
|
|
|
35745
35741
|
}
|
|
35746
35742
|
else {
|
|
35747
35743
|
parseExpected(58 /* ColonToken */);
|
|
35748
|
-
var initializer = allowInAnd(
|
|
35744
|
+
var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
35749
35745
|
node = factory.createPropertyAssignment(name, initializer);
|
|
35750
35746
|
}
|
|
35751
35747
|
// Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
|
|
@@ -35919,7 +35915,7 @@ var ts;
|
|
|
35919
35915
|
}
|
|
35920
35916
|
var node;
|
|
35921
35917
|
if (awaitToken ? parseExpected(160 /* OfKeyword */) : parseOptional(160 /* OfKeyword */)) {
|
|
35922
|
-
var expression = allowInAnd(
|
|
35918
|
+
var expression = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
35923
35919
|
parseExpected(21 /* CloseParenToken */);
|
|
35924
35920
|
node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
|
|
35925
35921
|
}
|
|
@@ -37087,7 +37083,7 @@ var ts;
|
|
|
37087
37083
|
var pos = getNodePos();
|
|
37088
37084
|
var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
|
|
37089
37085
|
parseExpected(58 /* ColonToken */);
|
|
37090
|
-
var value = parseAssignmentExpressionOrHigher(
|
|
37086
|
+
var value = parseAssignmentExpressionOrHigher();
|
|
37091
37087
|
return finishNode(factory.createAssertEntry(name, value), pos);
|
|
37092
37088
|
}
|
|
37093
37089
|
function parseAssertClause(skipAssertKeyword) {
|
|
@@ -37147,7 +37143,7 @@ var ts;
|
|
|
37147
37143
|
function parseModuleReference() {
|
|
37148
37144
|
return isExternalModuleReference()
|
|
37149
37145
|
? parseExternalModuleReference()
|
|
37150
|
-
: parseEntityName(/*allowReservedWords*/ false
|
|
37146
|
+
: parseEntityName(/*allowReservedWords*/ false);
|
|
37151
37147
|
}
|
|
37152
37148
|
function parseExternalModuleReference() {
|
|
37153
37149
|
var pos = getNodePos();
|
|
@@ -37326,7 +37322,7 @@ var ts;
|
|
|
37326
37322
|
else {
|
|
37327
37323
|
parseExpected(88 /* DefaultKeyword */);
|
|
37328
37324
|
}
|
|
37329
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
37325
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
37330
37326
|
parseSemicolon();
|
|
37331
37327
|
setAwaitContext(savedAwaitContext);
|
|
37332
37328
|
var node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression);
|
|
@@ -37400,7 +37396,7 @@ var ts;
|
|
|
37400
37396
|
var pos = getNodePos();
|
|
37401
37397
|
var hasBrace = parseOptional(18 /* OpenBraceToken */);
|
|
37402
37398
|
var p2 = getNodePos();
|
|
37403
|
-
var entityName = parseEntityName(/* allowReservedWords*/ false
|
|
37399
|
+
var entityName = parseEntityName(/* allowReservedWords*/ false);
|
|
37404
37400
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
37405
37401
|
reScanHashToken(); // rescan #id as # id
|
|
37406
37402
|
nextTokenJSDoc(); // then skip the #
|
|
@@ -37843,7 +37839,7 @@ var ts;
|
|
|
37843
37839
|
// parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error
|
|
37844
37840
|
var p2 = getNodePos();
|
|
37845
37841
|
var name = ts.tokenIsIdentifierOrKeyword(token())
|
|
37846
|
-
? parseEntityName(/*allowReservedWords*/ true
|
|
37842
|
+
? parseEntityName(/*allowReservedWords*/ true)
|
|
37847
37843
|
: undefined;
|
|
37848
37844
|
if (name) {
|
|
37849
37845
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
@@ -39165,6 +39161,7 @@ var ts;
|
|
|
39165
39161
|
["es2021.intl", "lib.es2021.intl.d.ts"],
|
|
39166
39162
|
["es2022.array", "lib.es2022.array.d.ts"],
|
|
39167
39163
|
["es2022.error", "lib.es2022.error.d.ts"],
|
|
39164
|
+
["es2022.intl", "lib.es2022.intl.d.ts"],
|
|
39168
39165
|
["es2022.object", "lib.es2022.object.d.ts"],
|
|
39169
39166
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
39170
39167
|
["esnext.array", "lib.es2022.array.d.ts"],
|
|
@@ -39500,7 +39497,7 @@ var ts;
|
|
|
39500
39497
|
es2020: ts.ModuleKind.ES2020,
|
|
39501
39498
|
es2022: ts.ModuleKind.ES2022,
|
|
39502
39499
|
esnext: ts.ModuleKind.ESNext,
|
|
39503
|
-
|
|
39500
|
+
node16: ts.ModuleKind.Node16,
|
|
39504
39501
|
nodenext: ts.ModuleKind.NodeNext,
|
|
39505
39502
|
})),
|
|
39506
39503
|
affectsModuleResolution: true,
|
|
@@ -39854,7 +39851,7 @@ var ts;
|
|
|
39854
39851
|
type: new ts.Map(ts.getEntries({
|
|
39855
39852
|
node: ts.ModuleResolutionKind.NodeJs,
|
|
39856
39853
|
classic: ts.ModuleResolutionKind.Classic,
|
|
39857
|
-
|
|
39854
|
+
node16: ts.ModuleResolutionKind.Node16,
|
|
39858
39855
|
nodenext: ts.ModuleResolutionKind.NodeNext,
|
|
39859
39856
|
})),
|
|
39860
39857
|
affectsModuleResolution: true,
|
|
@@ -40330,7 +40327,7 @@ var ts;
|
|
|
40330
40327
|
affectsModuleResolution: true,
|
|
40331
40328
|
description: ts.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
40332
40329
|
category: ts.Diagnostics.Language_and_Environment,
|
|
40333
|
-
defaultValueDescription: ts.Diagnostics.
|
|
40330
|
+
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
40331
|
}
|
|
40335
40332
|
];
|
|
40336
40333
|
/* @internal */
|
|
@@ -42363,7 +42360,7 @@ var ts;
|
|
|
42363
42360
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
42364
42361
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
42365
42362
|
}
|
|
42366
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, resultFromCache) {
|
|
42363
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, diagnostics, resultFromCache) {
|
|
42367
42364
|
var _a;
|
|
42368
42365
|
if (resultFromCache) {
|
|
42369
42366
|
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
@@ -42371,7 +42368,8 @@ var ts;
|
|
|
42371
42368
|
}
|
|
42372
42369
|
return {
|
|
42373
42370
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
42374
|
-
failedLookupLocations: failedLookupLocations
|
|
42371
|
+
failedLookupLocations: failedLookupLocations,
|
|
42372
|
+
resolutionDiagnostics: diagnostics
|
|
42375
42373
|
};
|
|
42376
42374
|
}
|
|
42377
42375
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
@@ -42566,13 +42564,24 @@ var ts;
|
|
|
42566
42564
|
// 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
42565
|
// 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
42566
|
// 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 (`
|
|
42567
|
+
// resolution" should be (`node16`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
|
|
42570
42568
|
// 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.
|
|
42569
|
+
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
|
|
42572
42570
|
features |= NodeResolutionFeatures.EsmMode;
|
|
42573
42571
|
}
|
|
42574
42572
|
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
42575
|
-
var
|
|
42573
|
+
var diagnostics = [];
|
|
42574
|
+
var moduleResolutionState = {
|
|
42575
|
+
compilerOptions: options,
|
|
42576
|
+
host: host,
|
|
42577
|
+
traceEnabled: traceEnabled,
|
|
42578
|
+
failedLookupLocations: failedLookupLocations,
|
|
42579
|
+
packageJsonInfoCache: cache,
|
|
42580
|
+
features: features,
|
|
42581
|
+
conditions: conditions,
|
|
42582
|
+
requestContainingDirectory: containingDirectory,
|
|
42583
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
42584
|
+
};
|
|
42576
42585
|
var resolved = primaryLookup();
|
|
42577
42586
|
var primary = true;
|
|
42578
42587
|
if (!resolved) {
|
|
@@ -42591,7 +42600,7 @@ var ts;
|
|
|
42591
42600
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
42592
42601
|
};
|
|
42593
42602
|
}
|
|
42594
|
-
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
|
|
42603
|
+
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, resolutionDiagnostics: diagnostics };
|
|
42595
42604
|
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
|
|
42596
42605
|
if (traceEnabled)
|
|
42597
42606
|
traceResult(result);
|
|
@@ -42657,7 +42666,7 @@ var ts;
|
|
|
42657
42666
|
}
|
|
42658
42667
|
ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
|
|
42659
42668
|
function getDefaultNodeResolutionFeatures(options) {
|
|
42660
|
-
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42669
|
+
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default :
|
|
42661
42670
|
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
42662
42671
|
NodeResolutionFeatures.None;
|
|
42663
42672
|
}
|
|
@@ -42674,6 +42683,8 @@ var ts;
|
|
|
42674
42683
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
42675
42684
|
conditions: ts.emptyArray,
|
|
42676
42685
|
features: NodeResolutionFeatures.None,
|
|
42686
|
+
requestContainingDirectory: containingDirectory,
|
|
42687
|
+
reportDiagnostic: ts.noop
|
|
42677
42688
|
};
|
|
42678
42689
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
42679
42690
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
@@ -43015,8 +43026,8 @@ var ts;
|
|
|
43015
43026
|
case ts.ModuleKind.CommonJS:
|
|
43016
43027
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
43017
43028
|
break;
|
|
43018
|
-
case ts.ModuleKind.
|
|
43019
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
43029
|
+
case ts.ModuleKind.Node16:
|
|
43030
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
43020
43031
|
break;
|
|
43021
43032
|
case ts.ModuleKind.NodeNext:
|
|
43022
43033
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -43036,8 +43047,8 @@ var ts;
|
|
|
43036
43047
|
}
|
|
43037
43048
|
ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
|
|
43038
43049
|
switch (moduleResolution) {
|
|
43039
|
-
case ts.ModuleResolutionKind.
|
|
43040
|
-
result =
|
|
43050
|
+
case ts.ModuleResolutionKind.Node16:
|
|
43051
|
+
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43041
43052
|
break;
|
|
43042
43053
|
case ts.ModuleResolutionKind.NodeNext:
|
|
43043
43054
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43271,15 +43282,15 @@ var ts;
|
|
|
43271
43282
|
// respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
|
|
43272
43283
|
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
43273
43284
|
// allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
|
|
43274
|
-
// not
|
|
43285
|
+
// not supported in node 12 - https://github.com/nodejs/Release/issues/690
|
|
43275
43286
|
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
43276
43287
|
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
43277
|
-
NodeResolutionFeatures[NodeResolutionFeatures["
|
|
43288
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Node16Default"] = 30] = "Node16Default";
|
|
43278
43289
|
NodeResolutionFeatures[NodeResolutionFeatures["NodeNextDefault"] = 30] = "NodeNextDefault";
|
|
43279
43290
|
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
43280
43291
|
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
43281
|
-
function
|
|
43282
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.
|
|
43292
|
+
function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43293
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node16Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43283
43294
|
}
|
|
43284
43295
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43285
43296
|
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43319,12 +43330,13 @@ var ts;
|
|
|
43319
43330
|
var _a, _b;
|
|
43320
43331
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
43321
43332
|
var failedLookupLocations = [];
|
|
43322
|
-
// conditions are only used by the
|
|
43333
|
+
// conditions are only used by the node16/nodenext resolver - there's no priority order in the list,
|
|
43323
43334
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43324
43335
|
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43325
43336
|
if (compilerOptions.noDtsResolution) {
|
|
43326
43337
|
conditions.pop();
|
|
43327
43338
|
}
|
|
43339
|
+
var diagnostics = [];
|
|
43328
43340
|
var state = {
|
|
43329
43341
|
compilerOptions: compilerOptions,
|
|
43330
43342
|
host: host,
|
|
@@ -43333,9 +43345,11 @@ var ts;
|
|
|
43333
43345
|
packageJsonInfoCache: cache,
|
|
43334
43346
|
features: features,
|
|
43335
43347
|
conditions: conditions,
|
|
43348
|
+
requestContainingDirectory: containingDirectory,
|
|
43349
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
43336
43350
|
};
|
|
43337
43351
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43338
|
-
return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, state.resultFromCache);
|
|
43352
|
+
return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
43339
43353
|
function tryResolve(extensions) {
|
|
43340
43354
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, /*considerPackageJson*/ true); };
|
|
43341
43355
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -43508,9 +43522,9 @@ var ts;
|
|
|
43508
43522
|
}
|
|
43509
43523
|
}
|
|
43510
43524
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
43511
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
43525
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, ts.supportedTSExtensionsFlat)) {
|
|
43512
43526
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
43513
|
-
return result !== undefined ? { path: candidate, ext: ts.
|
|
43527
|
+
return result !== undefined ? { path: candidate, ext: ts.tryExtractTSExtension(candidate) } : undefined;
|
|
43514
43528
|
}
|
|
43515
43529
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
43516
43530
|
}
|
|
@@ -43633,6 +43647,8 @@ var ts;
|
|
|
43633
43647
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
43634
43648
|
conditions: ["node", "require", "types"],
|
|
43635
43649
|
features: features,
|
|
43650
|
+
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
43651
|
+
reportDiagnostic: ts.noop
|
|
43636
43652
|
};
|
|
43637
43653
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
|
|
43638
43654
|
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
@@ -43719,6 +43735,8 @@ var ts;
|
|
|
43719
43735
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
43720
43736
|
features: 0,
|
|
43721
43737
|
conditions: [],
|
|
43738
|
+
requestContainingDirectory: undefined,
|
|
43739
|
+
reportDiagnostic: ts.noop
|
|
43722
43740
|
};
|
|
43723
43741
|
var parts = ts.getPathComponents(fileName);
|
|
43724
43742
|
parts.pop();
|
|
@@ -44010,7 +44028,6 @@ var ts;
|
|
|
44010
44028
|
function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
|
44011
44029
|
return loadModuleFromTargetImportOrExport;
|
|
44012
44030
|
function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
|
|
44013
|
-
var _a, _b;
|
|
44014
44031
|
if (typeof target === "string") {
|
|
44015
44032
|
if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
|
|
44016
44033
|
if (state.traceEnabled) {
|
|
@@ -44047,13 +44064,16 @@ var ts;
|
|
|
44047
44064
|
}
|
|
44048
44065
|
return toSearchResult(/*value*/ undefined);
|
|
44049
44066
|
}
|
|
44050
|
-
var finalPath =
|
|
44067
|
+
var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
|
|
44068
|
+
var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
44069
|
+
if (inputLink)
|
|
44070
|
+
return inputLink;
|
|
44051
44071
|
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, finalPath, /*onlyRecordFailures*/ false, state)));
|
|
44052
44072
|
}
|
|
44053
44073
|
else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
|
|
44054
44074
|
if (!Array.isArray(target)) {
|
|
44055
|
-
for (var _i = 0,
|
|
44056
|
-
var key =
|
|
44075
|
+
for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) {
|
|
44076
|
+
var key = _a[_i];
|
|
44057
44077
|
if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
|
|
44058
44078
|
var subTarget = target[key];
|
|
44059
44079
|
var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
|
|
@@ -44071,8 +44091,8 @@ var ts;
|
|
|
44071
44091
|
}
|
|
44072
44092
|
return toSearchResult(/*value*/ undefined);
|
|
44073
44093
|
}
|
|
44074
|
-
for (var
|
|
44075
|
-
var elem = target_2[
|
|
44094
|
+
for (var _b = 0, target_2 = target; _b < target_2.length; _b++) {
|
|
44095
|
+
var elem = target_2[_b];
|
|
44076
44096
|
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
44077
44097
|
if (result) {
|
|
44078
44098
|
return result;
|
|
@@ -44090,6 +44110,128 @@ var ts;
|
|
|
44090
44110
|
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
44091
44111
|
}
|
|
44092
44112
|
return toSearchResult(/*value*/ undefined);
|
|
44113
|
+
function toAbsolutePath(path) {
|
|
44114
|
+
var _a, _b;
|
|
44115
|
+
if (path === undefined)
|
|
44116
|
+
return path;
|
|
44117
|
+
return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
|
|
44118
|
+
}
|
|
44119
|
+
function combineDirectoryPath(root, dir) {
|
|
44120
|
+
return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
|
|
44121
|
+
}
|
|
44122
|
+
function useCaseSensitiveFileNames() {
|
|
44123
|
+
return !state.host.useCaseSensitiveFileNames ? true :
|
|
44124
|
+
typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames :
|
|
44125
|
+
state.host.useCaseSensitiveFileNames();
|
|
44126
|
+
}
|
|
44127
|
+
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports) {
|
|
44128
|
+
var _a, _b, _c, _d;
|
|
44129
|
+
// Replace any references to outputs for files in the program with the input files to support package self-names used with outDir
|
|
44130
|
+
// PROBLEM: We don't know how to calculate the output paths yet, because the "common source directory" we use as the base of the file structure
|
|
44131
|
+
// we reproduce into the output directory is based on the set of input files, which we're still in the process of traversing and resolving!
|
|
44132
|
+
// _Given that_, we have to guess what the base of the output directory is (obviously the user wrote the export map, so has some idea what it is!).
|
|
44133
|
+
// We are going to probe _so many_ possible paths. We limit where we'll do this to try to reduce the possibilities of false positive lookups.
|
|
44134
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
|
|
44135
|
+
&& (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
|
|
44136
|
+
&& finalPath.indexOf("/node_modules/") === -1
|
|
44137
|
+
&& (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
|
|
44138
|
+
// So that all means we'll only try these guesses for files outside `node_modules` in a directory where the `package.json` and `tsconfig.json` are siblings.
|
|
44139
|
+
// Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
|
|
44140
|
+
// `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
|
|
44141
|
+
var getCanonicalFileName = ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames });
|
|
44142
|
+
var commonSourceDirGuesses = [];
|
|
44143
|
+
// A `rootDir` compiler option strongly indicates the root location
|
|
44144
|
+
// A `composite` project is using project references and has it's common src dir set to `.`, so it shouldn't need to check any other locations
|
|
44145
|
+
if (state.compilerOptions.rootDir || (state.compilerOptions.composite && state.compilerOptions.configFilePath)) {
|
|
44146
|
+
var commonDir = toAbsolutePath(ts.getCommonSourceDirectory(state.compilerOptions, function () { return []; }, ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "", getCanonicalFileName));
|
|
44147
|
+
commonSourceDirGuesses.push(commonDir);
|
|
44148
|
+
}
|
|
44149
|
+
else if (state.requestContainingDirectory) {
|
|
44150
|
+
// However without either of those set we're in the dark. Let's say you have
|
|
44151
|
+
//
|
|
44152
|
+
// ./tools/index.ts
|
|
44153
|
+
// ./src/index.ts
|
|
44154
|
+
// ./dist/index.js
|
|
44155
|
+
// ./package.json <-- references ./dist/index.js
|
|
44156
|
+
// ./tsconfig.json <-- loads ./src/index.ts
|
|
44157
|
+
//
|
|
44158
|
+
// How do we know `./src` is the common src dir, and not `./tools`, given only the `./dist` out dir and `./dist/index.js` filename?
|
|
44159
|
+
// Answer: We... don't. We know we're looking for an `index.ts` input file, but we have _no clue_ which subfolder it's supposed to be loaded from
|
|
44160
|
+
// without more context.
|
|
44161
|
+
// But we do have more context! Just a tiny bit more! We're resolving an import _for some other input file_! And that input file, too
|
|
44162
|
+
// must be inside the common source directory! So we propagate that tidbit of info all the way to here via state.requestContainingDirectory
|
|
44163
|
+
var requestingFile_1 = toAbsolutePath(ts.combinePaths(state.requestContainingDirectory, "index.ts"));
|
|
44164
|
+
// And we can try every folder above the common folder for the request folder and the config/package base directory
|
|
44165
|
+
// This technically can be wrong - we may load ./src/index.ts when ./src/sub/index.ts was right because we don't
|
|
44166
|
+
// know if only `./src/sub` files were loaded by the program; but this has the best chance to be right of just about anything
|
|
44167
|
+
// else we have. And, given that we're about to load `./src/index.ts` because we choose it as likely correct, there will then
|
|
44168
|
+
// be a file outside of `./src/sub` in the program (the file we resolved to), making us de-facto right. So this fallback lookup
|
|
44169
|
+
// logic may influence what files are pulled in by self-names, which in turn influences the output path shape, but it's all
|
|
44170
|
+
// internally consistent so the paths should be stable so long as we prefer the "most general" (meaning: top-most-level directory) possible results first.
|
|
44171
|
+
var commonDir = toAbsolutePath(ts.getCommonSourceDirectory(state.compilerOptions, function () { return [requestingFile_1, toAbsolutePath(packagePath)]; }, ((_d = (_c = state.host).getCurrentDirectory) === null || _d === void 0 ? void 0 : _d.call(_c)) || "", getCanonicalFileName));
|
|
44172
|
+
commonSourceDirGuesses.push(commonDir);
|
|
44173
|
+
var fragment = ts.ensureTrailingDirectorySeparator(commonDir);
|
|
44174
|
+
while (fragment && fragment.length > 1) {
|
|
44175
|
+
var parts = ts.getPathComponents(fragment);
|
|
44176
|
+
parts.pop(); // remove a directory
|
|
44177
|
+
var commonDir_1 = ts.getPathFromPathComponents(parts);
|
|
44178
|
+
commonSourceDirGuesses.unshift(commonDir_1);
|
|
44179
|
+
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
44180
|
+
}
|
|
44181
|
+
}
|
|
44182
|
+
if (commonSourceDirGuesses.length > 1) {
|
|
44183
|
+
state.reportDiagnostic(ts.createCompilerDiagnostic(isImports
|
|
44184
|
+
? ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate
|
|
44185
|
+
: ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate, entry === "" ? "." : entry, // replace empty string with `.` - the reverse of the operation done when entries are built - so main entrypoint errors don't look weird
|
|
44186
|
+
packagePath));
|
|
44187
|
+
}
|
|
44188
|
+
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
44189
|
+
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
44190
|
+
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
44191
|
+
for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
|
|
44192
|
+
var candidateDir = candidateDirectories_1[_e];
|
|
44193
|
+
if (ts.startsWith(finalPath, candidateDir)) {
|
|
44194
|
+
// The matched export is looking up something in either the out declaration or js dir, now map the written path back into the source dir and source extension
|
|
44195
|
+
var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
|
|
44196
|
+
var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
|
|
44197
|
+
var jsAndDtsExtensions = [".mjs" /* Mjs */, ".cjs" /* Cjs */, ".js" /* Js */, ".json" /* Json */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".d.ts" /* Dts */];
|
|
44198
|
+
for (var _f = 0, jsAndDtsExtensions_1 = jsAndDtsExtensions; _f < jsAndDtsExtensions_1.length; _f++) {
|
|
44199
|
+
var ext = jsAndDtsExtensions_1[_f];
|
|
44200
|
+
if (ts.fileExtensionIs(possibleInputBase, ext)) {
|
|
44201
|
+
var inputExts = ts.getPossibleOriginalInputExtensionForExtension(possibleInputBase);
|
|
44202
|
+
for (var _g = 0, inputExts_1 = inputExts; _g < inputExts_1.length; _g++) {
|
|
44203
|
+
var possibleExt = inputExts_1[_g];
|
|
44204
|
+
var possibleInputWithInputExtension = ts.changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
44205
|
+
if ((extensions === Extensions.TypeScript && ts.hasJSFileExtension(possibleInputWithInputExtension)) ||
|
|
44206
|
+
(extensions === Extensions.JavaScript && ts.hasTSFileExtension(possibleInputWithInputExtension))) {
|
|
44207
|
+
continue;
|
|
44208
|
+
}
|
|
44209
|
+
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
44210
|
+
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, possibleInputWithInputExtension, /*onlyRecordFailures*/ false, state)));
|
|
44211
|
+
}
|
|
44212
|
+
}
|
|
44213
|
+
}
|
|
44214
|
+
}
|
|
44215
|
+
}
|
|
44216
|
+
}
|
|
44217
|
+
}
|
|
44218
|
+
}
|
|
44219
|
+
return undefined;
|
|
44220
|
+
function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
|
|
44221
|
+
var _a, _b;
|
|
44222
|
+
// Config file ouput paths are processed to be relative to the host's current directory, while
|
|
44223
|
+
// otherwise the paths are resolved relative to the common source dir the compiler puts together
|
|
44224
|
+
var currentDir = state.compilerOptions.configFile ? ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "" : commonSourceDirGuess;
|
|
44225
|
+
var candidateDirectories = [];
|
|
44226
|
+
if (state.compilerOptions.declarationDir) {
|
|
44227
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
|
|
44228
|
+
}
|
|
44229
|
+
if (state.compilerOptions.outDir && state.compilerOptions.outDir !== state.compilerOptions.declarationDir) {
|
|
44230
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.outDir)));
|
|
44231
|
+
}
|
|
44232
|
+
return candidateDirectories;
|
|
44233
|
+
}
|
|
44234
|
+
}
|
|
44093
44235
|
}
|
|
44094
44236
|
}
|
|
44095
44237
|
/* @internal */
|
|
@@ -44280,11 +44422,12 @@ var ts;
|
|
|
44280
44422
|
function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
44281
44423
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
44282
44424
|
var failedLookupLocations = [];
|
|
44283
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [] };
|
|
44284
44425
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
44426
|
+
var diagnostics = [];
|
|
44427
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [], requestContainingDirectory: containingDirectory, reportDiagnostic: function (diag) { return void diagnostics.push(diag); } };
|
|
44285
44428
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
44286
44429
|
// No originalPath because classic resolution doesn't resolve realPath
|
|
44287
|
-
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, state.resultFromCache);
|
|
44430
|
+
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
44288
44431
|
function tryResolve(extensions) {
|
|
44289
44432
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
44290
44433
|
if (resolvedUsingSettings) {
|
|
@@ -44327,9 +44470,10 @@ var ts;
|
|
|
44327
44470
|
trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache);
|
|
44328
44471
|
}
|
|
44329
44472
|
var failedLookupLocations = [];
|
|
44330
|
-
var
|
|
44473
|
+
var diagnostics = [];
|
|
44474
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache, features: NodeResolutionFeatures.None, conditions: [], requestContainingDirectory: undefined, reportDiagnostic: function (diag) { return void diagnostics.push(diag); } };
|
|
44331
44475
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
44332
|
-
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, state.resultFromCache);
|
|
44476
|
+
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
44333
44477
|
}
|
|
44334
44478
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
44335
44479
|
/**
|
|
@@ -48706,7 +48850,7 @@ var ts;
|
|
|
48706
48850
|
var enumRelation = new ts.Map();
|
|
48707
48851
|
var builtinGlobals = ts.createSymbolTable();
|
|
48708
48852
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
48709
|
-
// Extensions suggested for path imports when module resolution is
|
|
48853
|
+
// Extensions suggested for path imports when module resolution is node16 or higher.
|
|
48710
48854
|
// The first element of each tuple is the extension a file has.
|
|
48711
48855
|
// The second element of each tuple is the extension that should be used in a path import.
|
|
48712
48856
|
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
@@ -50995,7 +51139,7 @@ var ts;
|
|
|
50995
51139
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
50996
51140
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
50997
51141
|
}
|
|
50998
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
51142
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
50999
51143
|
var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
|
|
51000
51144
|
var overrideClauseHost = ts.findAncestor(location, function (l) { return ts.isImportTypeNode(l) || ts.isExportDeclaration(l) || ts.isImportDeclaration(l); });
|
|
51001
51145
|
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 +51148,6 @@ var ts;
|
|
|
51004
51148
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
|
|
51005
51149
|
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
51150
|
}
|
|
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
51151
|
}
|
|
51011
51152
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
51012
51153
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -51059,7 +51200,7 @@ var ts;
|
|
|
51059
51200
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
51060
51201
|
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
51061
51202
|
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
51062
|
-
var
|
|
51203
|
+
var resolutionIsNode16OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node16 ||
|
|
51063
51204
|
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
51064
51205
|
if (tsExtension) {
|
|
51065
51206
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
@@ -51080,17 +51221,17 @@ var ts;
|
|
|
51080
51221
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
51081
51222
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
51082
51223
|
}
|
|
51083
|
-
else if (mode === ts.ModuleKind.ESNext &&
|
|
51224
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
51084
51225
|
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
51085
51226
|
var suggestedExt = (_h = suggestedExtensions.find(function (_a) {
|
|
51086
51227
|
var actualExt = _a[0], _importExt = _a[1];
|
|
51087
51228
|
return host.fileExists(absoluteRef_1 + actualExt);
|
|
51088
51229
|
})) === null || _h === void 0 ? void 0 : _h[1];
|
|
51089
51230
|
if (suggestedExt) {
|
|
51090
|
-
error(errorNode, ts.Diagnostics.
|
|
51231
|
+
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
51232
|
}
|
|
51092
51233
|
else {
|
|
51093
|
-
error(errorNode, ts.Diagnostics.
|
|
51234
|
+
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
51235
|
}
|
|
51095
51236
|
}
|
|
51096
51237
|
else {
|
|
@@ -53412,7 +53553,7 @@ var ts;
|
|
|
53412
53553
|
var targetFile = ts.getSourceFileOfModule(chain[0]);
|
|
53413
53554
|
var specifier = void 0;
|
|
53414
53555
|
var assertion = void 0;
|
|
53415
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53556
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53416
53557
|
// An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion
|
|
53417
53558
|
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
53559
|
specifier = getSpecifierForModuleSymbol(chain[0], context, ts.ModuleKind.ESNext);
|
|
@@ -53426,7 +53567,7 @@ var ts;
|
|
|
53426
53567
|
}
|
|
53427
53568
|
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
|
|
53428
53569
|
var oldSpecifier = specifier;
|
|
53429
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53570
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53430
53571
|
// 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
53572
|
var swappedMode = (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat) === ts.ModuleKind.ESNext ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
53432
53573
|
specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
|
|
@@ -58196,7 +58337,8 @@ var ts;
|
|
|
58196
58337
|
if (symbol === globalThisSymbol) {
|
|
58197
58338
|
var varsOnly_1 = new ts.Map();
|
|
58198
58339
|
members.forEach(function (p) {
|
|
58199
|
-
|
|
58340
|
+
var _a;
|
|
58341
|
+
if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) === null || _a === void 0 ? void 0 : _a.length) && ts.every(p.declarations, ts.isAmbientModule))) {
|
|
58200
58342
|
varsOnly_1.set(p.escapedName, p);
|
|
58201
58343
|
}
|
|
58202
58344
|
});
|
|
@@ -71391,7 +71533,7 @@ var ts;
|
|
|
71391
71533
|
if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
71392
71534
|
var parent = declaration.parent.parent;
|
|
71393
71535
|
if (parent.kind === 254 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 164 /* Parameter */) {
|
|
71394
|
-
var links = getNodeLinks(
|
|
71536
|
+
var links = getNodeLinks(parent);
|
|
71395
71537
|
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
71396
71538
|
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
71397
71539
|
var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
|
|
@@ -77254,13 +77396,13 @@ var ts;
|
|
|
77254
77396
|
}
|
|
77255
77397
|
}
|
|
77256
77398
|
function checkImportMetaProperty(node) {
|
|
77257
|
-
if (moduleKind === ts.ModuleKind.
|
|
77399
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
77258
77400
|
if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
77259
77401
|
error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
77260
77402
|
}
|
|
77261
77403
|
}
|
|
77262
77404
|
else if (moduleKind < ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.System) {
|
|
77263
|
-
error(node, ts.Diagnostics.
|
|
77405
|
+
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
77406
|
}
|
|
77265
77407
|
var file = ts.getSourceFileOfNode(node);
|
|
77266
77408
|
ts.Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -78211,15 +78353,30 @@ var ts;
|
|
|
78211
78353
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
78212
78354
|
var span = void 0;
|
|
78213
78355
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
78214
|
-
|
|
78215
|
-
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
78356
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78216
78357
|
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
78358
|
diagnostics.add(diagnostic);
|
|
78218
78359
|
}
|
|
78219
|
-
|
|
78220
|
-
|
|
78221
|
-
|
|
78222
|
-
|
|
78360
|
+
switch (moduleKind) {
|
|
78361
|
+
case ts.ModuleKind.Node16:
|
|
78362
|
+
case ts.ModuleKind.NodeNext:
|
|
78363
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
78364
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78365
|
+
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));
|
|
78366
|
+
break;
|
|
78367
|
+
}
|
|
78368
|
+
// fallthrough
|
|
78369
|
+
case ts.ModuleKind.ES2022:
|
|
78370
|
+
case ts.ModuleKind.ESNext:
|
|
78371
|
+
case ts.ModuleKind.System:
|
|
78372
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
78373
|
+
break;
|
|
78374
|
+
}
|
|
78375
|
+
// fallthrough
|
|
78376
|
+
default:
|
|
78377
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78378
|
+
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));
|
|
78379
|
+
break;
|
|
78223
78380
|
}
|
|
78224
78381
|
}
|
|
78225
78382
|
}
|
|
@@ -80661,8 +80818,8 @@ var ts;
|
|
|
80661
80818
|
if (node.assertions) {
|
|
80662
80819
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80663
80820
|
if (override) {
|
|
80664
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
80665
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80821
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80822
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80666
80823
|
}
|
|
80667
80824
|
}
|
|
80668
80825
|
}
|
|
@@ -82112,7 +82269,7 @@ var ts;
|
|
|
82112
82269
|
}
|
|
82113
82270
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
82114
82271
|
// No need to check for require or exports for ES6 modules and later
|
|
82115
|
-
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.
|
|
82272
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node16 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
82116
82273
|
return;
|
|
82117
82274
|
}
|
|
82118
82275
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -85032,8 +85189,8 @@ var ts;
|
|
|
85032
85189
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
85033
85190
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85034
85191
|
if (validForTypeAssertions && override) {
|
|
85035
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
85036
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85192
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85193
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85037
85194
|
}
|
|
85038
85195
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
85039
85196
|
}
|
|
@@ -86372,7 +86529,7 @@ var ts;
|
|
|
86372
86529
|
if (ts.isDeclaration(node)) {
|
|
86373
86530
|
// In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
|
|
86374
86531
|
var symbol = getSymbolOfNode(node);
|
|
86375
|
-
return getTypeOfSymbol(symbol);
|
|
86532
|
+
return symbol ? getTypeOfSymbol(symbol) : errorType;
|
|
86376
86533
|
}
|
|
86377
86534
|
if (isDeclarationNameOrImportPropertyName(node)) {
|
|
86378
86535
|
var symbol = getSymbolAtLocation(node);
|
|
@@ -88220,8 +88377,24 @@ var ts;
|
|
|
88220
88377
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
88221
88378
|
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
88379
|
}
|
|
88223
|
-
|
|
88224
|
-
|
|
88380
|
+
switch (moduleKind) {
|
|
88381
|
+
case ts.ModuleKind.Node16:
|
|
88382
|
+
case ts.ModuleKind.NodeNext:
|
|
88383
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
88384
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
|
|
88385
|
+
break;
|
|
88386
|
+
}
|
|
88387
|
+
// fallthrough
|
|
88388
|
+
case ts.ModuleKind.ES2022:
|
|
88389
|
+
case ts.ModuleKind.ESNext:
|
|
88390
|
+
case ts.ModuleKind.System:
|
|
88391
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
88392
|
+
break;
|
|
88393
|
+
}
|
|
88394
|
+
// fallthrough
|
|
88395
|
+
default:
|
|
88396
|
+
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));
|
|
88397
|
+
break;
|
|
88225
88398
|
}
|
|
88226
88399
|
}
|
|
88227
88400
|
}
|
|
@@ -88916,7 +89089,7 @@ var ts;
|
|
|
88916
89089
|
}
|
|
88917
89090
|
function checkGrammarImportCallExpression(node) {
|
|
88918
89091
|
if (moduleKind === ts.ModuleKind.ES2015) {
|
|
88919
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
89092
|
+
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
89093
|
}
|
|
88921
89094
|
if (node.typeArguments) {
|
|
88922
89095
|
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 +89100,7 @@ var ts;
|
|
|
88927
89100
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
88928
89101
|
if (nodeArguments.length > 1) {
|
|
88929
89102
|
var assertionArgument = nodeArguments[1];
|
|
88930
|
-
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.
|
|
89103
|
+
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
|
|
88931
89104
|
}
|
|
88932
89105
|
}
|
|
88933
89106
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
@@ -109193,7 +109366,7 @@ var ts;
|
|
|
109193
109366
|
return ts.transformECMAScriptModule;
|
|
109194
109367
|
case ts.ModuleKind.System:
|
|
109195
109368
|
return ts.transformSystemModule;
|
|
109196
|
-
case ts.ModuleKind.
|
|
109369
|
+
case ts.ModuleKind.Node16:
|
|
109197
109370
|
case ts.ModuleKind.NodeNext:
|
|
109198
109371
|
return ts.transformNodeModule;
|
|
109199
109372
|
default:
|
|
@@ -116216,7 +116389,7 @@ var ts;
|
|
|
116216
116389
|
*/
|
|
116217
116390
|
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
116218
116391
|
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
116219
|
-
case ts.ModuleResolutionKind.
|
|
116392
|
+
case ts.ModuleResolutionKind.Node16:
|
|
116220
116393
|
case ts.ModuleResolutionKind.NodeNext:
|
|
116221
116394
|
return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
|
|
116222
116395
|
ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
|
|
@@ -116270,7 +116443,6 @@ var ts;
|
|
|
116270
116443
|
ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
|
|
116271
116444
|
ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
|
|
116272
116445
|
ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
|
|
116273
|
-
ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
|
|
116274
116446
|
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
116275
116447
|
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
116276
116448
|
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
@@ -116515,7 +116687,7 @@ var ts;
|
|
|
116515
116687
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
116516
116688
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
116517
116689
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
116518
|
-
// under
|
|
116690
|
+
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
|
|
116519
116691
|
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
116692
|
}
|
|
116521
116693
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -116657,6 +116829,40 @@ var ts;
|
|
|
116657
116829
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
116658
116830
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
116659
116831
|
return program;
|
|
116832
|
+
function addResolutionDiagnostics(list) {
|
|
116833
|
+
if (!list)
|
|
116834
|
+
return;
|
|
116835
|
+
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
116836
|
+
var elem = list_3[_i];
|
|
116837
|
+
programDiagnostics.add(elem);
|
|
116838
|
+
}
|
|
116839
|
+
}
|
|
116840
|
+
function pullDiagnosticsFromCache(names, containingFile) {
|
|
116841
|
+
var _a;
|
|
116842
|
+
if (!moduleResolutionCache)
|
|
116843
|
+
return;
|
|
116844
|
+
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
116845
|
+
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
116846
|
+
var containingDir = ts.getDirectoryPath(containingFileName);
|
|
116847
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
116848
|
+
var i = 0;
|
|
116849
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
116850
|
+
var n = names_4[_i];
|
|
116851
|
+
// mimics logic done in the resolution cache, should be resilient to upgrading it to use `FileReference`s for non-type-reference modal lookups to make it rely on the index in the list less
|
|
116852
|
+
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
116853
|
+
var name = typeof n === "string" ? n : n.fileName;
|
|
116854
|
+
i++;
|
|
116855
|
+
// only nonrelative names hit the cache, and, at least as of right now, only nonrelative names can issue diagnostics
|
|
116856
|
+
// (Since diagnostics are only issued via import or export map lookup)
|
|
116857
|
+
// This may totally change if/when the issue of output paths not mapping to input files is fixed in a broader context
|
|
116858
|
+
// When it is, how we extract diagnostics from the module name resolver will have the be refined - the current cache
|
|
116859
|
+
// APIs wrapping the underlying resolver make it almost impossible to smuggle the diagnostics out in a generalized way
|
|
116860
|
+
if (ts.isExternalModuleNameRelative(name))
|
|
116861
|
+
continue;
|
|
116862
|
+
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
116863
|
+
addResolutionDiagnostics(diags);
|
|
116864
|
+
}
|
|
116865
|
+
}
|
|
116660
116866
|
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
116661
116867
|
if (!moduleNames.length)
|
|
116662
116868
|
return ts.emptyArray;
|
|
@@ -116668,6 +116874,7 @@ var ts;
|
|
|
116668
116874
|
ts.performance.mark("afterResolveModule");
|
|
116669
116875
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
116670
116876
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
116877
|
+
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
116671
116878
|
return result;
|
|
116672
116879
|
}
|
|
116673
116880
|
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
@@ -118168,8 +118375,8 @@ var ts;
|
|
|
118168
118375
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
118169
118376
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
118170
118377
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
118171
|
-
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
118172
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118378
|
+
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118379
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
118173
118380
|
}
|
|
118174
118381
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
118175
118382
|
}
|
|
@@ -118531,7 +118738,7 @@ var ts;
|
|
|
118531
118738
|
}
|
|
118532
118739
|
if (options.resolveJsonModule) {
|
|
118533
118740
|
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
118534
|
-
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
118741
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 &&
|
|
118535
118742
|
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118536
118743
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
118537
118744
|
}
|
|
@@ -121104,8 +121311,8 @@ var ts;
|
|
|
121104
121311
|
!!redirectedReference;
|
|
121105
121312
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
121106
121313
|
var i = 0;
|
|
121107
|
-
for (var _i = 0,
|
|
121108
|
-
var entry =
|
|
121314
|
+
for (var _i = 0, names_5 = names; _i < names_5.length; _i++) {
|
|
121315
|
+
var entry = names_5[_i];
|
|
121109
121316
|
var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
|
|
121110
121317
|
// Imports supply a `containingSourceFile` but no `containingSourceFileMode` - it would be redundant
|
|
121111
121318
|
// they require calculating the mode for a given import from it's position in the resolution table, since a given
|
|
@@ -121671,7 +121878,7 @@ var ts;
|
|
|
121671
121878
|
}
|
|
121672
121879
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
121673
121880
|
var _a;
|
|
121674
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
121881
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16
|
|
121675
121882
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
121676
121883
|
return false;
|
|
121677
121884
|
}
|
|
@@ -122256,7 +122463,7 @@ var ts;
|
|
|
122256
122463
|
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
122464
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
122258
122465
|
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
122259
|
-
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
122466
|
+
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
122260
122467
|
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
122261
122468
|
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
122262
122469
|
// usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
|
|
@@ -127870,11 +128077,11 @@ var ts;
|
|
|
127870
128077
|
}
|
|
127871
128078
|
ts.getModuleSpecifierResolverHost = getModuleSpecifierResolverHost;
|
|
127872
128079
|
function moduleResolutionRespectsExports(moduleResolution) {
|
|
127873
|
-
return moduleResolution >= ts.ModuleResolutionKind.
|
|
128080
|
+
return moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127874
128081
|
}
|
|
127875
128082
|
ts.moduleResolutionRespectsExports = moduleResolutionRespectsExports;
|
|
127876
128083
|
function moduleResolutionUsesNodeModules(moduleResolution) {
|
|
127877
|
-
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.
|
|
128084
|
+
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127878
128085
|
}
|
|
127879
128086
|
ts.moduleResolutionUsesNodeModules = moduleResolutionUsesNodeModules;
|
|
127880
128087
|
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
|
|
@@ -129557,23 +129764,30 @@ var ts;
|
|
|
129557
129764
|
(_d = host.log) === null || _d === void 0 ? void 0 : _d.call(host, "getExportInfoMap: cache miss or empty; calculating new results");
|
|
129558
129765
|
var compilerOptions = program.getCompilerOptions();
|
|
129559
129766
|
var moduleCount = 0;
|
|
129560
|
-
|
|
129561
|
-
|
|
129562
|
-
|
|
129563
|
-
|
|
129564
|
-
|
|
129565
|
-
|
|
129566
|
-
|
|
129567
|
-
|
|
129568
|
-
|
|
129569
|
-
|
|
129570
|
-
|
|
129571
|
-
checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
|
|
129572
|
-
if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
|
|
129573
|
-
cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, checker);
|
|
129767
|
+
try {
|
|
129768
|
+
forEachExternalModuleToImportFrom(program, host, /*useAutoImportProvider*/ true, function (moduleSymbol, moduleFile, program, isFromPackageJson) {
|
|
129769
|
+
if (++moduleCount % 100 === 0)
|
|
129770
|
+
cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.throwIfCancellationRequested();
|
|
129771
|
+
var seenExports = new ts.Map();
|
|
129772
|
+
var checker = program.getTypeChecker();
|
|
129773
|
+
var defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
|
|
129774
|
+
// Note: I think we shouldn't actually see resolved module symbols here, but weird merges
|
|
129775
|
+
// can cause it to happen: see 'completionsImport_mergedReExport.ts'
|
|
129776
|
+
if (defaultInfo && isImportableSymbol(defaultInfo.symbol, checker)) {
|
|
129777
|
+
cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, checker);
|
|
129574
129778
|
}
|
|
129779
|
+
checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
|
|
129780
|
+
if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
|
|
129781
|
+
cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, checker);
|
|
129782
|
+
}
|
|
129783
|
+
});
|
|
129575
129784
|
});
|
|
129576
|
-
}
|
|
129785
|
+
}
|
|
129786
|
+
catch (err) {
|
|
129787
|
+
// Ensure cache is reset if operation is cancelled
|
|
129788
|
+
cache.clear();
|
|
129789
|
+
throw err;
|
|
129790
|
+
}
|
|
129577
129791
|
(_e = host.log) === null || _e === void 0 ? void 0 : _e.call(host, "getExportInfoMap: done in " + (ts.timestamp() - start) + " ms");
|
|
129578
129792
|
return cache;
|
|
129579
129793
|
}
|
|
@@ -131198,11 +131412,11 @@ var ts;
|
|
|
131198
131412
|
}
|
|
131199
131413
|
function isEmitResolutionKindUsingNodeModules(compilerOptions) {
|
|
131200
131414
|
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ||
|
|
131201
|
-
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
131415
|
+
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
131202
131416
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
131203
131417
|
}
|
|
131204
131418
|
function isEmitModuleResolutionRespectingExportMaps(compilerOptions) {
|
|
131205
|
-
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
131419
|
+
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
131206
131420
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
131207
131421
|
}
|
|
131208
131422
|
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
@@ -131762,7 +131976,7 @@ var ts;
|
|
|
131762
131976
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeAssertionKeywords"] = 6] = "TypeAssertionKeywords";
|
|
131763
131977
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeKeywords"] = 7] = "TypeKeywords";
|
|
131764
131978
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeKeyword"] = 8] = "TypeKeyword";
|
|
131765
|
-
KeywordCompletionFilters[KeywordCompletionFilters["Last"] =
|
|
131979
|
+
KeywordCompletionFilters[KeywordCompletionFilters["Last"] = 8] = "Last";
|
|
131766
131980
|
})(KeywordCompletionFilters || (KeywordCompletionFilters = {}));
|
|
131767
131981
|
var GlobalsSearch;
|
|
131768
131982
|
(function (GlobalsSearch) {
|
|
@@ -132012,7 +132226,7 @@ var ts;
|
|
|
132012
132226
|
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
132013
132227
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
132014
132228
|
var keywordEntry = _a[_i];
|
|
132015
|
-
if (!entryNames_1.has(keywordEntry.name)) {
|
|
132229
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !entryNames_1.has(keywordEntry.name)) {
|
|
132016
132230
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
132017
132231
|
}
|
|
132018
132232
|
}
|
|
@@ -133751,7 +133965,7 @@ var ts;
|
|
|
133751
133965
|
return;
|
|
133752
133966
|
}
|
|
133753
133967
|
// 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-
|
|
133968
|
+
// due to file location or package.json dependency filtering. For non-node16+
|
|
133755
133969
|
// module resolution modes, getting past this point guarantees that we'll be
|
|
133756
133970
|
// able to generate a suitable module specifier, so we can safely show a completion,
|
|
133757
133971
|
// even if we defer computing the module specifier.
|
|
@@ -133759,7 +133973,7 @@ var ts;
|
|
|
133759
133973
|
if (!firstImportableExportInfo) {
|
|
133760
133974
|
return;
|
|
133761
133975
|
}
|
|
133762
|
-
// In
|
|
133976
|
+
// In node16+, module specifier resolution can fail due to modules being blocked
|
|
133763
133977
|
// by package.json `exports`. If that happens, don't show a completion item.
|
|
133764
133978
|
// N.B. in this resolution mode we always try to resolve module specifiers here,
|
|
133765
133979
|
// because we have to know now if it's going to fail so we can omit the completion
|
|
@@ -134731,7 +134945,7 @@ var ts;
|
|
|
134731
134945
|
function getKeywordCompletions(keywordFilter, filterOutTsOnlyKeywords) {
|
|
134732
134946
|
if (!filterOutTsOnlyKeywords)
|
|
134733
134947
|
return getTypescriptKeywordCompletions(keywordFilter);
|
|
134734
|
-
var index = keywordFilter +
|
|
134948
|
+
var index = keywordFilter + 8 /* Last */ + 1;
|
|
134735
134949
|
return _keywordCompletions[index] ||
|
|
134736
134950
|
(_keywordCompletions[index] = getTypescriptKeywordCompletions(keywordFilter)
|
|
134737
134951
|
.filter(function (entry) { return !isTypeScriptOnlyKeyword(ts.stringToToken(entry.name)); }));
|
|
@@ -139354,7 +139568,7 @@ var ts;
|
|
|
139354
139568
|
(function (ts) {
|
|
139355
139569
|
var GoToDefinition;
|
|
139356
139570
|
(function (GoToDefinition) {
|
|
139357
|
-
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly) {
|
|
139571
|
+
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
139358
139572
|
var _a;
|
|
139359
139573
|
var _b;
|
|
139360
139574
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
@@ -139379,7 +139593,7 @@ var ts;
|
|
|
139379
139593
|
}
|
|
139380
139594
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
139381
139595
|
var classDecl = node.parent.parent;
|
|
139382
|
-
var _c = getSymbol(classDecl, typeChecker), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
139596
|
+
var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
139383
139597
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
139384
139598
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
139385
139599
|
var sourceFile_1 = node.getSourceFile();
|
|
@@ -139389,14 +139603,14 @@ var ts;
|
|
|
139389
139603
|
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
|
|
139390
139604
|
});
|
|
139391
139605
|
}
|
|
139392
|
-
var _d = getSymbol(node, typeChecker), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
139606
|
+
var _d = getSymbol(node, typeChecker, stopAtAlias), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
139393
139607
|
var fallbackNode = node;
|
|
139394
139608
|
if (searchOtherFilesOnly && failedAliasResolution) {
|
|
139395
139609
|
// We couldn't resolve the specific import, try on the module specifier.
|
|
139396
139610
|
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
139611
|
var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
|
|
139398
139612
|
if (moduleSpecifier) {
|
|
139399
|
-
(_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
139613
|
+
(_a = getSymbol(moduleSpecifier, typeChecker, stopAtAlias), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
139400
139614
|
fallbackNode = moduleSpecifier;
|
|
139401
139615
|
}
|
|
139402
139616
|
}
|
|
@@ -139570,7 +139784,7 @@ var ts;
|
|
|
139570
139784
|
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
139571
139785
|
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
|
|
139572
139786
|
}
|
|
139573
|
-
var _a = getSymbol(node, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
139787
|
+
var _a = getSymbol(node, typeChecker, /*stopAtAlias*/ false), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
139574
139788
|
if (!symbol)
|
|
139575
139789
|
return undefined;
|
|
139576
139790
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
@@ -139621,14 +139835,14 @@ var ts;
|
|
|
139621
139835
|
function getDefinitionInfoForIndexSignatures(node, checker) {
|
|
139622
139836
|
return ts.mapDefined(checker.getIndexInfosAtLocation(node), function (info) { return info.declaration && createDefinitionFromSignatureDeclaration(checker, info.declaration); });
|
|
139623
139837
|
}
|
|
139624
|
-
function getSymbol(node, checker) {
|
|
139838
|
+
function getSymbol(node, checker, stopAtAlias) {
|
|
139625
139839
|
var symbol = checker.getSymbolAtLocation(node);
|
|
139626
139840
|
// If this is an alias, and the request came at the declaration location
|
|
139627
139841
|
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
|
139628
139842
|
// import {A, B} from "mod";
|
|
139629
139843
|
// to jump to the implementation directly.
|
|
139630
139844
|
var failedAliasResolution = false;
|
|
139631
|
-
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139845
|
+
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && !stopAtAlias && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139632
139846
|
var aliased = checker.getAliasedSymbol(symbol);
|
|
139633
139847
|
if (aliased.declarations) {
|
|
139634
139848
|
return { symbol: aliased };
|
|
@@ -147156,6 +147370,9 @@ var ts;
|
|
|
147156
147370
|
consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node);
|
|
147157
147371
|
}
|
|
147158
147372
|
function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
|
|
147373
|
+
if (ts.nodeIsMissing(child)) {
|
|
147374
|
+
return inheritedIndentation;
|
|
147375
|
+
}
|
|
147159
147376
|
var childStartPos = child.getStart(sourceFile);
|
|
147160
147377
|
var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
|
|
147161
147378
|
var undecoratedChildStartLine = childStartLine;
|
|
@@ -153221,7 +153438,7 @@ var ts;
|
|
|
153221
153438
|
case ts.ModuleKind.None:
|
|
153222
153439
|
// Fall back to the `import * as ns` style import.
|
|
153223
153440
|
return 2 /* Namespace */;
|
|
153224
|
-
case ts.ModuleKind.
|
|
153441
|
+
case ts.ModuleKind.Node16:
|
|
153225
153442
|
case ts.ModuleKind.NodeNext:
|
|
153226
153443
|
return importingFile.impliedNodeFormat === ts.ModuleKind.ESNext ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
153227
153444
|
default:
|
|
@@ -155134,8 +155351,8 @@ var ts;
|
|
|
155134
155351
|
(function (codefix) {
|
|
155135
155352
|
codefix.registerCodeFix({
|
|
155136
155353
|
errorCodes: [
|
|
155137
|
-
ts.Diagnostics.
|
|
155138
|
-
ts.Diagnostics.
|
|
155354
|
+
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,
|
|
155355
|
+
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
155356
|
],
|
|
155140
155357
|
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
155141
155358
|
var compilerOptions = context.program.getCompilerOptions();
|
|
@@ -165018,9 +165235,9 @@ var ts;
|
|
|
165018
165235
|
}
|
|
165019
165236
|
}
|
|
165020
165237
|
/// Goto definition
|
|
165021
|
-
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly) {
|
|
165238
|
+
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly, stopAtAlias) {
|
|
165022
165239
|
synchronizeHostData();
|
|
165023
|
-
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
|
|
165240
|
+
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly, stopAtAlias);
|
|
165024
165241
|
}
|
|
165025
165242
|
function getDefinitionAndBoundSpan(fileName, position) {
|
|
165026
165243
|
synchronizeHostData();
|
|
@@ -174553,7 +174770,8 @@ var ts;
|
|
|
174553
174770
|
var providePrefixAndSuffixTextForRename = _a.providePrefixAndSuffixTextForRename;
|
|
174554
174771
|
var outputs = [];
|
|
174555
174772
|
var seen = createDocumentSpanSet();
|
|
174556
|
-
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174773
|
+
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174774
|
+
/*isForRename*/ true, function (project, location, tryAddToTodo) {
|
|
174557
174775
|
var projectOutputs = project.getLanguageService().findRenameLocations(location.fileName, location.pos, findInStrings, findInComments, providePrefixAndSuffixTextForRename);
|
|
174558
174776
|
if (projectOutputs) {
|
|
174559
174777
|
for (var _i = 0, projectOutputs_1 = projectOutputs; _i < projectOutputs_1.length; _i++) {
|
|
@@ -174567,18 +174785,20 @@ var ts;
|
|
|
174567
174785
|
});
|
|
174568
174786
|
return outputs;
|
|
174569
174787
|
}
|
|
174570
|
-
function getDefinitionLocation(defaultProject, initialLocation) {
|
|
174571
|
-
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos);
|
|
174788
|
+
function getDefinitionLocation(defaultProject, initialLocation, isForRename) {
|
|
174789
|
+
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, isForRename);
|
|
174572
174790
|
var info = infos && ts.firstOrUndefined(infos);
|
|
174573
174791
|
return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
|
|
174574
174792
|
}
|
|
174575
174793
|
function combineProjectOutputForReferences(projects, defaultProject, initialLocation, logger) {
|
|
174576
174794
|
var outputs = [];
|
|
174577
|
-
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174795
|
+
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174796
|
+
/*isForRename*/ false, function (project, location, getMappedLocation) {
|
|
174797
|
+
var _a, _b;
|
|
174578
174798
|
logger.info("Finding references to " + location.fileName + " position " + location.pos + " in project " + project.getProjectName());
|
|
174579
174799
|
var projectOutputs = project.getLanguageService().findReferences(location.fileName, location.pos);
|
|
174580
174800
|
if (projectOutputs) {
|
|
174581
|
-
var clearIsDefinition = projectOutputs[0].references[0].isDefinition === undefined;
|
|
174801
|
+
var clearIsDefinition = ((_b = (_a = projectOutputs[0]) === null || _a === void 0 ? void 0 : _a.references[0]) === null || _b === void 0 ? void 0 : _b.isDefinition) === undefined;
|
|
174582
174802
|
var _loop_9 = function (referencedSymbol) {
|
|
174583
174803
|
var mappedDefinitionFile = getMappedLocation(project, documentSpanLocation(referencedSymbol.definition));
|
|
174584
174804
|
var definition = mappedDefinitionFile === undefined ?
|
|
@@ -174588,8 +174808,8 @@ var ts;
|
|
|
174588
174808
|
symbolToAddTo = { definition: definition, references: [] };
|
|
174589
174809
|
outputs.push(symbolToAddTo);
|
|
174590
174810
|
}
|
|
174591
|
-
for (var
|
|
174592
|
-
var ref =
|
|
174811
|
+
for (var _c = 0, _d = referencedSymbol.references; _c < _d.length; _c++) {
|
|
174812
|
+
var ref = _d[_c];
|
|
174593
174813
|
// If it's in a mapped file, that is added to the todo list by `getMappedLocation`.
|
|
174594
174814
|
if (!ts.contains(symbolToAddTo.references, ref, ts.documentSpansEqual) && !getMappedLocation(project, documentSpanLocation(ref))) {
|
|
174595
174815
|
if (clearIsDefinition) {
|
|
@@ -174621,7 +174841,7 @@ var ts;
|
|
|
174621
174841
|
});
|
|
174622
174842
|
}
|
|
174623
174843
|
}
|
|
174624
|
-
function combineProjectOutputWorker(projects, defaultProject, initialLocation, cb) {
|
|
174844
|
+
function combineProjectOutputWorker(projects, defaultProject, initialLocation, isForRename, cb) {
|
|
174625
174845
|
var projectService = defaultProject.projectService;
|
|
174626
174846
|
var toDo;
|
|
174627
174847
|
var seenProjects = new ts.Set();
|
|
@@ -174632,7 +174852,7 @@ var ts;
|
|
|
174632
174852
|
});
|
|
174633
174853
|
// After initial references are collected, go over every other project and see if it has a reference for the symbol definition.
|
|
174634
174854
|
if (initialLocation) {
|
|
174635
|
-
var defaultDefinition_1 = getDefinitionLocation(defaultProject, initialLocation);
|
|
174855
|
+
var defaultDefinition_1 = getDefinitionLocation(defaultProject, initialLocation, isForRename);
|
|
174636
174856
|
if (defaultDefinition_1) {
|
|
174637
174857
|
var getGeneratedDefinition_1 = ts.memoize(function () { return defaultProject.isSourceOfProjectReferenceRedirect(defaultDefinition_1.fileName) ?
|
|
174638
174858
|
defaultDefinition_1 :
|
|
@@ -175688,7 +175908,7 @@ var ts;
|
|
|
175688
175908
|
definitions === null || definitions === void 0 ? void 0 : definitions.forEach(function (d) { return definitionSet_1.add(d); });
|
|
175689
175909
|
var noDtsProject = project.getNoDtsResolutionProject([file]);
|
|
175690
175910
|
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; });
|
|
175911
|
+
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
175912
|
if (ts.some(jsDefinitions)) {
|
|
175693
175913
|
for (var _i = 0, jsDefinitions_1 = jsDefinitions; _i < jsDefinitions_1.length; _i++) {
|
|
175694
175914
|
var jsDefinition = jsDefinitions_1[_i];
|
|
@@ -175736,7 +175956,7 @@ var ts;
|
|
|
175736
175956
|
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions);
|
|
175737
175957
|
if (!packageJson)
|
|
175738
175958
|
return undefined;
|
|
175739
|
-
// Use fake options instead of actual compiler options to avoid following export map if the project uses
|
|
175959
|
+
// Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext -
|
|
175740
175960
|
// Mapping from an export map entry across packages is out of scope for now. Returned entrypoints will only be what can be
|
|
175741
175961
|
// resolved from the package root under --moduleResolution node
|
|
175742
175962
|
var entrypoints = ts.getEntrypointsFromPackageJsonInfo(packageJson, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, project, project.getModuleResolutionCache());
|
|
@@ -175773,7 +175993,7 @@ var ts;
|
|
|
175773
175993
|
var _a;
|
|
175774
175994
|
if (nameInChain === initialNode)
|
|
175775
175995
|
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 ({
|
|
175996
|
+
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
175997
|
fileName: d.fileName,
|
|
175778
175998
|
name: ts.getTextOfIdentifierOrLiteral(initialNode)
|
|
175779
175999
|
}); });
|