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/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220506";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -5265,10 +5265,11 @@ var ts;
|
|
|
5265
5265
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5266
5266
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5267
5267
|
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
|
|
5268
|
-
// to better support ecmascript modules and their use within node - more features are still being added
|
|
5269
|
-
//
|
|
5270
|
-
// version-
|
|
5271
|
-
|
|
5268
|
+
// to better support ecmascript modules and their use within node - however more features are still being added.
|
|
5269
|
+
// TypeScript's Node ESM support was introduced after Node 12 went end-of-life, and Node 14 is the earliest stable
|
|
5270
|
+
// version that supports both pattern trailers - *but*, Node 16 is the first version that also supports ECMASCript 2022.
|
|
5271
|
+
// In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target
|
|
5272
|
+
ModuleResolutionKind[ModuleResolutionKind["Node16"] = 3] = "Node16";
|
|
5272
5273
|
ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
|
|
5273
5274
|
})(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
|
|
5274
5275
|
var ModuleDetectionKind;
|
|
@@ -5278,7 +5279,7 @@ var ts;
|
|
|
5278
5279
|
*/
|
|
5279
5280
|
ModuleDetectionKind[ModuleDetectionKind["Legacy"] = 1] = "Legacy";
|
|
5280
5281
|
/**
|
|
5281
|
-
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution:
|
|
5282
|
+
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node16+
|
|
5282
5283
|
*/
|
|
5283
5284
|
ModuleDetectionKind[ModuleDetectionKind["Auto"] = 2] = "Auto";
|
|
5284
5285
|
/**
|
|
@@ -5323,8 +5324,8 @@ var ts;
|
|
|
5323
5324
|
ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
|
|
5324
5325
|
ModuleKind[ModuleKind["ES2022"] = 7] = "ES2022";
|
|
5325
5326
|
ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
|
|
5326
|
-
//
|
|
5327
|
-
ModuleKind[ModuleKind["
|
|
5327
|
+
// Node16+ is an amalgam of commonjs (albeit updated) and es2022+, and represents a distinct module system from es2020/esnext
|
|
5328
|
+
ModuleKind[ModuleKind["Node16"] = 100] = "Node16";
|
|
5328
5329
|
ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
|
|
5329
5330
|
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
|
|
5330
5331
|
var JsxEmit;
|
|
@@ -8246,6 +8247,7 @@ var ts;
|
|
|
8246
8247
|
_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"),
|
|
8247
8248
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
8248
8249
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
8250
|
+
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
|
8249
8251
|
Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
|
|
8250
8252
|
The_body_of_an_if_statement_cannot_be_the_empty_statement: diag(1313, ts.DiagnosticCategory.Error, "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", "The body of an 'if' statement cannot be the empty statement."),
|
|
8251
8253
|
Global_module_exports_may_only_appear_in_module_files: diag(1314, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_in_module_files_1314", "Global module exports may only appear in module files."),
|
|
@@ -8257,8 +8259,8 @@ var ts;
|
|
|
8257
8259
|
Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, ts.DiagnosticCategory.Error, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
8258
8260
|
Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts.DiagnosticCategory.Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
|
|
8259
8261
|
Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, ts.DiagnosticCategory.Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
+
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."),
|
|
8263
|
+
Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nod_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'."),
|
|
8262
8264
|
Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
|
|
8263
8265
|
This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
|
|
8264
8266
|
String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
|
@@ -8275,7 +8277,7 @@ var ts;
|
|
|
8275
8277
|
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
|
|
8276
8278
|
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
|
|
8277
8279
|
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
8278
|
-
|
|
8280
|
+
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),
|
|
8279
8281
|
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
8280
8282
|
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
|
|
8281
8283
|
This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
|
|
@@ -8306,7 +8308,7 @@ var ts;
|
|
|
8306
8308
|
await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
8307
8309
|
_0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
8308
8310
|
_0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
8309
|
-
|
|
8311
|
+
Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, ts.DiagnosticCategory.Error, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
8310
8312
|
An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379", "An import alias cannot reference a declaration that was exported using 'export type'."),
|
|
8311
8313
|
An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
|
|
8312
8314
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
@@ -8358,7 +8360,7 @@ var ts;
|
|
|
8358
8360
|
File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
8359
8361
|
The_file_is_in_the_program_because_Colon: diag(1430, ts.DiagnosticCategory.Message, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
|
|
8360
8362
|
for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1431, ts.DiagnosticCategory.Error, "for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431", "'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
8361
|
-
|
|
8363
|
+
Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, ts.DiagnosticCategory.Error, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
8362
8364
|
Decorators_may_not_be_applied_to_this_parameters: diag(1433, ts.DiagnosticCategory.Error, "Decorators_may_not_be_applied_to_this_parameters_1433", "Decorators may not be applied to 'this' parameters."),
|
|
8363
8365
|
Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
8364
8366
|
Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, ts.DiagnosticCategory.Error, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
|
|
@@ -8376,7 +8378,7 @@ var ts;
|
|
|
8376
8378
|
Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, ts.DiagnosticCategory.Message, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."),
|
|
8377
8379
|
Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments: diag(1450, ts.DiagnosticCategory.Message, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional assertion as arguments"),
|
|
8378
8380
|
Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression: diag(1451, ts.DiagnosticCategory.Error, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),
|
|
8379
|
-
|
|
8381
|
+
Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext: diag(1452, ts.DiagnosticCategory.Error, "Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452", "Resolution modes are only supported when `moduleResolution` is `node16` or `nodenext`."),
|
|
8380
8382
|
resolution_mode_should_be_either_require_or_import: diag(1453, ts.DiagnosticCategory.Error, "resolution_mode_should_be_either_require_or_import_1453", "`resolution-mode` should be either `require` or `import`."),
|
|
8381
8383
|
resolution_mode_can_only_be_set_for_type_only_imports: diag(1454, ts.DiagnosticCategory.Error, "resolution_mode_can_only_be_set_for_type_only_imports_1454", "`resolution-mode` can only be set for type-only imports."),
|
|
8382
8384
|
resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, ts.DiagnosticCategory.Error, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
|
|
@@ -8387,7 +8389,7 @@ var ts;
|
|
|
8387
8389
|
An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
|
|
8388
8390
|
An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
|
|
8389
8391
|
Control_what_method_is_used_to_detect_module_format_JS_files: diag(1475, ts.DiagnosticCategory.Message, "Control_what_method_is_used_to_detect_module_format_JS_files_1475", "Control what method is used to detect module-format JS files."),
|
|
8390
|
-
|
|
8392
|
+
auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
|
|
8391
8393
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
8392
8394
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
8393
8395
|
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
@@ -8396,6 +8398,8 @@ var ts;
|
|
|
8396
8398
|
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),
|
|
8397
8399
|
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."),
|
|
8398
8400
|
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."),
|
|
8401
|
+
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."),
|
|
8402
|
+
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."),
|
|
8399
8403
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
8400
8404
|
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."),
|
|
8401
8405
|
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."),
|
|
@@ -8873,8 +8877,8 @@ var ts;
|
|
|
8873
8877
|
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
|
|
8874
8878
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
8875
8879
|
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
8876
|
-
|
|
8877
|
-
|
|
8880
|
+
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."),
|
|
8881
|
+
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),
|
|
8878
8882
|
Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
|
|
8879
8883
|
Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
|
|
8880
8884
|
All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
|
|
@@ -9540,7 +9544,6 @@ var ts;
|
|
|
9540
9544
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead: diag(7059, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),
|
|
9541
9545
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint: diag(7060, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),
|
|
9542
9546
|
A_mapped_type_may_not_declare_properties_or_methods: diag(7061, ts.DiagnosticCategory.Error, "A_mapped_type_may_not_declare_properties_or_methods_7061", "A mapped type may not declare properties or methods."),
|
|
9543
|
-
JSON_imports_are_experimental_in_ES_module_mode_imports: diag(7062, ts.DiagnosticCategory.Error, "JSON_imports_are_experimental_in_ES_module_mode_imports_7062", "JSON imports are experimental in ES module mode imports."),
|
|
9544
9547
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9545
9548
|
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
|
|
9546
9549
|
import_can_only_be_used_in_TypeScript_files: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."),
|
|
@@ -14833,7 +14836,7 @@ var ts;
|
|
|
14833
14836
|
}
|
|
14834
14837
|
ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
|
|
14835
14838
|
function isCommonJSContainingModuleKind(kind) {
|
|
14836
|
-
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.
|
|
14839
|
+
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node16 || kind === ts.ModuleKind.NodeNext;
|
|
14837
14840
|
}
|
|
14838
14841
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
14839
14842
|
return ts.isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator);
|
|
@@ -18222,6 +18225,16 @@ var ts;
|
|
|
18222
18225
|
".d.ts" /* Dts */;
|
|
18223
18226
|
}
|
|
18224
18227
|
ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
|
|
18228
|
+
/**
|
|
18229
|
+
* This function is an inverse of `getDeclarationEmitExtensionForPath`.
|
|
18230
|
+
*/
|
|
18231
|
+
function getPossibleOriginalInputExtensionForExtension(path) {
|
|
18232
|
+
return ts.fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] :
|
|
18233
|
+
ts.fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] :
|
|
18234
|
+
ts.fileExtensionIsOneOf(path, [".json.d.ts"]) ? [".json" /* Json */] :
|
|
18235
|
+
[".tsx" /* Tsx */, ".ts" /* Ts */, ".jsx" /* Jsx */, ".js" /* Js */];
|
|
18236
|
+
}
|
|
18237
|
+
ts.getPossibleOriginalInputExtensionForExtension = getPossibleOriginalInputExtensionForExtension;
|
|
18225
18238
|
function outFile(options) {
|
|
18226
18239
|
return options.outFile || options.out;
|
|
18227
18240
|
}
|
|
@@ -20001,7 +20014,7 @@ var ts;
|
|
|
20001
20014
|
file.externalModuleIndicator = ts.isFileProbablyExternalModule(file);
|
|
20002
20015
|
};
|
|
20003
20016
|
case ts.ModuleDetectionKind.Auto:
|
|
20004
|
-
// If module is nodenext or
|
|
20017
|
+
// If module is nodenext or node16, all esm format files are modules
|
|
20005
20018
|
// If jsx is react-jsx or react-jsxdev then jsx tags force module-ness
|
|
20006
20019
|
// otherwise, the presence of import or export statments (or import.meta) implies module-ness
|
|
20007
20020
|
var checks = [ts.isFileProbablyExternalModule];
|
|
@@ -20009,7 +20022,7 @@ var ts;
|
|
|
20009
20022
|
checks.push(isFileModuleFromUsingJSXTag);
|
|
20010
20023
|
}
|
|
20011
20024
|
var moduleKind = getEmitModuleKind(options);
|
|
20012
|
-
if (moduleKind === ts.ModuleKind.
|
|
20025
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
20013
20026
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
20014
20027
|
}
|
|
20015
20028
|
var combined_1 = ts.or.apply(void 0, checks);
|
|
@@ -20020,7 +20033,7 @@ var ts;
|
|
|
20020
20033
|
ts.getSetExternalModuleIndicator = getSetExternalModuleIndicator;
|
|
20021
20034
|
function getEmitScriptTarget(compilerOptions) {
|
|
20022
20035
|
return compilerOptions.target ||
|
|
20023
|
-
(compilerOptions.module === ts.ModuleKind.
|
|
20036
|
+
(compilerOptions.module === ts.ModuleKind.Node16 && 9 /* ES2022 */) ||
|
|
20024
20037
|
(compilerOptions.module === ts.ModuleKind.NodeNext && 99 /* ESNext */) ||
|
|
20025
20038
|
0 /* ES3 */;
|
|
20026
20039
|
}
|
|
@@ -20038,8 +20051,8 @@ var ts;
|
|
|
20038
20051
|
case ts.ModuleKind.CommonJS:
|
|
20039
20052
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
20040
20053
|
break;
|
|
20041
|
-
case ts.ModuleKind.
|
|
20042
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
20054
|
+
case ts.ModuleKind.Node16:
|
|
20055
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
20043
20056
|
break;
|
|
20044
20057
|
case ts.ModuleKind.NodeNext:
|
|
20045
20058
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -20064,7 +20077,7 @@ var ts;
|
|
|
20064
20077
|
case ts.ModuleKind.ES2020:
|
|
20065
20078
|
case ts.ModuleKind.ES2022:
|
|
20066
20079
|
case ts.ModuleKind.ESNext:
|
|
20067
|
-
case ts.ModuleKind.
|
|
20080
|
+
case ts.ModuleKind.Node16:
|
|
20068
20081
|
case ts.ModuleKind.NodeNext:
|
|
20069
20082
|
return true;
|
|
20070
20083
|
default:
|
|
@@ -20089,7 +20102,7 @@ var ts;
|
|
|
20089
20102
|
return compilerOptions.esModuleInterop;
|
|
20090
20103
|
}
|
|
20091
20104
|
switch (getEmitModuleKind(compilerOptions)) {
|
|
20092
|
-
case ts.ModuleKind.
|
|
20105
|
+
case ts.ModuleKind.Node16:
|
|
20093
20106
|
case ts.ModuleKind.NodeNext:
|
|
20094
20107
|
return true;
|
|
20095
20108
|
}
|
|
@@ -26171,7 +26184,7 @@ var ts;
|
|
|
26171
26184
|
return node;
|
|
26172
26185
|
}
|
|
26173
26186
|
function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
|
|
26174
|
-
var node = baseFactory.createBaseSourceFileNode(305 /* SourceFile */);
|
|
26187
|
+
var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SourceFile */));
|
|
26175
26188
|
for (var p in source) {
|
|
26176
26189
|
if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p))
|
|
26177
26190
|
continue;
|
|
@@ -31296,7 +31309,7 @@ var ts;
|
|
|
31296
31309
|
initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, 1 /* JS */);
|
|
31297
31310
|
// Prime the scanner.
|
|
31298
31311
|
nextToken();
|
|
31299
|
-
var entityName = parseEntityName(/*allowReservedWords*/ true
|
|
31312
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true);
|
|
31300
31313
|
var isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
|
|
31301
31314
|
clearState();
|
|
31302
31315
|
return isInvalid ? entityName : undefined;
|
|
@@ -32896,7 +32909,7 @@ var ts;
|
|
|
32896
32909
|
}
|
|
32897
32910
|
return createMissingList();
|
|
32898
32911
|
}
|
|
32899
|
-
function parseEntityName(allowReservedWords,
|
|
32912
|
+
function parseEntityName(allowReservedWords, diagnosticMessage) {
|
|
32900
32913
|
var pos = getNodePos();
|
|
32901
32914
|
var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage);
|
|
32902
32915
|
var dotPos = getNodePos();
|
|
@@ -32907,7 +32920,7 @@ var ts;
|
|
|
32907
32920
|
break;
|
|
32908
32921
|
}
|
|
32909
32922
|
dotPos = getNodePos();
|
|
32910
|
-
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, allowPrivateIdentifiers)), pos);
|
|
32923
|
+
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, /* allowPrivateIdentifiers */ false)), pos);
|
|
32911
32924
|
}
|
|
32912
32925
|
return entity;
|
|
32913
32926
|
}
|
|
@@ -33040,7 +33053,7 @@ var ts;
|
|
|
33040
33053
|
}
|
|
33041
33054
|
// TYPES
|
|
33042
33055
|
function parseEntityNameOfTypeReference() {
|
|
33043
|
-
return parseEntityName(/*allowReservedWords*/ true,
|
|
33056
|
+
return parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
|
|
33044
33057
|
}
|
|
33045
33058
|
function parseTypeArgumentsOfTypeReference() {
|
|
33046
33059
|
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
|
|
@@ -33173,7 +33186,7 @@ var ts;
|
|
|
33173
33186
|
function parseTypeQuery() {
|
|
33174
33187
|
var pos = getNodePos();
|
|
33175
33188
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33176
|
-
var entityName = parseEntityName(/*allowReservedWords*/ true
|
|
33189
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true);
|
|
33177
33190
|
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33178
33191
|
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33179
33192
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
@@ -34141,10 +34154,10 @@ var ts;
|
|
|
34141
34154
|
setDecoratorContext(/*val*/ false);
|
|
34142
34155
|
}
|
|
34143
34156
|
var pos = getNodePos();
|
|
34144
|
-
var expr = parseAssignmentExpressionOrHigher(
|
|
34157
|
+
var expr = parseAssignmentExpressionOrHigher();
|
|
34145
34158
|
var operatorToken;
|
|
34146
34159
|
while ((operatorToken = parseOptionalToken(27 /* CommaToken */))) {
|
|
34147
|
-
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(
|
|
34160
|
+
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
|
|
34148
34161
|
}
|
|
34149
34162
|
if (saveDecoratorContext) {
|
|
34150
34163
|
setDecoratorContext(/*val*/ true);
|
|
@@ -34152,9 +34165,9 @@ var ts;
|
|
|
34152
34165
|
return expr;
|
|
34153
34166
|
}
|
|
34154
34167
|
function parseInitializer() {
|
|
34155
|
-
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher(
|
|
34168
|
+
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
34156
34169
|
}
|
|
34157
|
-
function parseAssignmentExpressionOrHigher(
|
|
34170
|
+
function parseAssignmentExpressionOrHigher() {
|
|
34158
34171
|
// AssignmentExpression[in,yield]:
|
|
34159
34172
|
// 1) ConditionalExpression[?in,?yield]
|
|
34160
34173
|
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
|
|
@@ -34180,7 +34193,7 @@ var ts;
|
|
|
34180
34193
|
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
|
|
34181
34194
|
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
|
|
34182
34195
|
// with AssignmentExpression if we see one.
|
|
34183
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(
|
|
34196
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
34184
34197
|
if (arrowExpression) {
|
|
34185
34198
|
return arrowExpression;
|
|
34186
34199
|
}
|
|
@@ -34199,7 +34212,7 @@ var ts;
|
|
|
34199
34212
|
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
|
|
34200
34213
|
// identifier and the current token is an arrow.
|
|
34201
34214
|
if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
|
|
34202
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
34215
|
+
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
|
|
34203
34216
|
}
|
|
34204
34217
|
// Now see if we might be in cases '2' or '3'.
|
|
34205
34218
|
// If the expression was a LHS expression, and we have an assignment operator, then
|
|
@@ -34208,7 +34221,7 @@ var ts;
|
|
|
34208
34221
|
// Note: we call reScanGreaterToken so that we get an appropriately merged token
|
|
34209
34222
|
// for cases like `> > =` becoming `>>=`
|
|
34210
34223
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
34211
|
-
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(
|
|
34224
|
+
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
|
|
34212
34225
|
}
|
|
34213
34226
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34214
34227
|
return parseConditionalExpressionRest(expr, pos);
|
|
@@ -34251,7 +34264,7 @@ var ts;
|
|
|
34251
34264
|
nextToken();
|
|
34252
34265
|
if (!scanner.hasPrecedingLineBreak() &&
|
|
34253
34266
|
(token() === 41 /* AsteriskToken */ || isStartOfExpression())) {
|
|
34254
|
-
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher(
|
|
34267
|
+
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher()), pos);
|
|
34255
34268
|
}
|
|
34256
34269
|
else {
|
|
34257
34270
|
// if the next token is not on the same line as yield. or we don't have an '*' or
|
|
@@ -34259,7 +34272,7 @@ var ts;
|
|
|
34259
34272
|
return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
|
|
34260
34273
|
}
|
|
34261
34274
|
}
|
|
34262
|
-
function parseSimpleArrowFunctionExpression(pos, identifier,
|
|
34275
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
34263
34276
|
ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
34264
34277
|
var parameter = factory.createParameterDeclaration(
|
|
34265
34278
|
/*decorators*/ undefined,
|
|
@@ -34271,11 +34284,11 @@ var ts;
|
|
|
34271
34284
|
finishNode(parameter, identifier.pos);
|
|
34272
34285
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
34273
34286
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
34274
|
-
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier
|
|
34287
|
+
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
|
|
34275
34288
|
var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
|
|
34276
34289
|
return addJSDocComment(finishNode(node, pos));
|
|
34277
34290
|
}
|
|
34278
|
-
function tryParseParenthesizedArrowFunctionExpression(
|
|
34291
|
+
function tryParseParenthesizedArrowFunctionExpression() {
|
|
34279
34292
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
34280
34293
|
if (triState === 0 /* False */) {
|
|
34281
34294
|
// It's definitely not a parenthesized arrow function expression.
|
|
@@ -34286,8 +34299,8 @@ var ts;
|
|
|
34286
34299
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34287
34300
|
// expression instead.
|
|
34288
34301
|
return triState === 1 /* True */ ?
|
|
34289
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true
|
|
34290
|
-
tryParse(
|
|
34302
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
|
|
34303
|
+
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
34291
34304
|
}
|
|
34292
34305
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
34293
34306
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
@@ -34417,25 +34430,25 @@ var ts;
|
|
|
34417
34430
|
return 2 /* Unknown */;
|
|
34418
34431
|
}
|
|
34419
34432
|
}
|
|
34420
|
-
function parsePossibleParenthesizedArrowFunctionExpression(
|
|
34433
|
+
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
34421
34434
|
var tokenPos = scanner.getTokenPos();
|
|
34422
34435
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
34423
34436
|
return undefined;
|
|
34424
34437
|
}
|
|
34425
|
-
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false
|
|
34438
|
+
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
|
|
34426
34439
|
if (!result) {
|
|
34427
34440
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
34428
34441
|
}
|
|
34429
34442
|
return result;
|
|
34430
34443
|
}
|
|
34431
|
-
function tryParseAsyncSimpleArrowFunctionExpression(
|
|
34444
|
+
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
34432
34445
|
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
|
|
34433
34446
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34434
34447
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
34435
34448
|
var pos = getNodePos();
|
|
34436
34449
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
34437
34450
|
var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
34438
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
34451
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
34439
34452
|
}
|
|
34440
34453
|
}
|
|
34441
34454
|
return undefined;
|
|
@@ -34459,7 +34472,7 @@ var ts;
|
|
|
34459
34472
|
}
|
|
34460
34473
|
return 0 /* False */;
|
|
34461
34474
|
}
|
|
34462
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity
|
|
34475
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
34463
34476
|
var pos = getNodePos();
|
|
34464
34477
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
34465
34478
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -34494,23 +34507,6 @@ var ts;
|
|
|
34494
34507
|
return undefined;
|
|
34495
34508
|
}
|
|
34496
34509
|
}
|
|
34497
|
-
// Given:
|
|
34498
|
-
// x ? y => ({ y }) : z => ({ z })
|
|
34499
|
-
// We try to parse the body of the first arrow function by looking at:
|
|
34500
|
-
// ({ y }) : z => ({ z })
|
|
34501
|
-
// This is a valid arrow function with "z" as the return type.
|
|
34502
|
-
//
|
|
34503
|
-
// But, if we're in the true side of a conditional expression, this colon
|
|
34504
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34505
|
-
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34506
|
-
//
|
|
34507
|
-
// For example,
|
|
34508
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34509
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34510
|
-
// be an arrow expression, so we allow a return type.
|
|
34511
|
-
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34512
|
-
return undefined;
|
|
34513
|
-
}
|
|
34514
34510
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34515
34511
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34516
34512
|
return undefined;
|
|
@@ -34539,12 +34535,12 @@ var ts;
|
|
|
34539
34535
|
var lastToken = token();
|
|
34540
34536
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
34541
34537
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34542
|
-
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier)
|
|
34538
|
+
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
|
|
34543
34539
|
: parseIdentifier();
|
|
34544
34540
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34545
34541
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34546
34542
|
}
|
|
34547
|
-
function parseArrowFunctionExpressionBody(isAsync
|
|
34543
|
+
function parseArrowFunctionExpressionBody(isAsync) {
|
|
34548
34544
|
if (token() === 18 /* OpenBraceToken */) {
|
|
34549
34545
|
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
|
|
34550
34546
|
}
|
|
@@ -34572,8 +34568,8 @@ var ts;
|
|
|
34572
34568
|
var savedTopLevel = topLevel;
|
|
34573
34569
|
topLevel = false;
|
|
34574
34570
|
var node = isAsync
|
|
34575
|
-
? doInAwaitContext(
|
|
34576
|
-
: doOutsideOfAwaitContext(
|
|
34571
|
+
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
34572
|
+
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
34577
34573
|
topLevel = savedTopLevel;
|
|
34578
34574
|
return node;
|
|
34579
34575
|
}
|
|
@@ -34586,8 +34582,8 @@ var ts;
|
|
|
34586
34582
|
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
|
|
34587
34583
|
// we do not that for the 'whenFalse' part.
|
|
34588
34584
|
var colonToken;
|
|
34589
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext,
|
|
34590
|
-
? parseAssignmentExpressionOrHigher(
|
|
34585
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34586
|
+
? parseAssignmentExpressionOrHigher()
|
|
34591
34587
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34592
34588
|
}
|
|
34593
34589
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -35479,13 +35475,13 @@ var ts;
|
|
|
35479
35475
|
function parseSpreadElement() {
|
|
35480
35476
|
var pos = getNodePos();
|
|
35481
35477
|
parseExpected(25 /* DotDotDotToken */);
|
|
35482
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
35478
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
35483
35479
|
return finishNode(factory.createSpreadElement(expression), pos);
|
|
35484
35480
|
}
|
|
35485
35481
|
function parseArgumentOrArrayLiteralElement() {
|
|
35486
35482
|
return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
|
|
35487
35483
|
token() === 27 /* CommaToken */ ? finishNode(factory.createOmittedExpression(), getNodePos()) :
|
|
35488
|
-
parseAssignmentExpressionOrHigher(
|
|
35484
|
+
parseAssignmentExpressionOrHigher();
|
|
35489
35485
|
}
|
|
35490
35486
|
function parseArgumentExpression() {
|
|
35491
35487
|
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
|
|
@@ -35503,7 +35499,7 @@ var ts;
|
|
|
35503
35499
|
var pos = getNodePos();
|
|
35504
35500
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35505
35501
|
if (parseOptionalToken(25 /* DotDotDotToken */)) {
|
|
35506
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
35502
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
35507
35503
|
return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
|
|
35508
35504
|
}
|
|
35509
35505
|
var decorators = parseDecorators();
|
|
@@ -35532,7 +35528,7 @@ var ts;
|
|
|
35532
35528
|
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58 /* ColonToken */);
|
|
35533
35529
|
if (isShorthandPropertyAssignment) {
|
|
35534
35530
|
var equalsToken = parseOptionalToken(63 /* EqualsToken */);
|
|
35535
|
-
var objectAssignmentInitializer = equalsToken ? allowInAnd(
|
|
35531
|
+
var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
|
|
35536
35532
|
node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
|
|
35537
35533
|
// Save equals token for error reporting.
|
|
35538
35534
|
// TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful.
|
|
@@ -35540,7 +35536,7 @@ var ts;
|
|
|
35540
35536
|
}
|
|
35541
35537
|
else {
|
|
35542
35538
|
parseExpected(58 /* ColonToken */);
|
|
35543
|
-
var initializer = allowInAnd(
|
|
35539
|
+
var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
35544
35540
|
node = factory.createPropertyAssignment(name, initializer);
|
|
35545
35541
|
}
|
|
35546
35542
|
// Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
|
|
@@ -35714,7 +35710,7 @@ var ts;
|
|
|
35714
35710
|
}
|
|
35715
35711
|
var node;
|
|
35716
35712
|
if (awaitToken ? parseExpected(160 /* OfKeyword */) : parseOptional(160 /* OfKeyword */)) {
|
|
35717
|
-
var expression = allowInAnd(
|
|
35713
|
+
var expression = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
35718
35714
|
parseExpected(21 /* CloseParenToken */);
|
|
35719
35715
|
node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
|
|
35720
35716
|
}
|
|
@@ -36882,7 +36878,7 @@ var ts;
|
|
|
36882
36878
|
var pos = getNodePos();
|
|
36883
36879
|
var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
|
|
36884
36880
|
parseExpected(58 /* ColonToken */);
|
|
36885
|
-
var value = parseAssignmentExpressionOrHigher(
|
|
36881
|
+
var value = parseAssignmentExpressionOrHigher();
|
|
36886
36882
|
return finishNode(factory.createAssertEntry(name, value), pos);
|
|
36887
36883
|
}
|
|
36888
36884
|
function parseAssertClause(skipAssertKeyword) {
|
|
@@ -36942,7 +36938,7 @@ var ts;
|
|
|
36942
36938
|
function parseModuleReference() {
|
|
36943
36939
|
return isExternalModuleReference()
|
|
36944
36940
|
? parseExternalModuleReference()
|
|
36945
|
-
: parseEntityName(/*allowReservedWords*/ false
|
|
36941
|
+
: parseEntityName(/*allowReservedWords*/ false);
|
|
36946
36942
|
}
|
|
36947
36943
|
function parseExternalModuleReference() {
|
|
36948
36944
|
var pos = getNodePos();
|
|
@@ -37121,7 +37117,7 @@ var ts;
|
|
|
37121
37117
|
else {
|
|
37122
37118
|
parseExpected(88 /* DefaultKeyword */);
|
|
37123
37119
|
}
|
|
37124
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
37120
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
37125
37121
|
parseSemicolon();
|
|
37126
37122
|
setAwaitContext(savedAwaitContext);
|
|
37127
37123
|
var node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression);
|
|
@@ -37195,7 +37191,7 @@ var ts;
|
|
|
37195
37191
|
var pos = getNodePos();
|
|
37196
37192
|
var hasBrace = parseOptional(18 /* OpenBraceToken */);
|
|
37197
37193
|
var p2 = getNodePos();
|
|
37198
|
-
var entityName = parseEntityName(/* allowReservedWords*/ false
|
|
37194
|
+
var entityName = parseEntityName(/* allowReservedWords*/ false);
|
|
37199
37195
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
37200
37196
|
reScanHashToken(); // rescan #id as # id
|
|
37201
37197
|
nextTokenJSDoc(); // then skip the #
|
|
@@ -37638,7 +37634,7 @@ var ts;
|
|
|
37638
37634
|
// parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error
|
|
37639
37635
|
var p2 = getNodePos();
|
|
37640
37636
|
var name = ts.tokenIsIdentifierOrKeyword(token())
|
|
37641
|
-
? parseEntityName(/*allowReservedWords*/ true
|
|
37637
|
+
? parseEntityName(/*allowReservedWords*/ true)
|
|
37642
37638
|
: undefined;
|
|
37643
37639
|
if (name) {
|
|
37644
37640
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
@@ -38960,6 +38956,7 @@ var ts;
|
|
|
38960
38956
|
["es2021.intl", "lib.es2021.intl.d.ts"],
|
|
38961
38957
|
["es2022.array", "lib.es2022.array.d.ts"],
|
|
38962
38958
|
["es2022.error", "lib.es2022.error.d.ts"],
|
|
38959
|
+
["es2022.intl", "lib.es2022.intl.d.ts"],
|
|
38963
38960
|
["es2022.object", "lib.es2022.object.d.ts"],
|
|
38964
38961
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
38965
38962
|
["esnext.array", "lib.es2022.array.d.ts"],
|
|
@@ -39295,7 +39292,7 @@ var ts;
|
|
|
39295
39292
|
es2020: ts.ModuleKind.ES2020,
|
|
39296
39293
|
es2022: ts.ModuleKind.ES2022,
|
|
39297
39294
|
esnext: ts.ModuleKind.ESNext,
|
|
39298
|
-
|
|
39295
|
+
node16: ts.ModuleKind.Node16,
|
|
39299
39296
|
nodenext: ts.ModuleKind.NodeNext,
|
|
39300
39297
|
})),
|
|
39301
39298
|
affectsModuleResolution: true,
|
|
@@ -39649,7 +39646,7 @@ var ts;
|
|
|
39649
39646
|
type: new ts.Map(ts.getEntries({
|
|
39650
39647
|
node: ts.ModuleResolutionKind.NodeJs,
|
|
39651
39648
|
classic: ts.ModuleResolutionKind.Classic,
|
|
39652
|
-
|
|
39649
|
+
node16: ts.ModuleResolutionKind.Node16,
|
|
39653
39650
|
nodenext: ts.ModuleResolutionKind.NodeNext,
|
|
39654
39651
|
})),
|
|
39655
39652
|
affectsModuleResolution: true,
|
|
@@ -40125,7 +40122,7 @@ var ts;
|
|
|
40125
40122
|
affectsModuleResolution: true,
|
|
40126
40123
|
description: ts.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
40127
40124
|
category: ts.Diagnostics.Language_and_Environment,
|
|
40128
|
-
defaultValueDescription: ts.Diagnostics.
|
|
40125
|
+
defaultValueDescription: ts.Diagnostics.auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules,
|
|
40129
40126
|
}
|
|
40130
40127
|
];
|
|
40131
40128
|
/* @internal */
|
|
@@ -42158,7 +42155,7 @@ var ts;
|
|
|
42158
42155
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
42159
42156
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
42160
42157
|
}
|
|
42161
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, resultFromCache) {
|
|
42158
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, diagnostics, resultFromCache) {
|
|
42162
42159
|
var _a;
|
|
42163
42160
|
if (resultFromCache) {
|
|
42164
42161
|
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
@@ -42166,7 +42163,8 @@ var ts;
|
|
|
42166
42163
|
}
|
|
42167
42164
|
return {
|
|
42168
42165
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
42169
|
-
failedLookupLocations: failedLookupLocations
|
|
42166
|
+
failedLookupLocations: failedLookupLocations,
|
|
42167
|
+
resolutionDiagnostics: diagnostics
|
|
42170
42168
|
};
|
|
42171
42169
|
}
|
|
42172
42170
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
@@ -42361,13 +42359,24 @@ var ts;
|
|
|
42361
42359
|
// set in a non-modal module resolution setting here. Do note that our behavior is not particularly well defined when these mode-overriding imports
|
|
42362
42360
|
// are present in a non-modal project; while in theory we'd like to either ignore the mode or provide faithful modern resolution, depending on what we feel is best,
|
|
42363
42361
|
// in practice, not every cache has the options available to intelligently make the choice to ignore the mode request, and it's unclear how modern "faithful modern
|
|
42364
|
-
// resolution" should be (`
|
|
42362
|
+
// resolution" should be (`node16`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
|
|
42365
42363
|
// context should _probably_ be an error - and that should likely be handled by the `Program` (which is what we do).
|
|
42366
|
-
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42364
|
+
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
|
|
42367
42365
|
features |= NodeResolutionFeatures.EsmMode;
|
|
42368
42366
|
}
|
|
42369
42367
|
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
42370
|
-
var
|
|
42368
|
+
var diagnostics = [];
|
|
42369
|
+
var moduleResolutionState = {
|
|
42370
|
+
compilerOptions: options,
|
|
42371
|
+
host: host,
|
|
42372
|
+
traceEnabled: traceEnabled,
|
|
42373
|
+
failedLookupLocations: failedLookupLocations,
|
|
42374
|
+
packageJsonInfoCache: cache,
|
|
42375
|
+
features: features,
|
|
42376
|
+
conditions: conditions,
|
|
42377
|
+
requestContainingDirectory: containingDirectory,
|
|
42378
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
42379
|
+
};
|
|
42371
42380
|
var resolved = primaryLookup();
|
|
42372
42381
|
var primary = true;
|
|
42373
42382
|
if (!resolved) {
|
|
@@ -42386,7 +42395,7 @@ var ts;
|
|
|
42386
42395
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
42387
42396
|
};
|
|
42388
42397
|
}
|
|
42389
|
-
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
|
|
42398
|
+
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, resolutionDiagnostics: diagnostics };
|
|
42390
42399
|
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
|
|
42391
42400
|
if (traceEnabled)
|
|
42392
42401
|
traceResult(result);
|
|
@@ -42452,7 +42461,7 @@ var ts;
|
|
|
42452
42461
|
}
|
|
42453
42462
|
ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
|
|
42454
42463
|
function getDefaultNodeResolutionFeatures(options) {
|
|
42455
|
-
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42464
|
+
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default :
|
|
42456
42465
|
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
42457
42466
|
NodeResolutionFeatures.None;
|
|
42458
42467
|
}
|
|
@@ -42469,6 +42478,8 @@ var ts;
|
|
|
42469
42478
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
42470
42479
|
conditions: ts.emptyArray,
|
|
42471
42480
|
features: NodeResolutionFeatures.None,
|
|
42481
|
+
requestContainingDirectory: containingDirectory,
|
|
42482
|
+
reportDiagnostic: ts.noop
|
|
42472
42483
|
};
|
|
42473
42484
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
42474
42485
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
@@ -42810,8 +42821,8 @@ var ts;
|
|
|
42810
42821
|
case ts.ModuleKind.CommonJS:
|
|
42811
42822
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
42812
42823
|
break;
|
|
42813
|
-
case ts.ModuleKind.
|
|
42814
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
42824
|
+
case ts.ModuleKind.Node16:
|
|
42825
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
42815
42826
|
break;
|
|
42816
42827
|
case ts.ModuleKind.NodeNext:
|
|
42817
42828
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -42831,8 +42842,8 @@ var ts;
|
|
|
42831
42842
|
}
|
|
42832
42843
|
ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
|
|
42833
42844
|
switch (moduleResolution) {
|
|
42834
|
-
case ts.ModuleResolutionKind.
|
|
42835
|
-
result =
|
|
42845
|
+
case ts.ModuleResolutionKind.Node16:
|
|
42846
|
+
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
42836
42847
|
break;
|
|
42837
42848
|
case ts.ModuleResolutionKind.NodeNext:
|
|
42838
42849
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43066,15 +43077,15 @@ var ts;
|
|
|
43066
43077
|
// respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
|
|
43067
43078
|
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
43068
43079
|
// allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
|
|
43069
|
-
// not
|
|
43080
|
+
// not supported in node 12 - https://github.com/nodejs/Release/issues/690
|
|
43070
43081
|
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
43071
43082
|
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
43072
|
-
NodeResolutionFeatures[NodeResolutionFeatures["
|
|
43083
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Node16Default"] = 30] = "Node16Default";
|
|
43073
43084
|
NodeResolutionFeatures[NodeResolutionFeatures["NodeNextDefault"] = 30] = "NodeNextDefault";
|
|
43074
43085
|
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
43075
43086
|
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
43076
|
-
function
|
|
43077
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.
|
|
43087
|
+
function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43088
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node16Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43078
43089
|
}
|
|
43079
43090
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43080
43091
|
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43114,12 +43125,13 @@ var ts;
|
|
|
43114
43125
|
var _a, _b;
|
|
43115
43126
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
43116
43127
|
var failedLookupLocations = [];
|
|
43117
|
-
// conditions are only used by the
|
|
43128
|
+
// conditions are only used by the node16/nodenext resolver - there's no priority order in the list,
|
|
43118
43129
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43119
43130
|
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43120
43131
|
if (compilerOptions.noDtsResolution) {
|
|
43121
43132
|
conditions.pop();
|
|
43122
43133
|
}
|
|
43134
|
+
var diagnostics = [];
|
|
43123
43135
|
var state = {
|
|
43124
43136
|
compilerOptions: compilerOptions,
|
|
43125
43137
|
host: host,
|
|
@@ -43128,9 +43140,11 @@ var ts;
|
|
|
43128
43140
|
packageJsonInfoCache: cache,
|
|
43129
43141
|
features: features,
|
|
43130
43142
|
conditions: conditions,
|
|
43143
|
+
requestContainingDirectory: containingDirectory,
|
|
43144
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
43131
43145
|
};
|
|
43132
43146
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43133
|
-
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);
|
|
43147
|
+
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);
|
|
43134
43148
|
function tryResolve(extensions) {
|
|
43135
43149
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, /*considerPackageJson*/ true); };
|
|
43136
43150
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -43303,9 +43317,9 @@ var ts;
|
|
|
43303
43317
|
}
|
|
43304
43318
|
}
|
|
43305
43319
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
43306
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
43320
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, ts.supportedTSExtensionsFlat)) {
|
|
43307
43321
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
43308
|
-
return result !== undefined ? { path: candidate, ext: ts.
|
|
43322
|
+
return result !== undefined ? { path: candidate, ext: ts.tryExtractTSExtension(candidate) } : undefined;
|
|
43309
43323
|
}
|
|
43310
43324
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
43311
43325
|
}
|
|
@@ -43428,6 +43442,8 @@ var ts;
|
|
|
43428
43442
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
43429
43443
|
conditions: ["node", "require", "types"],
|
|
43430
43444
|
features: features,
|
|
43445
|
+
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
43446
|
+
reportDiagnostic: ts.noop
|
|
43431
43447
|
};
|
|
43432
43448
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
|
|
43433
43449
|
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
@@ -43514,6 +43530,8 @@ var ts;
|
|
|
43514
43530
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
43515
43531
|
features: 0,
|
|
43516
43532
|
conditions: [],
|
|
43533
|
+
requestContainingDirectory: undefined,
|
|
43534
|
+
reportDiagnostic: ts.noop
|
|
43517
43535
|
};
|
|
43518
43536
|
var parts = ts.getPathComponents(fileName);
|
|
43519
43537
|
parts.pop();
|
|
@@ -43805,7 +43823,6 @@ var ts;
|
|
|
43805
43823
|
function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
|
43806
43824
|
return loadModuleFromTargetImportOrExport;
|
|
43807
43825
|
function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
|
|
43808
|
-
var _a, _b;
|
|
43809
43826
|
if (typeof target === "string") {
|
|
43810
43827
|
if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
|
|
43811
43828
|
if (state.traceEnabled) {
|
|
@@ -43842,13 +43859,16 @@ var ts;
|
|
|
43842
43859
|
}
|
|
43843
43860
|
return toSearchResult(/*value*/ undefined);
|
|
43844
43861
|
}
|
|
43845
|
-
var finalPath =
|
|
43862
|
+
var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
|
|
43863
|
+
var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
43864
|
+
if (inputLink)
|
|
43865
|
+
return inputLink;
|
|
43846
43866
|
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, finalPath, /*onlyRecordFailures*/ false, state)));
|
|
43847
43867
|
}
|
|
43848
43868
|
else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
|
|
43849
43869
|
if (!Array.isArray(target)) {
|
|
43850
|
-
for (var _i = 0,
|
|
43851
|
-
var key =
|
|
43870
|
+
for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) {
|
|
43871
|
+
var key = _a[_i];
|
|
43852
43872
|
if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
|
|
43853
43873
|
var subTarget = target[key];
|
|
43854
43874
|
var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
|
|
@@ -43866,8 +43886,8 @@ var ts;
|
|
|
43866
43886
|
}
|
|
43867
43887
|
return toSearchResult(/*value*/ undefined);
|
|
43868
43888
|
}
|
|
43869
|
-
for (var
|
|
43870
|
-
var elem = target_2[
|
|
43889
|
+
for (var _b = 0, target_2 = target; _b < target_2.length; _b++) {
|
|
43890
|
+
var elem = target_2[_b];
|
|
43871
43891
|
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
43872
43892
|
if (result) {
|
|
43873
43893
|
return result;
|
|
@@ -43885,6 +43905,128 @@ var ts;
|
|
|
43885
43905
|
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
43886
43906
|
}
|
|
43887
43907
|
return toSearchResult(/*value*/ undefined);
|
|
43908
|
+
function toAbsolutePath(path) {
|
|
43909
|
+
var _a, _b;
|
|
43910
|
+
if (path === undefined)
|
|
43911
|
+
return path;
|
|
43912
|
+
return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
|
|
43913
|
+
}
|
|
43914
|
+
function combineDirectoryPath(root, dir) {
|
|
43915
|
+
return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
|
|
43916
|
+
}
|
|
43917
|
+
function useCaseSensitiveFileNames() {
|
|
43918
|
+
return !state.host.useCaseSensitiveFileNames ? true :
|
|
43919
|
+
typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames :
|
|
43920
|
+
state.host.useCaseSensitiveFileNames();
|
|
43921
|
+
}
|
|
43922
|
+
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports) {
|
|
43923
|
+
var _a, _b, _c, _d;
|
|
43924
|
+
// Replace any references to outputs for files in the program with the input files to support package self-names used with outDir
|
|
43925
|
+
// 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
|
|
43926
|
+
// 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!
|
|
43927
|
+
// _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!).
|
|
43928
|
+
// 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.
|
|
43929
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
|
|
43930
|
+
&& (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
|
|
43931
|
+
&& finalPath.indexOf("/node_modules/") === -1
|
|
43932
|
+
&& (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
|
|
43933
|
+
// 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.
|
|
43934
|
+
// Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
|
|
43935
|
+
// `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
|
|
43936
|
+
var getCanonicalFileName = ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames });
|
|
43937
|
+
var commonSourceDirGuesses = [];
|
|
43938
|
+
// A `rootDir` compiler option strongly indicates the root location
|
|
43939
|
+
// 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
|
|
43940
|
+
if (state.compilerOptions.rootDir || (state.compilerOptions.composite && state.compilerOptions.configFilePath)) {
|
|
43941
|
+
var commonDir = toAbsolutePath(ts.getCommonSourceDirectory(state.compilerOptions, function () { return []; }, ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "", getCanonicalFileName));
|
|
43942
|
+
commonSourceDirGuesses.push(commonDir);
|
|
43943
|
+
}
|
|
43944
|
+
else if (state.requestContainingDirectory) {
|
|
43945
|
+
// However without either of those set we're in the dark. Let's say you have
|
|
43946
|
+
//
|
|
43947
|
+
// ./tools/index.ts
|
|
43948
|
+
// ./src/index.ts
|
|
43949
|
+
// ./dist/index.js
|
|
43950
|
+
// ./package.json <-- references ./dist/index.js
|
|
43951
|
+
// ./tsconfig.json <-- loads ./src/index.ts
|
|
43952
|
+
//
|
|
43953
|
+
// How do we know `./src` is the common src dir, and not `./tools`, given only the `./dist` out dir and `./dist/index.js` filename?
|
|
43954
|
+
// 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
|
|
43955
|
+
// without more context.
|
|
43956
|
+
// 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
|
|
43957
|
+
// must be inside the common source directory! So we propagate that tidbit of info all the way to here via state.requestContainingDirectory
|
|
43958
|
+
var requestingFile_1 = toAbsolutePath(ts.combinePaths(state.requestContainingDirectory, "index.ts"));
|
|
43959
|
+
// And we can try every folder above the common folder for the request folder and the config/package base directory
|
|
43960
|
+
// This technically can be wrong - we may load ./src/index.ts when ./src/sub/index.ts was right because we don't
|
|
43961
|
+
// know if only `./src/sub` files were loaded by the program; but this has the best chance to be right of just about anything
|
|
43962
|
+
// else we have. And, given that we're about to load `./src/index.ts` because we choose it as likely correct, there will then
|
|
43963
|
+
// be a file outside of `./src/sub` in the program (the file we resolved to), making us de-facto right. So this fallback lookup
|
|
43964
|
+
// logic may influence what files are pulled in by self-names, which in turn influences the output path shape, but it's all
|
|
43965
|
+
// internally consistent so the paths should be stable so long as we prefer the "most general" (meaning: top-most-level directory) possible results first.
|
|
43966
|
+
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));
|
|
43967
|
+
commonSourceDirGuesses.push(commonDir);
|
|
43968
|
+
var fragment = ts.ensureTrailingDirectorySeparator(commonDir);
|
|
43969
|
+
while (fragment && fragment.length > 1) {
|
|
43970
|
+
var parts = ts.getPathComponents(fragment);
|
|
43971
|
+
parts.pop(); // remove a directory
|
|
43972
|
+
var commonDir_1 = ts.getPathFromPathComponents(parts);
|
|
43973
|
+
commonSourceDirGuesses.unshift(commonDir_1);
|
|
43974
|
+
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
43975
|
+
}
|
|
43976
|
+
}
|
|
43977
|
+
if (commonSourceDirGuesses.length > 1) {
|
|
43978
|
+
state.reportDiagnostic(ts.createCompilerDiagnostic(isImports
|
|
43979
|
+
? 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
|
|
43980
|
+
: 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
|
|
43981
|
+
packagePath));
|
|
43982
|
+
}
|
|
43983
|
+
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
43984
|
+
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
43985
|
+
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
43986
|
+
for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
|
|
43987
|
+
var candidateDir = candidateDirectories_1[_e];
|
|
43988
|
+
if (ts.startsWith(finalPath, candidateDir)) {
|
|
43989
|
+
// 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
|
|
43990
|
+
var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
|
|
43991
|
+
var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
|
|
43992
|
+
var jsAndDtsExtensions = [".mjs" /* Mjs */, ".cjs" /* Cjs */, ".js" /* Js */, ".json" /* Json */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".d.ts" /* Dts */];
|
|
43993
|
+
for (var _f = 0, jsAndDtsExtensions_1 = jsAndDtsExtensions; _f < jsAndDtsExtensions_1.length; _f++) {
|
|
43994
|
+
var ext = jsAndDtsExtensions_1[_f];
|
|
43995
|
+
if (ts.fileExtensionIs(possibleInputBase, ext)) {
|
|
43996
|
+
var inputExts = ts.getPossibleOriginalInputExtensionForExtension(possibleInputBase);
|
|
43997
|
+
for (var _g = 0, inputExts_1 = inputExts; _g < inputExts_1.length; _g++) {
|
|
43998
|
+
var possibleExt = inputExts_1[_g];
|
|
43999
|
+
var possibleInputWithInputExtension = ts.changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
44000
|
+
if ((extensions === Extensions.TypeScript && ts.hasJSFileExtension(possibleInputWithInputExtension)) ||
|
|
44001
|
+
(extensions === Extensions.JavaScript && ts.hasTSFileExtension(possibleInputWithInputExtension))) {
|
|
44002
|
+
continue;
|
|
44003
|
+
}
|
|
44004
|
+
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
44005
|
+
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, possibleInputWithInputExtension, /*onlyRecordFailures*/ false, state)));
|
|
44006
|
+
}
|
|
44007
|
+
}
|
|
44008
|
+
}
|
|
44009
|
+
}
|
|
44010
|
+
}
|
|
44011
|
+
}
|
|
44012
|
+
}
|
|
44013
|
+
}
|
|
44014
|
+
return undefined;
|
|
44015
|
+
function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
|
|
44016
|
+
var _a, _b;
|
|
44017
|
+
// Config file ouput paths are processed to be relative to the host's current directory, while
|
|
44018
|
+
// otherwise the paths are resolved relative to the common source dir the compiler puts together
|
|
44019
|
+
var currentDir = state.compilerOptions.configFile ? ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "" : commonSourceDirGuess;
|
|
44020
|
+
var candidateDirectories = [];
|
|
44021
|
+
if (state.compilerOptions.declarationDir) {
|
|
44022
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
|
|
44023
|
+
}
|
|
44024
|
+
if (state.compilerOptions.outDir && state.compilerOptions.outDir !== state.compilerOptions.declarationDir) {
|
|
44025
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.outDir)));
|
|
44026
|
+
}
|
|
44027
|
+
return candidateDirectories;
|
|
44028
|
+
}
|
|
44029
|
+
}
|
|
43888
44030
|
}
|
|
43889
44031
|
}
|
|
43890
44032
|
/* @internal */
|
|
@@ -44075,11 +44217,12 @@ var ts;
|
|
|
44075
44217
|
function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
44076
44218
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
44077
44219
|
var failedLookupLocations = [];
|
|
44078
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [] };
|
|
44079
44220
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
44221
|
+
var diagnostics = [];
|
|
44222
|
+
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); } };
|
|
44080
44223
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
44081
44224
|
// No originalPath because classic resolution doesn't resolve realPath
|
|
44082
|
-
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, state.resultFromCache);
|
|
44225
|
+
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
44083
44226
|
function tryResolve(extensions) {
|
|
44084
44227
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
44085
44228
|
if (resolvedUsingSettings) {
|
|
@@ -44122,9 +44265,10 @@ var ts;
|
|
|
44122
44265
|
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);
|
|
44123
44266
|
}
|
|
44124
44267
|
var failedLookupLocations = [];
|
|
44125
|
-
var
|
|
44268
|
+
var diagnostics = [];
|
|
44269
|
+
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); } };
|
|
44126
44270
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
44127
|
-
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, state.resultFromCache);
|
|
44271
|
+
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
44128
44272
|
}
|
|
44129
44273
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
44130
44274
|
/**
|
|
@@ -48501,7 +48645,7 @@ var ts;
|
|
|
48501
48645
|
var enumRelation = new ts.Map();
|
|
48502
48646
|
var builtinGlobals = ts.createSymbolTable();
|
|
48503
48647
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
48504
|
-
// Extensions suggested for path imports when module resolution is
|
|
48648
|
+
// Extensions suggested for path imports when module resolution is node16 or higher.
|
|
48505
48649
|
// The first element of each tuple is the extension a file has.
|
|
48506
48650
|
// The second element of each tuple is the extension that should be used in a path import.
|
|
48507
48651
|
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
@@ -50790,7 +50934,7 @@ var ts;
|
|
|
50790
50934
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
50791
50935
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
50792
50936
|
}
|
|
50793
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
50937
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
50794
50938
|
var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
|
|
50795
50939
|
var overrideClauseHost = ts.findAncestor(location, function (l) { return ts.isImportTypeNode(l) || ts.isExportDeclaration(l) || ts.isImportDeclaration(l); });
|
|
50796
50940
|
var overrideClause = overrideClauseHost && ts.isImportTypeNode(overrideClauseHost) ? (_g = overrideClauseHost.assertions) === null || _g === void 0 ? void 0 : _g.assertClause : overrideClauseHost === null || overrideClauseHost === void 0 ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -50799,9 +50943,6 @@ var ts;
|
|
|
50799
50943
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
|
|
50800
50944
|
error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
|
|
50801
50945
|
}
|
|
50802
|
-
if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
|
|
50803
|
-
error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
|
|
50804
|
-
}
|
|
50805
50946
|
}
|
|
50806
50947
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
50807
50948
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -50854,7 +50995,7 @@ var ts;
|
|
|
50854
50995
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
50855
50996
|
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
50856
50997
|
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
50857
|
-
var
|
|
50998
|
+
var resolutionIsNode16OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node16 ||
|
|
50858
50999
|
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
50859
51000
|
if (tsExtension) {
|
|
50860
51001
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
@@ -50875,17 +51016,17 @@ var ts;
|
|
|
50875
51016
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
50876
51017
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
50877
51018
|
}
|
|
50878
|
-
else if (mode === ts.ModuleKind.ESNext &&
|
|
51019
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
50879
51020
|
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
50880
51021
|
var suggestedExt = (_h = suggestedExtensions.find(function (_a) {
|
|
50881
51022
|
var actualExt = _a[0], _importExt = _a[1];
|
|
50882
51023
|
return host.fileExists(absoluteRef_1 + actualExt);
|
|
50883
51024
|
})) === null || _h === void 0 ? void 0 : _h[1];
|
|
50884
51025
|
if (suggestedExt) {
|
|
50885
|
-
error(errorNode, ts.Diagnostics.
|
|
51026
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
50886
51027
|
}
|
|
50887
51028
|
else {
|
|
50888
|
-
error(errorNode, ts.Diagnostics.
|
|
51029
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
50889
51030
|
}
|
|
50890
51031
|
}
|
|
50891
51032
|
else {
|
|
@@ -53207,7 +53348,7 @@ var ts;
|
|
|
53207
53348
|
var targetFile = ts.getSourceFileOfModule(chain[0]);
|
|
53208
53349
|
var specifier = void 0;
|
|
53209
53350
|
var assertion = void 0;
|
|
53210
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53351
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53211
53352
|
// An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion
|
|
53212
53353
|
if ((targetFile === null || targetFile === void 0 ? void 0 : targetFile.impliedNodeFormat) === ts.ModuleKind.ESNext && targetFile.impliedNodeFormat !== (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat)) {
|
|
53213
53354
|
specifier = getSpecifierForModuleSymbol(chain[0], context, ts.ModuleKind.ESNext);
|
|
@@ -53221,7 +53362,7 @@ var ts;
|
|
|
53221
53362
|
}
|
|
53222
53363
|
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
|
|
53223
53364
|
var oldSpecifier = specifier;
|
|
53224
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53365
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53225
53366
|
// We might be able to write a portable import type using a mode override; try specifier generation again, but with a different mode set
|
|
53226
53367
|
var swappedMode = (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat) === ts.ModuleKind.ESNext ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
53227
53368
|
specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
|
|
@@ -57991,7 +58132,8 @@ var ts;
|
|
|
57991
58132
|
if (symbol === globalThisSymbol) {
|
|
57992
58133
|
var varsOnly_1 = new ts.Map();
|
|
57993
58134
|
members.forEach(function (p) {
|
|
57994
|
-
|
|
58135
|
+
var _a;
|
|
58136
|
+
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))) {
|
|
57995
58137
|
varsOnly_1.set(p.escapedName, p);
|
|
57996
58138
|
}
|
|
57997
58139
|
});
|
|
@@ -71186,7 +71328,7 @@ var ts;
|
|
|
71186
71328
|
if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
71187
71329
|
var parent = declaration.parent.parent;
|
|
71188
71330
|
if (parent.kind === 254 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 164 /* Parameter */) {
|
|
71189
|
-
var links = getNodeLinks(
|
|
71331
|
+
var links = getNodeLinks(parent);
|
|
71190
71332
|
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
71191
71333
|
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
71192
71334
|
var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
|
|
@@ -77049,13 +77191,13 @@ var ts;
|
|
|
77049
77191
|
}
|
|
77050
77192
|
}
|
|
77051
77193
|
function checkImportMetaProperty(node) {
|
|
77052
|
-
if (moduleKind === ts.ModuleKind.
|
|
77194
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
77053
77195
|
if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
77054
77196
|
error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
77055
77197
|
}
|
|
77056
77198
|
}
|
|
77057
77199
|
else if (moduleKind < ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.System) {
|
|
77058
|
-
error(node, ts.Diagnostics.
|
|
77200
|
+
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
|
|
77059
77201
|
}
|
|
77060
77202
|
var file = ts.getSourceFileOfNode(node);
|
|
77061
77203
|
ts.Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -78006,15 +78148,30 @@ var ts;
|
|
|
78006
78148
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
78007
78149
|
var span = void 0;
|
|
78008
78150
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
78009
|
-
|
|
78010
|
-
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
78151
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78011
78152
|
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module);
|
|
78012
78153
|
diagnostics.add(diagnostic);
|
|
78013
78154
|
}
|
|
78014
|
-
|
|
78015
|
-
|
|
78016
|
-
|
|
78017
|
-
|
|
78155
|
+
switch (moduleKind) {
|
|
78156
|
+
case ts.ModuleKind.Node16:
|
|
78157
|
+
case ts.ModuleKind.NodeNext:
|
|
78158
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
78159
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78160
|
+
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));
|
|
78161
|
+
break;
|
|
78162
|
+
}
|
|
78163
|
+
// fallthrough
|
|
78164
|
+
case ts.ModuleKind.ES2022:
|
|
78165
|
+
case ts.ModuleKind.ESNext:
|
|
78166
|
+
case ts.ModuleKind.System:
|
|
78167
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
78168
|
+
break;
|
|
78169
|
+
}
|
|
78170
|
+
// fallthrough
|
|
78171
|
+
default:
|
|
78172
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78173
|
+
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));
|
|
78174
|
+
break;
|
|
78018
78175
|
}
|
|
78019
78176
|
}
|
|
78020
78177
|
}
|
|
@@ -80456,8 +80613,8 @@ var ts;
|
|
|
80456
80613
|
if (node.assertions) {
|
|
80457
80614
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80458
80615
|
if (override) {
|
|
80459
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
80460
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80616
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80617
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80461
80618
|
}
|
|
80462
80619
|
}
|
|
80463
80620
|
}
|
|
@@ -81907,7 +82064,7 @@ var ts;
|
|
|
81907
82064
|
}
|
|
81908
82065
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
81909
82066
|
// No need to check for require or exports for ES6 modules and later
|
|
81910
|
-
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.
|
|
82067
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node16 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
81911
82068
|
return;
|
|
81912
82069
|
}
|
|
81913
82070
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -84827,8 +84984,8 @@ var ts;
|
|
|
84827
84984
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
84828
84985
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
84829
84986
|
if (validForTypeAssertions && override) {
|
|
84830
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
84831
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
84987
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
84988
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
84832
84989
|
}
|
|
84833
84990
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
84834
84991
|
}
|
|
@@ -86167,7 +86324,7 @@ var ts;
|
|
|
86167
86324
|
if (ts.isDeclaration(node)) {
|
|
86168
86325
|
// In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
|
|
86169
86326
|
var symbol = getSymbolOfNode(node);
|
|
86170
|
-
return getTypeOfSymbol(symbol);
|
|
86327
|
+
return symbol ? getTypeOfSymbol(symbol) : errorType;
|
|
86171
86328
|
}
|
|
86172
86329
|
if (isDeclarationNameOrImportPropertyName(node)) {
|
|
86173
86330
|
var symbol = getSymbolAtLocation(node);
|
|
@@ -88015,8 +88172,24 @@ var ts;
|
|
|
88015
88172
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
88016
88173
|
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module));
|
|
88017
88174
|
}
|
|
88018
|
-
|
|
88019
|
-
|
|
88175
|
+
switch (moduleKind) {
|
|
88176
|
+
case ts.ModuleKind.Node16:
|
|
88177
|
+
case ts.ModuleKind.NodeNext:
|
|
88178
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
88179
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
|
|
88180
|
+
break;
|
|
88181
|
+
}
|
|
88182
|
+
// fallthrough
|
|
88183
|
+
case ts.ModuleKind.ES2022:
|
|
88184
|
+
case ts.ModuleKind.ESNext:
|
|
88185
|
+
case ts.ModuleKind.System:
|
|
88186
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
88187
|
+
break;
|
|
88188
|
+
}
|
|
88189
|
+
// fallthrough
|
|
88190
|
+
default:
|
|
88191
|
+
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));
|
|
88192
|
+
break;
|
|
88020
88193
|
}
|
|
88021
88194
|
}
|
|
88022
88195
|
}
|
|
@@ -88711,7 +88884,7 @@ var ts;
|
|
|
88711
88884
|
}
|
|
88712
88885
|
function checkGrammarImportCallExpression(node) {
|
|
88713
88886
|
if (moduleKind === ts.ModuleKind.ES2015) {
|
|
88714
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
88887
|
+
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext);
|
|
88715
88888
|
}
|
|
88716
88889
|
if (node.typeArguments) {
|
|
88717
88890
|
return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
|
|
@@ -88722,7 +88895,7 @@ var ts;
|
|
|
88722
88895
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
88723
88896
|
if (nodeArguments.length > 1) {
|
|
88724
88897
|
var assertionArgument = nodeArguments[1];
|
|
88725
|
-
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.
|
|
88898
|
+
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
|
|
88726
88899
|
}
|
|
88727
88900
|
}
|
|
88728
88901
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
@@ -108988,7 +109161,7 @@ var ts;
|
|
|
108988
109161
|
return ts.transformECMAScriptModule;
|
|
108989
109162
|
case ts.ModuleKind.System:
|
|
108990
109163
|
return ts.transformSystemModule;
|
|
108991
|
-
case ts.ModuleKind.
|
|
109164
|
+
case ts.ModuleKind.Node16:
|
|
108992
109165
|
case ts.ModuleKind.NodeNext:
|
|
108993
109166
|
return ts.transformNodeModule;
|
|
108994
109167
|
default:
|
|
@@ -116011,7 +116184,7 @@ var ts;
|
|
|
116011
116184
|
*/
|
|
116012
116185
|
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
116013
116186
|
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
116014
|
-
case ts.ModuleResolutionKind.
|
|
116187
|
+
case ts.ModuleResolutionKind.Node16:
|
|
116015
116188
|
case ts.ModuleResolutionKind.NodeNext:
|
|
116016
116189
|
return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
|
|
116017
116190
|
ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
|
|
@@ -116065,7 +116238,6 @@ var ts;
|
|
|
116065
116238
|
ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
|
|
116066
116239
|
ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
|
|
116067
116240
|
ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
|
|
116068
|
-
ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
|
|
116069
116241
|
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
116070
116242
|
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
116071
116243
|
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
@@ -116310,7 +116482,7 @@ var ts;
|
|
|
116310
116482
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
116311
116483
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
116312
116484
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
116313
|
-
// under
|
|
116485
|
+
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
|
|
116314
116486
|
processTypeReferenceDirective(typeReferences[i], /*mode*/ undefined, resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_c = resolutions[i]) === null || _c === void 0 ? void 0 : _c.packageId });
|
|
116315
116487
|
}
|
|
116316
116488
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -116452,6 +116624,40 @@ var ts;
|
|
|
116452
116624
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
116453
116625
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
116454
116626
|
return program;
|
|
116627
|
+
function addResolutionDiagnostics(list) {
|
|
116628
|
+
if (!list)
|
|
116629
|
+
return;
|
|
116630
|
+
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
116631
|
+
var elem = list_3[_i];
|
|
116632
|
+
programDiagnostics.add(elem);
|
|
116633
|
+
}
|
|
116634
|
+
}
|
|
116635
|
+
function pullDiagnosticsFromCache(names, containingFile) {
|
|
116636
|
+
var _a;
|
|
116637
|
+
if (!moduleResolutionCache)
|
|
116638
|
+
return;
|
|
116639
|
+
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
116640
|
+
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
116641
|
+
var containingDir = ts.getDirectoryPath(containingFileName);
|
|
116642
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
116643
|
+
var i = 0;
|
|
116644
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
116645
|
+
var n = names_4[_i];
|
|
116646
|
+
// 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
|
|
116647
|
+
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
116648
|
+
var name = typeof n === "string" ? n : n.fileName;
|
|
116649
|
+
i++;
|
|
116650
|
+
// only nonrelative names hit the cache, and, at least as of right now, only nonrelative names can issue diagnostics
|
|
116651
|
+
// (Since diagnostics are only issued via import or export map lookup)
|
|
116652
|
+
// This may totally change if/when the issue of output paths not mapping to input files is fixed in a broader context
|
|
116653
|
+
// When it is, how we extract diagnostics from the module name resolver will have the be refined - the current cache
|
|
116654
|
+
// APIs wrapping the underlying resolver make it almost impossible to smuggle the diagnostics out in a generalized way
|
|
116655
|
+
if (ts.isExternalModuleNameRelative(name))
|
|
116656
|
+
continue;
|
|
116657
|
+
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
116658
|
+
addResolutionDiagnostics(diags);
|
|
116659
|
+
}
|
|
116660
|
+
}
|
|
116455
116661
|
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
116456
116662
|
if (!moduleNames.length)
|
|
116457
116663
|
return ts.emptyArray;
|
|
@@ -116463,6 +116669,7 @@ var ts;
|
|
|
116463
116669
|
ts.performance.mark("afterResolveModule");
|
|
116464
116670
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
116465
116671
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
116672
|
+
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
116466
116673
|
return result;
|
|
116467
116674
|
}
|
|
116468
116675
|
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
@@ -117963,8 +118170,8 @@ var ts;
|
|
|
117963
118170
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
117964
118171
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
117965
118172
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
117966
|
-
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
117967
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118173
|
+
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118174
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
117968
118175
|
}
|
|
117969
118176
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
117970
118177
|
}
|
|
@@ -118326,7 +118533,7 @@ var ts;
|
|
|
118326
118533
|
}
|
|
118327
118534
|
if (options.resolveJsonModule) {
|
|
118328
118535
|
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
118329
|
-
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
118536
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 &&
|
|
118330
118537
|
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118331
118538
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
118332
118539
|
}
|
|
@@ -120899,8 +121106,8 @@ var ts;
|
|
|
120899
121106
|
!!redirectedReference;
|
|
120900
121107
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
120901
121108
|
var i = 0;
|
|
120902
|
-
for (var _i = 0,
|
|
120903
|
-
var entry =
|
|
121109
|
+
for (var _i = 0, names_5 = names; _i < names_5.length; _i++) {
|
|
121110
|
+
var entry = names_5[_i];
|
|
120904
121111
|
var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
|
|
120905
121112
|
// Imports supply a `containingSourceFile` but no `containingSourceFileMode` - it would be redundant
|
|
120906
121113
|
// they require calculating the mode for a given import from it's position in the resolution table, since a given
|
|
@@ -121466,7 +121673,7 @@ var ts;
|
|
|
121466
121673
|
}
|
|
121467
121674
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
121468
121675
|
var _a;
|
|
121469
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
121676
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16
|
|
121470
121677
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
121471
121678
|
return false;
|
|
121472
121679
|
}
|
|
@@ -122051,7 +122258,7 @@ var ts;
|
|
|
122051
122258
|
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
122052
122259
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
122053
122260
|
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
122054
|
-
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
122261
|
+
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
122055
122262
|
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
122056
122263
|
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
122057
122264
|
// usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
|