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/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220506";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -5276,10 +5276,11 @@ var ts;
|
|
|
5276
5276
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5277
5277
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5278
5278
|
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
|
|
5279
|
-
// to better support ecmascript modules and their use within node - more features are still being added
|
|
5280
|
-
//
|
|
5281
|
-
// version-
|
|
5282
|
-
|
|
5279
|
+
// to better support ecmascript modules and their use within node - however more features are still being added.
|
|
5280
|
+
// TypeScript's Node ESM support was introduced after Node 12 went end-of-life, and Node 14 is the earliest stable
|
|
5281
|
+
// version that supports both pattern trailers - *but*, Node 16 is the first version that also supports ECMASCript 2022.
|
|
5282
|
+
// In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target
|
|
5283
|
+
ModuleResolutionKind[ModuleResolutionKind["Node16"] = 3] = "Node16";
|
|
5283
5284
|
ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
|
|
5284
5285
|
})(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
|
|
5285
5286
|
var ModuleDetectionKind;
|
|
@@ -5289,7 +5290,7 @@ var ts;
|
|
|
5289
5290
|
*/
|
|
5290
5291
|
ModuleDetectionKind[ModuleDetectionKind["Legacy"] = 1] = "Legacy";
|
|
5291
5292
|
/**
|
|
5292
|
-
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution:
|
|
5293
|
+
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node16+
|
|
5293
5294
|
*/
|
|
5294
5295
|
ModuleDetectionKind[ModuleDetectionKind["Auto"] = 2] = "Auto";
|
|
5295
5296
|
/**
|
|
@@ -5334,8 +5335,8 @@ var ts;
|
|
|
5334
5335
|
ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
|
|
5335
5336
|
ModuleKind[ModuleKind["ES2022"] = 7] = "ES2022";
|
|
5336
5337
|
ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
|
|
5337
|
-
//
|
|
5338
|
-
ModuleKind[ModuleKind["
|
|
5338
|
+
// Node16+ is an amalgam of commonjs (albeit updated) and es2022+, and represents a distinct module system from es2020/esnext
|
|
5339
|
+
ModuleKind[ModuleKind["Node16"] = 100] = "Node16";
|
|
5339
5340
|
ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
|
|
5340
5341
|
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
|
|
5341
5342
|
var JsxEmit;
|
|
@@ -8257,6 +8258,7 @@ var ts;
|
|
|
8257
8258
|
_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"),
|
|
8258
8259
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
8259
8260
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
8261
|
+
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
|
8260
8262
|
Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
|
|
8261
8263
|
The_body_of_an_if_statement_cannot_be_the_empty_statement: diag(1313, ts.DiagnosticCategory.Error, "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", "The body of an 'if' statement cannot be the empty statement."),
|
|
8262
8264
|
Global_module_exports_may_only_appear_in_module_files: diag(1314, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_in_module_files_1314", "Global module exports may only appear in module files."),
|
|
@@ -8268,8 +8270,8 @@ var ts;
|
|
|
8268
8270
|
Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, ts.DiagnosticCategory.Error, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
8269
8271
|
Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts.DiagnosticCategory.Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
|
|
8270
8272
|
Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, ts.DiagnosticCategory.Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
+
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."),
|
|
8274
|
+
Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nod_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'."),
|
|
8273
8275
|
Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
|
|
8274
8276
|
This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
|
|
8275
8277
|
String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
|
@@ -8286,7 +8288,7 @@ var ts;
|
|
|
8286
8288
|
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
|
|
8287
8289
|
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
|
|
8288
8290
|
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
8289
|
-
|
|
8291
|
+
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),
|
|
8290
8292
|
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
8291
8293
|
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
|
|
8292
8294
|
This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
|
|
@@ -8317,7 +8319,7 @@ var ts;
|
|
|
8317
8319
|
await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
8318
8320
|
_0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
8319
8321
|
_0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
8320
|
-
|
|
8322
|
+
Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, ts.DiagnosticCategory.Error, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
8321
8323
|
An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379", "An import alias cannot reference a declaration that was exported using 'export type'."),
|
|
8322
8324
|
An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
|
|
8323
8325
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
@@ -8369,7 +8371,7 @@ var ts;
|
|
|
8369
8371
|
File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
8370
8372
|
The_file_is_in_the_program_because_Colon: diag(1430, ts.DiagnosticCategory.Message, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
|
|
8371
8373
|
for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1431, ts.DiagnosticCategory.Error, "for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431", "'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
8372
|
-
|
|
8374
|
+
Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, ts.DiagnosticCategory.Error, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
8373
8375
|
Decorators_may_not_be_applied_to_this_parameters: diag(1433, ts.DiagnosticCategory.Error, "Decorators_may_not_be_applied_to_this_parameters_1433", "Decorators may not be applied to 'this' parameters."),
|
|
8374
8376
|
Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
8375
8377
|
Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, ts.DiagnosticCategory.Error, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
|
|
@@ -8387,7 +8389,7 @@ var ts;
|
|
|
8387
8389
|
Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, ts.DiagnosticCategory.Message, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."),
|
|
8388
8390
|
Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments: diag(1450, ts.DiagnosticCategory.Message, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional assertion as arguments"),
|
|
8389
8391
|
Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression: diag(1451, ts.DiagnosticCategory.Error, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),
|
|
8390
|
-
|
|
8392
|
+
Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext: diag(1452, ts.DiagnosticCategory.Error, "Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452", "Resolution modes are only supported when `moduleResolution` is `node16` or `nodenext`."),
|
|
8391
8393
|
resolution_mode_should_be_either_require_or_import: diag(1453, ts.DiagnosticCategory.Error, "resolution_mode_should_be_either_require_or_import_1453", "`resolution-mode` should be either `require` or `import`."),
|
|
8392
8394
|
resolution_mode_can_only_be_set_for_type_only_imports: diag(1454, ts.DiagnosticCategory.Error, "resolution_mode_can_only_be_set_for_type_only_imports_1454", "`resolution-mode` can only be set for type-only imports."),
|
|
8393
8395
|
resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, ts.DiagnosticCategory.Error, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
|
|
@@ -8398,7 +8400,7 @@ var ts;
|
|
|
8398
8400
|
An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
|
|
8399
8401
|
An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
|
|
8400
8402
|
Control_what_method_is_used_to_detect_module_format_JS_files: diag(1475, ts.DiagnosticCategory.Message, "Control_what_method_is_used_to_detect_module_format_JS_files_1475", "Control what method is used to detect module-format JS files."),
|
|
8401
|
-
|
|
8403
|
+
auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
|
|
8402
8404
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
8403
8405
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
8404
8406
|
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
@@ -8407,6 +8409,8 @@ var ts;
|
|
|
8407
8409
|
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),
|
|
8408
8410
|
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."),
|
|
8409
8411
|
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."),
|
|
8412
|
+
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."),
|
|
8413
|
+
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."),
|
|
8410
8414
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
8411
8415
|
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."),
|
|
8412
8416
|
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."),
|
|
@@ -8884,8 +8888,8 @@ var ts;
|
|
|
8884
8888
|
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
|
|
8885
8889
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
8886
8890
|
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
8887
|
-
|
|
8888
|
-
|
|
8891
|
+
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."),
|
|
8892
|
+
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),
|
|
8889
8893
|
Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
|
|
8890
8894
|
Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
|
|
8891
8895
|
All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
|
|
@@ -9551,7 +9555,6 @@ var ts;
|
|
|
9551
9555
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead: diag(7059, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),
|
|
9552
9556
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint: diag(7060, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),
|
|
9553
9557
|
A_mapped_type_may_not_declare_properties_or_methods: diag(7061, ts.DiagnosticCategory.Error, "A_mapped_type_may_not_declare_properties_or_methods_7061", "A mapped type may not declare properties or methods."),
|
|
9554
|
-
JSON_imports_are_experimental_in_ES_module_mode_imports: diag(7062, ts.DiagnosticCategory.Error, "JSON_imports_are_experimental_in_ES_module_mode_imports_7062", "JSON imports are experimental in ES module mode imports."),
|
|
9555
9558
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9556
9559
|
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
|
|
9557
9560
|
import_can_only_be_used_in_TypeScript_files: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."),
|
|
@@ -14844,7 +14847,7 @@ var ts;
|
|
|
14844
14847
|
}
|
|
14845
14848
|
ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
|
|
14846
14849
|
function isCommonJSContainingModuleKind(kind) {
|
|
14847
|
-
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.
|
|
14850
|
+
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node16 || kind === ts.ModuleKind.NodeNext;
|
|
14848
14851
|
}
|
|
14849
14852
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
14850
14853
|
return ts.isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator);
|
|
@@ -18233,6 +18236,16 @@ var ts;
|
|
|
18233
18236
|
".d.ts" /* Dts */;
|
|
18234
18237
|
}
|
|
18235
18238
|
ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
|
|
18239
|
+
/**
|
|
18240
|
+
* This function is an inverse of `getDeclarationEmitExtensionForPath`.
|
|
18241
|
+
*/
|
|
18242
|
+
function getPossibleOriginalInputExtensionForExtension(path) {
|
|
18243
|
+
return ts.fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] :
|
|
18244
|
+
ts.fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] :
|
|
18245
|
+
ts.fileExtensionIsOneOf(path, [".json.d.ts"]) ? [".json" /* Json */] :
|
|
18246
|
+
[".tsx" /* Tsx */, ".ts" /* Ts */, ".jsx" /* Jsx */, ".js" /* Js */];
|
|
18247
|
+
}
|
|
18248
|
+
ts.getPossibleOriginalInputExtensionForExtension = getPossibleOriginalInputExtensionForExtension;
|
|
18236
18249
|
function outFile(options) {
|
|
18237
18250
|
return options.outFile || options.out;
|
|
18238
18251
|
}
|
|
@@ -20012,7 +20025,7 @@ var ts;
|
|
|
20012
20025
|
file.externalModuleIndicator = ts.isFileProbablyExternalModule(file);
|
|
20013
20026
|
};
|
|
20014
20027
|
case ts.ModuleDetectionKind.Auto:
|
|
20015
|
-
// If module is nodenext or
|
|
20028
|
+
// If module is nodenext or node16, all esm format files are modules
|
|
20016
20029
|
// If jsx is react-jsx or react-jsxdev then jsx tags force module-ness
|
|
20017
20030
|
// otherwise, the presence of import or export statments (or import.meta) implies module-ness
|
|
20018
20031
|
var checks = [ts.isFileProbablyExternalModule];
|
|
@@ -20020,7 +20033,7 @@ var ts;
|
|
|
20020
20033
|
checks.push(isFileModuleFromUsingJSXTag);
|
|
20021
20034
|
}
|
|
20022
20035
|
var moduleKind = getEmitModuleKind(options);
|
|
20023
|
-
if (moduleKind === ts.ModuleKind.
|
|
20036
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
20024
20037
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
20025
20038
|
}
|
|
20026
20039
|
var combined_1 = ts.or.apply(void 0, checks);
|
|
@@ -20031,7 +20044,7 @@ var ts;
|
|
|
20031
20044
|
ts.getSetExternalModuleIndicator = getSetExternalModuleIndicator;
|
|
20032
20045
|
function getEmitScriptTarget(compilerOptions) {
|
|
20033
20046
|
return compilerOptions.target ||
|
|
20034
|
-
(compilerOptions.module === ts.ModuleKind.
|
|
20047
|
+
(compilerOptions.module === ts.ModuleKind.Node16 && 9 /* ES2022 */) ||
|
|
20035
20048
|
(compilerOptions.module === ts.ModuleKind.NodeNext && 99 /* ESNext */) ||
|
|
20036
20049
|
0 /* ES3 */;
|
|
20037
20050
|
}
|
|
@@ -20049,8 +20062,8 @@ var ts;
|
|
|
20049
20062
|
case ts.ModuleKind.CommonJS:
|
|
20050
20063
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
20051
20064
|
break;
|
|
20052
|
-
case ts.ModuleKind.
|
|
20053
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
20065
|
+
case ts.ModuleKind.Node16:
|
|
20066
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
20054
20067
|
break;
|
|
20055
20068
|
case ts.ModuleKind.NodeNext:
|
|
20056
20069
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -20075,7 +20088,7 @@ var ts;
|
|
|
20075
20088
|
case ts.ModuleKind.ES2020:
|
|
20076
20089
|
case ts.ModuleKind.ES2022:
|
|
20077
20090
|
case ts.ModuleKind.ESNext:
|
|
20078
|
-
case ts.ModuleKind.
|
|
20091
|
+
case ts.ModuleKind.Node16:
|
|
20079
20092
|
case ts.ModuleKind.NodeNext:
|
|
20080
20093
|
return true;
|
|
20081
20094
|
default:
|
|
@@ -20100,7 +20113,7 @@ var ts;
|
|
|
20100
20113
|
return compilerOptions.esModuleInterop;
|
|
20101
20114
|
}
|
|
20102
20115
|
switch (getEmitModuleKind(compilerOptions)) {
|
|
20103
|
-
case ts.ModuleKind.
|
|
20116
|
+
case ts.ModuleKind.Node16:
|
|
20104
20117
|
case ts.ModuleKind.NodeNext:
|
|
20105
20118
|
return true;
|
|
20106
20119
|
}
|
|
@@ -26182,7 +26195,7 @@ var ts;
|
|
|
26182
26195
|
return node;
|
|
26183
26196
|
}
|
|
26184
26197
|
function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
|
|
26185
|
-
var node = baseFactory.createBaseSourceFileNode(305 /* SourceFile */);
|
|
26198
|
+
var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SourceFile */));
|
|
26186
26199
|
for (var p in source) {
|
|
26187
26200
|
if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p))
|
|
26188
26201
|
continue;
|
|
@@ -31307,7 +31320,7 @@ var ts;
|
|
|
31307
31320
|
initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, 1 /* JS */);
|
|
31308
31321
|
// Prime the scanner.
|
|
31309
31322
|
nextToken();
|
|
31310
|
-
var entityName = parseEntityName(/*allowReservedWords*/ true
|
|
31323
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true);
|
|
31311
31324
|
var isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
|
|
31312
31325
|
clearState();
|
|
31313
31326
|
return isInvalid ? entityName : undefined;
|
|
@@ -32907,7 +32920,7 @@ var ts;
|
|
|
32907
32920
|
}
|
|
32908
32921
|
return createMissingList();
|
|
32909
32922
|
}
|
|
32910
|
-
function parseEntityName(allowReservedWords,
|
|
32923
|
+
function parseEntityName(allowReservedWords, diagnosticMessage) {
|
|
32911
32924
|
var pos = getNodePos();
|
|
32912
32925
|
var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage);
|
|
32913
32926
|
var dotPos = getNodePos();
|
|
@@ -32918,7 +32931,7 @@ var ts;
|
|
|
32918
32931
|
break;
|
|
32919
32932
|
}
|
|
32920
32933
|
dotPos = getNodePos();
|
|
32921
|
-
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, allowPrivateIdentifiers)), pos);
|
|
32934
|
+
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, /* allowPrivateIdentifiers */ false)), pos);
|
|
32922
32935
|
}
|
|
32923
32936
|
return entity;
|
|
32924
32937
|
}
|
|
@@ -33051,7 +33064,7 @@ var ts;
|
|
|
33051
33064
|
}
|
|
33052
33065
|
// TYPES
|
|
33053
33066
|
function parseEntityNameOfTypeReference() {
|
|
33054
|
-
return parseEntityName(/*allowReservedWords*/ true,
|
|
33067
|
+
return parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
|
|
33055
33068
|
}
|
|
33056
33069
|
function parseTypeArgumentsOfTypeReference() {
|
|
33057
33070
|
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
|
|
@@ -33184,7 +33197,7 @@ var ts;
|
|
|
33184
33197
|
function parseTypeQuery() {
|
|
33185
33198
|
var pos = getNodePos();
|
|
33186
33199
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33187
|
-
var entityName = parseEntityName(/*allowReservedWords*/ true
|
|
33200
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true);
|
|
33188
33201
|
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33189
33202
|
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33190
33203
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
@@ -34152,10 +34165,10 @@ var ts;
|
|
|
34152
34165
|
setDecoratorContext(/*val*/ false);
|
|
34153
34166
|
}
|
|
34154
34167
|
var pos = getNodePos();
|
|
34155
|
-
var expr = parseAssignmentExpressionOrHigher(
|
|
34168
|
+
var expr = parseAssignmentExpressionOrHigher();
|
|
34156
34169
|
var operatorToken;
|
|
34157
34170
|
while ((operatorToken = parseOptionalToken(27 /* CommaToken */))) {
|
|
34158
|
-
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(
|
|
34171
|
+
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
|
|
34159
34172
|
}
|
|
34160
34173
|
if (saveDecoratorContext) {
|
|
34161
34174
|
setDecoratorContext(/*val*/ true);
|
|
@@ -34163,9 +34176,9 @@ var ts;
|
|
|
34163
34176
|
return expr;
|
|
34164
34177
|
}
|
|
34165
34178
|
function parseInitializer() {
|
|
34166
|
-
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher(
|
|
34179
|
+
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
34167
34180
|
}
|
|
34168
|
-
function parseAssignmentExpressionOrHigher(
|
|
34181
|
+
function parseAssignmentExpressionOrHigher() {
|
|
34169
34182
|
// AssignmentExpression[in,yield]:
|
|
34170
34183
|
// 1) ConditionalExpression[?in,?yield]
|
|
34171
34184
|
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
|
|
@@ -34191,7 +34204,7 @@ var ts;
|
|
|
34191
34204
|
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
|
|
34192
34205
|
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
|
|
34193
34206
|
// with AssignmentExpression if we see one.
|
|
34194
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(
|
|
34207
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
34195
34208
|
if (arrowExpression) {
|
|
34196
34209
|
return arrowExpression;
|
|
34197
34210
|
}
|
|
@@ -34210,7 +34223,7 @@ var ts;
|
|
|
34210
34223
|
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
|
|
34211
34224
|
// identifier and the current token is an arrow.
|
|
34212
34225
|
if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
|
|
34213
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
34226
|
+
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
|
|
34214
34227
|
}
|
|
34215
34228
|
// Now see if we might be in cases '2' or '3'.
|
|
34216
34229
|
// If the expression was a LHS expression, and we have an assignment operator, then
|
|
@@ -34219,7 +34232,7 @@ var ts;
|
|
|
34219
34232
|
// Note: we call reScanGreaterToken so that we get an appropriately merged token
|
|
34220
34233
|
// for cases like `> > =` becoming `>>=`
|
|
34221
34234
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
34222
|
-
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(
|
|
34235
|
+
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
|
|
34223
34236
|
}
|
|
34224
34237
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34225
34238
|
return parseConditionalExpressionRest(expr, pos);
|
|
@@ -34262,7 +34275,7 @@ var ts;
|
|
|
34262
34275
|
nextToken();
|
|
34263
34276
|
if (!scanner.hasPrecedingLineBreak() &&
|
|
34264
34277
|
(token() === 41 /* AsteriskToken */ || isStartOfExpression())) {
|
|
34265
|
-
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher(
|
|
34278
|
+
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher()), pos);
|
|
34266
34279
|
}
|
|
34267
34280
|
else {
|
|
34268
34281
|
// if the next token is not on the same line as yield. or we don't have an '*' or
|
|
@@ -34270,7 +34283,7 @@ var ts;
|
|
|
34270
34283
|
return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
|
|
34271
34284
|
}
|
|
34272
34285
|
}
|
|
34273
|
-
function parseSimpleArrowFunctionExpression(pos, identifier,
|
|
34286
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
34274
34287
|
ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
34275
34288
|
var parameter = factory.createParameterDeclaration(
|
|
34276
34289
|
/*decorators*/ undefined,
|
|
@@ -34282,11 +34295,11 @@ var ts;
|
|
|
34282
34295
|
finishNode(parameter, identifier.pos);
|
|
34283
34296
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
34284
34297
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
34285
|
-
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier
|
|
34298
|
+
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
|
|
34286
34299
|
var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
|
|
34287
34300
|
return addJSDocComment(finishNode(node, pos));
|
|
34288
34301
|
}
|
|
34289
|
-
function tryParseParenthesizedArrowFunctionExpression(
|
|
34302
|
+
function tryParseParenthesizedArrowFunctionExpression() {
|
|
34290
34303
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
34291
34304
|
if (triState === 0 /* False */) {
|
|
34292
34305
|
// It's definitely not a parenthesized arrow function expression.
|
|
@@ -34297,8 +34310,8 @@ var ts;
|
|
|
34297
34310
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34298
34311
|
// expression instead.
|
|
34299
34312
|
return triState === 1 /* True */ ?
|
|
34300
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true
|
|
34301
|
-
tryParse(
|
|
34313
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
|
|
34314
|
+
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
34302
34315
|
}
|
|
34303
34316
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
34304
34317
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
@@ -34428,25 +34441,25 @@ var ts;
|
|
|
34428
34441
|
return 2 /* Unknown */;
|
|
34429
34442
|
}
|
|
34430
34443
|
}
|
|
34431
|
-
function parsePossibleParenthesizedArrowFunctionExpression(
|
|
34444
|
+
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
34432
34445
|
var tokenPos = scanner.getTokenPos();
|
|
34433
34446
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
34434
34447
|
return undefined;
|
|
34435
34448
|
}
|
|
34436
|
-
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false
|
|
34449
|
+
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
|
|
34437
34450
|
if (!result) {
|
|
34438
34451
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
34439
34452
|
}
|
|
34440
34453
|
return result;
|
|
34441
34454
|
}
|
|
34442
|
-
function tryParseAsyncSimpleArrowFunctionExpression(
|
|
34455
|
+
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
34443
34456
|
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
|
|
34444
34457
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34445
34458
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
34446
34459
|
var pos = getNodePos();
|
|
34447
34460
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
34448
34461
|
var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
34449
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
34462
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
34450
34463
|
}
|
|
34451
34464
|
}
|
|
34452
34465
|
return undefined;
|
|
@@ -34470,7 +34483,7 @@ var ts;
|
|
|
34470
34483
|
}
|
|
34471
34484
|
return 0 /* False */;
|
|
34472
34485
|
}
|
|
34473
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity
|
|
34486
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
34474
34487
|
var pos = getNodePos();
|
|
34475
34488
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
34476
34489
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -34505,23 +34518,6 @@ var ts;
|
|
|
34505
34518
|
return undefined;
|
|
34506
34519
|
}
|
|
34507
34520
|
}
|
|
34508
|
-
// Given:
|
|
34509
|
-
// x ? y => ({ y }) : z => ({ z })
|
|
34510
|
-
// We try to parse the body of the first arrow function by looking at:
|
|
34511
|
-
// ({ y }) : z => ({ z })
|
|
34512
|
-
// This is a valid arrow function with "z" as the return type.
|
|
34513
|
-
//
|
|
34514
|
-
// But, if we're in the true side of a conditional expression, this colon
|
|
34515
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34516
|
-
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34517
|
-
//
|
|
34518
|
-
// For example,
|
|
34519
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34520
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34521
|
-
// be an arrow expression, so we allow a return type.
|
|
34522
|
-
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34523
|
-
return undefined;
|
|
34524
|
-
}
|
|
34525
34521
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34526
34522
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34527
34523
|
return undefined;
|
|
@@ -34550,12 +34546,12 @@ var ts;
|
|
|
34550
34546
|
var lastToken = token();
|
|
34551
34547
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
34552
34548
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34553
|
-
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier)
|
|
34549
|
+
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
|
|
34554
34550
|
: parseIdentifier();
|
|
34555
34551
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34556
34552
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34557
34553
|
}
|
|
34558
|
-
function parseArrowFunctionExpressionBody(isAsync
|
|
34554
|
+
function parseArrowFunctionExpressionBody(isAsync) {
|
|
34559
34555
|
if (token() === 18 /* OpenBraceToken */) {
|
|
34560
34556
|
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
|
|
34561
34557
|
}
|
|
@@ -34583,8 +34579,8 @@ var ts;
|
|
|
34583
34579
|
var savedTopLevel = topLevel;
|
|
34584
34580
|
topLevel = false;
|
|
34585
34581
|
var node = isAsync
|
|
34586
|
-
? doInAwaitContext(
|
|
34587
|
-
: doOutsideOfAwaitContext(
|
|
34582
|
+
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
34583
|
+
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
34588
34584
|
topLevel = savedTopLevel;
|
|
34589
34585
|
return node;
|
|
34590
34586
|
}
|
|
@@ -34597,8 +34593,8 @@ var ts;
|
|
|
34597
34593
|
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
|
|
34598
34594
|
// we do not that for the 'whenFalse' part.
|
|
34599
34595
|
var colonToken;
|
|
34600
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext,
|
|
34601
|
-
? parseAssignmentExpressionOrHigher(
|
|
34596
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34597
|
+
? parseAssignmentExpressionOrHigher()
|
|
34602
34598
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34603
34599
|
}
|
|
34604
34600
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -35490,13 +35486,13 @@ var ts;
|
|
|
35490
35486
|
function parseSpreadElement() {
|
|
35491
35487
|
var pos = getNodePos();
|
|
35492
35488
|
parseExpected(25 /* DotDotDotToken */);
|
|
35493
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
35489
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
35494
35490
|
return finishNode(factory.createSpreadElement(expression), pos);
|
|
35495
35491
|
}
|
|
35496
35492
|
function parseArgumentOrArrayLiteralElement() {
|
|
35497
35493
|
return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
|
|
35498
35494
|
token() === 27 /* CommaToken */ ? finishNode(factory.createOmittedExpression(), getNodePos()) :
|
|
35499
|
-
parseAssignmentExpressionOrHigher(
|
|
35495
|
+
parseAssignmentExpressionOrHigher();
|
|
35500
35496
|
}
|
|
35501
35497
|
function parseArgumentExpression() {
|
|
35502
35498
|
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
|
|
@@ -35514,7 +35510,7 @@ var ts;
|
|
|
35514
35510
|
var pos = getNodePos();
|
|
35515
35511
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35516
35512
|
if (parseOptionalToken(25 /* DotDotDotToken */)) {
|
|
35517
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
35513
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
35518
35514
|
return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
|
|
35519
35515
|
}
|
|
35520
35516
|
var decorators = parseDecorators();
|
|
@@ -35543,7 +35539,7 @@ var ts;
|
|
|
35543
35539
|
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58 /* ColonToken */);
|
|
35544
35540
|
if (isShorthandPropertyAssignment) {
|
|
35545
35541
|
var equalsToken = parseOptionalToken(63 /* EqualsToken */);
|
|
35546
|
-
var objectAssignmentInitializer = equalsToken ? allowInAnd(
|
|
35542
|
+
var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
|
|
35547
35543
|
node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
|
|
35548
35544
|
// Save equals token for error reporting.
|
|
35549
35545
|
// TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful.
|
|
@@ -35551,7 +35547,7 @@ var ts;
|
|
|
35551
35547
|
}
|
|
35552
35548
|
else {
|
|
35553
35549
|
parseExpected(58 /* ColonToken */);
|
|
35554
|
-
var initializer = allowInAnd(
|
|
35550
|
+
var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
35555
35551
|
node = factory.createPropertyAssignment(name, initializer);
|
|
35556
35552
|
}
|
|
35557
35553
|
// Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
|
|
@@ -35725,7 +35721,7 @@ var ts;
|
|
|
35725
35721
|
}
|
|
35726
35722
|
var node;
|
|
35727
35723
|
if (awaitToken ? parseExpected(160 /* OfKeyword */) : parseOptional(160 /* OfKeyword */)) {
|
|
35728
|
-
var expression = allowInAnd(
|
|
35724
|
+
var expression = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
35729
35725
|
parseExpected(21 /* CloseParenToken */);
|
|
35730
35726
|
node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
|
|
35731
35727
|
}
|
|
@@ -36893,7 +36889,7 @@ var ts;
|
|
|
36893
36889
|
var pos = getNodePos();
|
|
36894
36890
|
var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
|
|
36895
36891
|
parseExpected(58 /* ColonToken */);
|
|
36896
|
-
var value = parseAssignmentExpressionOrHigher(
|
|
36892
|
+
var value = parseAssignmentExpressionOrHigher();
|
|
36897
36893
|
return finishNode(factory.createAssertEntry(name, value), pos);
|
|
36898
36894
|
}
|
|
36899
36895
|
function parseAssertClause(skipAssertKeyword) {
|
|
@@ -36953,7 +36949,7 @@ var ts;
|
|
|
36953
36949
|
function parseModuleReference() {
|
|
36954
36950
|
return isExternalModuleReference()
|
|
36955
36951
|
? parseExternalModuleReference()
|
|
36956
|
-
: parseEntityName(/*allowReservedWords*/ false
|
|
36952
|
+
: parseEntityName(/*allowReservedWords*/ false);
|
|
36957
36953
|
}
|
|
36958
36954
|
function parseExternalModuleReference() {
|
|
36959
36955
|
var pos = getNodePos();
|
|
@@ -37132,7 +37128,7 @@ var ts;
|
|
|
37132
37128
|
else {
|
|
37133
37129
|
parseExpected(88 /* DefaultKeyword */);
|
|
37134
37130
|
}
|
|
37135
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
37131
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
37136
37132
|
parseSemicolon();
|
|
37137
37133
|
setAwaitContext(savedAwaitContext);
|
|
37138
37134
|
var node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression);
|
|
@@ -37206,7 +37202,7 @@ var ts;
|
|
|
37206
37202
|
var pos = getNodePos();
|
|
37207
37203
|
var hasBrace = parseOptional(18 /* OpenBraceToken */);
|
|
37208
37204
|
var p2 = getNodePos();
|
|
37209
|
-
var entityName = parseEntityName(/* allowReservedWords*/ false
|
|
37205
|
+
var entityName = parseEntityName(/* allowReservedWords*/ false);
|
|
37210
37206
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
37211
37207
|
reScanHashToken(); // rescan #id as # id
|
|
37212
37208
|
nextTokenJSDoc(); // then skip the #
|
|
@@ -37649,7 +37645,7 @@ var ts;
|
|
|
37649
37645
|
// parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error
|
|
37650
37646
|
var p2 = getNodePos();
|
|
37651
37647
|
var name = ts.tokenIsIdentifierOrKeyword(token())
|
|
37652
|
-
? parseEntityName(/*allowReservedWords*/ true
|
|
37648
|
+
? parseEntityName(/*allowReservedWords*/ true)
|
|
37653
37649
|
: undefined;
|
|
37654
37650
|
if (name) {
|
|
37655
37651
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
@@ -38971,6 +38967,7 @@ var ts;
|
|
|
38971
38967
|
["es2021.intl", "lib.es2021.intl.d.ts"],
|
|
38972
38968
|
["es2022.array", "lib.es2022.array.d.ts"],
|
|
38973
38969
|
["es2022.error", "lib.es2022.error.d.ts"],
|
|
38970
|
+
["es2022.intl", "lib.es2022.intl.d.ts"],
|
|
38974
38971
|
["es2022.object", "lib.es2022.object.d.ts"],
|
|
38975
38972
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
38976
38973
|
["esnext.array", "lib.es2022.array.d.ts"],
|
|
@@ -39306,7 +39303,7 @@ var ts;
|
|
|
39306
39303
|
es2020: ts.ModuleKind.ES2020,
|
|
39307
39304
|
es2022: ts.ModuleKind.ES2022,
|
|
39308
39305
|
esnext: ts.ModuleKind.ESNext,
|
|
39309
|
-
|
|
39306
|
+
node16: ts.ModuleKind.Node16,
|
|
39310
39307
|
nodenext: ts.ModuleKind.NodeNext,
|
|
39311
39308
|
})),
|
|
39312
39309
|
affectsModuleResolution: true,
|
|
@@ -39660,7 +39657,7 @@ var ts;
|
|
|
39660
39657
|
type: new ts.Map(ts.getEntries({
|
|
39661
39658
|
node: ts.ModuleResolutionKind.NodeJs,
|
|
39662
39659
|
classic: ts.ModuleResolutionKind.Classic,
|
|
39663
|
-
|
|
39660
|
+
node16: ts.ModuleResolutionKind.Node16,
|
|
39664
39661
|
nodenext: ts.ModuleResolutionKind.NodeNext,
|
|
39665
39662
|
})),
|
|
39666
39663
|
affectsModuleResolution: true,
|
|
@@ -40136,7 +40133,7 @@ var ts;
|
|
|
40136
40133
|
affectsModuleResolution: true,
|
|
40137
40134
|
description: ts.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
40138
40135
|
category: ts.Diagnostics.Language_and_Environment,
|
|
40139
|
-
defaultValueDescription: ts.Diagnostics.
|
|
40136
|
+
defaultValueDescription: ts.Diagnostics.auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules,
|
|
40140
40137
|
}
|
|
40141
40138
|
];
|
|
40142
40139
|
/* @internal */
|
|
@@ -42169,7 +42166,7 @@ var ts;
|
|
|
42169
42166
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
42170
42167
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
42171
42168
|
}
|
|
42172
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, resultFromCache) {
|
|
42169
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, diagnostics, resultFromCache) {
|
|
42173
42170
|
var _a;
|
|
42174
42171
|
if (resultFromCache) {
|
|
42175
42172
|
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
@@ -42177,7 +42174,8 @@ var ts;
|
|
|
42177
42174
|
}
|
|
42178
42175
|
return {
|
|
42179
42176
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
42180
|
-
failedLookupLocations: failedLookupLocations
|
|
42177
|
+
failedLookupLocations: failedLookupLocations,
|
|
42178
|
+
resolutionDiagnostics: diagnostics
|
|
42181
42179
|
};
|
|
42182
42180
|
}
|
|
42183
42181
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
@@ -42372,13 +42370,24 @@ var ts;
|
|
|
42372
42370
|
// set in a non-modal module resolution setting here. Do note that our behavior is not particularly well defined when these mode-overriding imports
|
|
42373
42371
|
// are present in a non-modal project; while in theory we'd like to either ignore the mode or provide faithful modern resolution, depending on what we feel is best,
|
|
42374
42372
|
// in practice, not every cache has the options available to intelligently make the choice to ignore the mode request, and it's unclear how modern "faithful modern
|
|
42375
|
-
// resolution" should be (`
|
|
42373
|
+
// resolution" should be (`node16`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
|
|
42376
42374
|
// context should _probably_ be an error - and that should likely be handled by the `Program` (which is what we do).
|
|
42377
|
-
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42375
|
+
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
|
|
42378
42376
|
features |= NodeResolutionFeatures.EsmMode;
|
|
42379
42377
|
}
|
|
42380
42378
|
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
42381
|
-
var
|
|
42379
|
+
var diagnostics = [];
|
|
42380
|
+
var moduleResolutionState = {
|
|
42381
|
+
compilerOptions: options,
|
|
42382
|
+
host: host,
|
|
42383
|
+
traceEnabled: traceEnabled,
|
|
42384
|
+
failedLookupLocations: failedLookupLocations,
|
|
42385
|
+
packageJsonInfoCache: cache,
|
|
42386
|
+
features: features,
|
|
42387
|
+
conditions: conditions,
|
|
42388
|
+
requestContainingDirectory: containingDirectory,
|
|
42389
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
42390
|
+
};
|
|
42382
42391
|
var resolved = primaryLookup();
|
|
42383
42392
|
var primary = true;
|
|
42384
42393
|
if (!resolved) {
|
|
@@ -42397,7 +42406,7 @@ var ts;
|
|
|
42397
42406
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
42398
42407
|
};
|
|
42399
42408
|
}
|
|
42400
|
-
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
|
|
42409
|
+
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, resolutionDiagnostics: diagnostics };
|
|
42401
42410
|
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
|
|
42402
42411
|
if (traceEnabled)
|
|
42403
42412
|
traceResult(result);
|
|
@@ -42463,7 +42472,7 @@ var ts;
|
|
|
42463
42472
|
}
|
|
42464
42473
|
ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
|
|
42465
42474
|
function getDefaultNodeResolutionFeatures(options) {
|
|
42466
|
-
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42475
|
+
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default :
|
|
42467
42476
|
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
42468
42477
|
NodeResolutionFeatures.None;
|
|
42469
42478
|
}
|
|
@@ -42480,6 +42489,8 @@ var ts;
|
|
|
42480
42489
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
42481
42490
|
conditions: ts.emptyArray,
|
|
42482
42491
|
features: NodeResolutionFeatures.None,
|
|
42492
|
+
requestContainingDirectory: containingDirectory,
|
|
42493
|
+
reportDiagnostic: ts.noop
|
|
42483
42494
|
};
|
|
42484
42495
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
42485
42496
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
@@ -42821,8 +42832,8 @@ var ts;
|
|
|
42821
42832
|
case ts.ModuleKind.CommonJS:
|
|
42822
42833
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
42823
42834
|
break;
|
|
42824
|
-
case ts.ModuleKind.
|
|
42825
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
42835
|
+
case ts.ModuleKind.Node16:
|
|
42836
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
42826
42837
|
break;
|
|
42827
42838
|
case ts.ModuleKind.NodeNext:
|
|
42828
42839
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -42842,8 +42853,8 @@ var ts;
|
|
|
42842
42853
|
}
|
|
42843
42854
|
ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
|
|
42844
42855
|
switch (moduleResolution) {
|
|
42845
|
-
case ts.ModuleResolutionKind.
|
|
42846
|
-
result =
|
|
42856
|
+
case ts.ModuleResolutionKind.Node16:
|
|
42857
|
+
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
42847
42858
|
break;
|
|
42848
42859
|
case ts.ModuleResolutionKind.NodeNext:
|
|
42849
42860
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43077,15 +43088,15 @@ var ts;
|
|
|
43077
43088
|
// respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
|
|
43078
43089
|
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
43079
43090
|
// allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
|
|
43080
|
-
// not
|
|
43091
|
+
// not supported in node 12 - https://github.com/nodejs/Release/issues/690
|
|
43081
43092
|
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
43082
43093
|
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
43083
|
-
NodeResolutionFeatures[NodeResolutionFeatures["
|
|
43094
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Node16Default"] = 30] = "Node16Default";
|
|
43084
43095
|
NodeResolutionFeatures[NodeResolutionFeatures["NodeNextDefault"] = 30] = "NodeNextDefault";
|
|
43085
43096
|
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
43086
43097
|
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
43087
|
-
function
|
|
43088
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.
|
|
43098
|
+
function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43099
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node16Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43089
43100
|
}
|
|
43090
43101
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43091
43102
|
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43125,12 +43136,13 @@ var ts;
|
|
|
43125
43136
|
var _a, _b;
|
|
43126
43137
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
43127
43138
|
var failedLookupLocations = [];
|
|
43128
|
-
// conditions are only used by the
|
|
43139
|
+
// conditions are only used by the node16/nodenext resolver - there's no priority order in the list,
|
|
43129
43140
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43130
43141
|
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43131
43142
|
if (compilerOptions.noDtsResolution) {
|
|
43132
43143
|
conditions.pop();
|
|
43133
43144
|
}
|
|
43145
|
+
var diagnostics = [];
|
|
43134
43146
|
var state = {
|
|
43135
43147
|
compilerOptions: compilerOptions,
|
|
43136
43148
|
host: host,
|
|
@@ -43139,9 +43151,11 @@ var ts;
|
|
|
43139
43151
|
packageJsonInfoCache: cache,
|
|
43140
43152
|
features: features,
|
|
43141
43153
|
conditions: conditions,
|
|
43154
|
+
requestContainingDirectory: containingDirectory,
|
|
43155
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
43142
43156
|
};
|
|
43143
43157
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43144
|
-
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);
|
|
43158
|
+
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);
|
|
43145
43159
|
function tryResolve(extensions) {
|
|
43146
43160
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, /*considerPackageJson*/ true); };
|
|
43147
43161
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -43314,9 +43328,9 @@ var ts;
|
|
|
43314
43328
|
}
|
|
43315
43329
|
}
|
|
43316
43330
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
43317
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
43331
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, ts.supportedTSExtensionsFlat)) {
|
|
43318
43332
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
43319
|
-
return result !== undefined ? { path: candidate, ext: ts.
|
|
43333
|
+
return result !== undefined ? { path: candidate, ext: ts.tryExtractTSExtension(candidate) } : undefined;
|
|
43320
43334
|
}
|
|
43321
43335
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
43322
43336
|
}
|
|
@@ -43439,6 +43453,8 @@ var ts;
|
|
|
43439
43453
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
43440
43454
|
conditions: ["node", "require", "types"],
|
|
43441
43455
|
features: features,
|
|
43456
|
+
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
43457
|
+
reportDiagnostic: ts.noop
|
|
43442
43458
|
};
|
|
43443
43459
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
|
|
43444
43460
|
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
@@ -43525,6 +43541,8 @@ var ts;
|
|
|
43525
43541
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
43526
43542
|
features: 0,
|
|
43527
43543
|
conditions: [],
|
|
43544
|
+
requestContainingDirectory: undefined,
|
|
43545
|
+
reportDiagnostic: ts.noop
|
|
43528
43546
|
};
|
|
43529
43547
|
var parts = ts.getPathComponents(fileName);
|
|
43530
43548
|
parts.pop();
|
|
@@ -43816,7 +43834,6 @@ var ts;
|
|
|
43816
43834
|
function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
|
43817
43835
|
return loadModuleFromTargetImportOrExport;
|
|
43818
43836
|
function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
|
|
43819
|
-
var _a, _b;
|
|
43820
43837
|
if (typeof target === "string") {
|
|
43821
43838
|
if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
|
|
43822
43839
|
if (state.traceEnabled) {
|
|
@@ -43853,13 +43870,16 @@ var ts;
|
|
|
43853
43870
|
}
|
|
43854
43871
|
return toSearchResult(/*value*/ undefined);
|
|
43855
43872
|
}
|
|
43856
|
-
var finalPath =
|
|
43873
|
+
var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
|
|
43874
|
+
var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
43875
|
+
if (inputLink)
|
|
43876
|
+
return inputLink;
|
|
43857
43877
|
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, finalPath, /*onlyRecordFailures*/ false, state)));
|
|
43858
43878
|
}
|
|
43859
43879
|
else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
|
|
43860
43880
|
if (!Array.isArray(target)) {
|
|
43861
|
-
for (var _i = 0,
|
|
43862
|
-
var key =
|
|
43881
|
+
for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) {
|
|
43882
|
+
var key = _a[_i];
|
|
43863
43883
|
if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
|
|
43864
43884
|
var subTarget = target[key];
|
|
43865
43885
|
var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
|
|
@@ -43877,8 +43897,8 @@ var ts;
|
|
|
43877
43897
|
}
|
|
43878
43898
|
return toSearchResult(/*value*/ undefined);
|
|
43879
43899
|
}
|
|
43880
|
-
for (var
|
|
43881
|
-
var elem = target_2[
|
|
43900
|
+
for (var _b = 0, target_2 = target; _b < target_2.length; _b++) {
|
|
43901
|
+
var elem = target_2[_b];
|
|
43882
43902
|
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
43883
43903
|
if (result) {
|
|
43884
43904
|
return result;
|
|
@@ -43896,6 +43916,128 @@ var ts;
|
|
|
43896
43916
|
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
43897
43917
|
}
|
|
43898
43918
|
return toSearchResult(/*value*/ undefined);
|
|
43919
|
+
function toAbsolutePath(path) {
|
|
43920
|
+
var _a, _b;
|
|
43921
|
+
if (path === undefined)
|
|
43922
|
+
return path;
|
|
43923
|
+
return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
|
|
43924
|
+
}
|
|
43925
|
+
function combineDirectoryPath(root, dir) {
|
|
43926
|
+
return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
|
|
43927
|
+
}
|
|
43928
|
+
function useCaseSensitiveFileNames() {
|
|
43929
|
+
return !state.host.useCaseSensitiveFileNames ? true :
|
|
43930
|
+
typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames :
|
|
43931
|
+
state.host.useCaseSensitiveFileNames();
|
|
43932
|
+
}
|
|
43933
|
+
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports) {
|
|
43934
|
+
var _a, _b, _c, _d;
|
|
43935
|
+
// Replace any references to outputs for files in the program with the input files to support package self-names used with outDir
|
|
43936
|
+
// 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
|
|
43937
|
+
// 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!
|
|
43938
|
+
// _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!).
|
|
43939
|
+
// 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.
|
|
43940
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
|
|
43941
|
+
&& (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
|
|
43942
|
+
&& finalPath.indexOf("/node_modules/") === -1
|
|
43943
|
+
&& (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
|
|
43944
|
+
// 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.
|
|
43945
|
+
// Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
|
|
43946
|
+
// `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
|
|
43947
|
+
var getCanonicalFileName = ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames });
|
|
43948
|
+
var commonSourceDirGuesses = [];
|
|
43949
|
+
// A `rootDir` compiler option strongly indicates the root location
|
|
43950
|
+
// 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
|
|
43951
|
+
if (state.compilerOptions.rootDir || (state.compilerOptions.composite && state.compilerOptions.configFilePath)) {
|
|
43952
|
+
var commonDir = toAbsolutePath(ts.getCommonSourceDirectory(state.compilerOptions, function () { return []; }, ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "", getCanonicalFileName));
|
|
43953
|
+
commonSourceDirGuesses.push(commonDir);
|
|
43954
|
+
}
|
|
43955
|
+
else if (state.requestContainingDirectory) {
|
|
43956
|
+
// However without either of those set we're in the dark. Let's say you have
|
|
43957
|
+
//
|
|
43958
|
+
// ./tools/index.ts
|
|
43959
|
+
// ./src/index.ts
|
|
43960
|
+
// ./dist/index.js
|
|
43961
|
+
// ./package.json <-- references ./dist/index.js
|
|
43962
|
+
// ./tsconfig.json <-- loads ./src/index.ts
|
|
43963
|
+
//
|
|
43964
|
+
// How do we know `./src` is the common src dir, and not `./tools`, given only the `./dist` out dir and `./dist/index.js` filename?
|
|
43965
|
+
// 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
|
|
43966
|
+
// without more context.
|
|
43967
|
+
// 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
|
|
43968
|
+
// must be inside the common source directory! So we propagate that tidbit of info all the way to here via state.requestContainingDirectory
|
|
43969
|
+
var requestingFile_1 = toAbsolutePath(ts.combinePaths(state.requestContainingDirectory, "index.ts"));
|
|
43970
|
+
// And we can try every folder above the common folder for the request folder and the config/package base directory
|
|
43971
|
+
// This technically can be wrong - we may load ./src/index.ts when ./src/sub/index.ts was right because we don't
|
|
43972
|
+
// know if only `./src/sub` files were loaded by the program; but this has the best chance to be right of just about anything
|
|
43973
|
+
// else we have. And, given that we're about to load `./src/index.ts` because we choose it as likely correct, there will then
|
|
43974
|
+
// be a file outside of `./src/sub` in the program (the file we resolved to), making us de-facto right. So this fallback lookup
|
|
43975
|
+
// logic may influence what files are pulled in by self-names, which in turn influences the output path shape, but it's all
|
|
43976
|
+
// internally consistent so the paths should be stable so long as we prefer the "most general" (meaning: top-most-level directory) possible results first.
|
|
43977
|
+
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));
|
|
43978
|
+
commonSourceDirGuesses.push(commonDir);
|
|
43979
|
+
var fragment = ts.ensureTrailingDirectorySeparator(commonDir);
|
|
43980
|
+
while (fragment && fragment.length > 1) {
|
|
43981
|
+
var parts = ts.getPathComponents(fragment);
|
|
43982
|
+
parts.pop(); // remove a directory
|
|
43983
|
+
var commonDir_1 = ts.getPathFromPathComponents(parts);
|
|
43984
|
+
commonSourceDirGuesses.unshift(commonDir_1);
|
|
43985
|
+
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
43986
|
+
}
|
|
43987
|
+
}
|
|
43988
|
+
if (commonSourceDirGuesses.length > 1) {
|
|
43989
|
+
state.reportDiagnostic(ts.createCompilerDiagnostic(isImports
|
|
43990
|
+
? 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
|
|
43991
|
+
: 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
|
|
43992
|
+
packagePath));
|
|
43993
|
+
}
|
|
43994
|
+
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
43995
|
+
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
43996
|
+
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
43997
|
+
for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
|
|
43998
|
+
var candidateDir = candidateDirectories_1[_e];
|
|
43999
|
+
if (ts.startsWith(finalPath, candidateDir)) {
|
|
44000
|
+
// 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
|
|
44001
|
+
var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
|
|
44002
|
+
var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
|
|
44003
|
+
var jsAndDtsExtensions = [".mjs" /* Mjs */, ".cjs" /* Cjs */, ".js" /* Js */, ".json" /* Json */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".d.ts" /* Dts */];
|
|
44004
|
+
for (var _f = 0, jsAndDtsExtensions_1 = jsAndDtsExtensions; _f < jsAndDtsExtensions_1.length; _f++) {
|
|
44005
|
+
var ext = jsAndDtsExtensions_1[_f];
|
|
44006
|
+
if (ts.fileExtensionIs(possibleInputBase, ext)) {
|
|
44007
|
+
var inputExts = ts.getPossibleOriginalInputExtensionForExtension(possibleInputBase);
|
|
44008
|
+
for (var _g = 0, inputExts_1 = inputExts; _g < inputExts_1.length; _g++) {
|
|
44009
|
+
var possibleExt = inputExts_1[_g];
|
|
44010
|
+
var possibleInputWithInputExtension = ts.changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
44011
|
+
if ((extensions === Extensions.TypeScript && ts.hasJSFileExtension(possibleInputWithInputExtension)) ||
|
|
44012
|
+
(extensions === Extensions.JavaScript && ts.hasTSFileExtension(possibleInputWithInputExtension))) {
|
|
44013
|
+
continue;
|
|
44014
|
+
}
|
|
44015
|
+
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
44016
|
+
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, possibleInputWithInputExtension, /*onlyRecordFailures*/ false, state)));
|
|
44017
|
+
}
|
|
44018
|
+
}
|
|
44019
|
+
}
|
|
44020
|
+
}
|
|
44021
|
+
}
|
|
44022
|
+
}
|
|
44023
|
+
}
|
|
44024
|
+
}
|
|
44025
|
+
return undefined;
|
|
44026
|
+
function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
|
|
44027
|
+
var _a, _b;
|
|
44028
|
+
// Config file ouput paths are processed to be relative to the host's current directory, while
|
|
44029
|
+
// otherwise the paths are resolved relative to the common source dir the compiler puts together
|
|
44030
|
+
var currentDir = state.compilerOptions.configFile ? ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "" : commonSourceDirGuess;
|
|
44031
|
+
var candidateDirectories = [];
|
|
44032
|
+
if (state.compilerOptions.declarationDir) {
|
|
44033
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
|
|
44034
|
+
}
|
|
44035
|
+
if (state.compilerOptions.outDir && state.compilerOptions.outDir !== state.compilerOptions.declarationDir) {
|
|
44036
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.outDir)));
|
|
44037
|
+
}
|
|
44038
|
+
return candidateDirectories;
|
|
44039
|
+
}
|
|
44040
|
+
}
|
|
43899
44041
|
}
|
|
43900
44042
|
}
|
|
43901
44043
|
/* @internal */
|
|
@@ -44086,11 +44228,12 @@ var ts;
|
|
|
44086
44228
|
function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
44087
44229
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
44088
44230
|
var failedLookupLocations = [];
|
|
44089
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [] };
|
|
44090
44231
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
44232
|
+
var diagnostics = [];
|
|
44233
|
+
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); } };
|
|
44091
44234
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
44092
44235
|
// No originalPath because classic resolution doesn't resolve realPath
|
|
44093
|
-
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, state.resultFromCache);
|
|
44236
|
+
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
44094
44237
|
function tryResolve(extensions) {
|
|
44095
44238
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
44096
44239
|
if (resolvedUsingSettings) {
|
|
@@ -44133,9 +44276,10 @@ var ts;
|
|
|
44133
44276
|
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);
|
|
44134
44277
|
}
|
|
44135
44278
|
var failedLookupLocations = [];
|
|
44136
|
-
var
|
|
44279
|
+
var diagnostics = [];
|
|
44280
|
+
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); } };
|
|
44137
44281
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
44138
|
-
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, state.resultFromCache);
|
|
44282
|
+
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
44139
44283
|
}
|
|
44140
44284
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
44141
44285
|
/**
|
|
@@ -48512,7 +48656,7 @@ var ts;
|
|
|
48512
48656
|
var enumRelation = new ts.Map();
|
|
48513
48657
|
var builtinGlobals = ts.createSymbolTable();
|
|
48514
48658
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
48515
|
-
// Extensions suggested for path imports when module resolution is
|
|
48659
|
+
// Extensions suggested for path imports when module resolution is node16 or higher.
|
|
48516
48660
|
// The first element of each tuple is the extension a file has.
|
|
48517
48661
|
// The second element of each tuple is the extension that should be used in a path import.
|
|
48518
48662
|
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
@@ -50801,7 +50945,7 @@ var ts;
|
|
|
50801
50945
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
50802
50946
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
50803
50947
|
}
|
|
50804
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
50948
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
50805
50949
|
var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
|
|
50806
50950
|
var overrideClauseHost = ts.findAncestor(location, function (l) { return ts.isImportTypeNode(l) || ts.isExportDeclaration(l) || ts.isImportDeclaration(l); });
|
|
50807
50951
|
var overrideClause = overrideClauseHost && ts.isImportTypeNode(overrideClauseHost) ? (_g = overrideClauseHost.assertions) === null || _g === void 0 ? void 0 : _g.assertClause : overrideClauseHost === null || overrideClauseHost === void 0 ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -50810,9 +50954,6 @@ var ts;
|
|
|
50810
50954
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
|
|
50811
50955
|
error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
|
|
50812
50956
|
}
|
|
50813
|
-
if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
|
|
50814
|
-
error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
|
|
50815
|
-
}
|
|
50816
50957
|
}
|
|
50817
50958
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
50818
50959
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -50865,7 +51006,7 @@ var ts;
|
|
|
50865
51006
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
50866
51007
|
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
50867
51008
|
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
50868
|
-
var
|
|
51009
|
+
var resolutionIsNode16OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node16 ||
|
|
50869
51010
|
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
50870
51011
|
if (tsExtension) {
|
|
50871
51012
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
@@ -50886,17 +51027,17 @@ var ts;
|
|
|
50886
51027
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
50887
51028
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
50888
51029
|
}
|
|
50889
|
-
else if (mode === ts.ModuleKind.ESNext &&
|
|
51030
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
50890
51031
|
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
50891
51032
|
var suggestedExt = (_h = suggestedExtensions.find(function (_a) {
|
|
50892
51033
|
var actualExt = _a[0], _importExt = _a[1];
|
|
50893
51034
|
return host.fileExists(absoluteRef_1 + actualExt);
|
|
50894
51035
|
})) === null || _h === void 0 ? void 0 : _h[1];
|
|
50895
51036
|
if (suggestedExt) {
|
|
50896
|
-
error(errorNode, ts.Diagnostics.
|
|
51037
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
50897
51038
|
}
|
|
50898
51039
|
else {
|
|
50899
|
-
error(errorNode, ts.Diagnostics.
|
|
51040
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
50900
51041
|
}
|
|
50901
51042
|
}
|
|
50902
51043
|
else {
|
|
@@ -53218,7 +53359,7 @@ var ts;
|
|
|
53218
53359
|
var targetFile = ts.getSourceFileOfModule(chain[0]);
|
|
53219
53360
|
var specifier = void 0;
|
|
53220
53361
|
var assertion = void 0;
|
|
53221
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53362
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53222
53363
|
// An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion
|
|
53223
53364
|
if ((targetFile === null || targetFile === void 0 ? void 0 : targetFile.impliedNodeFormat) === ts.ModuleKind.ESNext && targetFile.impliedNodeFormat !== (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat)) {
|
|
53224
53365
|
specifier = getSpecifierForModuleSymbol(chain[0], context, ts.ModuleKind.ESNext);
|
|
@@ -53232,7 +53373,7 @@ var ts;
|
|
|
53232
53373
|
}
|
|
53233
53374
|
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
|
|
53234
53375
|
var oldSpecifier = specifier;
|
|
53235
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53376
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53236
53377
|
// We might be able to write a portable import type using a mode override; try specifier generation again, but with a different mode set
|
|
53237
53378
|
var swappedMode = (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat) === ts.ModuleKind.ESNext ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
53238
53379
|
specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
|
|
@@ -58002,7 +58143,8 @@ var ts;
|
|
|
58002
58143
|
if (symbol === globalThisSymbol) {
|
|
58003
58144
|
var varsOnly_1 = new ts.Map();
|
|
58004
58145
|
members.forEach(function (p) {
|
|
58005
|
-
|
|
58146
|
+
var _a;
|
|
58147
|
+
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))) {
|
|
58006
58148
|
varsOnly_1.set(p.escapedName, p);
|
|
58007
58149
|
}
|
|
58008
58150
|
});
|
|
@@ -71197,7 +71339,7 @@ var ts;
|
|
|
71197
71339
|
if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
71198
71340
|
var parent = declaration.parent.parent;
|
|
71199
71341
|
if (parent.kind === 254 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 164 /* Parameter */) {
|
|
71200
|
-
var links = getNodeLinks(
|
|
71342
|
+
var links = getNodeLinks(parent);
|
|
71201
71343
|
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
71202
71344
|
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
71203
71345
|
var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
|
|
@@ -77060,13 +77202,13 @@ var ts;
|
|
|
77060
77202
|
}
|
|
77061
77203
|
}
|
|
77062
77204
|
function checkImportMetaProperty(node) {
|
|
77063
|
-
if (moduleKind === ts.ModuleKind.
|
|
77205
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
77064
77206
|
if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
77065
77207
|
error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
77066
77208
|
}
|
|
77067
77209
|
}
|
|
77068
77210
|
else if (moduleKind < ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.System) {
|
|
77069
|
-
error(node, ts.Diagnostics.
|
|
77211
|
+
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
|
|
77070
77212
|
}
|
|
77071
77213
|
var file = ts.getSourceFileOfNode(node);
|
|
77072
77214
|
ts.Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -78017,15 +78159,30 @@ var ts;
|
|
|
78017
78159
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
78018
78160
|
var span = void 0;
|
|
78019
78161
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
78020
|
-
|
|
78021
|
-
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
78162
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78022
78163
|
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module);
|
|
78023
78164
|
diagnostics.add(diagnostic);
|
|
78024
78165
|
}
|
|
78025
|
-
|
|
78026
|
-
|
|
78027
|
-
|
|
78028
|
-
|
|
78166
|
+
switch (moduleKind) {
|
|
78167
|
+
case ts.ModuleKind.Node16:
|
|
78168
|
+
case ts.ModuleKind.NodeNext:
|
|
78169
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
78170
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78171
|
+
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));
|
|
78172
|
+
break;
|
|
78173
|
+
}
|
|
78174
|
+
// fallthrough
|
|
78175
|
+
case ts.ModuleKind.ES2022:
|
|
78176
|
+
case ts.ModuleKind.ESNext:
|
|
78177
|
+
case ts.ModuleKind.System:
|
|
78178
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
78179
|
+
break;
|
|
78180
|
+
}
|
|
78181
|
+
// fallthrough
|
|
78182
|
+
default:
|
|
78183
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78184
|
+
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));
|
|
78185
|
+
break;
|
|
78029
78186
|
}
|
|
78030
78187
|
}
|
|
78031
78188
|
}
|
|
@@ -80467,8 +80624,8 @@ var ts;
|
|
|
80467
80624
|
if (node.assertions) {
|
|
80468
80625
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80469
80626
|
if (override) {
|
|
80470
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
80471
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80627
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80628
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80472
80629
|
}
|
|
80473
80630
|
}
|
|
80474
80631
|
}
|
|
@@ -81918,7 +82075,7 @@ var ts;
|
|
|
81918
82075
|
}
|
|
81919
82076
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
81920
82077
|
// No need to check for require or exports for ES6 modules and later
|
|
81921
|
-
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.
|
|
82078
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node16 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
81922
82079
|
return;
|
|
81923
82080
|
}
|
|
81924
82081
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -84838,8 +84995,8 @@ var ts;
|
|
|
84838
84995
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
84839
84996
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
84840
84997
|
if (validForTypeAssertions && override) {
|
|
84841
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
84842
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
84998
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
84999
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
84843
85000
|
}
|
|
84844
85001
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
84845
85002
|
}
|
|
@@ -86178,7 +86335,7 @@ var ts;
|
|
|
86178
86335
|
if (ts.isDeclaration(node)) {
|
|
86179
86336
|
// In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
|
|
86180
86337
|
var symbol = getSymbolOfNode(node);
|
|
86181
|
-
return getTypeOfSymbol(symbol);
|
|
86338
|
+
return symbol ? getTypeOfSymbol(symbol) : errorType;
|
|
86182
86339
|
}
|
|
86183
86340
|
if (isDeclarationNameOrImportPropertyName(node)) {
|
|
86184
86341
|
var symbol = getSymbolAtLocation(node);
|
|
@@ -88026,8 +88183,24 @@ var ts;
|
|
|
88026
88183
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
88027
88184
|
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module));
|
|
88028
88185
|
}
|
|
88029
|
-
|
|
88030
|
-
|
|
88186
|
+
switch (moduleKind) {
|
|
88187
|
+
case ts.ModuleKind.Node16:
|
|
88188
|
+
case ts.ModuleKind.NodeNext:
|
|
88189
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
88190
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
|
|
88191
|
+
break;
|
|
88192
|
+
}
|
|
88193
|
+
// fallthrough
|
|
88194
|
+
case ts.ModuleKind.ES2022:
|
|
88195
|
+
case ts.ModuleKind.ESNext:
|
|
88196
|
+
case ts.ModuleKind.System:
|
|
88197
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
88198
|
+
break;
|
|
88199
|
+
}
|
|
88200
|
+
// fallthrough
|
|
88201
|
+
default:
|
|
88202
|
+
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));
|
|
88203
|
+
break;
|
|
88031
88204
|
}
|
|
88032
88205
|
}
|
|
88033
88206
|
}
|
|
@@ -88722,7 +88895,7 @@ var ts;
|
|
|
88722
88895
|
}
|
|
88723
88896
|
function checkGrammarImportCallExpression(node) {
|
|
88724
88897
|
if (moduleKind === ts.ModuleKind.ES2015) {
|
|
88725
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
88898
|
+
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext);
|
|
88726
88899
|
}
|
|
88727
88900
|
if (node.typeArguments) {
|
|
88728
88901
|
return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
|
|
@@ -88733,7 +88906,7 @@ var ts;
|
|
|
88733
88906
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
88734
88907
|
if (nodeArguments.length > 1) {
|
|
88735
88908
|
var assertionArgument = nodeArguments[1];
|
|
88736
|
-
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.
|
|
88909
|
+
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
|
|
88737
88910
|
}
|
|
88738
88911
|
}
|
|
88739
88912
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
@@ -108999,7 +109172,7 @@ var ts;
|
|
|
108999
109172
|
return ts.transformECMAScriptModule;
|
|
109000
109173
|
case ts.ModuleKind.System:
|
|
109001
109174
|
return ts.transformSystemModule;
|
|
109002
|
-
case ts.ModuleKind.
|
|
109175
|
+
case ts.ModuleKind.Node16:
|
|
109003
109176
|
case ts.ModuleKind.NodeNext:
|
|
109004
109177
|
return ts.transformNodeModule;
|
|
109005
109178
|
default:
|
|
@@ -116022,7 +116195,7 @@ var ts;
|
|
|
116022
116195
|
*/
|
|
116023
116196
|
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
116024
116197
|
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
116025
|
-
case ts.ModuleResolutionKind.
|
|
116198
|
+
case ts.ModuleResolutionKind.Node16:
|
|
116026
116199
|
case ts.ModuleResolutionKind.NodeNext:
|
|
116027
116200
|
return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
|
|
116028
116201
|
ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
|
|
@@ -116076,7 +116249,6 @@ var ts;
|
|
|
116076
116249
|
ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
|
|
116077
116250
|
ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
|
|
116078
116251
|
ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
|
|
116079
|
-
ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
|
|
116080
116252
|
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
116081
116253
|
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
116082
116254
|
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
@@ -116321,7 +116493,7 @@ var ts;
|
|
|
116321
116493
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
116322
116494
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
116323
116495
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
116324
|
-
// under
|
|
116496
|
+
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
|
|
116325
116497
|
processTypeReferenceDirective(typeReferences[i], /*mode*/ undefined, resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_c = resolutions[i]) === null || _c === void 0 ? void 0 : _c.packageId });
|
|
116326
116498
|
}
|
|
116327
116499
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -116463,6 +116635,40 @@ var ts;
|
|
|
116463
116635
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
116464
116636
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
116465
116637
|
return program;
|
|
116638
|
+
function addResolutionDiagnostics(list) {
|
|
116639
|
+
if (!list)
|
|
116640
|
+
return;
|
|
116641
|
+
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
116642
|
+
var elem = list_3[_i];
|
|
116643
|
+
programDiagnostics.add(elem);
|
|
116644
|
+
}
|
|
116645
|
+
}
|
|
116646
|
+
function pullDiagnosticsFromCache(names, containingFile) {
|
|
116647
|
+
var _a;
|
|
116648
|
+
if (!moduleResolutionCache)
|
|
116649
|
+
return;
|
|
116650
|
+
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
116651
|
+
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
116652
|
+
var containingDir = ts.getDirectoryPath(containingFileName);
|
|
116653
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
116654
|
+
var i = 0;
|
|
116655
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
116656
|
+
var n = names_4[_i];
|
|
116657
|
+
// 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
|
|
116658
|
+
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
116659
|
+
var name = typeof n === "string" ? n : n.fileName;
|
|
116660
|
+
i++;
|
|
116661
|
+
// only nonrelative names hit the cache, and, at least as of right now, only nonrelative names can issue diagnostics
|
|
116662
|
+
// (Since diagnostics are only issued via import or export map lookup)
|
|
116663
|
+
// This may totally change if/when the issue of output paths not mapping to input files is fixed in a broader context
|
|
116664
|
+
// When it is, how we extract diagnostics from the module name resolver will have the be refined - the current cache
|
|
116665
|
+
// APIs wrapping the underlying resolver make it almost impossible to smuggle the diagnostics out in a generalized way
|
|
116666
|
+
if (ts.isExternalModuleNameRelative(name))
|
|
116667
|
+
continue;
|
|
116668
|
+
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
116669
|
+
addResolutionDiagnostics(diags);
|
|
116670
|
+
}
|
|
116671
|
+
}
|
|
116466
116672
|
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
116467
116673
|
if (!moduleNames.length)
|
|
116468
116674
|
return ts.emptyArray;
|
|
@@ -116474,6 +116680,7 @@ var ts;
|
|
|
116474
116680
|
ts.performance.mark("afterResolveModule");
|
|
116475
116681
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
116476
116682
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
116683
|
+
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
116477
116684
|
return result;
|
|
116478
116685
|
}
|
|
116479
116686
|
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
@@ -117974,8 +118181,8 @@ var ts;
|
|
|
117974
118181
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
117975
118182
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
117976
118183
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
117977
|
-
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
117978
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118184
|
+
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118185
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
117979
118186
|
}
|
|
117980
118187
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
117981
118188
|
}
|
|
@@ -118337,7 +118544,7 @@ var ts;
|
|
|
118337
118544
|
}
|
|
118338
118545
|
if (options.resolveJsonModule) {
|
|
118339
118546
|
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
118340
|
-
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
118547
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 &&
|
|
118341
118548
|
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118342
118549
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
118343
118550
|
}
|
|
@@ -120910,8 +121117,8 @@ var ts;
|
|
|
120910
121117
|
!!redirectedReference;
|
|
120911
121118
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
120912
121119
|
var i = 0;
|
|
120913
|
-
for (var _i = 0,
|
|
120914
|
-
var entry =
|
|
121120
|
+
for (var _i = 0, names_5 = names; _i < names_5.length; _i++) {
|
|
121121
|
+
var entry = names_5[_i];
|
|
120915
121122
|
var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
|
|
120916
121123
|
// Imports supply a `containingSourceFile` but no `containingSourceFileMode` - it would be redundant
|
|
120917
121124
|
// they require calculating the mode for a given import from it's position in the resolution table, since a given
|
|
@@ -121477,7 +121684,7 @@ var ts;
|
|
|
121477
121684
|
}
|
|
121478
121685
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
121479
121686
|
var _a;
|
|
121480
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
121687
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16
|
|
121481
121688
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
121482
121689
|
return false;
|
|
121483
121690
|
}
|
|
@@ -122062,7 +122269,7 @@ var ts;
|
|
|
122062
122269
|
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
122063
122270
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
122064
122271
|
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
122065
|
-
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
122272
|
+
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
122066
122273
|
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
122067
122274
|
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
122068
122275
|
// usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
|
|
@@ -127259,11 +127466,11 @@ var ts;
|
|
|
127259
127466
|
}
|
|
127260
127467
|
ts.getModuleSpecifierResolverHost = getModuleSpecifierResolverHost;
|
|
127261
127468
|
function moduleResolutionRespectsExports(moduleResolution) {
|
|
127262
|
-
return moduleResolution >= ts.ModuleResolutionKind.
|
|
127469
|
+
return moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127263
127470
|
}
|
|
127264
127471
|
ts.moduleResolutionRespectsExports = moduleResolutionRespectsExports;
|
|
127265
127472
|
function moduleResolutionUsesNodeModules(moduleResolution) {
|
|
127266
|
-
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.
|
|
127473
|
+
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127267
127474
|
}
|
|
127268
127475
|
ts.moduleResolutionUsesNodeModules = moduleResolutionUsesNodeModules;
|
|
127269
127476
|
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
|
|
@@ -128946,23 +129153,30 @@ var ts;
|
|
|
128946
129153
|
(_d = host.log) === null || _d === void 0 ? void 0 : _d.call(host, "getExportInfoMap: cache miss or empty; calculating new results");
|
|
128947
129154
|
var compilerOptions = program.getCompilerOptions();
|
|
128948
129155
|
var moduleCount = 0;
|
|
128949
|
-
|
|
128950
|
-
|
|
128951
|
-
|
|
128952
|
-
|
|
128953
|
-
|
|
128954
|
-
|
|
128955
|
-
|
|
128956
|
-
|
|
128957
|
-
|
|
128958
|
-
|
|
128959
|
-
|
|
128960
|
-
checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
|
|
128961
|
-
if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
|
|
128962
|
-
cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, checker);
|
|
129156
|
+
try {
|
|
129157
|
+
forEachExternalModuleToImportFrom(program, host, /*useAutoImportProvider*/ true, function (moduleSymbol, moduleFile, program, isFromPackageJson) {
|
|
129158
|
+
if (++moduleCount % 100 === 0)
|
|
129159
|
+
cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.throwIfCancellationRequested();
|
|
129160
|
+
var seenExports = new ts.Map();
|
|
129161
|
+
var checker = program.getTypeChecker();
|
|
129162
|
+
var defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
|
|
129163
|
+
// Note: I think we shouldn't actually see resolved module symbols here, but weird merges
|
|
129164
|
+
// can cause it to happen: see 'completionsImport_mergedReExport.ts'
|
|
129165
|
+
if (defaultInfo && isImportableSymbol(defaultInfo.symbol, checker)) {
|
|
129166
|
+
cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, checker);
|
|
128963
129167
|
}
|
|
129168
|
+
checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
|
|
129169
|
+
if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
|
|
129170
|
+
cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, checker);
|
|
129171
|
+
}
|
|
129172
|
+
});
|
|
128964
129173
|
});
|
|
128965
|
-
}
|
|
129174
|
+
}
|
|
129175
|
+
catch (err) {
|
|
129176
|
+
// Ensure cache is reset if operation is cancelled
|
|
129177
|
+
cache.clear();
|
|
129178
|
+
throw err;
|
|
129179
|
+
}
|
|
128966
129180
|
(_e = host.log) === null || _e === void 0 ? void 0 : _e.call(host, "getExportInfoMap: done in " + (ts.timestamp() - start) + " ms");
|
|
128967
129181
|
return cache;
|
|
128968
129182
|
}
|
|
@@ -130587,11 +130801,11 @@ var ts;
|
|
|
130587
130801
|
}
|
|
130588
130802
|
function isEmitResolutionKindUsingNodeModules(compilerOptions) {
|
|
130589
130803
|
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ||
|
|
130590
|
-
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
130804
|
+
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
130591
130805
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
130592
130806
|
}
|
|
130593
130807
|
function isEmitModuleResolutionRespectingExportMaps(compilerOptions) {
|
|
130594
|
-
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
130808
|
+
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
130595
130809
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
130596
130810
|
}
|
|
130597
130811
|
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
@@ -131151,7 +131365,7 @@ var ts;
|
|
|
131151
131365
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeAssertionKeywords"] = 6] = "TypeAssertionKeywords";
|
|
131152
131366
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeKeywords"] = 7] = "TypeKeywords";
|
|
131153
131367
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeKeyword"] = 8] = "TypeKeyword";
|
|
131154
|
-
KeywordCompletionFilters[KeywordCompletionFilters["Last"] =
|
|
131368
|
+
KeywordCompletionFilters[KeywordCompletionFilters["Last"] = 8] = "Last";
|
|
131155
131369
|
})(KeywordCompletionFilters || (KeywordCompletionFilters = {}));
|
|
131156
131370
|
var GlobalsSearch;
|
|
131157
131371
|
(function (GlobalsSearch) {
|
|
@@ -131401,7 +131615,7 @@ var ts;
|
|
|
131401
131615
|
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
131402
131616
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
131403
131617
|
var keywordEntry = _a[_i];
|
|
131404
|
-
if (!entryNames_1.has(keywordEntry.name)) {
|
|
131618
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !entryNames_1.has(keywordEntry.name)) {
|
|
131405
131619
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
131406
131620
|
}
|
|
131407
131621
|
}
|
|
@@ -133140,7 +133354,7 @@ var ts;
|
|
|
133140
133354
|
return;
|
|
133141
133355
|
}
|
|
133142
133356
|
// Do a relatively cheap check to bail early if all re-exports are non-importable
|
|
133143
|
-
// due to file location or package.json dependency filtering. For non-
|
|
133357
|
+
// due to file location or package.json dependency filtering. For non-node16+
|
|
133144
133358
|
// module resolution modes, getting past this point guarantees that we'll be
|
|
133145
133359
|
// able to generate a suitable module specifier, so we can safely show a completion,
|
|
133146
133360
|
// even if we defer computing the module specifier.
|
|
@@ -133148,7 +133362,7 @@ var ts;
|
|
|
133148
133362
|
if (!firstImportableExportInfo) {
|
|
133149
133363
|
return;
|
|
133150
133364
|
}
|
|
133151
|
-
// In
|
|
133365
|
+
// In node16+, module specifier resolution can fail due to modules being blocked
|
|
133152
133366
|
// by package.json `exports`. If that happens, don't show a completion item.
|
|
133153
133367
|
// N.B. in this resolution mode we always try to resolve module specifiers here,
|
|
133154
133368
|
// because we have to know now if it's going to fail so we can omit the completion
|
|
@@ -134120,7 +134334,7 @@ var ts;
|
|
|
134120
134334
|
function getKeywordCompletions(keywordFilter, filterOutTsOnlyKeywords) {
|
|
134121
134335
|
if (!filterOutTsOnlyKeywords)
|
|
134122
134336
|
return getTypescriptKeywordCompletions(keywordFilter);
|
|
134123
|
-
var index = keywordFilter +
|
|
134337
|
+
var index = keywordFilter + 8 /* Last */ + 1;
|
|
134124
134338
|
return _keywordCompletions[index] ||
|
|
134125
134339
|
(_keywordCompletions[index] = getTypescriptKeywordCompletions(keywordFilter)
|
|
134126
134340
|
.filter(function (entry) { return !isTypeScriptOnlyKeyword(ts.stringToToken(entry.name)); }));
|
|
@@ -138743,7 +138957,7 @@ var ts;
|
|
|
138743
138957
|
(function (ts) {
|
|
138744
138958
|
var GoToDefinition;
|
|
138745
138959
|
(function (GoToDefinition) {
|
|
138746
|
-
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly) {
|
|
138960
|
+
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
138747
138961
|
var _a;
|
|
138748
138962
|
var _b;
|
|
138749
138963
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
@@ -138768,7 +138982,7 @@ var ts;
|
|
|
138768
138982
|
}
|
|
138769
138983
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
138770
138984
|
var classDecl = node.parent.parent;
|
|
138771
|
-
var _c = getSymbol(classDecl, typeChecker), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
138985
|
+
var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
138772
138986
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
138773
138987
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
138774
138988
|
var sourceFile_1 = node.getSourceFile();
|
|
@@ -138778,14 +138992,14 @@ var ts;
|
|
|
138778
138992
|
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
|
|
138779
138993
|
});
|
|
138780
138994
|
}
|
|
138781
|
-
var _d = getSymbol(node, typeChecker), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
138995
|
+
var _d = getSymbol(node, typeChecker, stopAtAlias), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
138782
138996
|
var fallbackNode = node;
|
|
138783
138997
|
if (searchOtherFilesOnly && failedAliasResolution) {
|
|
138784
138998
|
// We couldn't resolve the specific import, try on the module specifier.
|
|
138785
138999
|
var importDeclaration = ts.forEach(__spreadArray([node], (symbol === null || symbol === void 0 ? void 0 : symbol.declarations) || ts.emptyArray, true), function (n) { return ts.findAncestor(n, ts.isAnyImportOrBareOrAccessedRequire); });
|
|
138786
139000
|
var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
|
|
138787
139001
|
if (moduleSpecifier) {
|
|
138788
|
-
(_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
139002
|
+
(_a = getSymbol(moduleSpecifier, typeChecker, stopAtAlias), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
138789
139003
|
fallbackNode = moduleSpecifier;
|
|
138790
139004
|
}
|
|
138791
139005
|
}
|
|
@@ -138959,7 +139173,7 @@ var ts;
|
|
|
138959
139173
|
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
138960
139174
|
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
|
|
138961
139175
|
}
|
|
138962
|
-
var _a = getSymbol(node, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
139176
|
+
var _a = getSymbol(node, typeChecker, /*stopAtAlias*/ false), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
138963
139177
|
if (!symbol)
|
|
138964
139178
|
return undefined;
|
|
138965
139179
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
@@ -139010,14 +139224,14 @@ var ts;
|
|
|
139010
139224
|
function getDefinitionInfoForIndexSignatures(node, checker) {
|
|
139011
139225
|
return ts.mapDefined(checker.getIndexInfosAtLocation(node), function (info) { return info.declaration && createDefinitionFromSignatureDeclaration(checker, info.declaration); });
|
|
139012
139226
|
}
|
|
139013
|
-
function getSymbol(node, checker) {
|
|
139227
|
+
function getSymbol(node, checker, stopAtAlias) {
|
|
139014
139228
|
var symbol = checker.getSymbolAtLocation(node);
|
|
139015
139229
|
// If this is an alias, and the request came at the declaration location
|
|
139016
139230
|
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
|
139017
139231
|
// import {A, B} from "mod";
|
|
139018
139232
|
// to jump to the implementation directly.
|
|
139019
139233
|
var failedAliasResolution = false;
|
|
139020
|
-
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139234
|
+
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && !stopAtAlias && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139021
139235
|
var aliased = checker.getAliasedSymbol(symbol);
|
|
139022
139236
|
if (aliased.declarations) {
|
|
139023
139237
|
return { symbol: aliased };
|
|
@@ -146545,6 +146759,9 @@ var ts;
|
|
|
146545
146759
|
consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node);
|
|
146546
146760
|
}
|
|
146547
146761
|
function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
|
|
146762
|
+
if (ts.nodeIsMissing(child)) {
|
|
146763
|
+
return inheritedIndentation;
|
|
146764
|
+
}
|
|
146548
146765
|
var childStartPos = child.getStart(sourceFile);
|
|
146549
146766
|
var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
|
|
146550
146767
|
var undecoratedChildStartLine = childStartLine;
|
|
@@ -152610,7 +152827,7 @@ var ts;
|
|
|
152610
152827
|
case ts.ModuleKind.None:
|
|
152611
152828
|
// Fall back to the `import * as ns` style import.
|
|
152612
152829
|
return 2 /* Namespace */;
|
|
152613
|
-
case ts.ModuleKind.
|
|
152830
|
+
case ts.ModuleKind.Node16:
|
|
152614
152831
|
case ts.ModuleKind.NodeNext:
|
|
152615
152832
|
return importingFile.impliedNodeFormat === ts.ModuleKind.ESNext ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
152616
152833
|
default:
|
|
@@ -154523,8 +154740,8 @@ var ts;
|
|
|
154523
154740
|
(function (codefix) {
|
|
154524
154741
|
codefix.registerCodeFix({
|
|
154525
154742
|
errorCodes: [
|
|
154526
|
-
ts.Diagnostics.
|
|
154527
|
-
ts.Diagnostics.
|
|
154743
|
+
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,
|
|
154744
|
+
ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
154528
154745
|
],
|
|
154529
154746
|
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
154530
154747
|
var compilerOptions = context.program.getCompilerOptions();
|
|
@@ -164407,9 +164624,9 @@ var ts;
|
|
|
164407
164624
|
}
|
|
164408
164625
|
}
|
|
164409
164626
|
/// Goto definition
|
|
164410
|
-
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly) {
|
|
164627
|
+
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly, stopAtAlias) {
|
|
164411
164628
|
synchronizeHostData();
|
|
164412
|
-
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
|
|
164629
|
+
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly, stopAtAlias);
|
|
164413
164630
|
}
|
|
164414
164631
|
function getDefinitionAndBoundSpan(fileName, position) {
|
|
164415
164632
|
synchronizeHostData();
|
|
@@ -174359,7 +174576,8 @@ var ts;
|
|
|
174359
174576
|
var providePrefixAndSuffixTextForRename = _a.providePrefixAndSuffixTextForRename;
|
|
174360
174577
|
var outputs = [];
|
|
174361
174578
|
var seen = createDocumentSpanSet();
|
|
174362
|
-
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174579
|
+
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174580
|
+
/*isForRename*/ true, function (project, location, tryAddToTodo) {
|
|
174363
174581
|
var projectOutputs = project.getLanguageService().findRenameLocations(location.fileName, location.pos, findInStrings, findInComments, providePrefixAndSuffixTextForRename);
|
|
174364
174582
|
if (projectOutputs) {
|
|
174365
174583
|
for (var _i = 0, projectOutputs_1 = projectOutputs; _i < projectOutputs_1.length; _i++) {
|
|
@@ -174373,18 +174591,20 @@ var ts;
|
|
|
174373
174591
|
});
|
|
174374
174592
|
return outputs;
|
|
174375
174593
|
}
|
|
174376
|
-
function getDefinitionLocation(defaultProject, initialLocation) {
|
|
174377
|
-
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos);
|
|
174594
|
+
function getDefinitionLocation(defaultProject, initialLocation, isForRename) {
|
|
174595
|
+
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, isForRename);
|
|
174378
174596
|
var info = infos && ts.firstOrUndefined(infos);
|
|
174379
174597
|
return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
|
|
174380
174598
|
}
|
|
174381
174599
|
function combineProjectOutputForReferences(projects, defaultProject, initialLocation, logger) {
|
|
174382
174600
|
var outputs = [];
|
|
174383
|
-
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174601
|
+
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174602
|
+
/*isForRename*/ false, function (project, location, getMappedLocation) {
|
|
174603
|
+
var _a, _b;
|
|
174384
174604
|
logger.info("Finding references to " + location.fileName + " position " + location.pos + " in project " + project.getProjectName());
|
|
174385
174605
|
var projectOutputs = project.getLanguageService().findReferences(location.fileName, location.pos);
|
|
174386
174606
|
if (projectOutputs) {
|
|
174387
|
-
var clearIsDefinition = projectOutputs[0].references[0].isDefinition === undefined;
|
|
174607
|
+
var clearIsDefinition = ((_b = (_a = projectOutputs[0]) === null || _a === void 0 ? void 0 : _a.references[0]) === null || _b === void 0 ? void 0 : _b.isDefinition) === undefined;
|
|
174388
174608
|
var _loop_9 = function (referencedSymbol) {
|
|
174389
174609
|
var mappedDefinitionFile = getMappedLocation(project, documentSpanLocation(referencedSymbol.definition));
|
|
174390
174610
|
var definition = mappedDefinitionFile === undefined ?
|
|
@@ -174394,8 +174614,8 @@ var ts;
|
|
|
174394
174614
|
symbolToAddTo = { definition: definition, references: [] };
|
|
174395
174615
|
outputs.push(symbolToAddTo);
|
|
174396
174616
|
}
|
|
174397
|
-
for (var
|
|
174398
|
-
var ref =
|
|
174617
|
+
for (var _c = 0, _d = referencedSymbol.references; _c < _d.length; _c++) {
|
|
174618
|
+
var ref = _d[_c];
|
|
174399
174619
|
// If it's in a mapped file, that is added to the todo list by `getMappedLocation`.
|
|
174400
174620
|
if (!ts.contains(symbolToAddTo.references, ref, ts.documentSpansEqual) && !getMappedLocation(project, documentSpanLocation(ref))) {
|
|
174401
174621
|
if (clearIsDefinition) {
|
|
@@ -174427,7 +174647,7 @@ var ts;
|
|
|
174427
174647
|
});
|
|
174428
174648
|
}
|
|
174429
174649
|
}
|
|
174430
|
-
function combineProjectOutputWorker(projects, defaultProject, initialLocation, cb) {
|
|
174650
|
+
function combineProjectOutputWorker(projects, defaultProject, initialLocation, isForRename, cb) {
|
|
174431
174651
|
var projectService = defaultProject.projectService;
|
|
174432
174652
|
var toDo;
|
|
174433
174653
|
var seenProjects = new ts.Set();
|
|
@@ -174438,7 +174658,7 @@ var ts;
|
|
|
174438
174658
|
});
|
|
174439
174659
|
// After initial references are collected, go over every other project and see if it has a reference for the symbol definition.
|
|
174440
174660
|
if (initialLocation) {
|
|
174441
|
-
var defaultDefinition_1 = getDefinitionLocation(defaultProject, initialLocation);
|
|
174661
|
+
var defaultDefinition_1 = getDefinitionLocation(defaultProject, initialLocation, isForRename);
|
|
174442
174662
|
if (defaultDefinition_1) {
|
|
174443
174663
|
var getGeneratedDefinition_1 = ts.memoize(function () { return defaultProject.isSourceOfProjectReferenceRedirect(defaultDefinition_1.fileName) ?
|
|
174444
174664
|
defaultDefinition_1 :
|
|
@@ -175494,7 +175714,7 @@ var ts;
|
|
|
175494
175714
|
definitions === null || definitions === void 0 ? void 0 : definitions.forEach(function (d) { return definitionSet_1.add(d); });
|
|
175495
175715
|
var noDtsProject = project.getNoDtsResolutionProject([file]);
|
|
175496
175716
|
var ls = noDtsProject.getLanguageService();
|
|
175497
|
-
var jsDefinitions = (_a = ls.getDefinitionAtPosition(file, position, /*searchOtherFilesOnly*/ true)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file; });
|
|
175717
|
+
var jsDefinitions = (_a = ls.getDefinitionAtPosition(file, position, /*searchOtherFilesOnly*/ true, /*stopAtAlias*/ false)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file; });
|
|
175498
175718
|
if (ts.some(jsDefinitions)) {
|
|
175499
175719
|
for (var _i = 0, jsDefinitions_1 = jsDefinitions; _i < jsDefinitions_1.length; _i++) {
|
|
175500
175720
|
var jsDefinition = jsDefinitions_1[_i];
|
|
@@ -175542,7 +175762,7 @@ var ts;
|
|
|
175542
175762
|
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions);
|
|
175543
175763
|
if (!packageJson)
|
|
175544
175764
|
return undefined;
|
|
175545
|
-
// Use fake options instead of actual compiler options to avoid following export map if the project uses
|
|
175765
|
+
// Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext -
|
|
175546
175766
|
// Mapping from an export map entry across packages is out of scope for now. Returned entrypoints will only be what can be
|
|
175547
175767
|
// resolved from the package root under --moduleResolution node
|
|
175548
175768
|
var entrypoints = ts.getEntrypointsFromPackageJsonInfo(packageJson, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, project, project.getModuleResolutionCache());
|
|
@@ -175579,7 +175799,7 @@ var ts;
|
|
|
175579
175799
|
var _a;
|
|
175580
175800
|
if (nameInChain === initialNode)
|
|
175581
175801
|
return undefined;
|
|
175582
|
-
var candidates = (_a = ls.getDefinitionAtPosition(file, nameInChain.getStart(), /*searchOtherFilesOnly*/ true)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file && d.isAmbient; }).map(function (d) { return ({
|
|
175802
|
+
var candidates = (_a = ls.getDefinitionAtPosition(file, nameInChain.getStart(), /*searchOtherFilesOnly*/ true, /*stopAtAlias*/ false)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file && d.isAmbient; }).map(function (d) { return ({
|
|
175583
175803
|
fileName: d.fileName,
|
|
175584
175804
|
name: ts.getTextOfIdentifierOrLiteral(initialNode)
|
|
175585
175805
|
}); });
|