typescript 4.5.0-dev.20210924 → 4.5.0-dev.20210928
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/cs/diagnosticMessages.generated.json +2 -1
- package/lib/de/diagnosticMessages.generated.json +17 -5
- package/lib/es/diagnosticMessages.generated.json +2 -1
- package/lib/fr/diagnosticMessages.generated.json +2 -1
- package/lib/it/diagnosticMessages.generated.json +17 -5
- package/lib/ja/diagnosticMessages.generated.json +2 -1
- package/lib/ko/diagnosticMessages.generated.json +17 -5
- package/lib/lib.dom.d.ts +669 -1896
- package/lib/lib.dom.iterable.d.ts +16 -48
- package/lib/lib.webworker.d.ts +183 -520
- package/lib/lib.webworker.iterable.d.ts +10 -30
- package/lib/pl/diagnosticMessages.generated.json +2 -1
- package/lib/pt-br/diagnosticMessages.generated.json +2 -1
- package/lib/ru/diagnosticMessages.generated.json +17 -5
- package/lib/tr/diagnosticMessages.generated.json +2 -1
- package/lib/tsc.js +1364 -426
- package/lib/tsserver.js +2027 -693
- package/lib/tsserverlibrary.d.ts +76 -23
- package/lib/tsserverlibrary.js +2027 -693
- package/lib/typescript.d.ts +74 -21
- package/lib/typescript.js +2022 -687
- package/lib/typescriptServices.d.ts +74 -21
- package/lib/typescriptServices.js +2022 -687
- package/lib/typingsInstaller.js +1544 -475
- package/lib/zh-cn/diagnosticMessages.generated.json +2 -1
- package/lib/zh-tw/diagnosticMessages.generated.json +17 -5
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.5";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20210928";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
function tryGetNativeMap() {
|
|
@@ -3259,6 +3259,8 @@ var ts;
|
|
|
3259
3259
|
(function (ModuleResolutionKind) {
|
|
3260
3260
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
3261
3261
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
3262
|
+
ModuleResolutionKind[ModuleResolutionKind["Node12"] = 3] = "Node12";
|
|
3263
|
+
ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
|
|
3262
3264
|
})(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
|
|
3263
3265
|
var WatchFileKind;
|
|
3264
3266
|
(function (WatchFileKind) {
|
|
@@ -3293,6 +3295,8 @@ var ts;
|
|
|
3293
3295
|
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
|
|
3294
3296
|
ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
|
|
3295
3297
|
ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
|
|
3298
|
+
ModuleKind[ModuleKind["Node12"] = 100] = "Node12";
|
|
3299
|
+
ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
|
|
3296
3300
|
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
|
|
3297
3301
|
ts.commentPragmas = {
|
|
3298
3302
|
"reference": {
|
|
@@ -5293,7 +5297,7 @@ var ts;
|
|
|
5293
5297
|
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."),
|
|
5294
5298
|
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."),
|
|
5295
5299
|
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."),
|
|
5296
|
-
|
|
5300
|
+
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_umd_node12_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'."),
|
|
5297
5301
|
Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext'."),
|
|
5298
5302
|
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."),
|
|
5299
5303
|
Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."),
|
|
@@ -5311,7 +5315,7 @@ var ts;
|
|
|
5311
5315
|
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."),
|
|
5312
5316
|
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}')'?"),
|
|
5313
5317
|
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
5314
|
-
|
|
5318
|
+
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12_or_nodenext: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'."),
|
|
5315
5319
|
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
5316
5320
|
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."),
|
|
5317
5321
|
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."),
|
|
@@ -5342,7 +5346,7 @@ var ts;
|
|
|
5342
5346
|
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."),
|
|
5343
5347
|
_0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
5344
5348
|
_0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
5345
|
-
|
|
5349
|
+
Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_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_esnext_system_or_noden_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
5346
5350
|
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'."),
|
|
5347
5351
|
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'."),
|
|
5348
5352
|
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 `}`?"),
|
|
@@ -5394,7 +5398,7 @@ var ts;
|
|
|
5394
5398
|
File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
5395
5399
|
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:"),
|
|
5396
5400
|
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."),
|
|
5397
|
-
|
|
5401
|
+
Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_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_esnext_system_or_nodenex_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
5398
5402
|
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."),
|
|
5399
5403
|
Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
5400
5404
|
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}'?"),
|
|
@@ -5411,12 +5415,17 @@ var ts;
|
|
|
5411
5415
|
_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isolatedModules_is_enabled: diag(1448, ts.DiagnosticCategory.Error, "_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isol_1448", "'{0}' resolves to a type-only declaration and must be re-exported using a type-only re-export when 'isolatedModules' is enabled."),
|
|
5412
5416
|
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."),
|
|
5413
5417
|
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"),
|
|
5418
|
+
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"),
|
|
5419
|
+
The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
|
|
5420
|
+
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: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "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."),
|
|
5414
5421
|
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."),
|
|
5415
5422
|
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."),
|
|
5416
5423
|
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.", undefined, true),
|
|
5417
5424
|
Construct_signature_return_types_0_and_1_are_incompatible: diag(2203, ts.DiagnosticCategory.Error, "Construct_signature_return_types_0_and_1_are_incompatible_2203", "Construct signature return types '{0}' and '{1}' are incompatible.", undefined, true),
|
|
5418
5425
|
Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2204, ts.DiagnosticCategory.Error, "Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2204", "Call signatures with no arguments have incompatible return types '{0}' and '{1}'.", undefined, true),
|
|
5419
5426
|
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}'.", undefined, true),
|
|
5427
|
+
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."),
|
|
5428
|
+
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."),
|
|
5420
5429
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
5421
5430
|
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."),
|
|
5422
5431
|
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."),
|
|
@@ -5475,7 +5484,7 @@ var ts;
|
|
|
5475
5484
|
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
|
|
5476
5485
|
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
|
|
5477
5486
|
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),
|
|
5478
|
-
|
|
5487
|
+
The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."),
|
|
5479
5488
|
The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."),
|
|
5480
5489
|
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
5481
5490
|
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
@@ -6280,6 +6289,13 @@ var ts;
|
|
|
6280
6289
|
Output_Formatting: diag(6256, ts.DiagnosticCategory.Message, "Output_Formatting_6256", "Output Formatting"),
|
|
6281
6290
|
Completeness: diag(6257, ts.DiagnosticCategory.Message, "Completeness_6257", "Completeness"),
|
|
6282
6291
|
_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file: diag(6258, ts.DiagnosticCategory.Error, "_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258", "'{0}' should be set inside the 'compilerOptions' object of the config json file"),
|
|
6292
|
+
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, ts.DiagnosticCategory.Message, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
|
|
6293
|
+
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, ts.DiagnosticCategory.Message, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
6294
|
+
Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, ts.DiagnosticCategory.Message, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
|
|
6295
|
+
package_json_scope_0_has_no_imports_defined: diag(6273, ts.DiagnosticCategory.Message, "package_json_scope_0_has_no_imports_defined_6273", "package.json scope '{0}' has no imports defined."),
|
|
6296
|
+
package_json_scope_0_explicitly_maps_specifier_1_to_null: diag(6274, ts.DiagnosticCategory.Message, "package_json_scope_0_explicitly_maps_specifier_1_to_null_6274", "package.json scope '{0}' explicitly maps specifier '{1}' to null."),
|
|
6297
|
+
package_json_scope_0_has_invalid_type_for_target_of_specifier_1: diag(6275, ts.DiagnosticCategory.Message, "package_json_scope_0_has_invalid_type_for_target_of_specifier_1_6275", "package.json scope '{0}' has invalid type for target of specifier '{1}'"),
|
|
6298
|
+
Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6276, ts.DiagnosticCategory.Message, "Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6276", "Export specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
6283
6299
|
Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"),
|
|
6284
6300
|
Composite_projects_may_not_disable_declaration_emit: diag(6304, ts.DiagnosticCategory.Error, "Composite_projects_may_not_disable_declaration_emit_6304", "Composite projects may not disable declaration emit."),
|
|
6285
6301
|
Output_file_0_has_not_been_built_from_source_file_1: diag(6305, ts.DiagnosticCategory.Error, "Output_file_0_has_not_been_built_from_source_file_1_6305", "Output file '{0}' has not been built from source file '{1}'."),
|
|
@@ -6539,6 +6555,8 @@ var ts;
|
|
|
6539
6555
|
The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_type_annotation_is_needed: diag(7056, ts.DiagnosticCategory.Error, "The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_ty_7056", "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."),
|
|
6540
6556
|
yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation: diag(7057, ts.DiagnosticCategory.Error, "yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_t_7057", "'yield' expression implicitly results in an 'any' type because its containing generator lacks a return-type annotation."),
|
|
6541
6557
|
If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1: diag(7058, ts.DiagnosticCategory.Error, "If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_decl_7058", "If the '{0}' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module '{1}';`"),
|
|
6558
|
+
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."),
|
|
6559
|
+
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."),
|
|
6542
6560
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
6543
6561
|
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."),
|
|
6544
6562
|
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."),
|
|
@@ -8911,7 +8929,7 @@ var ts;
|
|
|
8911
8929
|
}
|
|
8912
8930
|
ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics;
|
|
8913
8931
|
function getDefaultLibFileName(options) {
|
|
8914
|
-
switch (options
|
|
8932
|
+
switch (ts.getEmitScriptTarget(options)) {
|
|
8915
8933
|
case 99:
|
|
8916
8934
|
return "lib.esnext.full.d.ts";
|
|
8917
8935
|
case 8:
|
|
@@ -9707,7 +9725,7 @@ var ts;
|
|
|
9707
9725
|
switch (node.kind) {
|
|
9708
9726
|
case 269:
|
|
9709
9727
|
case 274:
|
|
9710
|
-
return node.parent.parent.isTypeOnly;
|
|
9728
|
+
return node.isTypeOnly || node.parent.parent.isTypeOnly;
|
|
9711
9729
|
case 267:
|
|
9712
9730
|
return node.parent.isTypeOnly;
|
|
9713
9731
|
case 266:
|
|
@@ -10030,6 +10048,7 @@ var ts;
|
|
|
10030
10048
|
case 225:
|
|
10031
10049
|
case 212:
|
|
10032
10050
|
case 79:
|
|
10051
|
+
case 80:
|
|
10033
10052
|
case 13:
|
|
10034
10053
|
case 8:
|
|
10035
10054
|
case 9:
|
|
@@ -10597,22 +10616,22 @@ var ts;
|
|
|
10597
10616
|
return node.end - node.pos;
|
|
10598
10617
|
}
|
|
10599
10618
|
ts.getFullWidth = getFullWidth;
|
|
10600
|
-
function getResolvedModule(sourceFile, moduleNameText) {
|
|
10601
|
-
return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText);
|
|
10619
|
+
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
10620
|
+
return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText, mode);
|
|
10602
10621
|
}
|
|
10603
10622
|
ts.getResolvedModule = getResolvedModule;
|
|
10604
|
-
function setResolvedModule(sourceFile, moduleNameText, resolvedModule) {
|
|
10623
|
+
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
10605
10624
|
if (!sourceFile.resolvedModules) {
|
|
10606
|
-
sourceFile.resolvedModules =
|
|
10625
|
+
sourceFile.resolvedModules = ts.createModeAwareCache();
|
|
10607
10626
|
}
|
|
10608
|
-
sourceFile.resolvedModules.set(moduleNameText, resolvedModule);
|
|
10627
|
+
sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
|
|
10609
10628
|
}
|
|
10610
10629
|
ts.setResolvedModule = setResolvedModule;
|
|
10611
10630
|
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
|
|
10612
10631
|
if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
10613
|
-
sourceFile.resolvedTypeReferenceDirectiveNames =
|
|
10632
|
+
sourceFile.resolvedTypeReferenceDirectiveNames = ts.createModeAwareCache();
|
|
10614
10633
|
}
|
|
10615
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective);
|
|
10634
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, undefined, resolvedTypeReferenceDirective);
|
|
10616
10635
|
}
|
|
10617
10636
|
ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
|
|
10618
10637
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
@@ -10644,11 +10663,11 @@ var ts;
|
|
|
10644
10663
|
&& oldResolution.originalPath === newResolution.originalPath;
|
|
10645
10664
|
}
|
|
10646
10665
|
ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
|
|
10647
|
-
function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) {
|
|
10666
|
+
function hasChangesInResolutions(names, newResolutions, oldResolutions, oldSourceFile, comparer) {
|
|
10648
10667
|
ts.Debug.assert(names.length === newResolutions.length);
|
|
10649
10668
|
for (var i = 0; i < names.length; i++) {
|
|
10650
10669
|
var newResolution = newResolutions[i];
|
|
10651
|
-
var oldResolution = oldResolutions && oldResolutions.get(names[i]);
|
|
10670
|
+
var oldResolution = oldResolutions && oldResolutions.get(names[i], oldSourceFile && ts.getModeForResolutionAtIndex(oldSourceFile, i));
|
|
10652
10671
|
var changed = oldResolution
|
|
10653
10672
|
? !newResolution || !comparer(oldResolution, newResolution)
|
|
10654
10673
|
: newResolution;
|
|
@@ -11092,8 +11111,11 @@ var ts;
|
|
|
11092
11111
|
return (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return !isExternalModuleAugmentation(d) && !(ts.isModuleDeclaration(d) && isGlobalScopeAugmentation(d)); });
|
|
11093
11112
|
}
|
|
11094
11113
|
ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
|
|
11114
|
+
function isCommonJSContainingModuleKind(kind) {
|
|
11115
|
+
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node12 || kind === ts.ModuleKind.NodeNext;
|
|
11116
|
+
}
|
|
11095
11117
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
11096
|
-
return ts.isExternalModule(node) || compilerOptions.isolatedModules || ((getEmitModuleKind(compilerOptions)
|
|
11118
|
+
return ts.isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator);
|
|
11097
11119
|
}
|
|
11098
11120
|
ts.isEffectiveExternalModule = isEffectiveExternalModule;
|
|
11099
11121
|
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
@@ -12118,6 +12140,8 @@ var ts;
|
|
|
12118
12140
|
node = node.parent;
|
|
12119
12141
|
}
|
|
12120
12142
|
return node.parent.kind === 180 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node);
|
|
12143
|
+
case 80:
|
|
12144
|
+
return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101;
|
|
12121
12145
|
case 79:
|
|
12122
12146
|
if (node.parent.kind === 180 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) {
|
|
12123
12147
|
return true;
|
|
@@ -13475,6 +13499,7 @@ var ts;
|
|
|
13475
13499
|
case 108:
|
|
13476
13500
|
case 106:
|
|
13477
13501
|
case 79:
|
|
13502
|
+
case 80:
|
|
13478
13503
|
case 104:
|
|
13479
13504
|
case 110:
|
|
13480
13505
|
case 95:
|
|
@@ -13948,9 +13973,17 @@ var ts;
|
|
|
13948
13973
|
var path = outputDir
|
|
13949
13974
|
? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName)
|
|
13950
13975
|
: fileName;
|
|
13951
|
-
|
|
13976
|
+
var declarationExtension = getDeclarationEmitExtensionForPath(path);
|
|
13977
|
+
return removeFileExtension(path) + declarationExtension;
|
|
13952
13978
|
}
|
|
13953
13979
|
ts.getDeclarationEmitOutputFilePathWorker = getDeclarationEmitOutputFilePathWorker;
|
|
13980
|
+
function getDeclarationEmitExtensionForPath(path) {
|
|
13981
|
+
return ts.fileExtensionIsOneOf(path, [".mjs", ".mts"]) ? ".d.mts" :
|
|
13982
|
+
ts.fileExtensionIsOneOf(path, [".cjs", ".cts"]) ? ".d.cts" :
|
|
13983
|
+
ts.fileExtensionIsOneOf(path, [".json"]) ? ".json.d.ts" :
|
|
13984
|
+
".d.ts";
|
|
13985
|
+
}
|
|
13986
|
+
ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
|
|
13954
13987
|
function outFile(options) {
|
|
13955
13988
|
return options.outFile || options.out;
|
|
13956
13989
|
}
|
|
@@ -14592,7 +14625,7 @@ var ts;
|
|
|
14592
14625
|
return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512);
|
|
14593
14626
|
}
|
|
14594
14627
|
function tryExtractTSExtension(fileName) {
|
|
14595
|
-
return ts.find(
|
|
14628
|
+
return ts.find(supportedTSExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
14596
14629
|
}
|
|
14597
14630
|
ts.tryExtractTSExtension = tryExtractTSExtension;
|
|
14598
14631
|
function getExpandedCharCodes(input) {
|
|
@@ -15450,7 +15483,10 @@ var ts;
|
|
|
15450
15483
|
}
|
|
15451
15484
|
ts.getLanguageVariant = getLanguageVariant;
|
|
15452
15485
|
function getEmitScriptTarget(compilerOptions) {
|
|
15453
|
-
return compilerOptions.target ||
|
|
15486
|
+
return compilerOptions.target ||
|
|
15487
|
+
(compilerOptions.module === ts.ModuleKind.Node12 && 7) ||
|
|
15488
|
+
(compilerOptions.module === ts.ModuleKind.NodeNext && 99) ||
|
|
15489
|
+
0;
|
|
15454
15490
|
}
|
|
15455
15491
|
ts.getEmitScriptTarget = getEmitScriptTarget;
|
|
15456
15492
|
function getEmitModuleKind(compilerOptions) {
|
|
@@ -15462,7 +15498,20 @@ var ts;
|
|
|
15462
15498
|
function getEmitModuleResolutionKind(compilerOptions) {
|
|
15463
15499
|
var moduleResolution = compilerOptions.moduleResolution;
|
|
15464
15500
|
if (moduleResolution === undefined) {
|
|
15465
|
-
|
|
15501
|
+
switch (getEmitModuleKind(compilerOptions)) {
|
|
15502
|
+
case ts.ModuleKind.CommonJS:
|
|
15503
|
+
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
15504
|
+
break;
|
|
15505
|
+
case ts.ModuleKind.Node12:
|
|
15506
|
+
moduleResolution = ts.ModuleResolutionKind.Node12;
|
|
15507
|
+
break;
|
|
15508
|
+
case ts.ModuleKind.NodeNext:
|
|
15509
|
+
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
15510
|
+
break;
|
|
15511
|
+
default:
|
|
15512
|
+
moduleResolution = ts.ModuleResolutionKind.Classic;
|
|
15513
|
+
break;
|
|
15514
|
+
}
|
|
15466
15515
|
}
|
|
15467
15516
|
return moduleResolution;
|
|
15468
15517
|
}
|
|
@@ -15492,11 +15541,23 @@ var ts;
|
|
|
15492
15541
|
return !!(getEmitDeclarations(options) && options.declarationMap);
|
|
15493
15542
|
}
|
|
15494
15543
|
ts.getAreDeclarationMapsEnabled = getAreDeclarationMapsEnabled;
|
|
15544
|
+
function getESModuleInterop(compilerOptions) {
|
|
15545
|
+
if (compilerOptions.esModuleInterop !== undefined) {
|
|
15546
|
+
return compilerOptions.esModuleInterop;
|
|
15547
|
+
}
|
|
15548
|
+
switch (getEmitModuleKind(compilerOptions)) {
|
|
15549
|
+
case ts.ModuleKind.Node12:
|
|
15550
|
+
case ts.ModuleKind.NodeNext:
|
|
15551
|
+
return true;
|
|
15552
|
+
}
|
|
15553
|
+
return undefined;
|
|
15554
|
+
}
|
|
15555
|
+
ts.getESModuleInterop = getESModuleInterop;
|
|
15495
15556
|
function getAllowSyntheticDefaultImports(compilerOptions) {
|
|
15496
15557
|
var moduleKind = getEmitModuleKind(compilerOptions);
|
|
15497
15558
|
return compilerOptions.allowSyntheticDefaultImports !== undefined
|
|
15498
15559
|
? compilerOptions.allowSyntheticDefaultImports
|
|
15499
|
-
: compilerOptions
|
|
15560
|
+
: getESModuleInterop(compilerOptions) ||
|
|
15500
15561
|
moduleKind === ts.ModuleKind.System;
|
|
15501
15562
|
}
|
|
15502
15563
|
ts.getAllowSyntheticDefaultImports = getAllowSyntheticDefaultImports;
|
|
@@ -15521,7 +15582,7 @@ var ts;
|
|
|
15521
15582
|
}
|
|
15522
15583
|
ts.getAllowJSCompilerOption = getAllowJSCompilerOption;
|
|
15523
15584
|
function getUseDefineForClassFields(compilerOptions) {
|
|
15524
|
-
return compilerOptions.useDefineForClassFields === undefined ? compilerOptions
|
|
15585
|
+
return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) === 99 : compilerOptions.useDefineForClassFields;
|
|
15525
15586
|
}
|
|
15526
15587
|
ts.getUseDefineForClassFields = getUseDefineForClassFields;
|
|
15527
15588
|
function compilerOptionsAffectSemanticDiagnostics(newOptions, oldOptions) {
|
|
@@ -15630,7 +15691,8 @@ var ts;
|
|
|
15630
15691
|
var aParts = ts.getPathComponents(ts.getNormalizedAbsolutePath(a, cwd));
|
|
15631
15692
|
var bParts = ts.getPathComponents(ts.getNormalizedAbsolutePath(b, cwd));
|
|
15632
15693
|
var isDirectory = false;
|
|
15633
|
-
while (
|
|
15694
|
+
while (aParts.length >= 2 && bParts.length >= 2 &&
|
|
15695
|
+
!isNodeModulesOrScopedPackageDirectory(aParts[aParts.length - 2], getCanonicalFileName) &&
|
|
15634
15696
|
!isNodeModulesOrScopedPackageDirectory(bParts[bParts.length - 2], getCanonicalFileName) &&
|
|
15635
15697
|
getCanonicalFileName(aParts[aParts.length - 1]) === getCanonicalFileName(bParts[bParts.length - 1])) {
|
|
15636
15698
|
aParts.pop();
|
|
@@ -15640,7 +15702,7 @@ var ts;
|
|
|
15640
15702
|
return isDirectory ? [ts.getPathFromPathComponents(aParts), ts.getPathFromPathComponents(bParts)] : undefined;
|
|
15641
15703
|
}
|
|
15642
15704
|
function isNodeModulesOrScopedPackageDirectory(s, getCanonicalFileName) {
|
|
15643
|
-
return getCanonicalFileName(s) === "node_modules" || ts.startsWith(s, "@");
|
|
15705
|
+
return s !== undefined && (getCanonicalFileName(s) === "node_modules" || ts.startsWith(s, "@"));
|
|
15644
15706
|
}
|
|
15645
15707
|
function stripLeadingDirectorySeparator(s) {
|
|
15646
15708
|
return ts.isAnyDirectorySeparator(s.charCodeAt(0)) ? s.slice(1) : undefined;
|
|
@@ -15899,48 +15961,51 @@ var ts;
|
|
|
15899
15961
|
}
|
|
15900
15962
|
}
|
|
15901
15963
|
ts.getScriptKindFromFileName = getScriptKindFromFileName;
|
|
15902
|
-
ts.supportedTSExtensions = [".ts", ".tsx", ".d.ts"];
|
|
15903
|
-
ts.
|
|
15904
|
-
|
|
15905
|
-
|
|
15906
|
-
ts.
|
|
15907
|
-
|
|
15908
|
-
var
|
|
15964
|
+
ts.supportedTSExtensions = [[".ts", ".tsx", ".d.ts"], [".cts", ".d.cts"], [".mts", ".d.mts"]];
|
|
15965
|
+
ts.supportedTSExtensionsFlat = ts.flatten(ts.supportedTSExtensions);
|
|
15966
|
+
var supportedTSExtensionsWithJson = __spreadArray(__spreadArray([], ts.supportedTSExtensions, true), [[".json"]], false);
|
|
15967
|
+
var supportedTSExtensionsForExtractExtension = [".d.ts", ".d.cts", ".d.mts", ".cts", ".mts", ".ts", ".tsx", ".cts", ".mts"];
|
|
15968
|
+
ts.supportedJSExtensions = [[".js", ".jsx"], [".mjs"], [".cjs"]];
|
|
15969
|
+
ts.supportedJSExtensionsFlat = ts.flatten(ts.supportedJSExtensions);
|
|
15970
|
+
var allSupportedExtensions = [[".ts", ".tsx", ".d.ts", ".js", ".jsx"], [".cts", ".d.cts", ".cjs"], [".mts", ".d.mts", ".mjs"]];
|
|
15971
|
+
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[".json"]], false);
|
|
15909
15972
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
15910
15973
|
var needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
15911
15974
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
15912
15975
|
return needJsExtensions ? allSupportedExtensions : ts.supportedTSExtensions;
|
|
15913
15976
|
}
|
|
15914
|
-
var
|
|
15915
|
-
|
|
15977
|
+
var builtins = needJsExtensions ? allSupportedExtensions : ts.supportedTSExtensions;
|
|
15978
|
+
var flatBuiltins = ts.flatten(builtins);
|
|
15979
|
+
var extensions = __spreadArray(__spreadArray([], builtins, true), ts.mapDefined(extraFileExtensions, function (x) { return x.scriptKind === 7 || needJsExtensions && isJSLike(x.scriptKind) && flatBuiltins.indexOf(x.extension) === -1 ? [x.extension] : undefined; }), true);
|
|
15980
|
+
return extensions;
|
|
15916
15981
|
}
|
|
15917
15982
|
ts.getSupportedExtensions = getSupportedExtensions;
|
|
15918
|
-
function
|
|
15983
|
+
function getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions) {
|
|
15919
15984
|
if (!options || !options.resolveJsonModule)
|
|
15920
15985
|
return supportedExtensions;
|
|
15921
15986
|
if (supportedExtensions === allSupportedExtensions)
|
|
15922
15987
|
return allSupportedExtensionsWithJson;
|
|
15923
15988
|
if (supportedExtensions === ts.supportedTSExtensions)
|
|
15924
|
-
return
|
|
15925
|
-
return __spreadArray(__spreadArray([], supportedExtensions, true), [".json"], false);
|
|
15989
|
+
return supportedTSExtensionsWithJson;
|
|
15990
|
+
return __spreadArray(__spreadArray([], supportedExtensions, true), [[".json"]], false);
|
|
15926
15991
|
}
|
|
15927
|
-
ts.
|
|
15992
|
+
ts.getSupportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule;
|
|
15928
15993
|
function isJSLike(scriptKind) {
|
|
15929
15994
|
return scriptKind === 1 || scriptKind === 2;
|
|
15930
15995
|
}
|
|
15931
15996
|
function hasJSFileExtension(fileName) {
|
|
15932
|
-
return ts.some(ts.
|
|
15997
|
+
return ts.some(ts.supportedJSExtensionsFlat, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
15933
15998
|
}
|
|
15934
15999
|
ts.hasJSFileExtension = hasJSFileExtension;
|
|
15935
16000
|
function hasTSFileExtension(fileName) {
|
|
15936
|
-
return ts.some(ts.
|
|
16001
|
+
return ts.some(ts.supportedTSExtensionsFlat, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
15937
16002
|
}
|
|
15938
16003
|
ts.hasTSFileExtension = hasTSFileExtension;
|
|
15939
16004
|
function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) {
|
|
15940
16005
|
if (!fileName)
|
|
15941
16006
|
return false;
|
|
15942
16007
|
var supportedExtensions = getSupportedExtensions(compilerOptions, extraFileExtensions);
|
|
15943
|
-
for (var _i = 0, _a =
|
|
16008
|
+
for (var _i = 0, _a = ts.flatten(getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, supportedExtensions)); _i < _a.length; _i++) {
|
|
15944
16009
|
var extension = _a[_i];
|
|
15945
16010
|
if (ts.fileExtensionIs(fileName, extension)) {
|
|
15946
16011
|
return true;
|
|
@@ -15957,37 +16022,7 @@ var ts;
|
|
|
15957
16022
|
return ts.compareValues(numberOfDirectorySeparators(path1), numberOfDirectorySeparators(path2));
|
|
15958
16023
|
}
|
|
15959
16024
|
ts.compareNumberOfDirectorySeparators = compareNumberOfDirectorySeparators;
|
|
15960
|
-
|
|
15961
|
-
for (var i = supportedExtensions.length - 1; i >= 0; i--) {
|
|
15962
|
-
if (ts.fileExtensionIs(path, supportedExtensions[i])) {
|
|
15963
|
-
return adjustExtensionPriority(i, supportedExtensions);
|
|
15964
|
-
}
|
|
15965
|
-
}
|
|
15966
|
-
return 0;
|
|
15967
|
-
}
|
|
15968
|
-
ts.getExtensionPriority = getExtensionPriority;
|
|
15969
|
-
function adjustExtensionPriority(extensionPriority, supportedExtensions) {
|
|
15970
|
-
if (extensionPriority < 2) {
|
|
15971
|
-
return 0;
|
|
15972
|
-
}
|
|
15973
|
-
else if (extensionPriority < supportedExtensions.length) {
|
|
15974
|
-
return 2;
|
|
15975
|
-
}
|
|
15976
|
-
else {
|
|
15977
|
-
return supportedExtensions.length;
|
|
15978
|
-
}
|
|
15979
|
-
}
|
|
15980
|
-
ts.adjustExtensionPriority = adjustExtensionPriority;
|
|
15981
|
-
function getNextLowestExtensionPriority(extensionPriority, supportedExtensions) {
|
|
15982
|
-
if (extensionPriority < 2) {
|
|
15983
|
-
return 2;
|
|
15984
|
-
}
|
|
15985
|
-
else {
|
|
15986
|
-
return supportedExtensions.length;
|
|
15987
|
-
}
|
|
15988
|
-
}
|
|
15989
|
-
ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority;
|
|
15990
|
-
var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx", ".json"];
|
|
16025
|
+
var extensionsToRemove = [".d.ts", ".d.mts", ".d.cts", ".mjs", ".mts", ".cjs", ".cts", ".ts", ".js", ".tsx", ".jsx", ".json"];
|
|
15991
16026
|
function removeFileExtension(path) {
|
|
15992
16027
|
for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) {
|
|
15993
16028
|
var ext = extensionsToRemove_1[_i];
|
|
@@ -16033,7 +16068,7 @@ var ts;
|
|
|
16033
16068
|
}
|
|
16034
16069
|
ts.positionIsSynthesized = positionIsSynthesized;
|
|
16035
16070
|
function extensionIsTS(ext) {
|
|
16036
|
-
return ext === ".ts" || ext === ".tsx" || ext === ".d.ts";
|
|
16071
|
+
return ext === ".ts" || ext === ".tsx" || ext === ".d.ts" || ext === ".cts" || ext === ".mts" || ext === ".d.mts" || ext === ".d.cts";
|
|
16037
16072
|
}
|
|
16038
16073
|
ts.extensionIsTS = extensionIsTS;
|
|
16039
16074
|
function resolutionExtensionIsTSOrJson(ext) {
|
|
@@ -16207,10 +16242,6 @@ var ts;
|
|
|
16207
16242
|
|| !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite));
|
|
16208
16243
|
}
|
|
16209
16244
|
ts.isValidTypeOnlyAliasUseSite = isValidTypeOnlyAliasUseSite;
|
|
16210
|
-
function typeOnlyDeclarationIsExport(typeOnlyDeclaration) {
|
|
16211
|
-
return typeOnlyDeclaration.kind === 274;
|
|
16212
|
-
}
|
|
16213
|
-
ts.typeOnlyDeclarationIsExport = typeOnlyDeclarationIsExport;
|
|
16214
16245
|
function isShorthandPropertyNameUseSite(useSite) {
|
|
16215
16246
|
return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite;
|
|
16216
16247
|
}
|
|
@@ -19667,8 +19698,9 @@ var ts;
|
|
|
19667
19698
|
? update(createNamedImports(elements), node)
|
|
19668
19699
|
: node;
|
|
19669
19700
|
}
|
|
19670
|
-
function createImportSpecifier(propertyName, name) {
|
|
19701
|
+
function createImportSpecifier(isTypeOnly, propertyName, name) {
|
|
19671
19702
|
var node = createBaseNode(269);
|
|
19703
|
+
node.isTypeOnly = isTypeOnly;
|
|
19672
19704
|
node.propertyName = propertyName;
|
|
19673
19705
|
node.name = name;
|
|
19674
19706
|
node.transformFlags |=
|
|
@@ -19677,10 +19709,11 @@ var ts;
|
|
|
19677
19709
|
node.transformFlags &= ~16777216;
|
|
19678
19710
|
return node;
|
|
19679
19711
|
}
|
|
19680
|
-
function updateImportSpecifier(node, propertyName, name) {
|
|
19681
|
-
return node.
|
|
19712
|
+
function updateImportSpecifier(node, isTypeOnly, propertyName, name) {
|
|
19713
|
+
return node.isTypeOnly !== isTypeOnly
|
|
19714
|
+
|| node.propertyName !== propertyName
|
|
19682
19715
|
|| node.name !== name
|
|
19683
|
-
? update(createImportSpecifier(propertyName, name), node)
|
|
19716
|
+
? update(createImportSpecifier(isTypeOnly, propertyName, name), node)
|
|
19684
19717
|
: node;
|
|
19685
19718
|
}
|
|
19686
19719
|
function createExportAssignment(decorators, modifiers, isExportEquals, expression) {
|
|
@@ -19734,8 +19767,9 @@ var ts;
|
|
|
19734
19767
|
? update(createNamedExports(elements), node)
|
|
19735
19768
|
: node;
|
|
19736
19769
|
}
|
|
19737
|
-
function createExportSpecifier(propertyName, name) {
|
|
19770
|
+
function createExportSpecifier(isTypeOnly, propertyName, name) {
|
|
19738
19771
|
var node = createBaseNode(274);
|
|
19772
|
+
node.isTypeOnly = isTypeOnly;
|
|
19739
19773
|
node.propertyName = asName(propertyName);
|
|
19740
19774
|
node.name = asName(name);
|
|
19741
19775
|
node.transformFlags |=
|
|
@@ -19744,10 +19778,11 @@ var ts;
|
|
|
19744
19778
|
node.transformFlags &= ~16777216;
|
|
19745
19779
|
return node;
|
|
19746
19780
|
}
|
|
19747
|
-
function updateExportSpecifier(node, propertyName, name) {
|
|
19748
|
-
return node.
|
|
19781
|
+
function updateExportSpecifier(node, isTypeOnly, propertyName, name) {
|
|
19782
|
+
return node.isTypeOnly !== isTypeOnly
|
|
19783
|
+
|| node.propertyName !== propertyName
|
|
19749
19784
|
|| node.name !== name
|
|
19750
|
-
? update(createExportSpecifier(propertyName, name), node)
|
|
19785
|
+
? update(createExportSpecifier(isTypeOnly, propertyName, name), node)
|
|
19751
19786
|
: node;
|
|
19752
19787
|
}
|
|
19753
19788
|
function createMissingDeclaration() {
|
|
@@ -20435,6 +20470,7 @@ var ts;
|
|
|
20435
20470
|
node.transformFlags =
|
|
20436
20471
|
propagateChildrenFlags(node.statements) |
|
|
20437
20472
|
propagateChildFlags(node.endOfFileToken);
|
|
20473
|
+
node.impliedNodeFormat = source.impliedNodeFormat;
|
|
20438
20474
|
return node;
|
|
20439
20475
|
}
|
|
20440
20476
|
function updateSourceFile(node, statements, isDeclarationFile, referencedFiles, typeReferenceDirectives, hasNoDefaultLib, libReferenceDirectives) {
|
|
@@ -20623,7 +20659,7 @@ var ts;
|
|
|
20623
20659
|
}
|
|
20624
20660
|
function createExternalModuleExport(exportName) {
|
|
20625
20661
|
return createExportDeclaration(undefined, undefined, false, createNamedExports([
|
|
20626
|
-
createExportSpecifier(undefined, exportName)
|
|
20662
|
+
createExportSpecifier(false, undefined, exportName)
|
|
20627
20663
|
]));
|
|
20628
20664
|
}
|
|
20629
20665
|
function createTypeCheck(value, tag) {
|
|
@@ -21682,6 +21718,7 @@ var ts;
|
|
|
21682
21718
|
createExportStarHelper: createExportStarHelper,
|
|
21683
21719
|
createClassPrivateFieldGetHelper: createClassPrivateFieldGetHelper,
|
|
21684
21720
|
createClassPrivateFieldSetHelper: createClassPrivateFieldSetHelper,
|
|
21721
|
+
createClassPrivateFieldInHelper: createClassPrivateFieldInHelper
|
|
21685
21722
|
};
|
|
21686
21723
|
function getUnscopedHelperName(name) {
|
|
21687
21724
|
return ts.setEmitFlags(factory.createIdentifier(name), 4096 | 2);
|
|
@@ -21714,7 +21751,7 @@ var ts;
|
|
|
21714
21751
|
]), location);
|
|
21715
21752
|
}
|
|
21716
21753
|
function createAssignHelper(attributesSegments) {
|
|
21717
|
-
if (context.getCompilerOptions()
|
|
21754
|
+
if (ts.getEmitScriptTarget(context.getCompilerOptions()) >= 2) {
|
|
21718
21755
|
return factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "assign"), undefined, attributesSegments);
|
|
21719
21756
|
}
|
|
21720
21757
|
context.requestEmitHelper(ts.assignHelper);
|
|
@@ -21847,6 +21884,10 @@ var ts;
|
|
|
21847
21884
|
}
|
|
21848
21885
|
return factory.createCallExpression(getUnscopedHelperName("__classPrivateFieldSet"), undefined, args);
|
|
21849
21886
|
}
|
|
21887
|
+
function createClassPrivateFieldInHelper(state, receiver) {
|
|
21888
|
+
context.requestEmitHelper(ts.classPrivateFieldInHelper);
|
|
21889
|
+
return factory.createCallExpression(getUnscopedHelperName("__classPrivateFieldIn"), undefined, [state, receiver]);
|
|
21890
|
+
}
|
|
21850
21891
|
}
|
|
21851
21892
|
ts.createEmitHelperFactory = createEmitHelperFactory;
|
|
21852
21893
|
function compareEmitHelpers(x, y) {
|
|
@@ -22031,6 +22072,12 @@ var ts;
|
|
|
22031
22072
|
scoped: false,
|
|
22032
22073
|
text: "\n var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n };"
|
|
22033
22074
|
};
|
|
22075
|
+
ts.classPrivateFieldInHelper = {
|
|
22076
|
+
name: "typescript:classPrivateFieldIn",
|
|
22077
|
+
importName: "__classPrivateFieldIn",
|
|
22078
|
+
scoped: false,
|
|
22079
|
+
text: "\n var __classPrivateFieldIn = (this && this.__classPrivateFieldIn) || function(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n };"
|
|
22080
|
+
};
|
|
22034
22081
|
var allUnscopedEmitHelpers;
|
|
22035
22082
|
function getAllUnscopedEmitHelpers() {
|
|
22036
22083
|
return allUnscopedEmitHelpers || (allUnscopedEmitHelpers = ts.arrayToMap([
|
|
@@ -22055,6 +22102,7 @@ var ts;
|
|
|
22055
22102
|
ts.exportStarHelper,
|
|
22056
22103
|
ts.classPrivateFieldGetHelper,
|
|
22057
22104
|
ts.classPrivateFieldSetHelper,
|
|
22105
|
+
ts.classPrivateFieldInHelper,
|
|
22058
22106
|
ts.createBindingHelper,
|
|
22059
22107
|
ts.setModuleDefaultHelper
|
|
22060
22108
|
], function (helper) { return helper.name; }));
|
|
@@ -23246,7 +23294,7 @@ var ts;
|
|
|
23246
23294
|
if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
23247
23295
|
var namedBindings = void 0;
|
|
23248
23296
|
var moduleKind = ts.getEmitModuleKind(compilerOptions);
|
|
23249
|
-
if (moduleKind >= ts.ModuleKind.ES2015 && moduleKind <= ts.ModuleKind.ESNext) {
|
|
23297
|
+
if ((moduleKind >= ts.ModuleKind.ES2015 && moduleKind <= ts.ModuleKind.ESNext) || sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
23250
23298
|
var helpers = ts.getEmitHelpers(sourceFile);
|
|
23251
23299
|
if (helpers) {
|
|
23252
23300
|
var helperNames = [];
|
|
@@ -23262,8 +23310,8 @@ var ts;
|
|
|
23262
23310
|
if (ts.some(helperNames)) {
|
|
23263
23311
|
helperNames.sort(ts.compareStringsCaseSensitive);
|
|
23264
23312
|
namedBindings = nodeFactory.createNamedImports(ts.map(helperNames, function (name) { return ts.isFileLevelUniqueName(sourceFile, name)
|
|
23265
|
-
? nodeFactory.createImportSpecifier(undefined, nodeFactory.createIdentifier(name))
|
|
23266
|
-
: nodeFactory.createImportSpecifier(nodeFactory.createIdentifier(name), helperFactory.getUnscopedHelperName(name)); }));
|
|
23313
|
+
? nodeFactory.createImportSpecifier(false, undefined, nodeFactory.createIdentifier(name))
|
|
23314
|
+
: nodeFactory.createImportSpecifier(false, nodeFactory.createIdentifier(name), helperFactory.getUnscopedHelperName(name)); }));
|
|
23267
23315
|
var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile);
|
|
23268
23316
|
var emitNode = ts.getOrCreateEmitNode(parseNode);
|
|
23269
23317
|
emitNode.externalHelpers = true;
|
|
@@ -23291,9 +23339,9 @@ var ts;
|
|
|
23291
23339
|
return externalHelpersModuleName;
|
|
23292
23340
|
}
|
|
23293
23341
|
var moduleKind = ts.getEmitModuleKind(compilerOptions);
|
|
23294
|
-
var create = (hasExportStarsToExportValues || (compilerOptions
|
|
23342
|
+
var create = (hasExportStarsToExportValues || (ts.getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault))
|
|
23295
23343
|
&& moduleKind !== ts.ModuleKind.System
|
|
23296
|
-
&& moduleKind < ts.ModuleKind.ES2015;
|
|
23344
|
+
&& (moduleKind < ts.ModuleKind.ES2015 || node.impliedNodeFormat === ts.ModuleKind.CommonJS);
|
|
23297
23345
|
if (!create) {
|
|
23298
23346
|
var helpers = ts.getEmitHelpers(node);
|
|
23299
23347
|
if (helpers) {
|
|
@@ -27672,6 +27720,8 @@ var ts;
|
|
|
27672
27720
|
break;
|
|
27673
27721
|
case 15:
|
|
27674
27722
|
return parseTemplateExpression(false);
|
|
27723
|
+
case 80:
|
|
27724
|
+
return parsePrivateIdentifier();
|
|
27675
27725
|
}
|
|
27676
27726
|
return parseIdentifier(ts.Diagnostics.Expression_expected);
|
|
27677
27727
|
}
|
|
@@ -29032,27 +29082,60 @@ var ts;
|
|
|
29032
29082
|
var checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();
|
|
29033
29083
|
var checkIdentifierStart = scanner.getTokenPos();
|
|
29034
29084
|
var checkIdentifierEnd = scanner.getTextPos();
|
|
29035
|
-
var
|
|
29085
|
+
var isTypeOnly = false;
|
|
29036
29086
|
var propertyName;
|
|
29037
|
-
var
|
|
29038
|
-
|
|
29039
|
-
|
|
29040
|
-
|
|
29041
|
-
|
|
29042
|
-
|
|
29043
|
-
|
|
29044
|
-
|
|
29087
|
+
var canParseAsKeyword = true;
|
|
29088
|
+
var name = parseIdentifierName();
|
|
29089
|
+
if (name.escapedText === "type") {
|
|
29090
|
+
if (token() === 127) {
|
|
29091
|
+
var firstAs = parseIdentifierName();
|
|
29092
|
+
if (token() === 127) {
|
|
29093
|
+
var secondAs = parseIdentifierName();
|
|
29094
|
+
if (ts.tokenIsIdentifierOrKeyword(token())) {
|
|
29095
|
+
isTypeOnly = true;
|
|
29096
|
+
propertyName = firstAs;
|
|
29097
|
+
name = parseNameWithKeywordCheck();
|
|
29098
|
+
canParseAsKeyword = false;
|
|
29099
|
+
}
|
|
29100
|
+
else {
|
|
29101
|
+
propertyName = name;
|
|
29102
|
+
name = secondAs;
|
|
29103
|
+
canParseAsKeyword = false;
|
|
29104
|
+
}
|
|
29105
|
+
}
|
|
29106
|
+
else if (ts.tokenIsIdentifierOrKeyword(token())) {
|
|
29107
|
+
propertyName = name;
|
|
29108
|
+
canParseAsKeyword = false;
|
|
29109
|
+
name = parseNameWithKeywordCheck();
|
|
29110
|
+
}
|
|
29111
|
+
else {
|
|
29112
|
+
isTypeOnly = true;
|
|
29113
|
+
name = firstAs;
|
|
29114
|
+
}
|
|
29115
|
+
}
|
|
29116
|
+
else if (ts.tokenIsIdentifierOrKeyword(token())) {
|
|
29117
|
+
isTypeOnly = true;
|
|
29118
|
+
name = parseNameWithKeywordCheck();
|
|
29119
|
+
}
|
|
29045
29120
|
}
|
|
29046
|
-
|
|
29047
|
-
|
|
29121
|
+
if (canParseAsKeyword && token() === 127) {
|
|
29122
|
+
propertyName = name;
|
|
29123
|
+
parseExpected(127);
|
|
29124
|
+
name = parseNameWithKeywordCheck();
|
|
29048
29125
|
}
|
|
29049
29126
|
if (kind === 269 && checkIdentifierIsKeyword) {
|
|
29050
29127
|
parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected);
|
|
29051
29128
|
}
|
|
29052
29129
|
var node = kind === 269
|
|
29053
|
-
? factory.createImportSpecifier(propertyName, name)
|
|
29054
|
-
: factory.createExportSpecifier(propertyName, name);
|
|
29130
|
+
? factory.createImportSpecifier(isTypeOnly, propertyName, name)
|
|
29131
|
+
: factory.createExportSpecifier(isTypeOnly, propertyName, name);
|
|
29055
29132
|
return finishNode(node, pos);
|
|
29133
|
+
function parseNameWithKeywordCheck() {
|
|
29134
|
+
checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();
|
|
29135
|
+
checkIdentifierStart = scanner.getTokenPos();
|
|
29136
|
+
checkIdentifierEnd = scanner.getTextPos();
|
|
29137
|
+
return parseIdentifierName();
|
|
29138
|
+
}
|
|
29056
29139
|
}
|
|
29057
29140
|
function parseNamespaceExport(pos) {
|
|
29058
29141
|
return finishNode(factory.createNamespaceExport(parseIdentifierName()), pos);
|
|
@@ -30046,6 +30129,7 @@ var ts;
|
|
|
30046
30129
|
updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks);
|
|
30047
30130
|
var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true, sourceFile.scriptKind);
|
|
30048
30131
|
result.commentDirectives = getNewCommentDirectives(sourceFile.commentDirectives, result.commentDirectives, changeRange.span.start, ts.textSpanEnd(changeRange.span), delta, oldText, newText, aggressiveChecks);
|
|
30132
|
+
result.impliedNodeFormat = sourceFile.impliedNodeFormat;
|
|
30049
30133
|
return result;
|
|
30050
30134
|
}
|
|
30051
30135
|
IncrementalParser.updateSourceFile = updateSourceFile;
|
|
@@ -30345,7 +30429,7 @@ var ts;
|
|
|
30345
30429
|
IncrementalParser.createSyntaxCursor = createSyntaxCursor;
|
|
30346
30430
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
30347
30431
|
function isDeclarationFileName(fileName) {
|
|
30348
|
-
return ts.
|
|
30432
|
+
return ts.fileExtensionIsOneOf(fileName, [".d.ts", ".d.mts", ".d.cts"]);
|
|
30349
30433
|
}
|
|
30350
30434
|
ts.isDeclarationFileName = isDeclarationFileName;
|
|
30351
30435
|
function processCommentPragmas(context, sourceText) {
|
|
@@ -30922,7 +31006,9 @@ var ts;
|
|
|
30922
31006
|
es6: ts.ModuleKind.ES2015,
|
|
30923
31007
|
es2015: ts.ModuleKind.ES2015,
|
|
30924
31008
|
es2020: ts.ModuleKind.ES2020,
|
|
30925
|
-
esnext: ts.ModuleKind.ESNext
|
|
31009
|
+
esnext: ts.ModuleKind.ESNext,
|
|
31010
|
+
node12: ts.ModuleKind.Node12,
|
|
31011
|
+
nodenext: ts.ModuleKind.NodeNext,
|
|
30926
31012
|
})),
|
|
30927
31013
|
affectsModuleResolution: true,
|
|
30928
31014
|
affectsEmit: true,
|
|
@@ -31792,7 +31878,7 @@ var ts;
|
|
|
31792
31878
|
};
|
|
31793
31879
|
ts.defaultInitCompilerOptions = {
|
|
31794
31880
|
module: ts.ModuleKind.CommonJS,
|
|
31795
|
-
target:
|
|
31881
|
+
target: 3,
|
|
31796
31882
|
strict: true,
|
|
31797
31883
|
esModuleInterop: true,
|
|
31798
31884
|
forceConsistentCasingInFileNames: true,
|
|
@@ -33132,7 +33218,7 @@ var ts;
|
|
|
33132
33218
|
var wildCardJsonFileMap = new ts.Map();
|
|
33133
33219
|
var validatedFilesSpec = configFileSpecs.validatedFilesSpec, validatedIncludeSpecs = configFileSpecs.validatedIncludeSpecs, validatedExcludeSpecs = configFileSpecs.validatedExcludeSpecs;
|
|
33134
33220
|
var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions);
|
|
33135
|
-
var supportedExtensionsWithJsonIfResolveJsonModule = ts.
|
|
33221
|
+
var supportedExtensionsWithJsonIfResolveJsonModule = ts.getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
|
|
33136
33222
|
if (validatedFilesSpec) {
|
|
33137
33223
|
for (var _i = 0, validatedFilesSpec_1 = validatedFilesSpec; _i < validatedFilesSpec_1.length; _i++) {
|
|
33138
33224
|
var fileName = validatedFilesSpec_1[_i];
|
|
@@ -33167,7 +33253,7 @@ var ts;
|
|
|
33167
33253
|
wildcardFileMap.set(key, file);
|
|
33168
33254
|
}
|
|
33169
33255
|
};
|
|
33170
|
-
for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensionsWithJsonIfResolveJsonModule, validatedExcludeSpecs, validatedIncludeSpecs, undefined); _a < _b.length; _a++) {
|
|
33256
|
+
for (var _a = 0, _b = host.readDirectory(basePath, ts.flatten(supportedExtensionsWithJsonIfResolveJsonModule), validatedExcludeSpecs, validatedIncludeSpecs, undefined); _a < _b.length; _a++) {
|
|
33171
33257
|
var file = _b[_a];
|
|
33172
33258
|
_loop_6(file);
|
|
33173
33259
|
}
|
|
@@ -33299,23 +33385,36 @@ var ts;
|
|
|
33299
33385
|
return undefined;
|
|
33300
33386
|
}
|
|
33301
33387
|
function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) {
|
|
33302
|
-
var
|
|
33303
|
-
|
|
33304
|
-
|
|
33305
|
-
|
|
33306
|
-
|
|
33388
|
+
var extensionGroup = ts.forEach(extensions, function (group) { return ts.fileExtensionIsOneOf(file, group) ? group : undefined; });
|
|
33389
|
+
if (!extensionGroup) {
|
|
33390
|
+
return false;
|
|
33391
|
+
}
|
|
33392
|
+
for (var _i = 0, extensionGroup_1 = extensionGroup; _i < extensionGroup_1.length; _i++) {
|
|
33393
|
+
var ext = extensionGroup_1[_i];
|
|
33394
|
+
if (ts.fileExtensionIs(file, ext)) {
|
|
33395
|
+
return false;
|
|
33396
|
+
}
|
|
33397
|
+
var higherPriorityPath = keyMapper(ts.changeExtension(file, ext));
|
|
33307
33398
|
if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) {
|
|
33399
|
+
if (ext === ".d.ts" && (ts.fileExtensionIs(file, ".js") || ts.fileExtensionIs(file, ".jsx"))) {
|
|
33400
|
+
continue;
|
|
33401
|
+
}
|
|
33308
33402
|
return true;
|
|
33309
33403
|
}
|
|
33310
33404
|
}
|
|
33311
33405
|
return false;
|
|
33312
33406
|
}
|
|
33313
33407
|
function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) {
|
|
33314
|
-
var
|
|
33315
|
-
|
|
33316
|
-
|
|
33317
|
-
|
|
33318
|
-
|
|
33408
|
+
var extensionGroup = ts.forEach(extensions, function (group) { return ts.fileExtensionIsOneOf(file, group) ? group : undefined; });
|
|
33409
|
+
if (!extensionGroup) {
|
|
33410
|
+
return;
|
|
33411
|
+
}
|
|
33412
|
+
for (var i = extensionGroup.length - 1; i >= 0; i--) {
|
|
33413
|
+
var ext = extensionGroup[i];
|
|
33414
|
+
if (ts.fileExtensionIs(file, ext)) {
|
|
33415
|
+
return;
|
|
33416
|
+
}
|
|
33417
|
+
var lowerPriorityPath = keyMapper(ts.changeExtension(file, ext));
|
|
33319
33418
|
wildcardFiles.delete(lowerPriorityPath);
|
|
33320
33419
|
}
|
|
33321
33420
|
}
|
|
@@ -33551,7 +33650,7 @@ var ts;
|
|
|
33551
33650
|
}
|
|
33552
33651
|
var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
|
|
33553
33652
|
var perFolderCache = containingDirectory ? cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference) : undefined;
|
|
33554
|
-
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName);
|
|
33653
|
+
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName, undefined);
|
|
33555
33654
|
if (result) {
|
|
33556
33655
|
if (traceEnabled) {
|
|
33557
33656
|
trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -33585,7 +33684,7 @@ var ts;
|
|
|
33585
33684
|
}
|
|
33586
33685
|
}
|
|
33587
33686
|
var failedLookupLocations = [];
|
|
33588
|
-
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache };
|
|
33687
|
+
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.AllFeatures, conditions: ["node", "require", "types"] };
|
|
33589
33688
|
var resolved = primaryLookup();
|
|
33590
33689
|
var primary = true;
|
|
33591
33690
|
if (!resolved) {
|
|
@@ -33605,7 +33704,7 @@ var ts;
|
|
|
33605
33704
|
};
|
|
33606
33705
|
}
|
|
33607
33706
|
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
|
|
33608
|
-
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, result);
|
|
33707
|
+
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, undefined, result);
|
|
33609
33708
|
if (traceEnabled)
|
|
33610
33709
|
traceResult(result);
|
|
33611
33710
|
return result;
|
|
@@ -33797,9 +33896,54 @@ var ts;
|
|
|
33797
33896
|
}
|
|
33798
33897
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
33799
33898
|
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
33800
|
-
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function () { return
|
|
33899
|
+
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function () { return createModeAwareCache(); });
|
|
33900
|
+
}
|
|
33901
|
+
}
|
|
33902
|
+
function createModeAwareCache() {
|
|
33903
|
+
var underlying = new ts.Map();
|
|
33904
|
+
var memoizedReverseKeys = new ts.Map();
|
|
33905
|
+
var cache = {
|
|
33906
|
+
get: function (specifier, mode) {
|
|
33907
|
+
return underlying.get(getUnderlyingCacheKey(specifier, mode));
|
|
33908
|
+
},
|
|
33909
|
+
set: function (specifier, mode, value) {
|
|
33910
|
+
underlying.set(getUnderlyingCacheKey(specifier, mode), value);
|
|
33911
|
+
return cache;
|
|
33912
|
+
},
|
|
33913
|
+
delete: function (specifier, mode) {
|
|
33914
|
+
underlying.delete(getUnderlyingCacheKey(specifier, mode));
|
|
33915
|
+
return cache;
|
|
33916
|
+
},
|
|
33917
|
+
has: function (specifier, mode) {
|
|
33918
|
+
return underlying.has(getUnderlyingCacheKey(specifier, mode));
|
|
33919
|
+
},
|
|
33920
|
+
forEach: function (cb) {
|
|
33921
|
+
return underlying.forEach(function (elem, key) {
|
|
33922
|
+
var _a = memoizedReverseKeys.get(key), specifier = _a[0], mode = _a[1];
|
|
33923
|
+
return cb(elem, specifier, mode);
|
|
33924
|
+
});
|
|
33925
|
+
},
|
|
33926
|
+
size: function () {
|
|
33927
|
+
return underlying.size;
|
|
33928
|
+
}
|
|
33929
|
+
};
|
|
33930
|
+
return cache;
|
|
33931
|
+
function getUnderlyingCacheKey(specifier, mode) {
|
|
33932
|
+
var result = mode === undefined ? specifier : mode + "|" + specifier;
|
|
33933
|
+
memoizedReverseKeys.set(result, [specifier, mode]);
|
|
33934
|
+
return result;
|
|
33935
|
+
}
|
|
33936
|
+
}
|
|
33937
|
+
ts.createModeAwareCache = createModeAwareCache;
|
|
33938
|
+
function zipToModeAwareCache(file, keys, values) {
|
|
33939
|
+
ts.Debug.assert(keys.length === values.length);
|
|
33940
|
+
var map = createModeAwareCache();
|
|
33941
|
+
for (var i = 0; i < keys.length; ++i) {
|
|
33942
|
+
map.set(keys[i], ts.getModeForResolutionAtIndex(file, i), values[i]);
|
|
33801
33943
|
}
|
|
33944
|
+
return map;
|
|
33802
33945
|
}
|
|
33946
|
+
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
33803
33947
|
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
33804
33948
|
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
33805
33949
|
moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
|
|
@@ -33813,9 +33957,9 @@ var ts;
|
|
|
33813
33957
|
function update(options) {
|
|
33814
33958
|
updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap);
|
|
33815
33959
|
}
|
|
33816
|
-
function getOrCreateCacheForModuleName(nonRelativeModuleName, redirectedReference) {
|
|
33960
|
+
function getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference) {
|
|
33817
33961
|
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
33818
|
-
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, nonRelativeModuleName, createPerModuleNameCache);
|
|
33962
|
+
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, mode === undefined ? nonRelativeModuleName : mode + "|" + nonRelativeModuleName, createPerModuleNameCache);
|
|
33819
33963
|
}
|
|
33820
33964
|
function createPerModuleNameCache() {
|
|
33821
33965
|
var directoryPathMap = new ts.Map();
|
|
@@ -33875,13 +34019,15 @@ var ts;
|
|
|
33875
34019
|
}
|
|
33876
34020
|
}
|
|
33877
34021
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
33878
|
-
function resolveModuleNameFromCache(moduleName, containingFile, cache) {
|
|
34022
|
+
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
33879
34023
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
33880
34024
|
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory);
|
|
33881
|
-
|
|
34025
|
+
if (!perFolderCache)
|
|
34026
|
+
return undefined;
|
|
34027
|
+
return perFolderCache.get(moduleName, mode);
|
|
33882
34028
|
}
|
|
33883
34029
|
ts.resolveModuleNameFromCache = resolveModuleNameFromCache;
|
|
33884
|
-
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
34030
|
+
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
33885
34031
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
33886
34032
|
if (redirectedReference) {
|
|
33887
34033
|
compilerOptions = redirectedReference.commandLine.options;
|
|
@@ -33894,7 +34040,7 @@ var ts;
|
|
|
33894
34040
|
}
|
|
33895
34041
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
33896
34042
|
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference);
|
|
33897
|
-
var result = perFolderCache && perFolderCache.get(moduleName);
|
|
34043
|
+
var result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
|
|
33898
34044
|
if (result) {
|
|
33899
34045
|
if (traceEnabled) {
|
|
33900
34046
|
trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -33903,7 +34049,20 @@ var ts;
|
|
|
33903
34049
|
else {
|
|
33904
34050
|
var moduleResolution = compilerOptions.moduleResolution;
|
|
33905
34051
|
if (moduleResolution === undefined) {
|
|
33906
|
-
|
|
34052
|
+
switch (ts.getEmitModuleKind(compilerOptions)) {
|
|
34053
|
+
case ts.ModuleKind.CommonJS:
|
|
34054
|
+
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
34055
|
+
break;
|
|
34056
|
+
case ts.ModuleKind.Node12:
|
|
34057
|
+
moduleResolution = ts.ModuleResolutionKind.Node12;
|
|
34058
|
+
break;
|
|
34059
|
+
case ts.ModuleKind.NodeNext:
|
|
34060
|
+
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
34061
|
+
break;
|
|
34062
|
+
default:
|
|
34063
|
+
moduleResolution = ts.ModuleResolutionKind.Classic;
|
|
34064
|
+
break;
|
|
34065
|
+
}
|
|
33907
34066
|
if (traceEnabled) {
|
|
33908
34067
|
trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]);
|
|
33909
34068
|
}
|
|
@@ -33915,6 +34074,12 @@ var ts;
|
|
|
33915
34074
|
}
|
|
33916
34075
|
ts.perfLogger.logStartResolveModule(moduleName);
|
|
33917
34076
|
switch (moduleResolution) {
|
|
34077
|
+
case ts.ModuleResolutionKind.Node12:
|
|
34078
|
+
result = node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
34079
|
+
break;
|
|
34080
|
+
case ts.ModuleResolutionKind.NodeNext:
|
|
34081
|
+
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
34082
|
+
break;
|
|
33918
34083
|
case ts.ModuleResolutionKind.NodeJs:
|
|
33919
34084
|
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
33920
34085
|
break;
|
|
@@ -33928,9 +34093,9 @@ var ts;
|
|
|
33928
34093
|
ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
|
|
33929
34094
|
ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
33930
34095
|
if (perFolderCache) {
|
|
33931
|
-
perFolderCache.set(moduleName, result);
|
|
34096
|
+
perFolderCache.set(moduleName, resolutionMode, result);
|
|
33932
34097
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
33933
|
-
cache.getOrCreateCacheForModuleName(moduleName, redirectedReference).set(containingDirectory, result);
|
|
34098
|
+
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
33934
34099
|
}
|
|
33935
34100
|
}
|
|
33936
34101
|
}
|
|
@@ -34064,22 +34229,51 @@ var ts;
|
|
|
34064
34229
|
return tryResolveJSModuleWorker(moduleName, initialDir, host).resolvedModule;
|
|
34065
34230
|
}
|
|
34066
34231
|
ts.tryResolveJSModule = tryResolveJSModule;
|
|
34232
|
+
var NodeResolutionFeatures;
|
|
34233
|
+
(function (NodeResolutionFeatures) {
|
|
34234
|
+
NodeResolutionFeatures[NodeResolutionFeatures["None"] = 0] = "None";
|
|
34235
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Imports"] = 2] = "Imports";
|
|
34236
|
+
NodeResolutionFeatures[NodeResolutionFeatures["SelfName"] = 4] = "SelfName";
|
|
34237
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
34238
|
+
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
34239
|
+
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
34240
|
+
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
34241
|
+
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
34242
|
+
function node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
34243
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Imports | NodeResolutionFeatures.SelfName | NodeResolutionFeatures.Exports, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
34244
|
+
}
|
|
34245
|
+
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
34246
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.AllFeatures, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
34247
|
+
}
|
|
34248
|
+
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
34249
|
+
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
34250
|
+
var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
|
|
34251
|
+
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions, redirectedReference);
|
|
34252
|
+
}
|
|
34067
34253
|
var jsOnlyExtensions = [Extensions.JavaScript];
|
|
34068
34254
|
var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
|
|
34069
34255
|
var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
|
|
34070
34256
|
var tsconfigExtensions = [Extensions.TSConfig];
|
|
34071
34257
|
function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
34072
|
-
return nodeModuleNameResolverWorker(moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, undefined, jsOnlyExtensions, undefined);
|
|
34258
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, undefined, jsOnlyExtensions, undefined);
|
|
34073
34259
|
}
|
|
34074
34260
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
34075
|
-
return nodeModuleNameResolverWorker(moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
|
|
34261
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
|
|
34076
34262
|
}
|
|
34077
34263
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
34078
|
-
function nodeModuleNameResolverWorker(moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
34264
|
+
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
34079
34265
|
var _a, _b;
|
|
34080
34266
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
34081
34267
|
var failedLookupLocations = [];
|
|
34082
|
-
var state = {
|
|
34268
|
+
var state = {
|
|
34269
|
+
compilerOptions: compilerOptions,
|
|
34270
|
+
host: host,
|
|
34271
|
+
traceEnabled: traceEnabled,
|
|
34272
|
+
failedLookupLocations: failedLookupLocations,
|
|
34273
|
+
packageJsonInfoCache: cache,
|
|
34274
|
+
features: features,
|
|
34275
|
+
conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]
|
|
34276
|
+
};
|
|
34083
34277
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
34084
34278
|
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);
|
|
34085
34279
|
function tryResolve(extensions) {
|
|
@@ -34089,10 +34283,19 @@ var ts;
|
|
|
34089
34283
|
return toSearchResult({ resolved: resolved, isExternalLibraryImport: pathContainsNodeModules(resolved.path) });
|
|
34090
34284
|
}
|
|
34091
34285
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
34092
|
-
|
|
34093
|
-
|
|
34286
|
+
var resolved_1;
|
|
34287
|
+
if (features & NodeResolutionFeatures.Imports && ts.startsWith(moduleName, "#")) {
|
|
34288
|
+
resolved_1 = loadModuleFromImports(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
34289
|
+
}
|
|
34290
|
+
if (!resolved_1 && features & NodeResolutionFeatures.SelfName) {
|
|
34291
|
+
resolved_1 = loadModuleFromSelfNameReference(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
34292
|
+
}
|
|
34293
|
+
if (!resolved_1) {
|
|
34294
|
+
if (traceEnabled) {
|
|
34295
|
+
trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]);
|
|
34296
|
+
}
|
|
34297
|
+
resolved_1 = loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
34094
34298
|
}
|
|
34095
|
-
var resolved_1 = loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
34096
34299
|
if (!resolved_1)
|
|
34097
34300
|
return undefined;
|
|
34098
34301
|
var resolvedValue = resolved_1.value;
|
|
@@ -34182,22 +34385,35 @@ var ts;
|
|
|
34182
34385
|
function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
|
|
34183
34386
|
if (extensions === Extensions.Json || extensions === Extensions.TSConfig) {
|
|
34184
34387
|
var extensionLess = ts.tryRemoveExtension(candidate, ".json");
|
|
34185
|
-
|
|
34388
|
+
var extension = extensionLess ? candidate.substring(extensionLess.length) : "";
|
|
34389
|
+
return (extensionLess === undefined && extensions === Extensions.Json) ? undefined : tryAddingExtensions(extensionLess || candidate, extensions, extension, onlyRecordFailures, state);
|
|
34186
34390
|
}
|
|
34187
|
-
|
|
34188
|
-
|
|
34189
|
-
|
|
34391
|
+
if (!(state.features & NodeResolutionFeatures.EsmMode)) {
|
|
34392
|
+
var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, "", onlyRecordFailures, state);
|
|
34393
|
+
if (resolvedByAddingExtension) {
|
|
34394
|
+
return resolvedByAddingExtension;
|
|
34395
|
+
}
|
|
34190
34396
|
}
|
|
34191
|
-
|
|
34397
|
+
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
34398
|
+
}
|
|
34399
|
+
function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
|
|
34400
|
+
if (ts.hasJSFileExtension(candidate) || (ts.fileExtensionIs(candidate, ".json") && state.compilerOptions.resolveJsonModule)) {
|
|
34192
34401
|
var extensionless = ts.removeFileExtension(candidate);
|
|
34402
|
+
var extension = candidate.substring(extensionless.length);
|
|
34193
34403
|
if (state.traceEnabled) {
|
|
34194
|
-
var extension = candidate.substring(extensionless.length);
|
|
34195
34404
|
trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
|
|
34196
34405
|
}
|
|
34197
|
-
return tryAddingExtensions(extensionless, extensions, onlyRecordFailures, state);
|
|
34406
|
+
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
34198
34407
|
}
|
|
34199
34408
|
}
|
|
34200
|
-
function
|
|
34409
|
+
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
34410
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, [".d.ts", ".d.cts", ".d.mts"])) {
|
|
34411
|
+
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
34412
|
+
return result !== undefined ? { path: candidate, ext: ts.forEach([".d.ts", ".d.cts", ".d.mts"], function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
|
|
34413
|
+
}
|
|
34414
|
+
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
34415
|
+
}
|
|
34416
|
+
function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecordFailures, state) {
|
|
34201
34417
|
if (!onlyRecordFailures) {
|
|
34202
34418
|
var directory = ts.getDirectoryPath(candidate);
|
|
34203
34419
|
if (directory) {
|
|
@@ -34206,11 +34422,51 @@ var ts;
|
|
|
34206
34422
|
}
|
|
34207
34423
|
switch (extensions) {
|
|
34208
34424
|
case Extensions.DtsOnly:
|
|
34209
|
-
|
|
34425
|
+
switch (originalExtension) {
|
|
34426
|
+
case ".mjs":
|
|
34427
|
+
case ".mts":
|
|
34428
|
+
case ".d.mts":
|
|
34429
|
+
return tryExtension(".d.mts");
|
|
34430
|
+
case ".cjs":
|
|
34431
|
+
case ".cts":
|
|
34432
|
+
case ".d.cts":
|
|
34433
|
+
return tryExtension(".d.cts");
|
|
34434
|
+
case ".json":
|
|
34435
|
+
candidate += ".json";
|
|
34436
|
+
return tryExtension(".d.ts");
|
|
34437
|
+
default: return tryExtension(".d.ts");
|
|
34438
|
+
}
|
|
34210
34439
|
case Extensions.TypeScript:
|
|
34211
|
-
|
|
34440
|
+
switch (originalExtension) {
|
|
34441
|
+
case ".mjs":
|
|
34442
|
+
case ".mts":
|
|
34443
|
+
case ".d.mts":
|
|
34444
|
+
return tryExtension(".mts") || tryExtension(".d.mts");
|
|
34445
|
+
case ".cjs":
|
|
34446
|
+
case ".cts":
|
|
34447
|
+
case ".d.cts":
|
|
34448
|
+
return tryExtension(".cts") || tryExtension(".d.cts");
|
|
34449
|
+
case ".json":
|
|
34450
|
+
candidate += ".json";
|
|
34451
|
+
return tryExtension(".d.ts");
|
|
34452
|
+
default:
|
|
34453
|
+
return tryExtension(".ts") || tryExtension(".tsx") || tryExtension(".d.ts");
|
|
34454
|
+
}
|
|
34212
34455
|
case Extensions.JavaScript:
|
|
34213
|
-
|
|
34456
|
+
switch (originalExtension) {
|
|
34457
|
+
case ".mjs":
|
|
34458
|
+
case ".mts":
|
|
34459
|
+
case ".d.mts":
|
|
34460
|
+
return tryExtension(".mjs");
|
|
34461
|
+
case ".cjs":
|
|
34462
|
+
case ".cts":
|
|
34463
|
+
case ".d.cts":
|
|
34464
|
+
return tryExtension(".cjs");
|
|
34465
|
+
case ".json":
|
|
34466
|
+
return tryExtension(".json");
|
|
34467
|
+
default:
|
|
34468
|
+
return tryExtension(".js") || tryExtension(".jsx");
|
|
34469
|
+
}
|
|
34214
34470
|
case Extensions.TSConfig:
|
|
34215
34471
|
case Extensions.Json:
|
|
34216
34472
|
return tryExtension(".json");
|
|
@@ -34244,6 +34500,28 @@ var ts;
|
|
|
34244
34500
|
var versionPaths = packageInfo && packageInfo.versionPaths;
|
|
34245
34501
|
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
|
|
34246
34502
|
}
|
|
34503
|
+
function getPackageScopeForPath(fileName, packageJsonInfoCache, host, options) {
|
|
34504
|
+
var state = {
|
|
34505
|
+
host: host,
|
|
34506
|
+
compilerOptions: options,
|
|
34507
|
+
traceEnabled: isTraceEnabled(options, host),
|
|
34508
|
+
failedLookupLocations: [],
|
|
34509
|
+
packageJsonInfoCache: packageJsonInfoCache,
|
|
34510
|
+
features: 0,
|
|
34511
|
+
conditions: [],
|
|
34512
|
+
};
|
|
34513
|
+
var parts = ts.getPathComponents(fileName);
|
|
34514
|
+
parts.pop();
|
|
34515
|
+
while (parts.length > 0) {
|
|
34516
|
+
var pkg = getPackageJsonInfo(ts.getPathFromPathComponents(parts), false, state);
|
|
34517
|
+
if (pkg) {
|
|
34518
|
+
return pkg;
|
|
34519
|
+
}
|
|
34520
|
+
parts.pop();
|
|
34521
|
+
}
|
|
34522
|
+
return undefined;
|
|
34523
|
+
}
|
|
34524
|
+
ts.getPackageScopeForPath = getPackageScopeForPath;
|
|
34247
34525
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
34248
34526
|
var _a, _b, _c;
|
|
34249
34527
|
var host = state.host, traceEnabled = state.traceEnabled;
|
|
@@ -34285,6 +34563,7 @@ var ts;
|
|
|
34285
34563
|
state.failedLookupLocations.push(packageJsonPath);
|
|
34286
34564
|
}
|
|
34287
34565
|
}
|
|
34566
|
+
ts.getPackageJsonInfo = getPackageJsonInfo;
|
|
34288
34567
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
34289
34568
|
var packageFile;
|
|
34290
34569
|
if (jsonContent) {
|
|
@@ -34336,7 +34615,9 @@ var ts;
|
|
|
34336
34615
|
var packageFileResult = packageFile && removeIgnoredPackageId(loader(extensions, packageFile, onlyRecordFailuresForPackageFile, state));
|
|
34337
34616
|
if (packageFileResult)
|
|
34338
34617
|
return packageFileResult;
|
|
34339
|
-
|
|
34618
|
+
if (!(state.features & NodeResolutionFeatures.EsmMode)) {
|
|
34619
|
+
return loadModuleFromFile(extensions, indexPath, onlyRecordFailuresForIndex, state);
|
|
34620
|
+
}
|
|
34340
34621
|
}
|
|
34341
34622
|
function resolvedIfExtensionMatches(extensions, path) {
|
|
34342
34623
|
var ext = ts.tryGetExtensionFromPath(path);
|
|
@@ -34363,6 +34644,221 @@ var ts;
|
|
|
34363
34644
|
return idx === -1 ? { packageName: moduleName, rest: "" } : { packageName: moduleName.slice(0, idx), rest: moduleName.slice(idx + 1) };
|
|
34364
34645
|
}
|
|
34365
34646
|
ts.parsePackageName = parsePackageName;
|
|
34647
|
+
function allKeysStartWithDot(obj) {
|
|
34648
|
+
return ts.every(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
|
|
34649
|
+
}
|
|
34650
|
+
function noKeyStartsWithDot(obj) {
|
|
34651
|
+
return !ts.some(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
|
|
34652
|
+
}
|
|
34653
|
+
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
34654
|
+
var _a, _b;
|
|
34655
|
+
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
34656
|
+
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
34657
|
+
var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
|
|
34658
|
+
if (!scope || !scope.packageJsonContent.exports) {
|
|
34659
|
+
return undefined;
|
|
34660
|
+
}
|
|
34661
|
+
var parts = ts.getPathComponents(moduleName);
|
|
34662
|
+
if (scope.packageJsonContent.name !== parts[1]) {
|
|
34663
|
+
return undefined;
|
|
34664
|
+
}
|
|
34665
|
+
var trailingParts = parts.slice(2);
|
|
34666
|
+
return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : "." + ts.directorySeparator + trailingParts.join(ts.directorySeparator), state, cache, redirectedReference);
|
|
34667
|
+
}
|
|
34668
|
+
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
34669
|
+
if (!scope.packageJsonContent.exports) {
|
|
34670
|
+
return undefined;
|
|
34671
|
+
}
|
|
34672
|
+
if (subpath === ".") {
|
|
34673
|
+
var mainExport = void 0;
|
|
34674
|
+
if (typeof scope.packageJsonContent.exports === "string" || Array.isArray(scope.packageJsonContent.exports) || (typeof scope.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.packageJsonContent.exports))) {
|
|
34675
|
+
mainExport = scope.packageJsonContent.exports;
|
|
34676
|
+
}
|
|
34677
|
+
else if (ts.hasProperty(scope.packageJsonContent.exports, ".")) {
|
|
34678
|
+
mainExport = scope.packageJsonContent.exports["."];
|
|
34679
|
+
}
|
|
34680
|
+
if (mainExport) {
|
|
34681
|
+
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, false);
|
|
34682
|
+
return loadModuleFromTargetImportOrExport(mainExport, "", false);
|
|
34683
|
+
}
|
|
34684
|
+
}
|
|
34685
|
+
else if (allKeysStartWithDot(scope.packageJsonContent.exports)) {
|
|
34686
|
+
if (typeof scope.packageJsonContent.exports !== "object") {
|
|
34687
|
+
if (state.traceEnabled) {
|
|
34688
|
+
trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory);
|
|
34689
|
+
}
|
|
34690
|
+
return toSearchResult(undefined);
|
|
34691
|
+
}
|
|
34692
|
+
var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.packageJsonContent.exports, scope, false);
|
|
34693
|
+
if (result) {
|
|
34694
|
+
return result;
|
|
34695
|
+
}
|
|
34696
|
+
}
|
|
34697
|
+
if (state.traceEnabled) {
|
|
34698
|
+
trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory);
|
|
34699
|
+
}
|
|
34700
|
+
return toSearchResult(undefined);
|
|
34701
|
+
}
|
|
34702
|
+
function loadModuleFromImports(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
34703
|
+
var _a, _b;
|
|
34704
|
+
if (moduleName === "#" || ts.startsWith(moduleName, "#/")) {
|
|
34705
|
+
if (state.traceEnabled) {
|
|
34706
|
+
trace(state.host, ts.Diagnostics.Invalid_import_specifier_0_has_no_possible_resolutions, moduleName);
|
|
34707
|
+
}
|
|
34708
|
+
return toSearchResult(undefined);
|
|
34709
|
+
}
|
|
34710
|
+
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
34711
|
+
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
34712
|
+
var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
|
|
34713
|
+
if (!scope) {
|
|
34714
|
+
if (state.traceEnabled) {
|
|
34715
|
+
trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
|
|
34716
|
+
}
|
|
34717
|
+
return toSearchResult(undefined);
|
|
34718
|
+
}
|
|
34719
|
+
if (!scope.packageJsonContent.imports) {
|
|
34720
|
+
if (state.traceEnabled) {
|
|
34721
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory);
|
|
34722
|
+
}
|
|
34723
|
+
return toSearchResult(undefined);
|
|
34724
|
+
}
|
|
34725
|
+
var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.packageJsonContent.imports, scope, true);
|
|
34726
|
+
if (result) {
|
|
34727
|
+
return result;
|
|
34728
|
+
}
|
|
34729
|
+
if (state.traceEnabled) {
|
|
34730
|
+
trace(state.host, ts.Diagnostics.Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1, moduleName, scope.packageDirectory);
|
|
34731
|
+
}
|
|
34732
|
+
return toSearchResult(undefined);
|
|
34733
|
+
}
|
|
34734
|
+
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
34735
|
+
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
34736
|
+
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
34737
|
+
var target = lookupTable[moduleName];
|
|
34738
|
+
return loadModuleFromTargetImportOrExport(target, "", false);
|
|
34739
|
+
}
|
|
34740
|
+
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), function (a, b) { return a.length - b.length; });
|
|
34741
|
+
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
34742
|
+
var potentialTarget = expandingKeys_1[_i];
|
|
34743
|
+
if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
34744
|
+
var target = lookupTable[potentialTarget];
|
|
34745
|
+
var starPos = potentialTarget.indexOf("*");
|
|
34746
|
+
var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos));
|
|
34747
|
+
return loadModuleFromTargetImportOrExport(target, subpath, true);
|
|
34748
|
+
}
|
|
34749
|
+
else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) {
|
|
34750
|
+
var target = lookupTable[potentialTarget];
|
|
34751
|
+
var subpath = moduleName.substring(potentialTarget.length - 1);
|
|
34752
|
+
return loadModuleFromTargetImportOrExport(target, subpath, true);
|
|
34753
|
+
}
|
|
34754
|
+
else if (ts.startsWith(moduleName, potentialTarget)) {
|
|
34755
|
+
var target = lookupTable[potentialTarget];
|
|
34756
|
+
var subpath = moduleName.substring(potentialTarget.length);
|
|
34757
|
+
return loadModuleFromTargetImportOrExport(target, subpath, false);
|
|
34758
|
+
}
|
|
34759
|
+
}
|
|
34760
|
+
function matchesPatternWithTrailer(target, name) {
|
|
34761
|
+
if (ts.endsWith(target, "*"))
|
|
34762
|
+
return false;
|
|
34763
|
+
var starPos = target.indexOf("*");
|
|
34764
|
+
if (starPos === -1)
|
|
34765
|
+
return false;
|
|
34766
|
+
return ts.startsWith(name, target.substring(0, starPos)) && ts.endsWith(name, target.substring(starPos + 1));
|
|
34767
|
+
}
|
|
34768
|
+
}
|
|
34769
|
+
function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
|
34770
|
+
return loadModuleFromTargetImportOrExport;
|
|
34771
|
+
function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
|
|
34772
|
+
var _a, _b;
|
|
34773
|
+
if (typeof target === "string") {
|
|
34774
|
+
if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
|
|
34775
|
+
if (state.traceEnabled) {
|
|
34776
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
34777
|
+
}
|
|
34778
|
+
return toSearchResult(undefined);
|
|
34779
|
+
}
|
|
34780
|
+
if (!ts.startsWith(target, "./")) {
|
|
34781
|
+
if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) {
|
|
34782
|
+
var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath;
|
|
34783
|
+
var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference);
|
|
34784
|
+
return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined);
|
|
34785
|
+
}
|
|
34786
|
+
if (state.traceEnabled) {
|
|
34787
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
34788
|
+
}
|
|
34789
|
+
return toSearchResult(undefined);
|
|
34790
|
+
}
|
|
34791
|
+
var parts = ts.pathIsRelative(target) ? ts.getPathComponents(target).slice(1) : ts.getPathComponents(target);
|
|
34792
|
+
var partsAfterFirst = parts.slice(1);
|
|
34793
|
+
if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) {
|
|
34794
|
+
if (state.traceEnabled) {
|
|
34795
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
34796
|
+
}
|
|
34797
|
+
return toSearchResult(undefined);
|
|
34798
|
+
}
|
|
34799
|
+
var resolvedTarget = ts.combinePaths(scope.packageDirectory, target);
|
|
34800
|
+
var subpathParts = ts.getPathComponents(subpath);
|
|
34801
|
+
if (subpathParts.indexOf("..") >= 0 || subpathParts.indexOf(".") >= 0 || subpathParts.indexOf("node_modules") >= 0) {
|
|
34802
|
+
if (state.traceEnabled) {
|
|
34803
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
34804
|
+
}
|
|
34805
|
+
return toSearchResult(undefined);
|
|
34806
|
+
}
|
|
34807
|
+
var finalPath = ts.getNormalizedAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
34808
|
+
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, finalPath, false, state)));
|
|
34809
|
+
}
|
|
34810
|
+
else if (typeof target === "object" && target !== null) {
|
|
34811
|
+
if (!Array.isArray(target)) {
|
|
34812
|
+
for (var _i = 0, _c = ts.getOwnKeys(target); _i < _c.length; _i++) {
|
|
34813
|
+
var key = _c[_i];
|
|
34814
|
+
if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
|
|
34815
|
+
var subTarget = target[key];
|
|
34816
|
+
var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
|
|
34817
|
+
if (result) {
|
|
34818
|
+
return result;
|
|
34819
|
+
}
|
|
34820
|
+
}
|
|
34821
|
+
}
|
|
34822
|
+
return undefined;
|
|
34823
|
+
}
|
|
34824
|
+
else {
|
|
34825
|
+
if (!ts.length(target)) {
|
|
34826
|
+
if (state.traceEnabled) {
|
|
34827
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
34828
|
+
}
|
|
34829
|
+
return toSearchResult(undefined);
|
|
34830
|
+
}
|
|
34831
|
+
for (var _d = 0, target_1 = target; _d < target_1.length; _d++) {
|
|
34832
|
+
var elem = target_1[_d];
|
|
34833
|
+
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
34834
|
+
if (result) {
|
|
34835
|
+
return result;
|
|
34836
|
+
}
|
|
34837
|
+
}
|
|
34838
|
+
}
|
|
34839
|
+
}
|
|
34840
|
+
else if (target === null) {
|
|
34841
|
+
if (state.traceEnabled) {
|
|
34842
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_explicitly_maps_specifier_1_to_null, scope.packageDirectory, moduleName);
|
|
34843
|
+
}
|
|
34844
|
+
return toSearchResult(undefined);
|
|
34845
|
+
}
|
|
34846
|
+
if (state.traceEnabled) {
|
|
34847
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
34848
|
+
}
|
|
34849
|
+
return toSearchResult(undefined);
|
|
34850
|
+
}
|
|
34851
|
+
function isApplicableVersionedTypesKey(conditions, key) {
|
|
34852
|
+
if (conditions.indexOf("types") === -1)
|
|
34853
|
+
return false;
|
|
34854
|
+
if (!ts.startsWith(key, "types@"))
|
|
34855
|
+
return false;
|
|
34856
|
+
var range = ts.VersionRange.tryParse(key.substring("types@".length));
|
|
34857
|
+
if (!range)
|
|
34858
|
+
return false;
|
|
34859
|
+
return range.test(ts.version);
|
|
34860
|
+
}
|
|
34861
|
+
}
|
|
34366
34862
|
function loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
34367
34863
|
return loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, false, cache, redirectedReference);
|
|
34368
34864
|
}
|
|
@@ -34370,24 +34866,24 @@ var ts;
|
|
|
34370
34866
|
return loadModuleFromNearestNodeModulesDirectoryWorker(Extensions.DtsOnly, moduleName, directory, state, true, undefined, undefined);
|
|
34371
34867
|
}
|
|
34372
34868
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
34373
|
-
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, redirectedReference);
|
|
34869
|
+
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, state.features === 0 ? undefined : state.features & NodeResolutionFeatures.EsmMode ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS, redirectedReference);
|
|
34374
34870
|
return ts.forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {
|
|
34375
34871
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
34376
34872
|
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state);
|
|
34377
34873
|
if (resolutionFromCache) {
|
|
34378
34874
|
return resolutionFromCache;
|
|
34379
34875
|
}
|
|
34380
|
-
return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, ancestorDirectory, state, typesScopeOnly));
|
|
34876
|
+
return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, ancestorDirectory, state, typesScopeOnly, cache, redirectedReference));
|
|
34381
34877
|
}
|
|
34382
34878
|
});
|
|
34383
34879
|
}
|
|
34384
|
-
function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly) {
|
|
34880
|
+
function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
34385
34881
|
var nodeModulesFolder = ts.combinePaths(directory, "node_modules");
|
|
34386
34882
|
var nodeModulesFolderExists = ts.directoryProbablyExists(nodeModulesFolder, state.host);
|
|
34387
34883
|
if (!nodeModulesFolderExists && state.traceEnabled) {
|
|
34388
34884
|
trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder);
|
|
34389
34885
|
}
|
|
34390
|
-
var packageResult = typesScopeOnly ? undefined : loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state);
|
|
34886
|
+
var packageResult = typesScopeOnly ? undefined : loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state, cache, redirectedReference);
|
|
34391
34887
|
if (packageResult) {
|
|
34392
34888
|
return packageResult;
|
|
34393
34889
|
}
|
|
@@ -34400,26 +34896,32 @@ var ts;
|
|
|
34400
34896
|
}
|
|
34401
34897
|
nodeModulesAtTypesExists = false;
|
|
34402
34898
|
}
|
|
34403
|
-
return loadModuleFromSpecificNodeModulesDirectory(Extensions.DtsOnly, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, state);
|
|
34899
|
+
return loadModuleFromSpecificNodeModulesDirectory(Extensions.DtsOnly, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, state, cache, redirectedReference);
|
|
34404
34900
|
}
|
|
34405
34901
|
}
|
|
34406
|
-
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state) {
|
|
34902
|
+
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
34407
34903
|
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
|
|
34408
34904
|
var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
34409
|
-
if (
|
|
34410
|
-
|
|
34411
|
-
|
|
34412
|
-
|
|
34905
|
+
if (!(state.features & NodeResolutionFeatures.Exports)) {
|
|
34906
|
+
if (packageInfo) {
|
|
34907
|
+
var fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
34908
|
+
if (fromFile) {
|
|
34909
|
+
return noPackageId(fromFile);
|
|
34910
|
+
}
|
|
34911
|
+
var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
|
|
34912
|
+
return withPackageId(packageInfo, fromDirectory);
|
|
34413
34913
|
}
|
|
34414
|
-
var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
|
|
34415
|
-
return withPackageId(packageInfo, fromDirectory);
|
|
34416
34914
|
}
|
|
34915
|
+
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
|
|
34417
34916
|
var loader = function (extensions, candidate, onlyRecordFailures, state) {
|
|
34917
|
+
var _a;
|
|
34918
|
+
if (packageInfo && packageInfo.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
|
|
34919
|
+
return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
|
|
34920
|
+
}
|
|
34418
34921
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
34419
34922
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
34420
34923
|
return withPackageId(packageInfo, pathAndExtension);
|
|
34421
34924
|
};
|
|
34422
|
-
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
|
|
34423
34925
|
if (rest !== "") {
|
|
34424
34926
|
var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
|
|
34425
34927
|
packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
@@ -34512,7 +35014,7 @@ var ts;
|
|
|
34512
35014
|
function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
34513
35015
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
34514
35016
|
var failedLookupLocations = [];
|
|
34515
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache };
|
|
35017
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [] };
|
|
34516
35018
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
34517
35019
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
34518
35020
|
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, state.resultFromCache);
|
|
@@ -34522,7 +35024,7 @@ var ts;
|
|
|
34522
35024
|
return { value: resolvedUsingSettings };
|
|
34523
35025
|
}
|
|
34524
35026
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
34525
|
-
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, redirectedReference);
|
|
35027
|
+
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, undefined, redirectedReference);
|
|
34526
35028
|
var resolved_3 = ts.forEachAncestorDirectory(containingDirectory, function (directory) {
|
|
34527
35029
|
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache_1, moduleName, directory, state);
|
|
34528
35030
|
if (resolutionFromCache) {
|
|
@@ -34551,8 +35053,8 @@ var ts;
|
|
|
34551
35053
|
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);
|
|
34552
35054
|
}
|
|
34553
35055
|
var failedLookupLocations = [];
|
|
34554
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache };
|
|
34555
|
-
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, false);
|
|
35056
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache, features: NodeResolutionFeatures.None, conditions: [] };
|
|
35057
|
+
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, false, undefined, undefined);
|
|
34556
35058
|
return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, state.resultFromCache);
|
|
34557
35059
|
}
|
|
34558
35060
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
@@ -36405,7 +36907,7 @@ var ts;
|
|
|
36405
36907
|
}
|
|
36406
36908
|
}
|
|
36407
36909
|
function checkStrictModeLabeledStatement(node) {
|
|
36408
|
-
if (inStrictMode && options
|
|
36910
|
+
if (inStrictMode && ts.getEmitScriptTarget(options) >= 2) {
|
|
36409
36911
|
if (ts.isDeclarationStatement(node.statement) || ts.isVariableStatement(node.statement)) {
|
|
36410
36912
|
errorOnFirstToken(node.label, ts.Diagnostics.A_label_is_not_allowed_here);
|
|
36411
36913
|
}
|
|
@@ -37563,7 +38065,7 @@ var ts;
|
|
|
37563
38065
|
host.getSourceFiles().forEach(function (sf) {
|
|
37564
38066
|
if (!sf.resolvedModules)
|
|
37565
38067
|
return;
|
|
37566
|
-
|
|
38068
|
+
sf.resolvedModules.forEach(function (r) {
|
|
37567
38069
|
if (r && r.packageId)
|
|
37568
38070
|
map.set(r.packageId.name, r.extension === ".d.ts" || !!map.get(r.packageId.name));
|
|
37569
38071
|
});
|
|
@@ -37935,6 +38437,7 @@ var ts;
|
|
|
37935
38437
|
getLocalTypeParametersOfClassOrInterfaceOrTypeAlias: getLocalTypeParametersOfClassOrInterfaceOrTypeAlias,
|
|
37936
38438
|
isDeclarationVisible: isDeclarationVisible,
|
|
37937
38439
|
isPropertyAccessible: isPropertyAccessible,
|
|
38440
|
+
getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration,
|
|
37938
38441
|
};
|
|
37939
38442
|
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
|
|
37940
38443
|
var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
|
|
@@ -38626,7 +39129,7 @@ var ts;
|
|
|
38626
39129
|
return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage, false);
|
|
38627
39130
|
}
|
|
38628
39131
|
else if (ts.isParameterPropertyDeclaration(declaration, declaration.parent)) {
|
|
38629
|
-
return !(compilerOptions
|
|
39132
|
+
return !(ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields
|
|
38630
39133
|
&& ts.getContainingClass(declaration) === ts.getContainingClass(usage)
|
|
38631
39134
|
&& isUsedInFunctionOrInstanceProperty(usage, declaration));
|
|
38632
39135
|
}
|
|
@@ -38642,7 +39145,7 @@ var ts;
|
|
|
38642
39145
|
return true;
|
|
38643
39146
|
}
|
|
38644
39147
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
38645
|
-
if (compilerOptions
|
|
39148
|
+
if (ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields
|
|
38646
39149
|
&& ts.getContainingClass(declaration)
|
|
38647
39150
|
&& (ts.isPropertyDeclaration(declaration) || ts.isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
38648
39151
|
return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage, true);
|
|
@@ -38797,7 +39300,7 @@ var ts;
|
|
|
38797
39300
|
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSymbol, issueSuggestions);
|
|
38798
39301
|
}
|
|
38799
39302
|
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup, issueSuggestions) {
|
|
38800
|
-
var _a;
|
|
39303
|
+
var _a, _b, _c;
|
|
38801
39304
|
var originalLocation = location;
|
|
38802
39305
|
var result;
|
|
38803
39306
|
var lastLocation;
|
|
@@ -38850,7 +39353,7 @@ var ts;
|
|
|
38850
39353
|
break;
|
|
38851
39354
|
isInExternalModule = true;
|
|
38852
39355
|
case 260:
|
|
38853
|
-
var moduleExports = getSymbolOfNode(location).exports || emptySymbols;
|
|
39356
|
+
var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols;
|
|
38854
39357
|
if (location.kind === 303 || (ts.isModuleDeclaration(location) && location.flags & 8388608 && !ts.isGlobalScopeAugmentation(location))) {
|
|
38855
39358
|
if (result = moduleExports.get("default")) {
|
|
38856
39359
|
var localSymbol = ts.getLocalSymbolForExportDefault(result);
|
|
@@ -38867,7 +39370,7 @@ var ts;
|
|
|
38867
39370
|
}
|
|
38868
39371
|
}
|
|
38869
39372
|
if (name !== "default" && (result = lookup(moduleExports, name, meaning & 2623475))) {
|
|
38870
|
-
if (ts.isSourceFile(location) && location.commonJsModuleIndicator && !((
|
|
39373
|
+
if (ts.isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) === null || _b === void 0 ? void 0 : _b.some(ts.isJSDocTypeAlias))) {
|
|
38871
39374
|
result = undefined;
|
|
38872
39375
|
}
|
|
38873
39376
|
else {
|
|
@@ -38876,7 +39379,7 @@ var ts;
|
|
|
38876
39379
|
}
|
|
38877
39380
|
break;
|
|
38878
39381
|
case 259:
|
|
38879
|
-
if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8)) {
|
|
39382
|
+
if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8)) {
|
|
38880
39383
|
break loop;
|
|
38881
39384
|
}
|
|
38882
39385
|
break;
|
|
@@ -38933,7 +39436,7 @@ var ts;
|
|
|
38933
39436
|
}
|
|
38934
39437
|
break;
|
|
38935
39438
|
case 213:
|
|
38936
|
-
if (compilerOptions
|
|
39439
|
+
if (ts.getEmitScriptTarget(compilerOptions) >= 2) {
|
|
38937
39440
|
break;
|
|
38938
39441
|
}
|
|
38939
39442
|
case 168:
|
|
@@ -39075,7 +39578,7 @@ var ts;
|
|
|
39075
39578
|
return undefined;
|
|
39076
39579
|
}
|
|
39077
39580
|
if (nameNotFoundMessage) {
|
|
39078
|
-
if (propertyWithInvalidInitializer && !(compilerOptions
|
|
39581
|
+
if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields)) {
|
|
39079
39582
|
var propertyName = propertyWithInvalidInitializer.name;
|
|
39080
39583
|
error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), diagnosticName(nameArg));
|
|
39081
39584
|
return undefined;
|
|
@@ -39114,8 +39617,7 @@ var ts;
|
|
|
39114
39617
|
if (!ts.isValidTypeOnlyAliasUseSite(useSite)) {
|
|
39115
39618
|
var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(symbol);
|
|
39116
39619
|
if (typeOnlyDeclaration) {
|
|
39117
|
-
var
|
|
39118
|
-
var message = isExport
|
|
39620
|
+
var message = typeOnlyDeclaration.kind === 274
|
|
39119
39621
|
? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type
|
|
39120
39622
|
: ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type;
|
|
39121
39623
|
var unescapedName = ts.unescapeLeadingUnderscores(name);
|
|
@@ -39126,7 +39628,7 @@ var ts;
|
|
|
39126
39628
|
function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) {
|
|
39127
39629
|
if (!typeOnlyDeclaration)
|
|
39128
39630
|
return diagnostic;
|
|
39129
|
-
return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration,
|
|
39631
|
+
return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 274 ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName));
|
|
39130
39632
|
}
|
|
39131
39633
|
function getIsDeferredContext(location, lastLocation) {
|
|
39132
39634
|
if (location.kind !== 213 && location.kind !== 212) {
|
|
@@ -39419,7 +39921,7 @@ var ts;
|
|
|
39419
39921
|
function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) {
|
|
39420
39922
|
if (markSymbolOfAliasDeclarationIfTypeOnly(node, undefined, resolved, false) && !node.isTypeOnly) {
|
|
39421
39923
|
var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node));
|
|
39422
|
-
var isExport =
|
|
39924
|
+
var isExport = typeOnlyDeclaration.kind === 274;
|
|
39423
39925
|
var message = isExport
|
|
39424
39926
|
? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type
|
|
39425
39927
|
: ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type;
|
|
@@ -39572,7 +40074,7 @@ var ts;
|
|
|
39572
40074
|
if (!ts.isIdentifier(name)) {
|
|
39573
40075
|
return undefined;
|
|
39574
40076
|
}
|
|
39575
|
-
var suppressInteropError = name.escapedText === "default" && !!(compilerOptions.allowSyntheticDefaultImports || compilerOptions
|
|
40077
|
+
var suppressInteropError = name.escapedText === "default" && !!(compilerOptions.allowSyntheticDefaultImports || ts.getESModuleInterop(compilerOptions));
|
|
39576
40078
|
var targetSymbol = resolveESModuleSymbol(moduleSymbol, moduleSpecifier, false, suppressInteropError);
|
|
39577
40079
|
if (targetSymbol) {
|
|
39578
40080
|
if (name.escapedText) {
|
|
@@ -39648,18 +40150,18 @@ var ts;
|
|
|
39648
40150
|
}
|
|
39649
40151
|
function reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) {
|
|
39650
40152
|
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
39651
|
-
var message = compilerOptions
|
|
40153
|
+
var message = ts.getESModuleInterop(compilerOptions) ? ts.Diagnostics._0_can_only_be_imported_by_using_a_default_import :
|
|
39652
40154
|
ts.Diagnostics._0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
39653
40155
|
error(name, message, declarationName);
|
|
39654
40156
|
}
|
|
39655
40157
|
else {
|
|
39656
40158
|
if (ts.isInJSFile(node)) {
|
|
39657
|
-
var message = compilerOptions
|
|
40159
|
+
var message = ts.getESModuleInterop(compilerOptions) ? ts.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import :
|
|
39658
40160
|
ts.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
39659
40161
|
error(name, message, declarationName);
|
|
39660
40162
|
}
|
|
39661
40163
|
else {
|
|
39662
|
-
var message = compilerOptions
|
|
40164
|
+
var message = ts.getESModuleInterop(compilerOptions) ? ts.Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import :
|
|
39663
40165
|
ts.Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
39664
40166
|
error(name, message, declarationName, declarationName, moduleName);
|
|
39665
40167
|
}
|
|
@@ -40037,6 +40539,7 @@ var ts;
|
|
|
40037
40539
|
: undefined;
|
|
40038
40540
|
}
|
|
40039
40541
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
|
|
40542
|
+
var _a, _b, _c, _d, _e, _f;
|
|
40040
40543
|
if (isForAugmentation === void 0) { isForAugmentation = false; }
|
|
40041
40544
|
if (ts.startsWith(moduleReference, "@types/")) {
|
|
40042
40545
|
var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
@@ -40048,7 +40551,15 @@ var ts;
|
|
|
40048
40551
|
return ambientModule;
|
|
40049
40552
|
}
|
|
40050
40553
|
var currentSourceFile = ts.getSourceFileOfNode(location);
|
|
40051
|
-
var
|
|
40554
|
+
var contextSpecifier = ts.isStringLiteralLike(location)
|
|
40555
|
+
? location
|
|
40556
|
+
: ((_a = ts.findAncestor(location, ts.isImportCall)) === null || _a === void 0 ? void 0 : _a.arguments[0]) ||
|
|
40557
|
+
((_b = ts.findAncestor(location, ts.isImportDeclaration)) === null || _b === void 0 ? void 0 : _b.moduleSpecifier) ||
|
|
40558
|
+
((_c = ts.findAncestor(location, ts.isExternalModuleImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.moduleReference.expression) ||
|
|
40559
|
+
((_d = ts.findAncestor(location, ts.isExportDeclaration)) === null || _d === void 0 ? void 0 : _d.moduleSpecifier) ||
|
|
40560
|
+
((_e = (ts.isModuleDeclaration(location) ? location : location.parent && ts.isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : undefined)) === null || _e === void 0 ? void 0 : _e.name) ||
|
|
40561
|
+
((_f = (ts.isLiteralImportTypeNode(location) ? location : undefined)) === null || _f === void 0 ? void 0 : _f.argument.literal);
|
|
40562
|
+
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : undefined);
|
|
40052
40563
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
40053
40564
|
var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
40054
40565
|
if (sourceFile) {
|
|
@@ -40056,6 +40567,12 @@ var ts;
|
|
|
40056
40567
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
40057
40568
|
errorOnImplicitAnyModule(false, errorNode, resolvedModule, moduleReference);
|
|
40058
40569
|
}
|
|
40570
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
40571
|
+
var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
|
|
40572
|
+
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
40573
|
+
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);
|
|
40574
|
+
}
|
|
40575
|
+
}
|
|
40059
40576
|
return getMergedSymbol(sourceFile.symbol);
|
|
40060
40577
|
}
|
|
40061
40578
|
if (moduleNotFoundError) {
|
|
@@ -40100,15 +40617,14 @@ var ts;
|
|
|
40100
40617
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
40101
40618
|
var importSourceWithoutExtension = ts.removeExtension(moduleReference, tsExtension);
|
|
40102
40619
|
var replacedImportSource = importSourceWithoutExtension;
|
|
40103
|
-
|
|
40104
|
-
|
|
40105
|
-
replacedImportSource += ".js";
|
|
40620
|
+
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
40621
|
+
replacedImportSource += tsExtension === ".mts" ? ".mjs" : tsExtension === ".cts" ? ".cjs" : ".js";
|
|
40106
40622
|
}
|
|
40107
40623
|
error(errorNode, diag, tsExtension, replacedImportSource);
|
|
40108
40624
|
}
|
|
40109
40625
|
else if (!compilerOptions.resolveJsonModule &&
|
|
40110
40626
|
ts.fileExtensionIs(moduleReference, ".json") &&
|
|
40111
|
-
ts.getEmitModuleResolutionKind(compilerOptions)
|
|
40627
|
+
ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic &&
|
|
40112
40628
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
40113
40629
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
40114
40630
|
}
|
|
@@ -40175,7 +40691,7 @@ var ts;
|
|
|
40175
40691
|
error(referencingLocation, ts.Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName);
|
|
40176
40692
|
return symbol;
|
|
40177
40693
|
}
|
|
40178
|
-
if (compilerOptions
|
|
40694
|
+
if (ts.getESModuleInterop(compilerOptions)) {
|
|
40179
40695
|
var referenceParent = referencingLocation.parent;
|
|
40180
40696
|
if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) ||
|
|
40181
40697
|
ts.isImportCall(referenceParent)) {
|
|
@@ -41024,6 +41540,7 @@ var ts;
|
|
|
41024
41540
|
isSourceOfProjectReferenceRedirect: function (fileName) { return host.isSourceOfProjectReferenceRedirect(fileName); },
|
|
41025
41541
|
fileExists: function (fileName) { return host.fileExists(fileName); },
|
|
41026
41542
|
getFileIncludeReasons: function () { return host.getFileIncludeReasons(); },
|
|
41543
|
+
readFile: host.readFile ? (function (fileName) { return host.readFile(fileName); }) : undefined,
|
|
41027
41544
|
} : undefined },
|
|
41028
41545
|
encounteredError: false,
|
|
41029
41546
|
reportedDiagnostic: false,
|
|
@@ -42121,7 +42638,7 @@ var ts;
|
|
|
42121
42638
|
var nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined;
|
|
42122
42639
|
var typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain, 0, context);
|
|
42123
42640
|
var specifier = getSpecifierForModuleSymbol(chain[0], context);
|
|
42124
|
-
if (!(context.flags & 67108864) && ts.getEmitModuleResolutionKind(compilerOptions)
|
|
42641
|
+
if (!(context.flags & 67108864) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
|
|
42125
42642
|
context.encounteredError = true;
|
|
42126
42643
|
if (context.tracker.reportLikelyUnsafeImportRequiredError) {
|
|
42127
42644
|
context.tracker.reportLikelyUnsafeImportRequiredError(specifier);
|
|
@@ -42338,7 +42855,7 @@ var ts;
|
|
|
42338
42855
|
if (nameType) {
|
|
42339
42856
|
if (nameType.flags & 384) {
|
|
42340
42857
|
var name = "" + nameType.value;
|
|
42341
|
-
if (!ts.isIdentifierText(name, compilerOptions
|
|
42858
|
+
if (!ts.isIdentifierText(name, ts.getEmitScriptTarget(compilerOptions)) && !isNumericLiteralName(name)) {
|
|
42342
42859
|
return ts.factory.createStringLiteral(name, !!singleQuote);
|
|
42343
42860
|
}
|
|
42344
42861
|
if (isNumericLiteralName(name) && ts.startsWith(name, "-")) {
|
|
@@ -42352,7 +42869,7 @@ var ts;
|
|
|
42352
42869
|
}
|
|
42353
42870
|
}
|
|
42354
42871
|
function createPropertyNameNodeForIdentifierOrLiteral(name, stringNamed, singleQuote) {
|
|
42355
|
-
return ts.isIdentifierText(name, compilerOptions
|
|
42872
|
+
return ts.isIdentifierText(name, ts.getEmitScriptTarget(compilerOptions)) ? ts.factory.createIdentifier(name) :
|
|
42356
42873
|
!stringNamed && isNumericLiteralName(name) && +name >= 0 ? ts.factory.createNumericLiteral(+name) :
|
|
42357
42874
|
ts.factory.createStringLiteral(name, !!singleQuote);
|
|
42358
42875
|
}
|
|
@@ -42606,7 +43123,7 @@ var ts;
|
|
|
42606
43123
|
var name_2 = ns.name;
|
|
42607
43124
|
var body = ns.body;
|
|
42608
43125
|
if (ts.length(excessExports)) {
|
|
42609
|
-
ns = ts.factory.updateModuleDeclaration(ns, ns.decorators, ns.modifiers, ns.name, body = ts.factory.updateModuleBlock(body, ts.factory.createNodeArray(__spreadArray(__spreadArray([], ns.body.statements, true), [ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports(ts.map(ts.flatMap(excessExports, function (e) { return getNamesOfDeclaration(e); }), function (id) { return ts.factory.createExportSpecifier(undefined, id); })), undefined)], false))));
|
|
43126
|
+
ns = ts.factory.updateModuleDeclaration(ns, ns.decorators, ns.modifiers, ns.name, body = ts.factory.updateModuleBlock(body, ts.factory.createNodeArray(__spreadArray(__spreadArray([], ns.body.statements, true), [ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports(ts.map(ts.flatMap(excessExports, function (e) { return getNamesOfDeclaration(e); }), function (id) { return ts.factory.createExportSpecifier(false, undefined, id); })), undefined)], false))));
|
|
42610
43127
|
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, nsIndex), true), [ns], false), statements.slice(nsIndex + 1), true);
|
|
42611
43128
|
}
|
|
42612
43129
|
if (!ts.find(statements, function (s) { return s !== ns && ts.nodeHasName(s, name_2); })) {
|
|
@@ -42788,7 +43305,7 @@ var ts;
|
|
|
42788
43305
|
if (propertyAccessRequire && ts.isBinaryExpression(propertyAccessRequire.parent) && ts.isIdentifier(propertyAccessRequire.parent.right)
|
|
42789
43306
|
&& ((_b = type.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration) && ts.isSourceFile(type.symbol.valueDeclaration)) {
|
|
42790
43307
|
var alias = localName === propertyAccessRequire.parent.right.escapedText ? undefined : propertyAccessRequire.parent.right;
|
|
42791
|
-
addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(alias, localName)])), 0);
|
|
43308
|
+
addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(false, alias, localName)])), 0);
|
|
42792
43309
|
context.tracker.trackSymbol(type.symbol, context.enclosingDeclaration, 111551);
|
|
42793
43310
|
}
|
|
42794
43311
|
else {
|
|
@@ -42797,7 +43314,7 @@ var ts;
|
|
|
42797
43314
|
], flags)), textRange);
|
|
42798
43315
|
addResult(statement, name !== localName ? modifierFlags & ~1 : modifierFlags);
|
|
42799
43316
|
if (name !== localName && !isPrivate) {
|
|
42800
|
-
addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(name, localName)])), 0);
|
|
43317
|
+
addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(false, name, localName)])), 0);
|
|
42801
43318
|
needsExportDeclaration = false;
|
|
42802
43319
|
needsPostExportDefault = false;
|
|
42803
43320
|
}
|
|
@@ -42846,7 +43363,7 @@ var ts;
|
|
|
42846
43363
|
addResult(ts.factory.createExportAssignment(undefined, undefined, false, ts.factory.createIdentifier(getInternalSymbolName(symbol, symbolName))), 0);
|
|
42847
43364
|
}
|
|
42848
43365
|
else if (needsExportDeclaration) {
|
|
42849
|
-
addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(getInternalSymbolName(symbol, symbolName), symbolName)])), 0);
|
|
43366
|
+
addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(false, getInternalSymbolName(symbol, symbolName), symbolName)])), 0);
|
|
42850
43367
|
}
|
|
42851
43368
|
}
|
|
42852
43369
|
function includePrivateSymbol(symbol) {
|
|
@@ -42951,7 +43468,7 @@ var ts;
|
|
|
42951
43468
|
var target = aliasDecl && getTargetOfAliasDeclaration(aliasDecl, true);
|
|
42952
43469
|
includePrivateSymbol(target || s);
|
|
42953
43470
|
var targetName = target ? getInternalSymbolName(target, ts.unescapeLeadingUnderscores(target.escapedName)) : localName;
|
|
42954
|
-
return ts.factory.createExportSpecifier(name === targetName ? undefined : targetName, name);
|
|
43471
|
+
return ts.factory.createExportSpecifier(false, name === targetName ? undefined : targetName, name);
|
|
42955
43472
|
})))]);
|
|
42956
43473
|
addResult(ts.factory.createModuleDeclaration(undefined, undefined, ts.factory.createIdentifier(localName), nsBody, 16), 0);
|
|
42957
43474
|
}
|
|
@@ -43011,7 +43528,7 @@ var ts;
|
|
|
43011
43528
|
addingDeclare = oldAddingDeclare;
|
|
43012
43529
|
var declarations = results;
|
|
43013
43530
|
results = oldResults;
|
|
43014
|
-
var defaultReplaced = ts.map(declarations, function (d) { return ts.isExportAssignment(d) && !d.isExportEquals && ts.isIdentifier(d.expression) ? ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(d.expression, ts.factory.createIdentifier("default"))])) : d; });
|
|
43531
|
+
var defaultReplaced = ts.map(declarations, function (d) { return ts.isExportAssignment(d) && !d.isExportEquals && ts.isIdentifier(d.expression) ? ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(false, d.expression, ts.factory.createIdentifier("default"))])) : d; });
|
|
43015
43532
|
var exportModifierStripped = ts.every(defaultReplaced, function (d) { return ts.hasSyntacticModifier(d, 1); }) ? ts.map(defaultReplaced, removeExportModifier) : defaultReplaced;
|
|
43016
43533
|
fakespace = ts.factory.updateModuleDeclaration(fakespace, fakespace.decorators, fakespace.modifiers, fakespace.name, ts.factory.createModuleBlock(exportModifierStripped));
|
|
43017
43534
|
addResult(fakespace, modifierFlags);
|
|
@@ -43094,6 +43611,26 @@ var ts;
|
|
|
43094
43611
|
context.enclosingDeclaration = oldEnclosing;
|
|
43095
43612
|
addResult(ts.setTextRange(ts.factory.createClassDeclaration(undefined, undefined, localName, typeParamDecls, heritageClauses, __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], indexSignatures, true), staticMembers, true), constructors, true), publicProperties, true), privateProperties, true)), symbol.declarations && ts.filter(symbol.declarations, function (d) { return ts.isClassDeclaration(d) || ts.isClassExpression(d); })[0]), modifierFlags);
|
|
43096
43613
|
}
|
|
43614
|
+
function getSomeTargetNameFromDeclarations(declarations) {
|
|
43615
|
+
return ts.firstDefined(declarations, function (d) {
|
|
43616
|
+
if (ts.isImportSpecifier(d) || ts.isExportSpecifier(d)) {
|
|
43617
|
+
return ts.idText(d.propertyName || d.name);
|
|
43618
|
+
}
|
|
43619
|
+
if (ts.isBinaryExpression(d) || ts.isExportAssignment(d)) {
|
|
43620
|
+
var expression = ts.isExportAssignment(d) ? d.expression : d.right;
|
|
43621
|
+
if (ts.isPropertyAccessExpression(expression)) {
|
|
43622
|
+
return ts.idText(expression.name);
|
|
43623
|
+
}
|
|
43624
|
+
}
|
|
43625
|
+
if (isAliasSymbolDeclaration(d)) {
|
|
43626
|
+
var name = ts.getNameOfDeclaration(d);
|
|
43627
|
+
if (name && ts.isIdentifier(name)) {
|
|
43628
|
+
return ts.idText(name);
|
|
43629
|
+
}
|
|
43630
|
+
}
|
|
43631
|
+
return undefined;
|
|
43632
|
+
});
|
|
43633
|
+
}
|
|
43097
43634
|
function serializeAsAlias(symbol, localName, modifierFlags) {
|
|
43098
43635
|
var _a, _b, _c, _d, _e;
|
|
43099
43636
|
var node = getDeclarationOfAliasSymbol(symbol);
|
|
@@ -43103,8 +43640,8 @@ var ts;
|
|
|
43103
43640
|
if (!target) {
|
|
43104
43641
|
return;
|
|
43105
43642
|
}
|
|
43106
|
-
var verbatimTargetName = ts.unescapeLeadingUnderscores(target.escapedName);
|
|
43107
|
-
if (verbatimTargetName === "export=" && (compilerOptions
|
|
43643
|
+
var verbatimTargetName = ts.isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || ts.unescapeLeadingUnderscores(target.escapedName);
|
|
43644
|
+
if (verbatimTargetName === "export=" && (ts.getESModuleInterop(compilerOptions) || compilerOptions.allowSyntheticDefaultImports)) {
|
|
43108
43645
|
verbatimTargetName = "default";
|
|
43109
43646
|
}
|
|
43110
43647
|
var targetName = getInternalSymbolName(target, verbatimTargetName);
|
|
@@ -43114,7 +43651,7 @@ var ts;
|
|
|
43114
43651
|
if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 253) {
|
|
43115
43652
|
var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context);
|
|
43116
43653
|
var propertyName = node.propertyName;
|
|
43117
|
-
addResult(ts.factory.createImportDeclaration(undefined, undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([ts.factory.createImportSpecifier(propertyName && ts.isIdentifier(propertyName) ? ts.factory.createIdentifier(ts.idText(propertyName)) : undefined, ts.factory.createIdentifier(localName))])), ts.factory.createStringLiteral(specifier_1), undefined), 0);
|
|
43654
|
+
addResult(ts.factory.createImportDeclaration(undefined, undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([ts.factory.createImportSpecifier(false, propertyName && ts.isIdentifier(propertyName) ? ts.factory.createIdentifier(ts.idText(propertyName)) : undefined, ts.factory.createIdentifier(localName))])), ts.factory.createStringLiteral(specifier_1), undefined), 0);
|
|
43118
43655
|
break;
|
|
43119
43656
|
}
|
|
43120
43657
|
ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization");
|
|
@@ -43157,7 +43694,7 @@ var ts;
|
|
|
43157
43694
|
break;
|
|
43158
43695
|
case 269:
|
|
43159
43696
|
addResult(ts.factory.createImportDeclaration(undefined, undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([
|
|
43160
|
-
ts.factory.createImportSpecifier(localName !== verbatimTargetName ? ts.factory.createIdentifier(verbatimTargetName) : undefined, ts.factory.createIdentifier(localName))
|
|
43697
|
+
ts.factory.createImportSpecifier(false, localName !== verbatimTargetName ? ts.factory.createIdentifier(verbatimTargetName) : undefined, ts.factory.createIdentifier(localName))
|
|
43161
43698
|
])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), undefined), 0);
|
|
43162
43699
|
break;
|
|
43163
43700
|
case 274:
|
|
@@ -43182,7 +43719,7 @@ var ts;
|
|
|
43182
43719
|
}
|
|
43183
43720
|
}
|
|
43184
43721
|
function serializeExportSpecifier(localName, targetName, specifier) {
|
|
43185
|
-
addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(localName !== targetName ? targetName : undefined, localName)]), specifier), 0);
|
|
43722
|
+
addResult(ts.factory.createExportDeclaration(undefined, undefined, false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(false, localName !== targetName ? targetName : undefined, localName)]), specifier), 0);
|
|
43186
43723
|
}
|
|
43187
43724
|
function serializeMaybeAliasAssignment(symbol) {
|
|
43188
43725
|
if (symbol.flags & 4194304) {
|
|
@@ -43531,7 +44068,7 @@ var ts;
|
|
|
43531
44068
|
if (nameType) {
|
|
43532
44069
|
if (nameType.flags & 384) {
|
|
43533
44070
|
var name = "" + nameType.value;
|
|
43534
|
-
if (!ts.isIdentifierText(name, compilerOptions
|
|
44071
|
+
if (!ts.isIdentifierText(name, ts.getEmitScriptTarget(compilerOptions)) && !isNumericLiteralName(name)) {
|
|
43535
44072
|
return "\"" + ts.escapeString(name, 34) + "\"";
|
|
43536
44073
|
}
|
|
43537
44074
|
if (isNumericLiteralName(name) && ts.startsWith(name, "-")) {
|
|
@@ -46208,6 +46745,23 @@ var ts;
|
|
|
46208
46745
|
function getIsLateCheckFlag(s) {
|
|
46209
46746
|
return ts.getCheckFlags(s) & 4096;
|
|
46210
46747
|
}
|
|
46748
|
+
function forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(type, include, stringsOnly, cb) {
|
|
46749
|
+
for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) {
|
|
46750
|
+
var prop = _a[_i];
|
|
46751
|
+
cb(getLiteralTypeFromProperty(prop, include));
|
|
46752
|
+
}
|
|
46753
|
+
if (type.flags & 1) {
|
|
46754
|
+
cb(stringType);
|
|
46755
|
+
}
|
|
46756
|
+
else {
|
|
46757
|
+
for (var _b = 0, _c = getIndexInfosOfType(type); _b < _c.length; _b++) {
|
|
46758
|
+
var info = _c[_b];
|
|
46759
|
+
if (!stringsOnly || info.keyType.flags & (4 | 134217728)) {
|
|
46760
|
+
cb(info.keyType);
|
|
46761
|
+
}
|
|
46762
|
+
}
|
|
46763
|
+
}
|
|
46764
|
+
}
|
|
46211
46765
|
function resolveMappedTypeMembers(type) {
|
|
46212
46766
|
var members = ts.createSymbolTable();
|
|
46213
46767
|
var indexInfos;
|
|
@@ -46220,21 +46774,7 @@ var ts;
|
|
|
46220
46774
|
var templateModifiers = getMappedTypeModifiers(type);
|
|
46221
46775
|
var include = keyofStringsOnly ? 128 : 8576;
|
|
46222
46776
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
46223
|
-
|
|
46224
|
-
var prop = _a[_i];
|
|
46225
|
-
addMemberForKeyType(getLiteralTypeFromProperty(prop, include));
|
|
46226
|
-
}
|
|
46227
|
-
if (modifiersType.flags & 1) {
|
|
46228
|
-
addMemberForKeyType(stringType);
|
|
46229
|
-
}
|
|
46230
|
-
else {
|
|
46231
|
-
for (var _b = 0, _c = getIndexInfosOfType(modifiersType); _b < _c.length; _b++) {
|
|
46232
|
-
var info = _c[_b];
|
|
46233
|
-
if (!keyofStringsOnly || info.keyType.flags & (4 | 134217728)) {
|
|
46234
|
-
addMemberForKeyType(info.keyType);
|
|
46235
|
-
}
|
|
46236
|
-
}
|
|
46237
|
-
}
|
|
46777
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, include, keyofStringsOnly, addMemberForKeyType);
|
|
46238
46778
|
}
|
|
46239
46779
|
else {
|
|
46240
46780
|
forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
|
|
@@ -48456,8 +48996,6 @@ var ts;
|
|
|
48456
48996
|
}
|
|
48457
48997
|
if (!(flags & 131072)) {
|
|
48458
48998
|
includes |= flags & 205258751;
|
|
48459
|
-
if (flags & 469499904)
|
|
48460
|
-
includes |= 262144;
|
|
48461
48999
|
if (type === wildcardType)
|
|
48462
49000
|
includes |= 8388608;
|
|
48463
49001
|
if (!strictNullChecks && flags & 98304) {
|
|
@@ -48739,11 +49277,17 @@ var ts;
|
|
|
48739
49277
|
if (type === wildcardType)
|
|
48740
49278
|
includes |= 8388608;
|
|
48741
49279
|
}
|
|
48742
|
-
else if (
|
|
48743
|
-
if (
|
|
48744
|
-
includes |=
|
|
49280
|
+
else if (strictNullChecks || !(flags & 98304)) {
|
|
49281
|
+
if (exactOptionalPropertyTypes && type === missingType) {
|
|
49282
|
+
includes |= 262144;
|
|
49283
|
+
type = undefinedType;
|
|
49284
|
+
}
|
|
49285
|
+
if (!typeSet.has(type.id.toString())) {
|
|
49286
|
+
if (type.flags & 109440 && includes & 109440) {
|
|
49287
|
+
includes |= 67108864;
|
|
49288
|
+
}
|
|
49289
|
+
typeSet.set(type.id.toString(), type);
|
|
48745
49290
|
}
|
|
48746
|
-
typeSet.set(type.id.toString(), type);
|
|
48747
49291
|
}
|
|
48748
49292
|
includes |= flags & 205258751;
|
|
48749
49293
|
}
|
|
@@ -48807,14 +49351,13 @@ var ts;
|
|
|
48807
49351
|
}
|
|
48808
49352
|
return false;
|
|
48809
49353
|
}
|
|
48810
|
-
function
|
|
48811
|
-
|
|
48812
|
-
|
|
48813
|
-
|
|
48814
|
-
|
|
48815
|
-
return
|
|
49354
|
+
function eachIsUnionContaining(types, flag) {
|
|
49355
|
+
return ts.every(types, function (t) { return !!(t.flags & 1048576) && ts.some(t.types, function (tt) { return !!(tt.flags & flag); }); });
|
|
49356
|
+
}
|
|
49357
|
+
function removeFromEach(types, flag) {
|
|
49358
|
+
for (var i = 0; i < types.length; i++) {
|
|
49359
|
+
types[i] = filterType(types[i], function (t) { return !(t.flags & flag); });
|
|
48816
49360
|
}
|
|
48817
|
-
return false;
|
|
48818
49361
|
}
|
|
48819
49362
|
function intersectUnionsOfPrimitiveTypes(types) {
|
|
48820
49363
|
var unionTypes;
|
|
@@ -48894,6 +49437,9 @@ var ts;
|
|
|
48894
49437
|
if (includes & 16777216 && includes & 524288) {
|
|
48895
49438
|
ts.orderedRemoveItemAt(typeSet, ts.findIndex(typeSet, isEmptyAnonymousObjectType));
|
|
48896
49439
|
}
|
|
49440
|
+
if (includes & 262144) {
|
|
49441
|
+
typeSet[typeSet.indexOf(undefinedType)] = missingType;
|
|
49442
|
+
}
|
|
48897
49443
|
if (typeSet.length === 0) {
|
|
48898
49444
|
return unknownType;
|
|
48899
49445
|
}
|
|
@@ -48907,10 +49453,13 @@ var ts;
|
|
|
48907
49453
|
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
|
48908
49454
|
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
48909
49455
|
}
|
|
48910
|
-
else if (
|
|
48911
|
-
|
|
49456
|
+
else if (eachIsUnionContaining(typeSet, 32768)) {
|
|
49457
|
+
var undefinedOrMissingType = exactOptionalPropertyTypes && ts.some(typeSet, function (t) { return containsType(t.types, missingType); }) ? missingType : undefinedType;
|
|
49458
|
+
removeFromEach(typeSet, 32768);
|
|
49459
|
+
result = getUnionType([getIntersectionType(typeSet), undefinedOrMissingType], 1, aliasSymbol, aliasTypeArguments);
|
|
48912
49460
|
}
|
|
48913
|
-
else if (
|
|
49461
|
+
else if (eachIsUnionContaining(typeSet, 65536)) {
|
|
49462
|
+
removeFromEach(typeSet, 65536);
|
|
48914
49463
|
result = getUnionType([getIntersectionType(typeSet), nullType], 1, aliasSymbol, aliasTypeArguments);
|
|
48915
49464
|
}
|
|
48916
49465
|
else {
|
|
@@ -48985,16 +49534,38 @@ var ts;
|
|
|
48985
49534
|
type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, true)) :
|
|
48986
49535
|
type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, false));
|
|
48987
49536
|
}
|
|
48988
|
-
function
|
|
48989
|
-
|
|
48990
|
-
|
|
48991
|
-
|
|
48992
|
-
|
|
48993
|
-
|
|
48994
|
-
|
|
48995
|
-
|
|
48996
|
-
|
|
48997
|
-
|
|
49537
|
+
function getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) {
|
|
49538
|
+
var typeParameter = getTypeParameterFromMappedType(type);
|
|
49539
|
+
var constraintType = getConstraintTypeFromMappedType(type);
|
|
49540
|
+
var nameType = getNameTypeFromMappedType(type.target || type);
|
|
49541
|
+
if (!nameType && !noIndexSignatures) {
|
|
49542
|
+
return constraintType;
|
|
49543
|
+
}
|
|
49544
|
+
var keyTypes = [];
|
|
49545
|
+
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
49546
|
+
if (!isGenericIndexType(constraintType)) {
|
|
49547
|
+
var modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
49548
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576, stringsOnly, addMemberForKeyType);
|
|
49549
|
+
}
|
|
49550
|
+
else {
|
|
49551
|
+
return getIndexTypeForGenericType(type, stringsOnly);
|
|
49552
|
+
}
|
|
49553
|
+
}
|
|
49554
|
+
else {
|
|
49555
|
+
forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
|
|
49556
|
+
}
|
|
49557
|
+
if (isGenericIndexType(constraintType)) {
|
|
49558
|
+
forEachType(constraintType, addMemberForKeyType);
|
|
49559
|
+
}
|
|
49560
|
+
var result = noIndexSignatures ? filterType(getUnionType(keyTypes), function (t) { return !(t.flags & (1 | 4)); }) : getUnionType(keyTypes);
|
|
49561
|
+
if (result.flags & 1048576 && constraintType.flags & 1048576 && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
|
|
49562
|
+
return constraintType;
|
|
49563
|
+
}
|
|
49564
|
+
return result;
|
|
49565
|
+
function addMemberForKeyType(keyType) {
|
|
49566
|
+
var propNameType = nameType ? instantiateType(nameType, appendTypeMapping(type.mapper, typeParameter, keyType)) : keyType;
|
|
49567
|
+
keyTypes.push(propNameType === stringType ? stringOrNumberType : propNameType);
|
|
49568
|
+
}
|
|
48998
49569
|
}
|
|
48999
49570
|
function hasDistributiveNameType(mappedType) {
|
|
49000
49571
|
var typeVariable = getTypeParameterFromMappedType(mappedType);
|
|
@@ -49046,7 +49617,7 @@ var ts;
|
|
|
49046
49617
|
return type.flags & 1048576 ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
|
|
49047
49618
|
type.flags & 2097152 ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
|
|
49048
49619
|
type.flags & 58982400 || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
|
|
49049
|
-
ts.getObjectFlags(type) & 32 ? getIndexTypeForMappedType(type, noIndexSignatures) :
|
|
49620
|
+
ts.getObjectFlags(type) & 32 ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) :
|
|
49050
49621
|
type === wildcardType ? wildcardType :
|
|
49051
49622
|
type.flags & 2 ? neverType :
|
|
49052
49623
|
type.flags & (1 | 131072) ? keyofConstraintType :
|
|
@@ -51611,7 +52182,7 @@ var ts;
|
|
|
51611
52182
|
if (path.length === 0) {
|
|
51612
52183
|
path = "" + str;
|
|
51613
52184
|
}
|
|
51614
|
-
else if (ts.isIdentifierText(str, compilerOptions
|
|
52185
|
+
else if (ts.isIdentifierText(str, ts.getEmitScriptTarget(compilerOptions))) {
|
|
51615
52186
|
path = path + "." + str;
|
|
51616
52187
|
}
|
|
51617
52188
|
else if (str[0] === "[" && str[str.length - 1] === "]") {
|
|
@@ -52370,24 +52941,41 @@ var ts;
|
|
|
52370
52941
|
}
|
|
52371
52942
|
}
|
|
52372
52943
|
else if (target.flags & 4194304) {
|
|
52373
|
-
var
|
|
52944
|
+
var targetType_1 = target.type;
|
|
52374
52945
|
if (source.flags & 4194304) {
|
|
52375
|
-
if (result = isRelatedTo(
|
|
52946
|
+
if (result = isRelatedTo(targetType_1, source.type, false)) {
|
|
52376
52947
|
return result;
|
|
52377
52948
|
}
|
|
52378
52949
|
}
|
|
52379
|
-
if (isTupleType(
|
|
52380
|
-
if (result = isRelatedTo(source, getKnownKeysOfTupleType(
|
|
52950
|
+
if (isTupleType(targetType_1)) {
|
|
52951
|
+
if (result = isRelatedTo(source, getKnownKeysOfTupleType(targetType_1), reportErrors)) {
|
|
52381
52952
|
return result;
|
|
52382
52953
|
}
|
|
52383
52954
|
}
|
|
52384
52955
|
else {
|
|
52385
|
-
var constraint = getSimplifiedTypeOrConstraint(
|
|
52956
|
+
var constraint = getSimplifiedTypeOrConstraint(targetType_1);
|
|
52386
52957
|
if (constraint) {
|
|
52387
52958
|
if (isRelatedTo(source, getIndexType(constraint, target.stringsOnly), reportErrors) === -1) {
|
|
52388
52959
|
return -1;
|
|
52389
52960
|
}
|
|
52390
52961
|
}
|
|
52962
|
+
else if (isGenericMappedType(targetType_1)) {
|
|
52963
|
+
var nameType_1 = getNameTypeFromMappedType(targetType_1);
|
|
52964
|
+
var constraintType = getConstraintTypeFromMappedType(targetType_1);
|
|
52965
|
+
var targetKeys = void 0;
|
|
52966
|
+
if (nameType_1 && isMappedTypeWithKeyofConstraintDeclaration(targetType_1)) {
|
|
52967
|
+
var modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType_1));
|
|
52968
|
+
var mappedKeys_1 = [];
|
|
52969
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576, false, function (t) { return void mappedKeys_1.push(instantiateType(nameType_1, appendTypeMapping(targetType_1.mapper, getTypeParameterFromMappedType(targetType_1), t))); });
|
|
52970
|
+
targetKeys = getUnionType(__spreadArray(__spreadArray([], mappedKeys_1, true), [nameType_1], false));
|
|
52971
|
+
}
|
|
52972
|
+
else {
|
|
52973
|
+
targetKeys = nameType_1 || constraintType;
|
|
52974
|
+
}
|
|
52975
|
+
if (isRelatedTo(source, targetKeys, reportErrors) === -1) {
|
|
52976
|
+
return -1;
|
|
52977
|
+
}
|
|
52978
|
+
}
|
|
52391
52979
|
}
|
|
52392
52980
|
}
|
|
52393
52981
|
else if (target.flags & 8388608) {
|
|
@@ -54975,8 +55563,10 @@ var ts;
|
|
|
54975
55563
|
function inferToTemplateLiteralType(source, target) {
|
|
54976
55564
|
var matches = inferTypesFromTemplateLiteralType(source, target);
|
|
54977
55565
|
var types = target.types;
|
|
54978
|
-
|
|
54979
|
-
|
|
55566
|
+
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
55567
|
+
for (var i = 0; i < types.length; i++) {
|
|
55568
|
+
inferFromTypes(matches ? matches[i] : neverType, types[i]);
|
|
55569
|
+
}
|
|
54980
55570
|
}
|
|
54981
55571
|
}
|
|
54982
55572
|
function inferFromObjectTypes(source, target) {
|
|
@@ -56700,6 +57290,9 @@ var ts;
|
|
|
56700
57290
|
case 102:
|
|
56701
57291
|
return narrowTypeByInstanceof(type, expr, assumeTrue);
|
|
56702
57292
|
case 101:
|
|
57293
|
+
if (ts.isPrivateIdentifier(expr.left)) {
|
|
57294
|
+
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
57295
|
+
}
|
|
56703
57296
|
var target = getReferenceCandidate(expr.right);
|
|
56704
57297
|
var leftType = getTypeOfNode(expr.left);
|
|
56705
57298
|
if (leftType.flags & 128) {
|
|
@@ -56726,6 +57319,22 @@ var ts;
|
|
|
56726
57319
|
}
|
|
56727
57320
|
return type;
|
|
56728
57321
|
}
|
|
57322
|
+
function narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue) {
|
|
57323
|
+
var target = getReferenceCandidate(expr.right);
|
|
57324
|
+
if (!isMatchingReference(reference, target)) {
|
|
57325
|
+
return type;
|
|
57326
|
+
}
|
|
57327
|
+
ts.Debug.assertNode(expr.left, ts.isPrivateIdentifier);
|
|
57328
|
+
var symbol = getSymbolForPrivateIdentifierExpression(expr.left);
|
|
57329
|
+
if (symbol === undefined) {
|
|
57330
|
+
return type;
|
|
57331
|
+
}
|
|
57332
|
+
var classSymbol = symbol.parent;
|
|
57333
|
+
var targetType = ts.hasStaticModifier(ts.Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration"))
|
|
57334
|
+
? getTypeOfSymbol(classSymbol)
|
|
57335
|
+
: getDeclaredTypeOfSymbol(classSymbol);
|
|
57336
|
+
return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
|
|
57337
|
+
}
|
|
56729
57338
|
function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) {
|
|
56730
57339
|
var equalsOperator = operator === 34 || operator === 36;
|
|
56731
57340
|
var nullableFlags = operator === 34 || operator === 35 ? 98304 : 32768;
|
|
@@ -58175,8 +58784,8 @@ var ts;
|
|
|
58175
58784
|
return getTypeOfPropertyOfContextualType(type, getSymbolOfNode(element).escapedName);
|
|
58176
58785
|
}
|
|
58177
58786
|
if (element.name) {
|
|
58178
|
-
var
|
|
58179
|
-
return mapType(type, function (t) { var _a; return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t),
|
|
58787
|
+
var nameType_2 = getLiteralTypeFromPropertyName(element.name);
|
|
58788
|
+
return mapType(type, function (t) { var _a; return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType_2)) === null || _a === void 0 ? void 0 : _a.type; }, true);
|
|
58180
58789
|
}
|
|
58181
58790
|
}
|
|
58182
58791
|
return undefined;
|
|
@@ -59596,6 +60205,36 @@ var ts;
|
|
|
59596
60205
|
}
|
|
59597
60206
|
}
|
|
59598
60207
|
}
|
|
60208
|
+
function checkGrammarPrivateIdentifierExpression(privId) {
|
|
60209
|
+
if (!ts.getContainingClass(privId)) {
|
|
60210
|
+
return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
60211
|
+
}
|
|
60212
|
+
if (!ts.isExpressionNode(privId)) {
|
|
60213
|
+
return grammarErrorOnNode(privId, ts.Diagnostics.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);
|
|
60214
|
+
}
|
|
60215
|
+
if (!getSymbolForPrivateIdentifierExpression(privId)) {
|
|
60216
|
+
return grammarErrorOnNode(privId, ts.Diagnostics.Cannot_find_name_0, ts.idText(privId));
|
|
60217
|
+
}
|
|
60218
|
+
return false;
|
|
60219
|
+
}
|
|
60220
|
+
function checkPrivateIdentifierExpression(privId) {
|
|
60221
|
+
checkGrammarPrivateIdentifierExpression(privId);
|
|
60222
|
+
var symbol = getSymbolForPrivateIdentifierExpression(privId);
|
|
60223
|
+
if (symbol) {
|
|
60224
|
+
markPropertyAsReferenced(symbol, undefined, false);
|
|
60225
|
+
}
|
|
60226
|
+
return anyType;
|
|
60227
|
+
}
|
|
60228
|
+
function getSymbolForPrivateIdentifierExpression(privId) {
|
|
60229
|
+
if (!ts.isExpressionNode(privId)) {
|
|
60230
|
+
return undefined;
|
|
60231
|
+
}
|
|
60232
|
+
var links = getNodeLinks(privId);
|
|
60233
|
+
if (links.resolvedSymbol === undefined) {
|
|
60234
|
+
links.resolvedSymbol = lookupSymbolForPrivateIdentifierDeclaration(privId.escapedText, privId);
|
|
60235
|
+
}
|
|
60236
|
+
return links.resolvedSymbol;
|
|
60237
|
+
}
|
|
59599
60238
|
function getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedIdentifier) {
|
|
59600
60239
|
return getPropertyOfType(leftType, lexicallyScopedIdentifier.escapedName);
|
|
59601
60240
|
}
|
|
@@ -59653,7 +60292,7 @@ var ts;
|
|
|
59653
60292
|
if (assignmentKind && lexicallyScopedSymbol && lexicallyScopedSymbol.valueDeclaration && ts.isMethodDeclaration(lexicallyScopedSymbol.valueDeclaration)) {
|
|
59654
60293
|
grammarErrorOnNode(right, ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable, ts.idText(right));
|
|
59655
60294
|
}
|
|
59656
|
-
if ((lexicallyScopedSymbol === null || lexicallyScopedSymbol === void 0 ? void 0 : lexicallyScopedSymbol.valueDeclaration) && (compilerOptions
|
|
60295
|
+
if ((lexicallyScopedSymbol === null || lexicallyScopedSymbol === void 0 ? void 0 : lexicallyScopedSymbol.valueDeclaration) && (ts.getEmitScriptTarget(compilerOptions) === 99 && !useDefineForClassFields)) {
|
|
59657
60296
|
var lexicalClass_1 = ts.getContainingClass(lexicallyScopedSymbol.valueDeclaration);
|
|
59658
60297
|
var parentStaticFieldInitializer = ts.findAncestor(node, function (n) {
|
|
59659
60298
|
if (n === lexicalClass_1)
|
|
@@ -61876,6 +62515,12 @@ var ts;
|
|
|
61876
62515
|
return getReturnTypeOfSignature(signature);
|
|
61877
62516
|
}
|
|
61878
62517
|
function checkAssertion(node) {
|
|
62518
|
+
if (node.kind === 210) {
|
|
62519
|
+
var file = ts.getSourceFileOfNode(node);
|
|
62520
|
+
if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts", ".mts"])) {
|
|
62521
|
+
grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
|
|
62522
|
+
}
|
|
62523
|
+
}
|
|
61879
62524
|
return checkAssertionWorker(node, node.type, node.expression);
|
|
61880
62525
|
}
|
|
61881
62526
|
function isValidConstAssertionArgument(node) {
|
|
@@ -61974,7 +62619,14 @@ var ts;
|
|
|
61974
62619
|
}
|
|
61975
62620
|
function checkImportMetaProperty(node) {
|
|
61976
62621
|
if (moduleKind !== ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) {
|
|
61977
|
-
|
|
62622
|
+
if (moduleKind === ts.ModuleKind.Node12 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
62623
|
+
if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
62624
|
+
error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
62625
|
+
}
|
|
62626
|
+
}
|
|
62627
|
+
else {
|
|
62628
|
+
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12_or_nodenext);
|
|
62629
|
+
}
|
|
61978
62630
|
}
|
|
61979
62631
|
var file = ts.getSourceFileOfNode(node);
|
|
61980
62632
|
ts.Debug.assert(!!(file.flags & 2097152), "Containing file is missing import meta node flag.");
|
|
@@ -62801,9 +63453,9 @@ var ts;
|
|
|
62801
63453
|
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);
|
|
62802
63454
|
diagnostics.add(diagnostic);
|
|
62803
63455
|
}
|
|
62804
|
-
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) || languageVersion < 4) {
|
|
63456
|
+
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4) {
|
|
62805
63457
|
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
62806
|
-
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.
|
|
63458
|
+
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher);
|
|
62807
63459
|
diagnostics.add(diagnostic);
|
|
62808
63460
|
}
|
|
62809
63461
|
}
|
|
@@ -62965,12 +63617,23 @@ var ts;
|
|
|
62965
63617
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
62966
63618
|
return silentNeverType;
|
|
62967
63619
|
}
|
|
62968
|
-
|
|
62969
|
-
|
|
62970
|
-
|
|
62971
|
-
|
|
62972
|
-
|
|
63620
|
+
if (ts.isPrivateIdentifier(left)) {
|
|
63621
|
+
if (languageVersion < 99) {
|
|
63622
|
+
checkExternalEmitHelpers(left, 2097152);
|
|
63623
|
+
}
|
|
63624
|
+
if (!getNodeLinks(left).resolvedSymbol && ts.getContainingClass(left)) {
|
|
63625
|
+
var isUncheckedJS = isUncheckedJSSuggestion(left, rightType.symbol, true);
|
|
63626
|
+
reportNonexistentProperty(left, rightType, isUncheckedJS);
|
|
63627
|
+
}
|
|
62973
63628
|
}
|
|
63629
|
+
else {
|
|
63630
|
+
leftType = checkNonNullType(leftType, left);
|
|
63631
|
+
if (!(allTypesAssignableToKind(leftType, 402653316 | 296 | 12288) ||
|
|
63632
|
+
isTypeAssignableToKind(leftType, 4194304 | 134217728 | 268435456 | 262144))) {
|
|
63633
|
+
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
|
|
63634
|
+
}
|
|
63635
|
+
}
|
|
63636
|
+
rightType = checkNonNullType(rightType, right);
|
|
62974
63637
|
var rightTypeConstraint = getConstraintOfType(rightType);
|
|
62975
63638
|
if (!allTypesAssignableToKind(rightType, 67108864 | 58982400) ||
|
|
62976
63639
|
rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 | 58982400) ||
|
|
@@ -64090,6 +64753,8 @@ var ts;
|
|
|
64090
64753
|
switch (kind) {
|
|
64091
64754
|
case 79:
|
|
64092
64755
|
return checkIdentifier(node, checkMode);
|
|
64756
|
+
case 80:
|
|
64757
|
+
return checkPrivateIdentifierExpression(node);
|
|
64093
64758
|
case 108:
|
|
64094
64759
|
return checkThisExpression(node);
|
|
64095
64760
|
case 106:
|
|
@@ -64618,7 +65283,7 @@ var ts;
|
|
|
64618
65283
|
if (classExtendsNull) {
|
|
64619
65284
|
error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null);
|
|
64620
65285
|
}
|
|
64621
|
-
var superCallShouldBeFirst = (compilerOptions
|
|
65286
|
+
var superCallShouldBeFirst = (ts.getEmitScriptTarget(compilerOptions) !== 99 || !useDefineForClassFields) &&
|
|
64622
65287
|
(ts.some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
|
|
64623
65288
|
ts.some(node.parameters, function (p) { return ts.hasSyntacticModifier(p, 16476); }));
|
|
64624
65289
|
if (superCallShouldBeFirst) {
|
|
@@ -66065,7 +66730,7 @@ var ts;
|
|
|
66065
66730
|
});
|
|
66066
66731
|
}
|
|
66067
66732
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
66068
|
-
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
66733
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node12 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
66069
66734
|
return;
|
|
66070
66735
|
}
|
|
66071
66736
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -67290,8 +67955,8 @@ var ts;
|
|
|
67290
67955
|
}
|
|
67291
67956
|
}
|
|
67292
67957
|
function checkClassNameCollisionWithObject(name) {
|
|
67293
|
-
if (languageVersion
|
|
67294
|
-
&& moduleKind < ts.ModuleKind.ES2015) {
|
|
67958
|
+
if (languageVersion >= 1 && name.escapedText === "Object"
|
|
67959
|
+
&& (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(name).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
67295
67960
|
error(name, ts.Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ts.ModuleKind[moduleKind]);
|
|
67296
67961
|
}
|
|
67297
67962
|
}
|
|
@@ -68348,8 +69013,8 @@ var ts;
|
|
|
68348
69013
|
checkAliasSymbol(node);
|
|
68349
69014
|
if (node.kind === 269 &&
|
|
68350
69015
|
ts.idText(node.propertyName || node.name) === "default" &&
|
|
68351
|
-
compilerOptions
|
|
68352
|
-
moduleKind !== ts.ModuleKind.System && moduleKind < ts.ModuleKind.ES2015) {
|
|
69016
|
+
ts.getESModuleInterop(compilerOptions) &&
|
|
69017
|
+
moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
68353
69018
|
checkExternalEmitHelpers(node, 131072);
|
|
68354
69019
|
}
|
|
68355
69020
|
}
|
|
@@ -68380,7 +69045,7 @@ var ts;
|
|
|
68380
69045
|
if (importClause.namedBindings) {
|
|
68381
69046
|
if (importClause.namedBindings.kind === 267) {
|
|
68382
69047
|
checkImportBinding(importClause.namedBindings);
|
|
68383
|
-
if (moduleKind !== ts.ModuleKind.System && moduleKind < ts.ModuleKind.ES2015 && compilerOptions
|
|
69048
|
+
if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) {
|
|
68384
69049
|
checkExternalEmitHelpers(node, 65536);
|
|
68385
69050
|
}
|
|
68386
69051
|
}
|
|
@@ -68423,7 +69088,7 @@ var ts;
|
|
|
68423
69088
|
}
|
|
68424
69089
|
}
|
|
68425
69090
|
else {
|
|
68426
|
-
if (moduleKind >= ts.ModuleKind.ES2015 && !node.isTypeOnly && !(node.flags & 8388608)) {
|
|
69091
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & 8388608)) {
|
|
68427
69092
|
grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
68428
69093
|
}
|
|
68429
69094
|
}
|
|
@@ -68437,7 +69102,7 @@ var ts;
|
|
|
68437
69102
|
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);
|
|
68438
69103
|
}
|
|
68439
69104
|
if (node.moduleSpecifier && node.exportClause && ts.isNamedExports(node.exportClause) && ts.length(node.exportClause.elements) && languageVersion === 0) {
|
|
68440
|
-
checkExternalEmitHelpers(node,
|
|
69105
|
+
checkExternalEmitHelpers(node, 4194304);
|
|
68441
69106
|
}
|
|
68442
69107
|
checkGrammarExportDeclaration(node);
|
|
68443
69108
|
if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) {
|
|
@@ -68458,9 +69123,9 @@ var ts;
|
|
|
68458
69123
|
else if (node.exportClause) {
|
|
68459
69124
|
checkAliasSymbol(node.exportClause);
|
|
68460
69125
|
}
|
|
68461
|
-
if (moduleKind !== ts.ModuleKind.System && moduleKind < ts.ModuleKind.ES2015) {
|
|
69126
|
+
if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
68462
69127
|
if (node.exportClause) {
|
|
68463
|
-
if (compilerOptions
|
|
69128
|
+
if (ts.getESModuleInterop(compilerOptions)) {
|
|
68464
69129
|
checkExternalEmitHelpers(node, 65536);
|
|
68465
69130
|
}
|
|
68466
69131
|
}
|
|
@@ -68474,11 +69139,15 @@ var ts;
|
|
|
68474
69139
|
}
|
|
68475
69140
|
function checkGrammarExportDeclaration(node) {
|
|
68476
69141
|
var _a;
|
|
68477
|
-
|
|
68478
|
-
|
|
68479
|
-
|
|
69142
|
+
if (node.isTypeOnly) {
|
|
69143
|
+
if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 272) {
|
|
69144
|
+
return checkGrammarNamedImportsOrExports(node.exportClause);
|
|
69145
|
+
}
|
|
69146
|
+
else {
|
|
69147
|
+
return grammarErrorOnNode(node, ts.Diagnostics.Only_named_exports_may_use_export_type);
|
|
69148
|
+
}
|
|
68480
69149
|
}
|
|
68481
|
-
return
|
|
69150
|
+
return false;
|
|
68482
69151
|
}
|
|
68483
69152
|
function checkGrammarModuleElementContext(node, errorMessage) {
|
|
68484
69153
|
var isInAppropriateContext = node.parent.kind === 303 || node.parent.kind === 261 || node.parent.kind === 260;
|
|
@@ -68541,9 +69210,9 @@ var ts;
|
|
|
68541
69210
|
}
|
|
68542
69211
|
}
|
|
68543
69212
|
else {
|
|
68544
|
-
if (compilerOptions
|
|
69213
|
+
if (ts.getESModuleInterop(compilerOptions) &&
|
|
68545
69214
|
moduleKind !== ts.ModuleKind.System &&
|
|
68546
|
-
moduleKind < ts.ModuleKind.ES2015 &&
|
|
69215
|
+
(moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) &&
|
|
68547
69216
|
ts.idText(node.propertyName || node.name) === "default") {
|
|
68548
69217
|
checkExternalEmitHelpers(node, 131072);
|
|
68549
69218
|
}
|
|
@@ -68598,7 +69267,7 @@ var ts;
|
|
|
68598
69267
|
grammarErrorOnNode(node.expression, ts.Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
68599
69268
|
}
|
|
68600
69269
|
if (node.isExportEquals && !(node.flags & 8388608)) {
|
|
68601
|
-
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
69270
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.CommonJS) {
|
|
68602
69271
|
grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
68603
69272
|
}
|
|
68604
69273
|
else if (moduleKind === ts.ModuleKind.System) {
|
|
@@ -69317,6 +69986,9 @@ var ts;
|
|
|
69317
69986
|
}
|
|
69318
69987
|
return result;
|
|
69319
69988
|
}
|
|
69989
|
+
else if (ts.isPrivateIdentifier(name)) {
|
|
69990
|
+
return getSymbolForPrivateIdentifierExpression(name);
|
|
69991
|
+
}
|
|
69320
69992
|
else if (name.kind === 205 || name.kind === 160) {
|
|
69321
69993
|
var links = getNodeLinks(name);
|
|
69322
69994
|
if (links.resolvedSymbol) {
|
|
@@ -70418,7 +71090,7 @@ var ts;
|
|
|
70418
71090
|
var helpersModule = resolveHelpersModule(sourceFile, location);
|
|
70419
71091
|
if (helpersModule !== unknownSymbol) {
|
|
70420
71092
|
var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;
|
|
70421
|
-
for (var helper = 1; helper <=
|
|
71093
|
+
for (var helper = 1; helper <= 4194304; helper <<= 1) {
|
|
70422
71094
|
if (uncheckedHelpers & helper) {
|
|
70423
71095
|
var name = getHelperName(helper);
|
|
70424
71096
|
var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 111551);
|
|
@@ -70470,7 +71142,8 @@ var ts;
|
|
|
70470
71142
|
case 262144: return "__makeTemplateObject";
|
|
70471
71143
|
case 524288: return "__classPrivateFieldGet";
|
|
70472
71144
|
case 1048576: return "__classPrivateFieldSet";
|
|
70473
|
-
case 2097152: return "
|
|
71145
|
+
case 2097152: return "__classPrivateFieldIn";
|
|
71146
|
+
case 4194304: return "__createBinding";
|
|
70474
71147
|
default: return ts.Debug.fail("Unrecognized helper");
|
|
70475
71148
|
}
|
|
70476
71149
|
}
|
|
@@ -70894,6 +71567,11 @@ var ts;
|
|
|
70894
71567
|
if (!ts.isArrowFunction(node)) {
|
|
70895
71568
|
return false;
|
|
70896
71569
|
}
|
|
71570
|
+
if (node.typeParameters && !(ts.length(node.typeParameters) > 1 || node.typeParameters.hasTrailingComma || node.typeParameters[0].constraint)) {
|
|
71571
|
+
if (file && ts.fileExtensionIsOneOf(file.fileName, [".mts", ".cts"])) {
|
|
71572
|
+
grammarErrorOnNode(node.typeParameters[0], ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint);
|
|
71573
|
+
}
|
|
71574
|
+
}
|
|
70897
71575
|
var equalsGreaterThanToken = node.equalsGreaterThanToken;
|
|
70898
71576
|
var startLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.pos).line;
|
|
70899
71577
|
var endLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.end).line;
|
|
@@ -71206,8 +71884,8 @@ var ts;
|
|
|
71206
71884
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
71207
71885
|
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));
|
|
71208
71886
|
}
|
|
71209
|
-
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) || languageVersion < 4) {
|
|
71210
|
-
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.
|
|
71887
|
+
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(forInOrOfStatement).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4) {
|
|
71888
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));
|
|
71211
71889
|
}
|
|
71212
71890
|
}
|
|
71213
71891
|
}
|
|
@@ -71524,8 +72202,7 @@ var ts;
|
|
|
71524
72202
|
: ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
|
|
71525
72203
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
71526
72204
|
}
|
|
71527
|
-
|
|
71528
|
-
if (moduleKind < ts.ModuleKind.ES2015 && moduleKind !== ts.ModuleKind.System &&
|
|
72205
|
+
if ((moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && moduleKind !== ts.ModuleKind.System &&
|
|
71529
72206
|
!(node.parent.parent.flags & 8388608) && ts.hasSyntacticModifier(node.parent.parent, 1)) {
|
|
71530
72207
|
checkESModuleMarker(node.name);
|
|
71531
72208
|
}
|
|
@@ -71815,14 +72492,27 @@ var ts;
|
|
|
71815
72492
|
return ambientModulesCache;
|
|
71816
72493
|
}
|
|
71817
72494
|
function checkGrammarImportClause(node) {
|
|
72495
|
+
var _a;
|
|
71818
72496
|
if (node.isTypeOnly && node.name && node.namedBindings) {
|
|
71819
72497
|
return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both);
|
|
71820
72498
|
}
|
|
72499
|
+
if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 268) {
|
|
72500
|
+
return checkGrammarNamedImportsOrExports(node.namedBindings);
|
|
72501
|
+
}
|
|
71821
72502
|
return false;
|
|
71822
72503
|
}
|
|
72504
|
+
function checkGrammarNamedImportsOrExports(namedBindings) {
|
|
72505
|
+
return !!ts.forEach(namedBindings.elements, function (specifier) {
|
|
72506
|
+
if (specifier.isTypeOnly) {
|
|
72507
|
+
return grammarErrorOnFirstToken(specifier, specifier.kind === 269
|
|
72508
|
+
? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement
|
|
72509
|
+
: ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement);
|
|
72510
|
+
}
|
|
72511
|
+
});
|
|
72512
|
+
}
|
|
71823
72513
|
function checkGrammarImportCallExpression(node) {
|
|
71824
72514
|
if (moduleKind === ts.ModuleKind.ES2015) {
|
|
71825
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
72515
|
+
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_umd_node12_or_nodenext);
|
|
71826
72516
|
}
|
|
71827
72517
|
if (node.typeArguments) {
|
|
71828
72518
|
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments);
|
|
@@ -72493,7 +73183,7 @@ var ts;
|
|
|
72493
73183
|
return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier));
|
|
72494
73184
|
case 269:
|
|
72495
73185
|
ts.Debug.type(node);
|
|
72496
|
-
return factory.updateImportSpecifier(node, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier));
|
|
73186
|
+
return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier));
|
|
72497
73187
|
case 270:
|
|
72498
73188
|
ts.Debug.type(node);
|
|
72499
73189
|
return factory.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression));
|
|
@@ -72505,7 +73195,7 @@ var ts;
|
|
|
72505
73195
|
return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier));
|
|
72506
73196
|
case 274:
|
|
72507
73197
|
ts.Debug.type(node);
|
|
72508
|
-
return factory.updateExportSpecifier(node, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier));
|
|
73198
|
+
return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier));
|
|
72509
73199
|
case 276:
|
|
72510
73200
|
ts.Debug.type(node);
|
|
72511
73201
|
return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression));
|
|
@@ -75283,12 +75973,14 @@ var ts;
|
|
|
75283
75973
|
return shouldEmitAliasDeclaration(node) ? node : undefined;
|
|
75284
75974
|
}
|
|
75285
75975
|
else {
|
|
75976
|
+
var allowEmpty = compilerOptions.preserveValueImports && (compilerOptions.importsNotUsedAsValues === 1 ||
|
|
75977
|
+
compilerOptions.importsNotUsedAsValues === 2);
|
|
75286
75978
|
var elements = ts.visitNodes(node.elements, visitImportSpecifier, ts.isImportSpecifier);
|
|
75287
|
-
return ts.some(elements) ? factory.updateNamedImports(node, elements) : undefined;
|
|
75979
|
+
return allowEmpty || ts.some(elements) ? factory.updateNamedImports(node, elements) : undefined;
|
|
75288
75980
|
}
|
|
75289
75981
|
}
|
|
75290
75982
|
function visitImportSpecifier(node) {
|
|
75291
|
-
return shouldEmitAliasDeclaration(node) ? node : undefined;
|
|
75983
|
+
return !node.isTypeOnly && shouldEmitAliasDeclaration(node) ? node : undefined;
|
|
75292
75984
|
}
|
|
75293
75985
|
function visitExportAssignment(node) {
|
|
75294
75986
|
return resolver.isValueAliasDeclaration(node)
|
|
@@ -75302,26 +75994,25 @@ var ts;
|
|
|
75302
75994
|
if (!node.exportClause || ts.isNamespaceExport(node.exportClause)) {
|
|
75303
75995
|
return node;
|
|
75304
75996
|
}
|
|
75305
|
-
|
|
75306
|
-
|
|
75307
|
-
}
|
|
75308
|
-
var exportClause = ts.visitNode(node.exportClause, visitNamedExportBindings, ts.isNamedExportBindings);
|
|
75997
|
+
var allowEmpty = !!node.moduleSpecifier && (compilerOptions.importsNotUsedAsValues === 1 ||
|
|
75998
|
+
compilerOptions.importsNotUsedAsValues === 2);
|
|
75999
|
+
var exportClause = ts.visitNode(node.exportClause, function (bindings) { return visitNamedExportBindings(bindings, allowEmpty); }, ts.isNamedExportBindings);
|
|
75309
76000
|
return exportClause
|
|
75310
76001
|
? factory.updateExportDeclaration(node, undefined, undefined, node.isTypeOnly, exportClause, node.moduleSpecifier, node.assertClause)
|
|
75311
76002
|
: undefined;
|
|
75312
76003
|
}
|
|
75313
|
-
function visitNamedExports(node) {
|
|
76004
|
+
function visitNamedExports(node, allowEmpty) {
|
|
75314
76005
|
var elements = ts.visitNodes(node.elements, visitExportSpecifier, ts.isExportSpecifier);
|
|
75315
|
-
return ts.some(elements) ? factory.updateNamedExports(node, elements) : undefined;
|
|
76006
|
+
return allowEmpty || ts.some(elements) ? factory.updateNamedExports(node, elements) : undefined;
|
|
75316
76007
|
}
|
|
75317
76008
|
function visitNamespaceExports(node) {
|
|
75318
76009
|
return factory.updateNamespaceExport(node, ts.visitNode(node.name, visitor, ts.isIdentifier));
|
|
75319
76010
|
}
|
|
75320
|
-
function visitNamedExportBindings(node) {
|
|
75321
|
-
return ts.isNamespaceExport(node) ? visitNamespaceExports(node) : visitNamedExports(node);
|
|
76011
|
+
function visitNamedExportBindings(node, allowEmpty) {
|
|
76012
|
+
return ts.isNamespaceExport(node) ? visitNamespaceExports(node) : visitNamedExports(node, allowEmpty);
|
|
75322
76013
|
}
|
|
75323
76014
|
function visitExportSpecifier(node) {
|
|
75324
|
-
return resolver.isValueAliasDeclaration(node) ? node : undefined;
|
|
76015
|
+
return !node.isTypeOnly && resolver.isValueAliasDeclaration(node) ? node : undefined;
|
|
75325
76016
|
}
|
|
75326
76017
|
function shouldEmitImportEqualsDeclaration(node) {
|
|
75327
76018
|
return shouldEmitAliasDeclaration(node)
|
|
@@ -75588,7 +76279,7 @@ var ts;
|
|
|
75588
76279
|
function transformSourceFile(node) {
|
|
75589
76280
|
var options = context.getCompilerOptions();
|
|
75590
76281
|
if (node.isDeclarationFile
|
|
75591
|
-
|| useDefineForClassFields && options
|
|
76282
|
+
|| useDefineForClassFields && ts.getEmitScriptTarget(options) === 99) {
|
|
75592
76283
|
return node;
|
|
75593
76284
|
}
|
|
75594
76285
|
var visited = ts.visitEachChild(node, visitor, context);
|
|
@@ -75678,8 +76369,25 @@ var ts;
|
|
|
75678
76369
|
if (!shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
75679
76370
|
return node;
|
|
75680
76371
|
}
|
|
76372
|
+
if (ts.isStatement(node.parent)) {
|
|
76373
|
+
return node;
|
|
76374
|
+
}
|
|
75681
76375
|
return ts.setOriginalNode(factory.createIdentifier(""), node);
|
|
75682
76376
|
}
|
|
76377
|
+
function visitPrivateIdentifierInInExpression(node) {
|
|
76378
|
+
if (!shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
76379
|
+
return node;
|
|
76380
|
+
}
|
|
76381
|
+
var privId = node.left;
|
|
76382
|
+
ts.Debug.assertNode(privId, ts.isPrivateIdentifier);
|
|
76383
|
+
ts.Debug.assert(node.operatorToken.kind === 101);
|
|
76384
|
+
var info = accessPrivateIdentifier(privId);
|
|
76385
|
+
if (info) {
|
|
76386
|
+
var receiver = ts.visitNode(node.right, visitor, ts.isExpression);
|
|
76387
|
+
return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node);
|
|
76388
|
+
}
|
|
76389
|
+
return ts.visitEachChild(node, visitor, context);
|
|
76390
|
+
}
|
|
75683
76391
|
function classElementVisitor(node) {
|
|
75684
76392
|
switch (node.kind) {
|
|
75685
76393
|
case 170:
|
|
@@ -76022,6 +76730,9 @@ var ts;
|
|
|
76022
76730
|
}
|
|
76023
76731
|
}
|
|
76024
76732
|
}
|
|
76733
|
+
if (node.operatorToken.kind === 101 && ts.isPrivateIdentifier(node.left)) {
|
|
76734
|
+
return visitPrivateIdentifierInInExpression(node);
|
|
76735
|
+
}
|
|
76025
76736
|
return ts.visitEachChild(node, visitor, context);
|
|
76026
76737
|
}
|
|
76027
76738
|
function createPrivateIdentifierAssignment(info, receiver, right, operator) {
|
|
@@ -78275,7 +78986,7 @@ var ts;
|
|
|
78275
78986
|
currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
|
|
78276
78987
|
}
|
|
78277
78988
|
var generatedName = factory.createUniqueName("_" + name, 16 | 32 | 64);
|
|
78278
|
-
var specifier = factory.createImportSpecifier(factory.createIdentifier(name), generatedName);
|
|
78989
|
+
var specifier = factory.createImportSpecifier(false, factory.createIdentifier(name), generatedName);
|
|
78279
78990
|
generatedName.generatedImportReference = specifier;
|
|
78280
78991
|
specifierSourceImports.set(name, specifier);
|
|
78281
78992
|
return generatedName;
|
|
@@ -78454,7 +79165,7 @@ var ts;
|
|
|
78454
79165
|
objectProperties = factory.createNull();
|
|
78455
79166
|
}
|
|
78456
79167
|
else {
|
|
78457
|
-
var target = compilerOptions
|
|
79168
|
+
var target = ts.getEmitScriptTarget(compilerOptions);
|
|
78458
79169
|
if (target && target >= 5) {
|
|
78459
79170
|
objectProperties = factory.createObjectLiteralExpression(ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) {
|
|
78460
79171
|
return isSpread ? ts.map(attrs, transformJsxSpreadAttributeToSpreadAssignment) : ts.map(attrs, transformJsxAttributeToObjectLiteralElement);
|
|
@@ -78603,7 +79314,8 @@ var ts;
|
|
|
78603
79314
|
}
|
|
78604
79315
|
}
|
|
78605
79316
|
function visitJsxExpression(node) {
|
|
78606
|
-
|
|
79317
|
+
var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
|
|
79318
|
+
return node.dotDotDotToken ? factory.createSpreadElement(expression) : expression;
|
|
78607
79319
|
}
|
|
78608
79320
|
}
|
|
78609
79321
|
ts.transformJsx = transformJsx;
|
|
@@ -82879,7 +83591,7 @@ var ts;
|
|
|
82879
83591
|
case 348:
|
|
82880
83592
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
82881
83593
|
case 207:
|
|
82882
|
-
if (ts.isImportCall(node)) {
|
|
83594
|
+
if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) {
|
|
82883
83595
|
return visitImportCallExpression(node);
|
|
82884
83596
|
}
|
|
82885
83597
|
break;
|
|
@@ -83050,7 +83762,7 @@ var ts;
|
|
|
83050
83762
|
}
|
|
83051
83763
|
}
|
|
83052
83764
|
var promise = factory.createNewExpression(factory.createIdentifier("Promise"), undefined, [func]);
|
|
83053
|
-
if (compilerOptions
|
|
83765
|
+
if (ts.getESModuleInterop(compilerOptions)) {
|
|
83054
83766
|
return factory.createCallExpression(factory.createPropertyAccessExpression(promise, factory.createIdentifier("then")), undefined, [emitHelpers().createImportStarCallbackHelper()]);
|
|
83055
83767
|
}
|
|
83056
83768
|
return promise;
|
|
@@ -83058,7 +83770,7 @@ var ts;
|
|
|
83058
83770
|
function createImportCallExpressionCommonJS(arg, containsLexicalThis) {
|
|
83059
83771
|
var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), undefined, []);
|
|
83060
83772
|
var requireCall = factory.createCallExpression(factory.createIdentifier("require"), undefined, arg ? [arg] : []);
|
|
83061
|
-
if (compilerOptions
|
|
83773
|
+
if (ts.getESModuleInterop(compilerOptions)) {
|
|
83062
83774
|
requireCall = emitHelpers().createImportStarHelper(requireCall);
|
|
83063
83775
|
}
|
|
83064
83776
|
var func;
|
|
@@ -83074,7 +83786,7 @@ var ts;
|
|
|
83074
83786
|
return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), undefined, [func]);
|
|
83075
83787
|
}
|
|
83076
83788
|
function getHelperExpressionForExport(node, innerExpr) {
|
|
83077
|
-
if (!compilerOptions
|
|
83789
|
+
if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864) {
|
|
83078
83790
|
return innerExpr;
|
|
83079
83791
|
}
|
|
83080
83792
|
if (ts.getExportNeedsImportStarHelper(node)) {
|
|
@@ -83083,7 +83795,7 @@ var ts;
|
|
|
83083
83795
|
return innerExpr;
|
|
83084
83796
|
}
|
|
83085
83797
|
function getHelperExpressionForImport(node, innerExpr) {
|
|
83086
|
-
if (!compilerOptions
|
|
83798
|
+
if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864) {
|
|
83087
83799
|
return innerExpr;
|
|
83088
83800
|
}
|
|
83089
83801
|
if (ts.getImportNeedsImportStarHelper(node)) {
|
|
@@ -83182,7 +83894,7 @@ var ts;
|
|
|
83182
83894
|
statements.push(ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(emitHelpers().createCreateBindingHelper(generatedName, factory.createStringLiteralFromNode(specifier.propertyName || specifier.name), specifier.propertyName ? factory.createStringLiteralFromNode(specifier.name) : undefined)), specifier), specifier));
|
|
83183
83895
|
}
|
|
83184
83896
|
else {
|
|
83185
|
-
var exportNeedsImportDefault = !!compilerOptions
|
|
83897
|
+
var exportNeedsImportDefault = !!ts.getESModuleInterop(compilerOptions) &&
|
|
83186
83898
|
!(ts.getEmitFlags(node) & 67108864) &&
|
|
83187
83899
|
ts.idText(specifier.propertyName || specifier.name) === "default";
|
|
83188
83900
|
var exportedValue = factory.createPropertyAccessExpression(exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName, specifier.propertyName || specifier.name);
|
|
@@ -84525,7 +85237,10 @@ var ts;
|
|
|
84525
85237
|
(function (ts) {
|
|
84526
85238
|
function transformECMAScriptModule(context) {
|
|
84527
85239
|
var factory = context.factory, emitHelpers = context.getEmitHelperFactory;
|
|
85240
|
+
var host = context.getEmitHost();
|
|
85241
|
+
var resolver = context.getEmitResolver();
|
|
84528
85242
|
var compilerOptions = context.getCompilerOptions();
|
|
85243
|
+
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
|
|
84529
85244
|
var previousOnEmitNode = context.onEmitNode;
|
|
84530
85245
|
var previousOnSubstituteNode = context.onSubstituteNode;
|
|
84531
85246
|
context.onEmitNode = onEmitNode;
|
|
@@ -84533,13 +85248,21 @@ var ts;
|
|
|
84533
85248
|
context.enableEmitNotification(303);
|
|
84534
85249
|
context.enableSubstitution(79);
|
|
84535
85250
|
var helperNameSubstitutions;
|
|
85251
|
+
var currentSourceFile;
|
|
85252
|
+
var importRequireStatements;
|
|
84536
85253
|
return ts.chainBundle(context, transformSourceFile);
|
|
84537
85254
|
function transformSourceFile(node) {
|
|
84538
85255
|
if (node.isDeclarationFile) {
|
|
84539
85256
|
return node;
|
|
84540
85257
|
}
|
|
84541
85258
|
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
|
|
85259
|
+
currentSourceFile = node;
|
|
85260
|
+
importRequireStatements = undefined;
|
|
84542
85261
|
var result = updateExternalModule(node);
|
|
85262
|
+
currentSourceFile = undefined;
|
|
85263
|
+
if (importRequireStatements) {
|
|
85264
|
+
result = factory.updateSourceFile(result, ts.setTextRange(factory.createNodeArray(ts.insertStatementsAfterCustomPrologue(result.statements.slice(), importRequireStatements)), result.statements));
|
|
85265
|
+
}
|
|
84543
85266
|
if (!ts.isExternalModule(node) || ts.some(result.statements, ts.isExternalModuleIndicator)) {
|
|
84544
85267
|
return result;
|
|
84545
85268
|
}
|
|
@@ -84563,7 +85286,7 @@ var ts;
|
|
|
84563
85286
|
function visitor(node) {
|
|
84564
85287
|
switch (node.kind) {
|
|
84565
85288
|
case 264:
|
|
84566
|
-
return undefined;
|
|
85289
|
+
return ts.getEmitScriptTarget(compilerOptions) >= ts.ModuleKind.ES2020 ? visitImportEqualsDeclaration(node) : undefined;
|
|
84567
85290
|
case 270:
|
|
84568
85291
|
return visitExportAssignment(node);
|
|
84569
85292
|
case 271:
|
|
@@ -84572,6 +85295,44 @@ var ts;
|
|
|
84572
85295
|
}
|
|
84573
85296
|
return node;
|
|
84574
85297
|
}
|
|
85298
|
+
function createRequireCall(importNode) {
|
|
85299
|
+
var moduleName = ts.getExternalModuleNameLiteral(factory, importNode, ts.Debug.checkDefined(currentSourceFile), host, resolver, compilerOptions);
|
|
85300
|
+
var args = [];
|
|
85301
|
+
if (moduleName) {
|
|
85302
|
+
args.push(moduleName);
|
|
85303
|
+
}
|
|
85304
|
+
if (!importRequireStatements) {
|
|
85305
|
+
var createRequireName = factory.createUniqueName("_createRequire", 16 | 32);
|
|
85306
|
+
var importStatement = factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
|
|
85307
|
+
factory.createImportSpecifier(false, factory.createIdentifier("createRequire"), createRequireName)
|
|
85308
|
+
])), factory.createStringLiteral("module"));
|
|
85309
|
+
var requireHelperName = factory.createUniqueName("__require", 16 | 32);
|
|
85310
|
+
var requireStatement = factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
|
|
85311
|
+
factory.createVariableDeclaration(requireHelperName, undefined, undefined, factory.createCallExpression(factory.cloneNode(createRequireName), undefined, [
|
|
85312
|
+
factory.createPropertyAccessExpression(factory.createMetaProperty(100, factory.createIdentifier("meta")), factory.createIdentifier("url"))
|
|
85313
|
+
]))
|
|
85314
|
+
], languageVersion >= 2 ? 2 : 0));
|
|
85315
|
+
importRequireStatements = [importStatement, requireStatement];
|
|
85316
|
+
}
|
|
85317
|
+
var name = importRequireStatements[1].declarationList.declarations[0].name;
|
|
85318
|
+
ts.Debug.assertNode(name, ts.isIdentifier);
|
|
85319
|
+
return factory.createCallExpression(factory.cloneNode(name), undefined, args);
|
|
85320
|
+
}
|
|
85321
|
+
function visitImportEqualsDeclaration(node) {
|
|
85322
|
+
ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer.");
|
|
85323
|
+
var statements;
|
|
85324
|
+
statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
|
|
85325
|
+
factory.createVariableDeclaration(factory.cloneNode(node.name), undefined, undefined, createRequireCall(node))
|
|
85326
|
+
], languageVersion >= 2 ? 2 : 0)), node), node));
|
|
85327
|
+
statements = appendExportsOfImportEqualsDeclaration(statements, node);
|
|
85328
|
+
return ts.singleOrMany(statements);
|
|
85329
|
+
}
|
|
85330
|
+
function appendExportsOfImportEqualsDeclaration(statements, node) {
|
|
85331
|
+
if (ts.hasSyntacticModifier(node, 1)) {
|
|
85332
|
+
statements = ts.append(statements, factory.createExportDeclaration(undefined, undefined, node.isTypeOnly, factory.createNamedExports([factory.createExportSpecifier(false, undefined, ts.idText(node.name))])));
|
|
85333
|
+
}
|
|
85334
|
+
return statements;
|
|
85335
|
+
}
|
|
84575
85336
|
function visitExportAssignment(node) {
|
|
84576
85337
|
return node.isExportEquals ? undefined : node;
|
|
84577
85338
|
}
|
|
@@ -84586,7 +85347,7 @@ var ts;
|
|
|
84586
85347
|
var synthName = factory.getGeneratedNameForNode(oldIdentifier);
|
|
84587
85348
|
var importDecl = factory.createImportDeclaration(undefined, undefined, factory.createImportClause(false, undefined, factory.createNamespaceImport(synthName)), node.moduleSpecifier, node.assertClause);
|
|
84588
85349
|
ts.setOriginalNode(importDecl, node.exportClause);
|
|
84589
|
-
var exportDecl = ts.isExportNamespaceAsDefaultDeclaration(node) ? factory.createExportDefault(synthName) : factory.createExportDeclaration(undefined, undefined, false, factory.createNamedExports([factory.createExportSpecifier(synthName, oldIdentifier)]));
|
|
85350
|
+
var exportDecl = ts.isExportNamespaceAsDefaultDeclaration(node) ? factory.createExportDefault(synthName) : factory.createExportDeclaration(undefined, undefined, false, factory.createNamedExports([factory.createExportSpecifier(false, synthName, oldIdentifier)]));
|
|
84590
85351
|
ts.setOriginalNode(exportDecl, node);
|
|
84591
85352
|
return [importDecl, exportDecl];
|
|
84592
85353
|
}
|
|
@@ -84621,6 +85382,74 @@ var ts;
|
|
|
84621
85382
|
ts.transformECMAScriptModule = transformECMAScriptModule;
|
|
84622
85383
|
})(ts || (ts = {}));
|
|
84623
85384
|
var ts;
|
|
85385
|
+
(function (ts) {
|
|
85386
|
+
function transformNodeModule(context) {
|
|
85387
|
+
var previousOnSubstituteNode = context.onSubstituteNode;
|
|
85388
|
+
var previousOnEmitNode = context.onEmitNode;
|
|
85389
|
+
var esmTransform = ts.transformECMAScriptModule(context);
|
|
85390
|
+
var esmOnSubstituteNode = context.onSubstituteNode;
|
|
85391
|
+
var esmOnEmitNode = context.onEmitNode;
|
|
85392
|
+
context.onSubstituteNode = previousOnSubstituteNode;
|
|
85393
|
+
context.onEmitNode = previousOnEmitNode;
|
|
85394
|
+
var cjsTransform = ts.transformModule(context);
|
|
85395
|
+
var cjsOnSubstituteNode = context.onSubstituteNode;
|
|
85396
|
+
var cjsOnEmitNode = context.onEmitNode;
|
|
85397
|
+
context.onSubstituteNode = onSubstituteNode;
|
|
85398
|
+
context.onEmitNode = onEmitNode;
|
|
85399
|
+
context.enableSubstitution(303);
|
|
85400
|
+
context.enableEmitNotification(303);
|
|
85401
|
+
var currentSourceFile;
|
|
85402
|
+
return transformSourceFileOrBundle;
|
|
85403
|
+
function onSubstituteNode(hint, node) {
|
|
85404
|
+
if (ts.isSourceFile(node)) {
|
|
85405
|
+
currentSourceFile = node;
|
|
85406
|
+
return previousOnSubstituteNode(hint, node);
|
|
85407
|
+
}
|
|
85408
|
+
else {
|
|
85409
|
+
if (!currentSourceFile) {
|
|
85410
|
+
return previousOnSubstituteNode(hint, node);
|
|
85411
|
+
}
|
|
85412
|
+
if (currentSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
85413
|
+
return esmOnSubstituteNode(hint, node);
|
|
85414
|
+
}
|
|
85415
|
+
return cjsOnSubstituteNode(hint, node);
|
|
85416
|
+
}
|
|
85417
|
+
}
|
|
85418
|
+
function onEmitNode(hint, node, emitCallback) {
|
|
85419
|
+
if (ts.isSourceFile(node)) {
|
|
85420
|
+
currentSourceFile = node;
|
|
85421
|
+
}
|
|
85422
|
+
if (!currentSourceFile) {
|
|
85423
|
+
return previousOnEmitNode(hint, node, emitCallback);
|
|
85424
|
+
}
|
|
85425
|
+
if (currentSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
85426
|
+
return esmOnEmitNode(hint, node, emitCallback);
|
|
85427
|
+
}
|
|
85428
|
+
return cjsOnEmitNode(hint, node, emitCallback);
|
|
85429
|
+
}
|
|
85430
|
+
function getModuleTransformForFile(file) {
|
|
85431
|
+
return file.impliedNodeFormat === ts.ModuleKind.ESNext ? esmTransform : cjsTransform;
|
|
85432
|
+
}
|
|
85433
|
+
function transformSourceFile(node) {
|
|
85434
|
+
if (node.isDeclarationFile) {
|
|
85435
|
+
return node;
|
|
85436
|
+
}
|
|
85437
|
+
currentSourceFile = node;
|
|
85438
|
+
var result = getModuleTransformForFile(node)(node);
|
|
85439
|
+
currentSourceFile = undefined;
|
|
85440
|
+
ts.Debug.assert(ts.isSourceFile(result));
|
|
85441
|
+
return result;
|
|
85442
|
+
}
|
|
85443
|
+
function transformSourceFileOrBundle(node) {
|
|
85444
|
+
return node.kind === 303 ? transformSourceFile(node) : transformBundle(node);
|
|
85445
|
+
}
|
|
85446
|
+
function transformBundle(node) {
|
|
85447
|
+
return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends);
|
|
85448
|
+
}
|
|
85449
|
+
}
|
|
85450
|
+
ts.transformNodeModule = transformNodeModule;
|
|
85451
|
+
})(ts || (ts = {}));
|
|
85452
|
+
var ts;
|
|
84624
85453
|
(function (ts) {
|
|
84625
85454
|
function canProduceDiagnostics(node) {
|
|
84626
85455
|
return ts.isVariableDeclaration(node) ||
|
|
@@ -85932,7 +86761,7 @@ var ts;
|
|
|
85932
86761
|
else {
|
|
85933
86762
|
declarations.push(factory.createExportDeclaration(undefined, undefined, false, factory.createNamedExports(ts.map(exportMappings_1, function (_a) {
|
|
85934
86763
|
var gen = _a[0], exp = _a[1];
|
|
85935
|
-
return factory.createExportSpecifier(gen, exp);
|
|
86764
|
+
return factory.createExportSpecifier(false, gen, exp);
|
|
85936
86765
|
}))));
|
|
85937
86766
|
}
|
|
85938
86767
|
var namespaceDecl = factory.createModuleDeclaration(undefined, ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16);
|
|
@@ -86274,6 +87103,9 @@ var ts;
|
|
|
86274
87103
|
return ts.transformECMAScriptModule;
|
|
86275
87104
|
case ts.ModuleKind.System:
|
|
86276
87105
|
return ts.transformSystemModule;
|
|
87106
|
+
case ts.ModuleKind.Node12:
|
|
87107
|
+
case ts.ModuleKind.NodeNext:
|
|
87108
|
+
return ts.transformNodeModule;
|
|
86277
87109
|
default:
|
|
86278
87110
|
return ts.transformModule;
|
|
86279
87111
|
}
|
|
@@ -86770,7 +87602,7 @@ var ts;
|
|
|
86770
87602
|
return getOutputPathsForBundle(options, forceDtsPaths);
|
|
86771
87603
|
}
|
|
86772
87604
|
else {
|
|
86773
|
-
var ownOutputFilePath = ts.getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile, options));
|
|
87605
|
+
var ownOutputFilePath = ts.getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile.fileName, options));
|
|
86774
87606
|
var isJsonFile = ts.isJsonSourceFile(sourceFile);
|
|
86775
87607
|
var isJsonEmittedToSameLocation = isJsonFile &&
|
|
86776
87608
|
ts.comparePaths(sourceFile.fileName, ownOutputFilePath, host.getCurrentDirectory(), !host.useCaseSensitiveFileNames()) === 0;
|
|
@@ -86785,21 +87617,12 @@ var ts;
|
|
|
86785
87617
|
function getSourceMapFilePath(jsFilePath, options) {
|
|
86786
87618
|
return (options.sourceMap && !options.inlineSourceMap) ? jsFilePath + ".map" : undefined;
|
|
86787
87619
|
}
|
|
86788
|
-
function getOutputExtension(
|
|
86789
|
-
|
|
86790
|
-
|
|
86791
|
-
|
|
86792
|
-
|
|
86793
|
-
|
|
86794
|
-
if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) {
|
|
86795
|
-
return ".jsx";
|
|
86796
|
-
}
|
|
86797
|
-
}
|
|
86798
|
-
else if (sourceFile.languageVariant === 1) {
|
|
86799
|
-
return ".jsx";
|
|
86800
|
-
}
|
|
86801
|
-
}
|
|
86802
|
-
return ".js";
|
|
87620
|
+
function getOutputExtension(fileName, options) {
|
|
87621
|
+
return ts.fileExtensionIs(fileName, ".json") ? ".json" :
|
|
87622
|
+
options.jsx === 1 && ts.fileExtensionIsOneOf(fileName, [".jsx", ".tsx"]) ? ".jsx" :
|
|
87623
|
+
ts.fileExtensionIsOneOf(fileName, [".mts", ".mjs"]) ? ".mjs" :
|
|
87624
|
+
ts.fileExtensionIsOneOf(fileName, [".cts", ".cjs"]) ? ".cjs" :
|
|
87625
|
+
".js";
|
|
86803
87626
|
}
|
|
86804
87627
|
ts.getOutputExtension = getOutputExtension;
|
|
86805
87628
|
function getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, outputDir, getCommonSourceDirectory) {
|
|
@@ -86808,19 +87631,14 @@ var ts;
|
|
|
86808
87631
|
inputFileName;
|
|
86809
87632
|
}
|
|
86810
87633
|
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory) {
|
|
86811
|
-
ts.
|
|
86812
|
-
return ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir, getCommonSourceDirectory), ".d.ts");
|
|
87634
|
+
return ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir, getCommonSourceDirectory), ts.getDeclarationEmitExtensionForPath(inputFileName));
|
|
86813
87635
|
}
|
|
86814
87636
|
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
|
86815
87637
|
function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory) {
|
|
86816
87638
|
if (configFile.options.emitDeclarationOnly)
|
|
86817
87639
|
return undefined;
|
|
86818
87640
|
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json");
|
|
86819
|
-
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory),
|
|
86820
|
-
".json" :
|
|
86821
|
-
configFile.options.jsx === 1 && (ts.fileExtensionIs(inputFileName, ".tsx") || ts.fileExtensionIs(inputFileName, ".jsx")) ?
|
|
86822
|
-
".jsx" :
|
|
86823
|
-
".js");
|
|
87641
|
+
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), getOutputExtension(inputFileName, configFile.options));
|
|
86824
87642
|
return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 ?
|
|
86825
87643
|
outputFileName :
|
|
86826
87644
|
undefined;
|
|
@@ -86884,7 +87702,7 @@ var ts;
|
|
|
86884
87702
|
ts.getCommonSourceDirectory = getCommonSourceDirectory;
|
|
86885
87703
|
function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
|
|
86886
87704
|
var options = _a.options, fileNames = _a.fileNames;
|
|
86887
|
-
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.
|
|
87705
|
+
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.fileExtensionIs(file, ".d.ts"); }); }, ts.getDirectoryPath(ts.normalizeSlashes(ts.Debug.checkDefined(options.configFilePath))), ts.createGetCanonicalFileName(!ignoreCase));
|
|
86888
87706
|
}
|
|
86889
87707
|
ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
|
|
86890
87708
|
function getAllProjectOutputs(configFile, ignoreCase) {
|
|
@@ -88070,6 +88888,8 @@ var ts;
|
|
|
88070
88888
|
return emitLiteral(node, false);
|
|
88071
88889
|
case 79:
|
|
88072
88890
|
return emitIdentifier(node);
|
|
88891
|
+
case 80:
|
|
88892
|
+
return emitPrivateIdentifier(node);
|
|
88073
88893
|
case 203:
|
|
88074
88894
|
return emitArrayLiteralExpression(node);
|
|
88075
88895
|
case 204:
|
|
@@ -89535,6 +90355,10 @@ var ts;
|
|
|
89535
90355
|
writePunctuation("}");
|
|
89536
90356
|
}
|
|
89537
90357
|
function emitImportOrExportSpecifier(node) {
|
|
90358
|
+
if (node.isTypeOnly) {
|
|
90359
|
+
writeKeyword("type");
|
|
90360
|
+
writeSpace();
|
|
90361
|
+
}
|
|
89538
90362
|
if (node.propertyName) {
|
|
89539
90363
|
emit(node.propertyName);
|
|
89540
90364
|
writeSpace();
|
|
@@ -91660,7 +92484,7 @@ var ts;
|
|
|
91660
92484
|
if (options.declarationDir)
|
|
91661
92485
|
return false;
|
|
91662
92486
|
}
|
|
91663
|
-
else if (!ts.fileExtensionIsOneOf(fileOrDirectoryPath, ts.
|
|
92487
|
+
else if (!ts.fileExtensionIsOneOf(fileOrDirectoryPath, ts.supportedJSExtensionsFlat)) {
|
|
91664
92488
|
return false;
|
|
91665
92489
|
}
|
|
91666
92490
|
var filePathWithoutExtension = ts.removeFileExtension(fileOrDirectoryPath);
|
|
@@ -92243,6 +93067,48 @@ var ts;
|
|
|
92243
93067
|
return resolutions;
|
|
92244
93068
|
}
|
|
92245
93069
|
ts.loadWithLocalCache = loadWithLocalCache;
|
|
93070
|
+
;
|
|
93071
|
+
function getModeForResolutionAtIndex(file, index) {
|
|
93072
|
+
if (file.impliedNodeFormat === undefined)
|
|
93073
|
+
return undefined;
|
|
93074
|
+
return getModeForUsageLocation(file, getModuleNameStringLiteralAt(file, index));
|
|
93075
|
+
}
|
|
93076
|
+
ts.getModeForResolutionAtIndex = getModeForResolutionAtIndex;
|
|
93077
|
+
function getModeForUsageLocation(file, usage) {
|
|
93078
|
+
var _a;
|
|
93079
|
+
if (file.impliedNodeFormat === undefined)
|
|
93080
|
+
return undefined;
|
|
93081
|
+
if (file.impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
93082
|
+
return ts.isImportCall(ts.walkUpParenthesizedExpressions(usage.parent)) ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
93083
|
+
}
|
|
93084
|
+
var exprParentParent = (_a = ts.walkUpParenthesizedExpressions(usage.parent)) === null || _a === void 0 ? void 0 : _a.parent;
|
|
93085
|
+
return exprParentParent && ts.isImportEqualsDeclaration(exprParentParent) ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
93086
|
+
}
|
|
93087
|
+
ts.getModeForUsageLocation = getModeForUsageLocation;
|
|
93088
|
+
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, loader) {
|
|
93089
|
+
if (names.length === 0) {
|
|
93090
|
+
return [];
|
|
93091
|
+
}
|
|
93092
|
+
var resolutions = [];
|
|
93093
|
+
var cache = new ts.Map();
|
|
93094
|
+
var i = 0;
|
|
93095
|
+
for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
|
|
93096
|
+
var name = names_3[_i];
|
|
93097
|
+
var result = void 0;
|
|
93098
|
+
var mode = getModeForResolutionAtIndex(containingFile, i);
|
|
93099
|
+
i++;
|
|
93100
|
+
var cacheKey = mode !== undefined ? mode + "|" + name : name;
|
|
93101
|
+
if (cache.has(cacheKey)) {
|
|
93102
|
+
result = cache.get(cacheKey);
|
|
93103
|
+
}
|
|
93104
|
+
else {
|
|
93105
|
+
cache.set(cacheKey, result = loader(name, mode, containingFileName, redirectedReference));
|
|
93106
|
+
}
|
|
93107
|
+
resolutions.push(result);
|
|
93108
|
+
}
|
|
93109
|
+
return resolutions;
|
|
93110
|
+
}
|
|
93111
|
+
ts.loadWithModeAwareCache = loadWithModeAwareCache;
|
|
92246
93112
|
function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
|
|
92247
93113
|
return forEachProjectReference(undefined, resolvedProjectReferences, function (resolvedRef, parent) { return resolvedRef && cb(resolvedRef, parent); });
|
|
92248
93114
|
}
|
|
@@ -92294,7 +93160,7 @@ var ts;
|
|
|
92294
93160
|
switch (kind) {
|
|
92295
93161
|
case ts.FileIncludeKind.Import:
|
|
92296
93162
|
var importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
92297
|
-
packageId = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text)) === null || _e === void 0 ? void 0 : _e.packageId;
|
|
93163
|
+
packageId = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) === null || _e === void 0 ? void 0 : _e.packageId;
|
|
92298
93164
|
if (importLiteral.pos === -1)
|
|
92299
93165
|
return { file: file, packageId: packageId, text: importLiteral.text };
|
|
92300
93166
|
pos = ts.skipTrivia(file.text, importLiteral.pos);
|
|
@@ -92305,7 +93171,7 @@ var ts;
|
|
|
92305
93171
|
break;
|
|
92306
93172
|
case ts.FileIncludeKind.TypeReferenceDirective:
|
|
92307
93173
|
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end);
|
|
92308
|
-
packageId = (_g = (_f = file.resolvedTypeReferenceDirectiveNames) === null || _f === void 0 ? void 0 : _f.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName))) === null || _g === void 0 ? void 0 : _g.packageId;
|
|
93174
|
+
packageId = (_g = (_f = file.resolvedTypeReferenceDirectiveNames) === null || _f === void 0 ? void 0 : _f.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), getModeForResolutionAtIndex(file, index))) === null || _g === void 0 ? void 0 : _g.packageId;
|
|
92309
93175
|
break;
|
|
92310
93176
|
case ts.FileIncludeKind.LibReferenceDirective:
|
|
92311
93177
|
(_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
|
|
@@ -92372,6 +93238,23 @@ var ts;
|
|
|
92372
93238
|
configFileParseResult.errors;
|
|
92373
93239
|
}
|
|
92374
93240
|
ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics;
|
|
93241
|
+
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
93242
|
+
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
93243
|
+
case ts.ModuleResolutionKind.Node12:
|
|
93244
|
+
case ts.ModuleResolutionKind.NodeNext:
|
|
93245
|
+
return ts.fileExtensionIsOneOf(fileName, [".d.mts", ".mts", ".mjs"]) ? ts.ModuleKind.ESNext :
|
|
93246
|
+
ts.fileExtensionIsOneOf(fileName, [".d.cts", ".cts", ".cjs"]) ? ts.ModuleKind.CommonJS :
|
|
93247
|
+
ts.fileExtensionIsOneOf(fileName, [".d.ts", ".ts", ".tsx", ".js", ".jsx"]) ? lookupFromPackageJson() :
|
|
93248
|
+
undefined;
|
|
93249
|
+
default:
|
|
93250
|
+
return undefined;
|
|
93251
|
+
}
|
|
93252
|
+
function lookupFromPackageJson() {
|
|
93253
|
+
var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
|
|
93254
|
+
return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
93255
|
+
}
|
|
93256
|
+
}
|
|
93257
|
+
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
92375
93258
|
function shouldProgramCreateNewSourceFiles(program, newOptions) {
|
|
92376
93259
|
if (!program)
|
|
92377
93260
|
return false;
|
|
@@ -92387,7 +93270,7 @@ var ts;
|
|
|
92387
93270
|
};
|
|
92388
93271
|
}
|
|
92389
93272
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
92390
|
-
var _a, _b, _c;
|
|
93273
|
+
var _a, _b, _c, _d;
|
|
92391
93274
|
var createProgramOptions = ts.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
92392
93275
|
var rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences;
|
|
92393
93276
|
var oldProgram = createProgramOptions.oldProgram;
|
|
@@ -92419,7 +93302,7 @@ var ts;
|
|
|
92419
93302
|
var programDiagnostics = ts.createDiagnosticCollection();
|
|
92420
93303
|
var currentDirectory = host.getCurrentDirectory();
|
|
92421
93304
|
var supportedExtensions = ts.getSupportedExtensions(options);
|
|
92422
|
-
var supportedExtensionsWithJsonIfResolveJsonModule = ts.
|
|
93305
|
+
var supportedExtensionsWithJsonIfResolveJsonModule = ts.getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
|
|
92423
93306
|
var hasEmitBlockingDiagnostics = new ts.Map();
|
|
92424
93307
|
var _compilerOptionsObjectLiteralSyntax;
|
|
92425
93308
|
var moduleResolutionCache;
|
|
@@ -92427,7 +93310,7 @@ var ts;
|
|
|
92427
93310
|
var actualResolveModuleNamesWorker;
|
|
92428
93311
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|
|
92429
93312
|
if (host.resolveModuleNames) {
|
|
92430
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames),
|
|
93313
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) {
|
|
92431
93314
|
if (!resolved || resolved.extension !== undefined) {
|
|
92432
93315
|
return resolved;
|
|
92433
93316
|
}
|
|
@@ -92435,11 +93318,12 @@ var ts;
|
|
|
92435
93318
|
withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName);
|
|
92436
93319
|
return withExtension;
|
|
92437
93320
|
}); };
|
|
93321
|
+
moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
92438
93322
|
}
|
|
92439
93323
|
else {
|
|
92440
93324
|
moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
92441
|
-
var loader_1 = function (moduleName,
|
|
92442
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, _reusedNames, redirectedReference) { return
|
|
93325
|
+
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; };
|
|
93326
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, _reusedNames, redirectedReference) { return loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), containingFile, containingFileName, redirectedReference, loader_1); };
|
|
92443
93327
|
}
|
|
92444
93328
|
var actualResolveTypeReferenceDirectiveNamesWorker;
|
|
92445
93329
|
if (host.resolveTypeReferenceDirectives) {
|
|
@@ -92461,9 +93345,9 @@ var ts;
|
|
|
92461
93345
|
var projectReferenceRedirects;
|
|
92462
93346
|
var mapFromFileToProjectReferenceRedirects;
|
|
92463
93347
|
var mapFromToProjectReferenceRedirectSource;
|
|
92464
|
-
var useSourceOfProjectReferenceRedirect = !!((
|
|
93348
|
+
var useSourceOfProjectReferenceRedirect = !!((_b = host.useSourceOfProjectReferenceRedirect) === null || _b === void 0 ? void 0 : _b.call(host)) &&
|
|
92465
93349
|
!options.disableSourceOfProjectReferenceRedirect;
|
|
92466
|
-
var
|
|
93350
|
+
var _e = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
92467
93351
|
compilerHost: host,
|
|
92468
93352
|
getSymlinkCache: getSymlinkCache,
|
|
92469
93353
|
useSourceOfProjectReferenceRedirect: useSourceOfProjectReferenceRedirect,
|
|
@@ -92471,7 +93355,8 @@ var ts;
|
|
|
92471
93355
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
92472
93356
|
getSourceOfProjectReferenceRedirect: getSourceOfProjectReferenceRedirect,
|
|
92473
93357
|
forEachResolvedProjectReference: forEachResolvedProjectReference
|
|
92474
|
-
}), onProgramCreateComplete =
|
|
93358
|
+
}), onProgramCreateComplete = _e.onProgramCreateComplete, fileExists = _e.fileExists, directoryExists = _e.directoryExists;
|
|
93359
|
+
var readFile = host.readFile.bind(host);
|
|
92475
93360
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
92476
93361
|
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
92477
93362
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -92526,7 +93411,7 @@ var ts;
|
|
|
92526
93411
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
92527
93412
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
92528
93413
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
92529
|
-
processTypeReferenceDirective(typeReferences[i], resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (
|
|
93414
|
+
processTypeReferenceDirective(typeReferences[i], resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_c = resolutions[i]) === null || _c === void 0 ? void 0 : _c.packageId });
|
|
92530
93415
|
}
|
|
92531
93416
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
92532
93417
|
}
|
|
@@ -92631,9 +93516,10 @@ var ts;
|
|
|
92631
93516
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
92632
93517
|
emitBuildInfo: emitBuildInfo,
|
|
92633
93518
|
fileExists: fileExists,
|
|
93519
|
+
readFile: readFile,
|
|
92634
93520
|
directoryExists: directoryExists,
|
|
92635
93521
|
getSymlinkCache: getSymlinkCache,
|
|
92636
|
-
realpath: (
|
|
93522
|
+
realpath: (_d = host.realpath) === null || _d === void 0 ? void 0 : _d.bind(host),
|
|
92637
93523
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
92638
93524
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
92639
93525
|
structureIsReused: structureIsReused,
|
|
@@ -92662,7 +93548,7 @@ var ts;
|
|
|
92662
93548
|
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
92663
93549
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "resolveModuleNamesWorker", { containingFileName: containingFileName });
|
|
92664
93550
|
ts.performance.mark("beforeResolveModule");
|
|
92665
|
-
var result = actualResolveModuleNamesWorker(moduleNames, containingFileName, reusedNames, redirectedReference);
|
|
93551
|
+
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName, reusedNames, redirectedReference);
|
|
92666
93552
|
ts.performance.mark("afterResolveModule");
|
|
92667
93553
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
92668
93554
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -92683,7 +93569,7 @@ var ts;
|
|
|
92683
93569
|
}
|
|
92684
93570
|
function getRedirectReferenceForResolution(file) {
|
|
92685
93571
|
var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName);
|
|
92686
|
-
if (redirect || !ts.
|
|
93572
|
+
if (redirect || !ts.fileExtensionIsOneOf(file.originalFileName, [".d.ts", ".d.cts", ".d.mts"]))
|
|
92687
93573
|
return redirect;
|
|
92688
93574
|
var resultFromDts = getRedirectReferenceForResolutionFromSourceOfProject(file.path);
|
|
92689
93575
|
if (resultFromDts)
|
|
@@ -92721,8 +93607,8 @@ var ts;
|
|
|
92721
93607
|
}
|
|
92722
93608
|
return ts.libs.length + 2;
|
|
92723
93609
|
}
|
|
92724
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
|
|
92725
|
-
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache);
|
|
93610
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
|
|
93611
|
+
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
|
|
92726
93612
|
}
|
|
92727
93613
|
function toPath(fileName) {
|
|
92728
93614
|
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
@@ -92753,9 +93639,11 @@ var ts;
|
|
|
92753
93639
|
var oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
92754
93640
|
if (oldSourceFile !== file && file.resolvedModules) {
|
|
92755
93641
|
var result_14 = [];
|
|
93642
|
+
var i = 0;
|
|
92756
93643
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
92757
93644
|
var moduleName = moduleNames_1[_i];
|
|
92758
|
-
var resolvedModule = file.resolvedModules.get(moduleName);
|
|
93645
|
+
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
93646
|
+
i++;
|
|
92759
93647
|
result_14.push(resolvedModule);
|
|
92760
93648
|
}
|
|
92761
93649
|
return result_14;
|
|
@@ -92767,7 +93655,7 @@ var ts;
|
|
|
92767
93655
|
for (var i = 0; i < moduleNames.length; i++) {
|
|
92768
93656
|
var moduleName = moduleNames[i];
|
|
92769
93657
|
if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
92770
|
-
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName);
|
|
93658
|
+
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i));
|
|
92771
93659
|
if (oldResolvedModule) {
|
|
92772
93660
|
if (ts.isTraceEnabled(options, host)) {
|
|
92773
93661
|
ts.trace(host, oldResolvedModule.packageId ?
|
|
@@ -92787,7 +93675,7 @@ var ts;
|
|
|
92787
93675
|
}
|
|
92788
93676
|
}
|
|
92789
93677
|
else {
|
|
92790
|
-
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName);
|
|
93678
|
+
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, i);
|
|
92791
93679
|
}
|
|
92792
93680
|
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
92793
93681
|
(result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
@@ -92817,8 +93705,10 @@ var ts;
|
|
|
92817
93705
|
}
|
|
92818
93706
|
ts.Debug.assert(j === resolutions.length);
|
|
92819
93707
|
return result;
|
|
92820
|
-
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
92821
|
-
|
|
93708
|
+
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, index) {
|
|
93709
|
+
if (index >= ts.length(oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.imports) + ts.length(oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.moduleAugmentations))
|
|
93710
|
+
return false;
|
|
93711
|
+
var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName, oldSourceFile && getModeForResolutionAtIndex(oldSourceFile, index));
|
|
92822
93712
|
var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
92823
93713
|
if (resolutionToFile && resolvedFile) {
|
|
92824
93714
|
return false;
|
|
@@ -92880,8 +93770,8 @@ var ts;
|
|
|
92880
93770
|
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
|
|
92881
93771
|
var oldSourceFile = oldSourceFiles_2[_i];
|
|
92882
93772
|
var newSourceFile = host.getSourceFileByPath
|
|
92883
|
-
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, options
|
|
92884
|
-
: host.getSourceFile(oldSourceFile.fileName, options
|
|
93773
|
+
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, ts.getEmitScriptTarget(options), undefined, shouldCreateNewSourceFile)
|
|
93774
|
+
: host.getSourceFile(oldSourceFile.fileName, ts.getEmitScriptTarget(options), undefined, shouldCreateNewSourceFile);
|
|
92885
93775
|
if (!newSourceFile) {
|
|
92886
93776
|
return 0;
|
|
92887
93777
|
}
|
|
@@ -92964,20 +93854,20 @@ var ts;
|
|
|
92964
93854
|
var _f = modifiedSourceFiles_1[_e], oldSourceFile = _f.oldFile, newSourceFile = _f.newFile;
|
|
92965
93855
|
var moduleNames = getModuleNames(newSourceFile);
|
|
92966
93856
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
92967
|
-
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo);
|
|
93857
|
+
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, oldSourceFile, ts.moduleResolutionIsEqualTo);
|
|
92968
93858
|
if (resolutionsChanged) {
|
|
92969
93859
|
structureIsReused = 1;
|
|
92970
|
-
newSourceFile.resolvedModules = ts.
|
|
93860
|
+
newSourceFile.resolvedModules = ts.zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
|
|
92971
93861
|
}
|
|
92972
93862
|
else {
|
|
92973
93863
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
92974
93864
|
}
|
|
92975
93865
|
var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (ref) { return ts.toFileNameLowerCase(ref.fileName); });
|
|
92976
93866
|
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
92977
|
-
var typeReferenceEesolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo);
|
|
93867
|
+
var typeReferenceEesolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
92978
93868
|
if (typeReferenceEesolutionsChanged) {
|
|
92979
93869
|
structureIsReused = 1;
|
|
92980
|
-
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.
|
|
93870
|
+
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
92981
93871
|
}
|
|
92982
93872
|
else {
|
|
92983
93873
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
@@ -93538,6 +94428,7 @@ var ts;
|
|
|
93538
94428
|
if (ts.isAnyImportOrReExport(node)) {
|
|
93539
94429
|
var moduleNameExpr = ts.getExternalModuleName(node);
|
|
93540
94430
|
if (moduleNameExpr && ts.isStringLiteral(moduleNameExpr) && moduleNameExpr.text && (!inAmbientModule || !ts.isExternalModuleNameRelative(moduleNameExpr.text))) {
|
|
94431
|
+
ts.setParentRecursive(node, false);
|
|
93541
94432
|
imports = ts.append(imports, moduleNameExpr);
|
|
93542
94433
|
if (!usesUriStyleNodeCoreModules && currentNodeModulesDepth === 0 && !file.isDeclarationFile) {
|
|
93543
94434
|
usesUriStyleNodeCoreModules = ts.startsWith(moduleNameExpr.text, "node:");
|
|
@@ -93546,6 +94437,7 @@ var ts;
|
|
|
93546
94437
|
}
|
|
93547
94438
|
else if (ts.isModuleDeclaration(node)) {
|
|
93548
94439
|
if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasSyntacticModifier(node, 2) || file.isDeclarationFile)) {
|
|
94440
|
+
node.name.parent = node;
|
|
93549
94441
|
var nameText = ts.getTextOfIdentifierOrLiteral(node.name);
|
|
93550
94442
|
if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(nameText))) {
|
|
93551
94443
|
(moduleAugmentations || (moduleAugmentations = [])).push(node.name);
|
|
@@ -93570,12 +94462,15 @@ var ts;
|
|
|
93570
94462
|
while (r.exec(file.text) !== null) {
|
|
93571
94463
|
var node = getNodeAtPosition(file, r.lastIndex);
|
|
93572
94464
|
if (isJavaScriptFile && ts.isRequireCall(node, true)) {
|
|
94465
|
+
ts.setParentRecursive(node, false);
|
|
93573
94466
|
imports = ts.append(imports, node.arguments[0]);
|
|
93574
94467
|
}
|
|
93575
94468
|
else if (ts.isImportCall(node) && node.arguments.length >= 1 && ts.isStringLiteralLike(node.arguments[0])) {
|
|
94469
|
+
ts.setParentRecursive(node, false);
|
|
93576
94470
|
imports = ts.append(imports, node.arguments[0]);
|
|
93577
94471
|
}
|
|
93578
94472
|
else if (ts.isLiteralImportTypeNode(node)) {
|
|
94473
|
+
ts.setParentRecursive(node, false);
|
|
93579
94474
|
imports = ts.append(imports, node.argument.literal);
|
|
93580
94475
|
}
|
|
93581
94476
|
}
|
|
@@ -93609,13 +94504,13 @@ var ts;
|
|
|
93609
94504
|
function getSourceFileFromReferenceWorker(fileName, getSourceFile, fail, reason) {
|
|
93610
94505
|
if (ts.hasExtension(fileName)) {
|
|
93611
94506
|
var canonicalFileName_1 = host.getCanonicalFileName(fileName);
|
|
93612
|
-
if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensionsWithJsonIfResolveJsonModule, function (extension) { return ts.fileExtensionIs(canonicalFileName_1, extension); })) {
|
|
94507
|
+
if (!options.allowNonTsExtensions && !ts.forEach(ts.flatten(supportedExtensionsWithJsonIfResolveJsonModule), function (extension) { return ts.fileExtensionIs(canonicalFileName_1, extension); })) {
|
|
93613
94508
|
if (fail) {
|
|
93614
94509
|
if (ts.hasJSFileExtension(canonicalFileName_1)) {
|
|
93615
94510
|
fail(ts.Diagnostics.File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option, fileName);
|
|
93616
94511
|
}
|
|
93617
94512
|
else {
|
|
93618
|
-
fail(ts.Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1, fileName, "'" + supportedExtensions.join("', '") + "'");
|
|
94513
|
+
fail(ts.Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1, fileName, "'" + ts.flatten(supportedExtensions).join("', '") + "'");
|
|
93619
94514
|
}
|
|
93620
94515
|
}
|
|
93621
94516
|
return undefined;
|
|
@@ -93645,9 +94540,9 @@ var ts;
|
|
|
93645
94540
|
fail(ts.Diagnostics.File_0_not_found, fileName);
|
|
93646
94541
|
return undefined;
|
|
93647
94542
|
}
|
|
93648
|
-
var sourceFileWithAddedExtension = ts.forEach(supportedExtensions, function (extension) { return getSourceFile(fileName + extension); });
|
|
94543
|
+
var sourceFileWithAddedExtension = ts.forEach(supportedExtensions[0], function (extension) { return getSourceFile(fileName + extension); });
|
|
93649
94544
|
if (fail && !sourceFileWithAddedExtension)
|
|
93650
|
-
fail(ts.Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1, fileName, "'" + supportedExtensions.join("', '") + "'");
|
|
94545
|
+
fail(ts.Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1, fileName, "'" + ts.flatten(supportedExtensions).join("', '") + "'");
|
|
93651
94546
|
return sourceFileWithAddedExtension;
|
|
93652
94547
|
}
|
|
93653
94548
|
}
|
|
@@ -93772,7 +94667,7 @@ var ts;
|
|
|
93772
94667
|
redirectedPath = toPath(redirect);
|
|
93773
94668
|
}
|
|
93774
94669
|
}
|
|
93775
|
-
var file = host.getSourceFile(fileName, options
|
|
94670
|
+
var file = host.getSourceFile(fileName, ts.getEmitScriptTarget(options), function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile);
|
|
93776
94671
|
if (packageId) {
|
|
93777
94672
|
var packageIdKey = ts.packageIdToString(packageId);
|
|
93778
94673
|
var fileFromPackageId = packageIdToSourceFile.get(packageIdKey);
|
|
@@ -93797,6 +94692,7 @@ var ts;
|
|
|
93797
94692
|
file.path = path;
|
|
93798
94693
|
file.resolvedPath = toPath(fileName);
|
|
93799
94694
|
file.originalFileName = originalFileName;
|
|
94695
|
+
file.impliedNodeFormat = getImpliedNodeFormatForFile(file.resolvedPath, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
93800
94696
|
addFileIncludeReason(file, reason);
|
|
93801
94697
|
if (host.useCaseSensitiveFileNames()) {
|
|
93802
94698
|
var pathLowerCase = ts.toFileNameLowerCase(path);
|
|
@@ -93975,7 +94871,7 @@ var ts;
|
|
|
93975
94871
|
i++;
|
|
93976
94872
|
}
|
|
93977
94873
|
var resolveFrom = ts.combinePaths(currentDirectory, "__lib_node_modules_lookup_" + libFileName + "__.ts");
|
|
93978
|
-
var localOverrideModuleResult = ts.resolveModuleName("@typescript/" + path, resolveFrom, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host, moduleResolutionCache);
|
|
94874
|
+
var localOverrideModuleResult = ts.resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host, moduleResolutionCache);
|
|
93979
94875
|
if (localOverrideModuleResult === null || localOverrideModuleResult === void 0 ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
93980
94876
|
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
93981
94877
|
}
|
|
@@ -94014,7 +94910,7 @@ var ts;
|
|
|
94014
94910
|
var optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a = getRedirectReferenceForResolution(file)) === null || _a === void 0 ? void 0 : _a.commandLine.options : undefined) || options;
|
|
94015
94911
|
for (var index = 0; index < moduleNames.length; index++) {
|
|
94016
94912
|
var resolution = resolutions[index];
|
|
94017
|
-
ts.setResolvedModule(file, moduleNames[index], resolution);
|
|
94913
|
+
ts.setResolvedModule(file, moduleNames[index], resolution, getModeForResolutionAtIndex(file, index));
|
|
94018
94914
|
if (!resolution) {
|
|
94019
94915
|
continue;
|
|
94020
94916
|
}
|
|
@@ -94222,7 +95118,7 @@ var ts;
|
|
|
94222
95118
|
if (options.noImplicitUseStrict && ts.getStrictOptionValue(options, "alwaysStrict")) {
|
|
94223
95119
|
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict");
|
|
94224
95120
|
}
|
|
94225
|
-
var languageVersion = options
|
|
95121
|
+
var languageVersion = ts.getEmitScriptTarget(options);
|
|
94226
95122
|
var firstNonAmbientExternalModuleSourceFile = ts.find(files, function (f) { return ts.isExternalModule(f) && !f.isDeclarationFile; });
|
|
94227
95123
|
if (options.isolatedModules) {
|
|
94228
95124
|
if (options.module === ts.ModuleKind.None && languageVersion < 2) {
|
|
@@ -94466,7 +95362,7 @@ var ts;
|
|
|
94466
95362
|
message = ts.Diagnostics.File_is_library_specified_here;
|
|
94467
95363
|
break;
|
|
94468
95364
|
}
|
|
94469
|
-
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === options
|
|
95365
|
+
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === ts.getEmitScriptTarget(options) ? key : undefined; });
|
|
94470
95366
|
configFileNode = target ? getOptionsSyntaxByValue("target", target) : undefined;
|
|
94471
95367
|
message = ts.Diagnostics.File_is_default_library_for_target_specified_here;
|
|
94472
95368
|
break;
|
|
@@ -94629,7 +95525,7 @@ var ts;
|
|
|
94629
95525
|
if (options.outDir) {
|
|
94630
95526
|
return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
|
|
94631
95527
|
}
|
|
94632
|
-
if (ts.fileExtensionIsOneOf(filePath, ts.
|
|
95528
|
+
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.fileExtensionIs(filePath, ".d.ts")) {
|
|
94633
95529
|
var filePathWithoutExtension = ts.removeFileExtension(filePath);
|
|
94634
95530
|
return !!getSourceFileByPath((filePathWithoutExtension + ".ts")) ||
|
|
94635
95531
|
!!getSourceFileByPath((filePathWithoutExtension + ".tsx"));
|
|
@@ -95093,7 +95989,7 @@ var ts;
|
|
|
95093
95989
|
}
|
|
95094
95990
|
}
|
|
95095
95991
|
}
|
|
95096
|
-
fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined });
|
|
95992
|
+
fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
|
|
95097
95993
|
}
|
|
95098
95994
|
return {
|
|
95099
95995
|
fileInfos: fileInfos,
|
|
@@ -95161,7 +96057,7 @@ var ts;
|
|
|
95161
96057
|
var emitOutput_1 = getFileEmitOutput(programOfThisState, sourceFile, true, cancellationToken, undefined, true);
|
|
95162
96058
|
var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
|
|
95163
96059
|
if (firstDts_1) {
|
|
95164
|
-
ts.Debug.assert(ts.
|
|
96060
|
+
ts.Debug.assert(ts.fileExtensionIsOneOf(firstDts_1.name, [".d.ts", ".d.mts", ".d.cts"]), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
|
|
95165
96061
|
latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
|
|
95166
96062
|
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
|
95167
96063
|
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
|
@@ -95409,6 +96305,13 @@ var ts;
|
|
|
95409
96305
|
ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
|
|
95410
96306
|
state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
|
|
95411
96307
|
}
|
|
96308
|
+
if (useOldState) {
|
|
96309
|
+
ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
|
|
96310
|
+
if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
|
|
96311
|
+
state.changedFilesSet.add(sourceFilePath);
|
|
96312
|
+
}
|
|
96313
|
+
});
|
|
96314
|
+
}
|
|
95412
96315
|
state.buildInfoEmitPending = !!state.changedFilesSet.size;
|
|
95413
96316
|
return state;
|
|
95414
96317
|
}
|
|
@@ -95708,13 +96611,13 @@ var ts;
|
|
|
95708
96611
|
var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
|
|
95709
96612
|
return value.version === actualSignature ?
|
|
95710
96613
|
value.affectsGlobalScope ?
|
|
95711
|
-
{ version: value.version, signature: undefined, affectsGlobalScope: true } :
|
|
96614
|
+
{ version: value.version, signature: undefined, affectsGlobalScope: true, impliedFormat: value.impliedFormat } :
|
|
95712
96615
|
value.version :
|
|
95713
96616
|
actualSignature !== undefined ?
|
|
95714
96617
|
signature === undefined ?
|
|
95715
96618
|
value :
|
|
95716
|
-
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope } :
|
|
95717
|
-
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope };
|
|
96619
|
+
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
96620
|
+
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
|
|
95718
96621
|
});
|
|
95719
96622
|
var referencedMap;
|
|
95720
96623
|
if (state.referencedMap) {
|
|
@@ -96067,10 +96970,10 @@ var ts;
|
|
|
96067
96970
|
}
|
|
96068
96971
|
function toBuilderStateFileInfo(fileInfo) {
|
|
96069
96972
|
return ts.isString(fileInfo) ?
|
|
96070
|
-
{ version: fileInfo, signature: fileInfo, affectsGlobalScope: undefined } :
|
|
96973
|
+
{ version: fileInfo, signature: fileInfo, affectsGlobalScope: undefined, impliedFormat: undefined } :
|
|
96071
96974
|
ts.isString(fileInfo.signature) ?
|
|
96072
96975
|
fileInfo :
|
|
96073
|
-
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope };
|
|
96976
|
+
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
|
|
96074
96977
|
}
|
|
96075
96978
|
ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
|
|
96076
96979
|
function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
|
|
@@ -96370,14 +97273,14 @@ var ts;
|
|
|
96370
97273
|
}
|
|
96371
97274
|
function resolveNamesWithLocalCache(_a) {
|
|
96372
97275
|
var _b, _c, _d;
|
|
96373
|
-
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
|
|
97276
|
+
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges, containingSourceFile = _a.containingSourceFile;
|
|
96374
97277
|
var path = resolutionHost.toPath(containingFile);
|
|
96375
|
-
var resolutionsInFile = cache.get(path) || cache.set(path,
|
|
97278
|
+
var resolutionsInFile = cache.get(path) || cache.set(path, ts.createModeAwareCache()).get(path);
|
|
96376
97279
|
var dirPath = ts.getDirectoryPath(path);
|
|
96377
97280
|
var perDirectoryCache = perDirectoryCacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
96378
97281
|
var perDirectoryResolution = perDirectoryCache.get(dirPath);
|
|
96379
97282
|
if (!perDirectoryResolution) {
|
|
96380
|
-
perDirectoryResolution =
|
|
97283
|
+
perDirectoryResolution = ts.createModeAwareCache();
|
|
96381
97284
|
perDirectoryCache.set(dirPath, perDirectoryResolution);
|
|
96382
97285
|
}
|
|
96383
97286
|
var resolvedModules = [];
|
|
@@ -96388,15 +97291,18 @@ var ts;
|
|
|
96388
97291
|
var unmatchedRedirects = oldRedirect ?
|
|
96389
97292
|
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
|
|
96390
97293
|
!!redirectedReference;
|
|
96391
|
-
var seenNamesInFile =
|
|
96392
|
-
|
|
96393
|
-
|
|
96394
|
-
var
|
|
96395
|
-
|
|
97294
|
+
var seenNamesInFile = ts.createModeAwareCache();
|
|
97295
|
+
var i = 0;
|
|
97296
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
97297
|
+
var name = names_4[_i];
|
|
97298
|
+
var mode = containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
97299
|
+
i++;
|
|
97300
|
+
var resolution = resolutionsInFile.get(name, mode);
|
|
97301
|
+
if (!seenNamesInFile.has(name, mode) &&
|
|
96396
97302
|
unmatchedRedirects || !resolution || resolution.isInvalidated ||
|
|
96397
97303
|
(hasInvalidatedNonRelativeUnresolvedImport && !ts.isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
96398
97304
|
var existingResolution = resolution;
|
|
96399
|
-
var resolutionInDirectory = perDirectoryResolution.get(name);
|
|
97305
|
+
var resolutionInDirectory = perDirectoryResolution.get(name, mode);
|
|
96400
97306
|
if (resolutionInDirectory) {
|
|
96401
97307
|
resolution = resolutionInDirectory;
|
|
96402
97308
|
var host = ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost;
|
|
@@ -96416,10 +97322,10 @@ var ts;
|
|
|
96416
97322
|
}
|
|
96417
97323
|
}
|
|
96418
97324
|
else {
|
|
96419
|
-
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference);
|
|
96420
|
-
perDirectoryResolution.set(name, resolution);
|
|
97325
|
+
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile);
|
|
97326
|
+
perDirectoryResolution.set(name, mode, resolution);
|
|
96421
97327
|
}
|
|
96422
|
-
resolutionsInFile.set(name, resolution);
|
|
97328
|
+
resolutionsInFile.set(name, mode, resolution);
|
|
96423
97329
|
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
96424
97330
|
if (existingResolution) {
|
|
96425
97331
|
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
@@ -96431,7 +97337,7 @@ var ts;
|
|
|
96431
97337
|
}
|
|
96432
97338
|
else {
|
|
96433
97339
|
var host = ((_d = resolutionHost.getCompilerHost) === null || _d === void 0 ? void 0 : _d.call(resolutionHost)) || resolutionHost;
|
|
96434
|
-
if (ts.isTraceEnabled(compilerOptions, host) && !seenNamesInFile.has(name)) {
|
|
97340
|
+
if (ts.isTraceEnabled(compilerOptions, host) && !seenNamesInFile.has(name, mode)) {
|
|
96435
97341
|
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
96436
97342
|
ts.trace(host, loader === resolveModuleName ?
|
|
96437
97343
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
@@ -96447,13 +97353,13 @@ var ts;
|
|
|
96447
97353
|
}
|
|
96448
97354
|
}
|
|
96449
97355
|
ts.Debug.assert(resolution !== undefined && !resolution.isInvalidated);
|
|
96450
|
-
seenNamesInFile.set(name, true);
|
|
97356
|
+
seenNamesInFile.set(name, mode, true);
|
|
96451
97357
|
resolvedModules.push(getResolutionWithResolvedFileName(resolution));
|
|
96452
97358
|
}
|
|
96453
|
-
resolutionsInFile.forEach(function (resolution, name) {
|
|
96454
|
-
if (!seenNamesInFile.has(name) && !ts.contains(reusedNames, name)) {
|
|
97359
|
+
resolutionsInFile.forEach(function (resolution, name, mode) {
|
|
97360
|
+
if (!seenNamesInFile.has(name, mode) && !ts.contains(reusedNames, name)) {
|
|
96455
97361
|
stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
96456
|
-
resolutionsInFile.delete(name);
|
|
97362
|
+
resolutionsInFile.delete(name, mode);
|
|
96457
97363
|
}
|
|
96458
97364
|
});
|
|
96459
97365
|
return resolvedModules;
|
|
@@ -96487,7 +97393,7 @@ var ts;
|
|
|
96487
97393
|
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
|
|
96488
97394
|
});
|
|
96489
97395
|
}
|
|
96490
|
-
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
97396
|
+
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile) {
|
|
96491
97397
|
return resolveNamesWithLocalCache({
|
|
96492
97398
|
names: moduleNames,
|
|
96493
97399
|
containingFile: containingFile,
|
|
@@ -96499,11 +97405,14 @@ var ts;
|
|
|
96499
97405
|
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
|
|
96500
97406
|
reusedNames: reusedNames,
|
|
96501
97407
|
logChanges: logChangesWhenResolvingModule,
|
|
97408
|
+
containingSourceFile: containingSourceFile,
|
|
96502
97409
|
});
|
|
96503
97410
|
}
|
|
96504
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
|
|
97411
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode) {
|
|
96505
97412
|
var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile));
|
|
96506
|
-
|
|
97413
|
+
if (!cache)
|
|
97414
|
+
return undefined;
|
|
97415
|
+
return cache.get(moduleName, resolutionMode);
|
|
96507
97416
|
}
|
|
96508
97417
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
96509
97418
|
return ts.endsWith(dirPath, "/node_modules/@types");
|
|
@@ -96837,7 +97746,7 @@ var ts;
|
|
|
96837
97746
|
(function (ts) {
|
|
96838
97747
|
var moduleSpecifiers;
|
|
96839
97748
|
(function (moduleSpecifiers_1) {
|
|
96840
|
-
function getPreferences(_a, compilerOptions, importingSourceFile) {
|
|
97749
|
+
function getPreferences(host, _a, compilerOptions, importingSourceFile) {
|
|
96841
97750
|
var importModuleSpecifierPreference = _a.importModuleSpecifierPreference, importModuleSpecifierEnding = _a.importModuleSpecifierEnding;
|
|
96842
97751
|
return {
|
|
96843
97752
|
relativePreference: importModuleSpecifierPreference === "relative" ? 0 :
|
|
@@ -96851,28 +97760,46 @@ var ts;
|
|
|
96851
97760
|
case "minimal": return 0;
|
|
96852
97761
|
case "index": return 1;
|
|
96853
97762
|
case "js": return 2;
|
|
96854
|
-
default: return usesJsExtensionOnImports(importingSourceFile) ? 2
|
|
97763
|
+
default: return usesJsExtensionOnImports(importingSourceFile) || isFormatRequiringExtensions(compilerOptions, importingSourceFile.path, host) ? 2
|
|
96855
97764
|
: ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 : 0;
|
|
96856
97765
|
}
|
|
96857
97766
|
}
|
|
96858
97767
|
}
|
|
96859
|
-
function getPreferencesForUpdate(compilerOptions, oldImportSpecifier) {
|
|
97768
|
+
function getPreferencesForUpdate(compilerOptions, oldImportSpecifier, importingSourceFileName, host) {
|
|
96860
97769
|
return {
|
|
96861
97770
|
relativePreference: ts.isExternalModuleNameRelative(oldImportSpecifier) ? 0 : 1,
|
|
96862
|
-
ending: ts.hasJSFileExtension(oldImportSpecifier) ?
|
|
97771
|
+
ending: ts.hasJSFileExtension(oldImportSpecifier) || isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) ?
|
|
96863
97772
|
2 :
|
|
96864
97773
|
ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs || ts.endsWith(oldImportSpecifier, "index") ? 1 : 0,
|
|
96865
97774
|
};
|
|
96866
97775
|
}
|
|
97776
|
+
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
97777
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12
|
|
97778
|
+
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
97779
|
+
return false;
|
|
97780
|
+
}
|
|
97781
|
+
return ts.getImpliedNodeFormatForFile(importingSourceFileName, undefined, getModuleResolutionHost(host), compilerOptions) !== ts.ModuleKind.CommonJS;
|
|
97782
|
+
}
|
|
97783
|
+
function getModuleResolutionHost(host) {
|
|
97784
|
+
var _a;
|
|
97785
|
+
return {
|
|
97786
|
+
fileExists: host.fileExists,
|
|
97787
|
+
readFile: ts.Debug.checkDefined(host.readFile),
|
|
97788
|
+
directoryExists: host.directoryExists,
|
|
97789
|
+
getCurrentDirectory: host.getCurrentDirectory,
|
|
97790
|
+
realpath: host.realpath,
|
|
97791
|
+
useCaseSensitiveFileNames: (_a = host.useCaseSensitiveFileNames) === null || _a === void 0 ? void 0 : _a.call(host),
|
|
97792
|
+
};
|
|
97793
|
+
}
|
|
96867
97794
|
function updateModuleSpecifier(compilerOptions, importingSourceFileName, toFileName, host, oldImportSpecifier) {
|
|
96868
|
-
var res = getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, getPreferencesForUpdate(compilerOptions, oldImportSpecifier), {});
|
|
97795
|
+
var res = getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, getPreferencesForUpdate(compilerOptions, oldImportSpecifier, importingSourceFileName, host), {});
|
|
96869
97796
|
if (res === oldImportSpecifier)
|
|
96870
97797
|
return undefined;
|
|
96871
97798
|
return res;
|
|
96872
97799
|
}
|
|
96873
97800
|
moduleSpecifiers_1.updateModuleSpecifier = updateModuleSpecifier;
|
|
96874
97801
|
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host) {
|
|
96875
|
-
return getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, getPreferences({}, compilerOptions, importingSourceFile), {});
|
|
97802
|
+
return getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, getPreferences(host, {}, compilerOptions, importingSourceFile), {});
|
|
96876
97803
|
}
|
|
96877
97804
|
moduleSpecifiers_1.getModuleSpecifier = getModuleSpecifier;
|
|
96878
97805
|
function getNodeModulesPackageName(compilerOptions, importingSourceFileName, nodeModulesFileName, host, preferences) {
|
|
@@ -96924,7 +97851,7 @@ var ts;
|
|
|
96924
97851
|
moduleSpecifiers_1.getModuleSpecifiersWithCacheInfo = getModuleSpecifiersWithCacheInfo;
|
|
96925
97852
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences) {
|
|
96926
97853
|
var info = getInfo(importingSourceFile.path, host);
|
|
96927
|
-
var preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
97854
|
+
var preferences = getPreferences(host, userPreferences, compilerOptions, importingSourceFile);
|
|
96928
97855
|
var existingSpecifier = ts.forEach(modulePaths, function (modulePath) { return ts.forEach(host.getFileIncludeReasons().get(ts.toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)), function (reason) {
|
|
96929
97856
|
if (reason.kind !== ts.FileIncludeKind.Import || reason.file !== importingSourceFile.path)
|
|
96930
97857
|
return undefined;
|
|
@@ -97292,7 +98219,7 @@ var ts;
|
|
|
97292
98219
|
function tryGetAnyFileFromPath(host, path) {
|
|
97293
98220
|
if (!host.fileExists)
|
|
97294
98221
|
return;
|
|
97295
|
-
var extensions = ts.getSupportedExtensions({ allowJs: true }, [{ extension: "node", isMixedContent: false }, { extension: "json", isMixedContent: false, scriptKind: 6 }]);
|
|
98222
|
+
var extensions = ts.flatten(ts.getSupportedExtensions({ allowJs: true }, [{ extension: "node", isMixedContent: false }, { extension: "json", isMixedContent: false, scriptKind: 6 }]));
|
|
97296
98223
|
for (var _i = 0, extensions_3 = extensions; _i < extensions_3.length; _i++) {
|
|
97297
98224
|
var e = extensions_3[_i];
|
|
97298
98225
|
var fullPath = path + e;
|
|
@@ -97350,9 +98277,11 @@ var ts;
|
|
|
97350
98277
|
});
|
|
97351
98278
|
}
|
|
97352
98279
|
function removeExtensionAndIndexPostFix(fileName, ending, options) {
|
|
97353
|
-
if (ts.
|
|
98280
|
+
if (ts.fileExtensionIsOneOf(fileName, [".json", ".mjs", ".cjs"]))
|
|
97354
98281
|
return fileName;
|
|
97355
98282
|
var noExtension = ts.removeFileExtension(fileName);
|
|
98283
|
+
if (ts.fileExtensionIsOneOf(fileName, [".d.mts", ".mts", ".d.cts", ".cts"]))
|
|
98284
|
+
return noExtension + getJSExtensionForFile(fileName, options);
|
|
97356
98285
|
switch (ending) {
|
|
97357
98286
|
case 0:
|
|
97358
98287
|
return ts.removeSuffix(noExtension, "/index");
|
|
@@ -97380,6 +98309,14 @@ var ts;
|
|
|
97380
98309
|
case ".jsx":
|
|
97381
98310
|
case ".json":
|
|
97382
98311
|
return ext;
|
|
98312
|
+
case ".d.mts":
|
|
98313
|
+
case ".mts":
|
|
98314
|
+
case ".mjs":
|
|
98315
|
+
return ".mjs";
|
|
98316
|
+
case ".d.cts":
|
|
98317
|
+
case ".cts":
|
|
98318
|
+
case ".cjs":
|
|
98319
|
+
return ".cjs";
|
|
97383
98320
|
default:
|
|
97384
98321
|
return undefined;
|
|
97385
98322
|
}
|
|
@@ -97633,7 +98570,7 @@ var ts;
|
|
|
97633
98570
|
case ts.FileIncludeKind.LibFile:
|
|
97634
98571
|
if (reason.index !== undefined)
|
|
97635
98572
|
return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Library_0_specified_in_compilerOptions, options.lib[reason.index]);
|
|
97636
|
-
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === options
|
|
98573
|
+
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === ts.getEmitScriptTarget(options) ? key : undefined; });
|
|
97637
98574
|
return ts.chainDiagnosticMessages(undefined, target ?
|
|
97638
98575
|
ts.Diagnostics.Default_library_for_target_0 :
|
|
97639
98576
|
ts.Diagnostics.Default_library, target);
|
|
@@ -98021,7 +98958,7 @@ var ts;
|
|
|
98021
98958
|
}
|
|
98022
98959
|
return host.resolveModuleNames.apply(host, args);
|
|
98023
98960
|
}) :
|
|
98024
|
-
(function (moduleNames, containingFile, reusedNames, redirectedReference) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); });
|
|
98961
|
+
(function (moduleNames, containingFile, reusedNames, redirectedReference, _options, sourceFile) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, sourceFile); });
|
|
98025
98962
|
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
|
|
98026
98963
|
(function () {
|
|
98027
98964
|
var args = [];
|
|
@@ -98667,10 +99604,11 @@ var ts;
|
|
|
98667
99604
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
98668
99605
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
98669
99606
|
if (!compilerHost.resolveModuleNames) {
|
|
98670
|
-
var loader_3 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule; };
|
|
98671
|
-
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference) {
|
|
98672
|
-
return ts.
|
|
99607
|
+
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; };
|
|
99608
|
+
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile) {
|
|
99609
|
+
return ts.loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference, loader_3);
|
|
98673
99610
|
};
|
|
99611
|
+
compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
|
|
98674
99612
|
}
|
|
98675
99613
|
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
98676
99614
|
var loader_4 = function (moduleName, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache).resolvedTypeReferenceDirective; };
|
|
@@ -100028,10 +100966,10 @@ var ts;
|
|
|
100028
100966
|
return "Definitions";
|
|
100029
100967
|
}
|
|
100030
100968
|
var path = file.path;
|
|
100031
|
-
if (ts.fileExtensionIsOneOf(path, ts.
|
|
100969
|
+
if (ts.fileExtensionIsOneOf(path, ts.supportedTSExtensionsFlat)) {
|
|
100032
100970
|
return "TypeScript";
|
|
100033
100971
|
}
|
|
100034
|
-
else if (ts.fileExtensionIsOneOf(path, ts.
|
|
100972
|
+
else if (ts.fileExtensionIsOneOf(path, ts.supportedJSExtensionsFlat)) {
|
|
100035
100973
|
return "JavaScript";
|
|
100036
100974
|
}
|
|
100037
100975
|
else if (ts.fileExtensionIs(path, ".json")) {
|