typescript 5.3.0-dev.20230925 → 5.3.0-dev.20230927
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es5.d.ts +9 -1
- package/lib/tsc.js +377 -300
- package/lib/tsserver.js +431 -338
- package/lib/typescript.d.ts +51 -29
- package/lib/typescript.js +425 -335
- package/lib/typingsInstaller.js +165 -109
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.3";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230927`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3312,8 +3312,10 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind4) => {
|
|
|
3312
3312
|
SyntaxKind4[SyntaxKind4["DefaultClause"] = 297] = "DefaultClause";
|
|
3313
3313
|
SyntaxKind4[SyntaxKind4["HeritageClause"] = 298] = "HeritageClause";
|
|
3314
3314
|
SyntaxKind4[SyntaxKind4["CatchClause"] = 299] = "CatchClause";
|
|
3315
|
-
SyntaxKind4[SyntaxKind4["
|
|
3316
|
-
SyntaxKind4[SyntaxKind4["
|
|
3315
|
+
SyntaxKind4[SyntaxKind4["ImportAttributes"] = 300] = "ImportAttributes";
|
|
3316
|
+
SyntaxKind4[SyntaxKind4["ImportAttribute"] = 301] = "ImportAttribute";
|
|
3317
|
+
SyntaxKind4[SyntaxKind4["AssertClause"] = 300 /* ImportAttributes */] = "AssertClause";
|
|
3318
|
+
SyntaxKind4[SyntaxKind4["AssertEntry"] = 301 /* ImportAttribute */] = "AssertEntry";
|
|
3317
3319
|
SyntaxKind4[SyntaxKind4["ImportTypeAssertionContainer"] = 302] = "ImportTypeAssertionContainer";
|
|
3318
3320
|
SyntaxKind4[SyntaxKind4["PropertyAssignment"] = 303] = "PropertyAssignment";
|
|
3319
3321
|
SyntaxKind4[SyntaxKind4["ShorthandPropertyAssignment"] = 304] = "ShorthandPropertyAssignment";
|
|
@@ -6054,9 +6056,8 @@ var Diagnostics = {
|
|
|
6054
6056
|
_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled: diag(1446, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveVa_1446", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled."),
|
|
6055
6057
|
_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_enabled: diag(1448, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_1448", "'{0}' resolves to a type-only declaration and must be re-exported using a type-only re-export when '{1}' is enabled."),
|
|
6056
6058
|
Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, 3 /* 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."),
|
|
6057
|
-
|
|
6059
|
+
Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_set_of_attributes_as_arguments: diag(1450, 3 /* Message */, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_set_of_attributes_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional set of attributes as arguments"),
|
|
6058
6060
|
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, 1 /* 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"),
|
|
6059
|
-
resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext: diag(1452, 1 /* Error */, "resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452", "'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`."),
|
|
6060
6061
|
resolution_mode_should_be_either_require_or_import: diag(1453, 1 /* Error */, "resolution_mode_should_be_either_require_or_import_1453", "`resolution-mode` should be either `require` or `import`."),
|
|
6061
6062
|
resolution_mode_can_only_be_set_for_type_only_imports: diag(1454, 1 /* Error */, "resolution_mode_can_only_be_set_for_type_only_imports_1454", "`resolution-mode` can only be set for type-only imports."),
|
|
6062
6063
|
resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, 1 /* Error */, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
|
|
@@ -6066,6 +6067,8 @@ var Diagnostics = {
|
|
|
6066
6067
|
File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module: diag(1459, 3 /* Message */, "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459", `File is CommonJS module because '{0}' has field "type" whose value is not "module"`),
|
|
6067
6068
|
File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, 3 /* Message */, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", `File is CommonJS module because '{0}' does not have field "type"`),
|
|
6068
6069
|
File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, 3 /* Message */, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"),
|
|
6070
|
+
resolution_mode_is_the_only_valid_key_for_type_import_attributes: diag(1463, 1 /* Error */, "resolution_mode_is_the_only_valid_key_for_type_import_attributes_1463", "'resolution-mode' is the only valid key for type import attributes."),
|
|
6071
|
+
Type_import_attributes_should_have_exactly_one_key_resolution_mode_with_value_import_or_require: diag(1464, 1 /* Error */, "Type_import_attributes_should_have_exactly_one_key_resolution_mode_with_value_import_or_require_1464", "Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'."),
|
|
6069
6072
|
The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, 1 /* 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."),
|
|
6070
6073
|
Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead: diag(1471, 1 /* 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 with 'require'. Use an ECMAScript import instead."),
|
|
6071
6074
|
catch_or_finally_expected: diag(1472, 1 /* Error */, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
@@ -6092,6 +6095,7 @@ var Diagnostics = {
|
|
|
6092
6095
|
The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration: diag(1493, 1 /* Error */, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration_1493", "The left-hand side of a 'for...in' statement cannot be a 'using' declaration."),
|
|
6093
6096
|
The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration: diag(1494, 1 /* Error */, "The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration_1494", "The left-hand side of a 'for...in' statement cannot be an 'await using' declaration."),
|
|
6094
6097
|
_0_modifier_cannot_appear_on_an_await_using_declaration: diag(1495, 1 /* Error */, "_0_modifier_cannot_appear_on_an_await_using_declaration_1495", "'{0}' modifier cannot appear on an 'await using' declaration."),
|
|
6098
|
+
Identifier_string_literal_or_number_literal_expected: diag(1496, 1 /* Error */, "Identifier_string_literal_or_number_literal_expected_1496", "Identifier, string literal, or number literal expected."),
|
|
6095
6099
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
6096
6100
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
6097
6101
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -6621,15 +6625,15 @@ var Diagnostics = {
|
|
|
6621
6625
|
Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, 1 /* Error */, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
|
|
6622
6626
|
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, 1 /* Error */, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
|
|
6623
6627
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, 1 /* Error */, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
6628
|
+
Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2823, 1 /* Error */, "Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2823", "Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
|
|
6624
6629
|
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, 1 /* Error */, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
6625
6630
|
Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."),
|
|
6626
6631
|
Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),
|
|
6627
|
-
|
|
6632
|
+
Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls: diag(2836, 1 /* Error */, "Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls_2836", "Import assertions are not allowed on statements that compile to CommonJS 'require' calls."),
|
|
6628
6633
|
Import_assertion_values_must_be_string_literal_expressions: diag(2837, 1 /* Error */, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
|
|
6629
6634
|
All_declarations_of_0_must_have_identical_constraints: diag(2838, 1 /* Error */, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
|
|
6630
6635
|
This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, 1 /* Error */, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
|
|
6631
6636
|
An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes: diag(2840, 1 /* Error */, "An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_clas_2840", "An interface cannot extend a primitive type like '{0}'; an interface can only extend named types and classes"),
|
|
6632
|
-
The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(2841, 1 /* Error */, "The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_2841", "The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6633
6637
|
_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, 1 /* Error */, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"),
|
|
6634
6638
|
We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, 1 /* Error */, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."),
|
|
6635
6639
|
Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, 1 /* Error */, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
@@ -6643,6 +6647,10 @@ var Diagnostics = {
|
|
|
6643
6647
|
await_using_statements_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(2853, 1 /* Error */, "await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853", "'await using' statements 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."),
|
|
6644
6648
|
Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
6645
6649
|
Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super: diag(2855, 1 /* Error */, "Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855", "Class field '{0}' defined by the parent class is not accessible in the child class via super."),
|
|
6650
|
+
Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls: diag(2856, 1 /* Error */, "Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls_2856", "Import attributes are not allowed on statements that compile to CommonJS 'require' calls."),
|
|
6651
|
+
Import_attributes_cannot_be_used_with_type_only_imports_or_exports: diag(2857, 1 /* Error */, "Import_attributes_cannot_be_used_with_type_only_imports_or_exports_2857", "Import attributes cannot be used with type-only imports or exports."),
|
|
6652
|
+
Import_attribute_values_must_be_string_literal_expressions: diag(2858, 1 /* Error */, "Import_attribute_values_must_be_string_literal_expressions_2858", "Import attribute values must be string literal expressions."),
|
|
6653
|
+
Excessive_complexity_comparing_types_0_and_1: diag(2859, 1 /* Error */, "Excessive_complexity_comparing_types_0_and_1_2859", "Excessive complexity comparing types '{0}' and '{1}'."),
|
|
6646
6654
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6647
6655
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
6648
6656
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -6751,7 +6759,6 @@ var Diagnostics = {
|
|
|
6751
6759
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
|
|
6752
6760
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
6753
6761
|
Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, 1 /* Error */, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6754
|
-
resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4125, 1 /* Error */, "resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125", "'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6755
6762
|
The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
6756
6763
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
6757
6764
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
@@ -10686,7 +10693,7 @@ function isTypeOnlyExportDeclaration(node) {
|
|
|
10686
10693
|
function isTypeOnlyImportOrExportDeclaration(node) {
|
|
10687
10694
|
return isTypeOnlyImportDeclaration(node) || isTypeOnlyExportDeclaration(node);
|
|
10688
10695
|
}
|
|
10689
|
-
function
|
|
10696
|
+
function isImportAttributeName(node) {
|
|
10690
10697
|
return isStringLiteral(node) || isIdentifier(node);
|
|
10691
10698
|
}
|
|
10692
10699
|
function isGeneratedIdentifier(node) {
|
|
@@ -10930,6 +10937,9 @@ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
|
|
|
10930
10937
|
const kind = node.kind;
|
|
10931
10938
|
return kind === 211 /* PropertyAccessExpression */ || kind === 166 /* QualifiedName */ || kind === 205 /* ImportType */;
|
|
10932
10939
|
}
|
|
10940
|
+
function isCallLikeOrFunctionLikeExpression(node) {
|
|
10941
|
+
return isCallLikeExpression(node) || isFunctionLike(node);
|
|
10942
|
+
}
|
|
10933
10943
|
function isCallLikeExpression(node) {
|
|
10934
10944
|
switch (node.kind) {
|
|
10935
10945
|
case 286 /* JsxOpeningElement */:
|
|
@@ -14739,9 +14749,6 @@ function getIndentString(level) {
|
|
|
14739
14749
|
function getIndentSize() {
|
|
14740
14750
|
return indentStrings[1].length;
|
|
14741
14751
|
}
|
|
14742
|
-
function isNightly() {
|
|
14743
|
-
return version.includes("-dev") || version.includes("-insiders");
|
|
14744
|
-
}
|
|
14745
14752
|
function createTextWriter(newLine) {
|
|
14746
14753
|
var output;
|
|
14747
14754
|
var indent2;
|
|
@@ -16473,7 +16480,7 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
|
|
|
16473
16480
|
if (!containsIgnoredPath(symlinkPath)) {
|
|
16474
16481
|
symlinkPath = ensureTrailingDirectorySeparator(symlinkPath);
|
|
16475
16482
|
if (real !== false && !(symlinkedDirectories == null ? void 0 : symlinkedDirectories.has(symlinkPath))) {
|
|
16476
|
-
(symlinkedDirectoriesByRealpath || (symlinkedDirectoriesByRealpath = createMultiMap())).add(
|
|
16483
|
+
(symlinkedDirectoriesByRealpath || (symlinkedDirectoriesByRealpath = createMultiMap())).add(real.realPath, symlink);
|
|
16477
16484
|
}
|
|
16478
16485
|
(symlinkedDirectories || (symlinkedDirectories = /* @__PURE__ */ new Map())).set(symlinkPath, real);
|
|
16479
16486
|
}
|
|
@@ -16496,7 +16503,10 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
|
|
|
16496
16503
|
if (commonResolved && commonOriginal) {
|
|
16497
16504
|
cache.setSymlinkedDirectory(
|
|
16498
16505
|
commonOriginal,
|
|
16499
|
-
{
|
|
16506
|
+
{
|
|
16507
|
+
real: ensureTrailingDirectorySeparator(commonResolved),
|
|
16508
|
+
realPath: ensureTrailingDirectorySeparator(toPath(commonResolved, cwd, getCanonicalFileName))
|
|
16509
|
+
}
|
|
16500
16510
|
);
|
|
16501
16511
|
}
|
|
16502
16512
|
}
|
|
@@ -17458,6 +17468,12 @@ function getPropertyNameFromType(type) {
|
|
|
17458
17468
|
function isExpandoPropertyDeclaration(declaration) {
|
|
17459
17469
|
return !!declaration && (isPropertyAccessExpression(declaration) || isElementAccessExpression(declaration) || isBinaryExpression(declaration));
|
|
17460
17470
|
}
|
|
17471
|
+
function hasResolutionModeOverride(node) {
|
|
17472
|
+
if (node === void 0) {
|
|
17473
|
+
return false;
|
|
17474
|
+
}
|
|
17475
|
+
return !!getResolutionModeOverride(node.attributes);
|
|
17476
|
+
}
|
|
17461
17477
|
|
|
17462
17478
|
// src/compiler/factory/baseNodeFactory.ts
|
|
17463
17479
|
function createBaseNodeFactory() {
|
|
@@ -18329,6 +18345,10 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
18329
18345
|
updateAssertEntry,
|
|
18330
18346
|
createImportTypeAssertionContainer,
|
|
18331
18347
|
updateImportTypeAssertionContainer,
|
|
18348
|
+
createImportAttributes,
|
|
18349
|
+
updateImportAttributes,
|
|
18350
|
+
createImportAttribute,
|
|
18351
|
+
updateImportAttribute,
|
|
18332
18352
|
createNamespaceImport,
|
|
18333
18353
|
updateNamespaceImport,
|
|
18334
18354
|
createNamespaceExport,
|
|
@@ -19597,18 +19617,21 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
19597
19617
|
function updateTemplateLiteralType(node, head, templateSpans) {
|
|
19598
19618
|
return node.head !== head || node.templateSpans !== templateSpans ? update(createTemplateLiteralType(head, templateSpans), node) : node;
|
|
19599
19619
|
}
|
|
19600
|
-
function createImportTypeNode(argument,
|
|
19620
|
+
function createImportTypeNode(argument, attributes, qualifier, typeArguments, isTypeOf = false) {
|
|
19601
19621
|
const node = createBaseNode(205 /* ImportType */);
|
|
19602
19622
|
node.argument = argument;
|
|
19603
|
-
node.
|
|
19623
|
+
node.attributes = attributes;
|
|
19624
|
+
if (node.assertions && node.assertions.assertClause && node.attributes) {
|
|
19625
|
+
node.assertions.assertClause = node.attributes;
|
|
19626
|
+
}
|
|
19604
19627
|
node.qualifier = qualifier;
|
|
19605
19628
|
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
19606
19629
|
node.isTypeOf = isTypeOf;
|
|
19607
19630
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
19608
19631
|
return node;
|
|
19609
19632
|
}
|
|
19610
|
-
function updateImportTypeNode(node, argument,
|
|
19611
|
-
return node.argument !== argument || node.
|
|
19633
|
+
function updateImportTypeNode(node, argument, attributes, qualifier, typeArguments, isTypeOf = node.isTypeOf) {
|
|
19634
|
+
return node.argument !== argument || node.attributes !== attributes || node.qualifier !== qualifier || node.typeArguments !== typeArguments || node.isTypeOf !== isTypeOf ? update(createImportTypeNode(argument, attributes, qualifier, typeArguments, isTypeOf), node) : node;
|
|
19612
19635
|
}
|
|
19613
19636
|
function createParenthesizedType(type) {
|
|
19614
19637
|
const node = createBaseNode(196 /* ParenthesizedType */);
|
|
@@ -20738,19 +20761,19 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20738
20761
|
function updateImportEqualsDeclaration(node, modifiers, isTypeOnly, name, moduleReference) {
|
|
20739
20762
|
return node.modifiers !== modifiers || node.isTypeOnly !== isTypeOnly || node.name !== name || node.moduleReference !== moduleReference ? update(createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference), node) : node;
|
|
20740
20763
|
}
|
|
20741
|
-
function createImportDeclaration(modifiers, importClause, moduleSpecifier,
|
|
20764
|
+
function createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes) {
|
|
20742
20765
|
const node = createBaseNode(272 /* ImportDeclaration */);
|
|
20743
20766
|
node.modifiers = asNodeArray(modifiers);
|
|
20744
20767
|
node.importClause = importClause;
|
|
20745
20768
|
node.moduleSpecifier = moduleSpecifier;
|
|
20746
|
-
node.assertClause =
|
|
20769
|
+
node.attributes = node.assertClause = attributes;
|
|
20747
20770
|
node.transformFlags |= propagateChildFlags(node.importClause) | propagateChildFlags(node.moduleSpecifier);
|
|
20748
20771
|
node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */;
|
|
20749
20772
|
node.jsDoc = void 0;
|
|
20750
20773
|
return node;
|
|
20751
20774
|
}
|
|
20752
|
-
function updateImportDeclaration(node, modifiers, importClause, moduleSpecifier,
|
|
20753
|
-
return node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.
|
|
20775
|
+
function updateImportDeclaration(node, modifiers, importClause, moduleSpecifier, attributes) {
|
|
20776
|
+
return node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.attributes !== attributes ? update(createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes), node) : node;
|
|
20754
20777
|
}
|
|
20755
20778
|
function createImportClause(isTypeOnly, name, namedBindings) {
|
|
20756
20779
|
const node = createBaseDeclaration(273 /* ImportClause */);
|
|
@@ -20771,6 +20794,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20771
20794
|
const node = createBaseNode(300 /* AssertClause */);
|
|
20772
20795
|
node.elements = createNodeArray(elements);
|
|
20773
20796
|
node.multiLine = multiLine;
|
|
20797
|
+
node.token = 132 /* AssertKeyword */;
|
|
20774
20798
|
node.transformFlags |= 4 /* ContainsESNext */;
|
|
20775
20799
|
return node;
|
|
20776
20800
|
}
|
|
@@ -20796,6 +20820,27 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20796
20820
|
function updateImportTypeAssertionContainer(node, clause, multiLine) {
|
|
20797
20821
|
return node.assertClause !== clause || node.multiLine !== multiLine ? update(createImportTypeAssertionContainer(clause, multiLine), node) : node;
|
|
20798
20822
|
}
|
|
20823
|
+
function createImportAttributes(elements, multiLine, token) {
|
|
20824
|
+
const node = createBaseNode(300 /* ImportAttributes */);
|
|
20825
|
+
node.token = token ?? 118 /* WithKeyword */;
|
|
20826
|
+
node.elements = createNodeArray(elements);
|
|
20827
|
+
node.multiLine = multiLine;
|
|
20828
|
+
node.transformFlags |= 4 /* ContainsESNext */;
|
|
20829
|
+
return node;
|
|
20830
|
+
}
|
|
20831
|
+
function updateImportAttributes(node, elements, multiLine) {
|
|
20832
|
+
return node.elements !== elements || node.multiLine !== multiLine ? update(createImportAttributes(elements, multiLine, node.token), node) : node;
|
|
20833
|
+
}
|
|
20834
|
+
function createImportAttribute(name, value) {
|
|
20835
|
+
const node = createBaseNode(301 /* ImportAttribute */);
|
|
20836
|
+
node.name = name;
|
|
20837
|
+
node.value = value;
|
|
20838
|
+
node.transformFlags |= 4 /* ContainsESNext */;
|
|
20839
|
+
return node;
|
|
20840
|
+
}
|
|
20841
|
+
function updateImportAttribute(node, name, value) {
|
|
20842
|
+
return node.name !== name || node.value !== value ? update(createImportAttribute(name, value), node) : node;
|
|
20843
|
+
}
|
|
20799
20844
|
function createNamespaceImport(name) {
|
|
20800
20845
|
const node = createBaseDeclaration(274 /* NamespaceImport */);
|
|
20801
20846
|
node.name = name;
|
|
@@ -20856,20 +20901,20 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20856
20901
|
function updateExportAssignment(node, modifiers, expression) {
|
|
20857
20902
|
return node.modifiers !== modifiers || node.expression !== expression ? update(createExportAssignment(modifiers, node.isExportEquals, expression), node) : node;
|
|
20858
20903
|
}
|
|
20859
|
-
function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier,
|
|
20904
|
+
function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes) {
|
|
20860
20905
|
const node = createBaseDeclaration(278 /* ExportDeclaration */);
|
|
20861
20906
|
node.modifiers = asNodeArray(modifiers);
|
|
20862
20907
|
node.isTypeOnly = isTypeOnly;
|
|
20863
20908
|
node.exportClause = exportClause;
|
|
20864
20909
|
node.moduleSpecifier = moduleSpecifier;
|
|
20865
|
-
node.assertClause =
|
|
20910
|
+
node.attributes = node.assertClause = attributes;
|
|
20866
20911
|
node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.exportClause) | propagateChildFlags(node.moduleSpecifier);
|
|
20867
20912
|
node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */;
|
|
20868
20913
|
node.jsDoc = void 0;
|
|
20869
20914
|
return node;
|
|
20870
20915
|
}
|
|
20871
|
-
function updateExportDeclaration(node, modifiers, isTypeOnly, exportClause, moduleSpecifier,
|
|
20872
|
-
return node.modifiers !== modifiers || node.isTypeOnly !== isTypeOnly || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier || node.
|
|
20916
|
+
function updateExportDeclaration(node, modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes) {
|
|
20917
|
+
return node.modifiers !== modifiers || node.isTypeOnly !== isTypeOnly || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier || node.attributes !== attributes ? finishUpdateExportDeclaration(createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes), node) : node;
|
|
20873
20918
|
}
|
|
20874
20919
|
function finishUpdateExportDeclaration(updated, original) {
|
|
20875
20920
|
if (updated !== original) {
|
|
@@ -22196,7 +22241,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22196
22241
|
} else {
|
|
22197
22242
|
modifierArray = modifiers;
|
|
22198
22243
|
}
|
|
22199
|
-
return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.
|
|
22244
|
+
return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.attributes) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.attributes) : Debug.assertNever(node);
|
|
22200
22245
|
}
|
|
22201
22246
|
function updateModifierLike(node, modifierArray) {
|
|
22202
22247
|
return isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isPropertyDeclaration(node) ? updatePropertyDeclaration(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : Debug.assertNever(node);
|
|
@@ -24420,14 +24465,14 @@ function isImportDeclaration(node) {
|
|
|
24420
24465
|
function isImportClause(node) {
|
|
24421
24466
|
return node.kind === 273 /* ImportClause */;
|
|
24422
24467
|
}
|
|
24423
|
-
function isImportTypeAssertionContainer(node) {
|
|
24424
|
-
return node.kind === 302 /* ImportTypeAssertionContainer */;
|
|
24425
|
-
}
|
|
24426
24468
|
function isAssertClause(node) {
|
|
24427
24469
|
return node.kind === 300 /* AssertClause */;
|
|
24428
24470
|
}
|
|
24429
|
-
function
|
|
24430
|
-
return node.kind ===
|
|
24471
|
+
function isImportAttributes(node) {
|
|
24472
|
+
return node.kind === 300 /* ImportAttributes */;
|
|
24473
|
+
}
|
|
24474
|
+
function isImportAttribute(node) {
|
|
24475
|
+
return node.kind === 301 /* ImportAttribute */;
|
|
24431
24476
|
}
|
|
24432
24477
|
function isNamespaceImport(node) {
|
|
24433
24478
|
return node.kind === 274 /* NamespaceImport */;
|
|
@@ -25103,7 +25148,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
25103
25148
|
namedBindings
|
|
25104
25149
|
),
|
|
25105
25150
|
nodeFactory.createStringLiteral(externalHelpersModuleNameText),
|
|
25106
|
-
/*
|
|
25151
|
+
/*attributes*/
|
|
25107
25152
|
void 0
|
|
25108
25153
|
);
|
|
25109
25154
|
addInternalEmitFlags(externalHelpersImportDeclaration, 2 /* NeverApplyImportHelper */);
|
|
@@ -25857,7 +25902,7 @@ var forEachChildTable = {
|
|
|
25857
25902
|
return visitNode2(cbNode, node.typeParameter);
|
|
25858
25903
|
},
|
|
25859
25904
|
[205 /* ImportType */]: function forEachChildInImportType(node, cbNode, cbNodes) {
|
|
25860
|
-
return visitNode2(cbNode, node.argument) || visitNode2(cbNode, node.
|
|
25905
|
+
return visitNode2(cbNode, node.argument) || visitNode2(cbNode, node.attributes) || visitNode2(cbNode, node.qualifier) || visitNodes(cbNode, cbNodes, node.typeArguments);
|
|
25861
25906
|
},
|
|
25862
25907
|
[302 /* ImportTypeAssertionContainer */]: function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) {
|
|
25863
25908
|
return visitNode2(cbNode, node.assertClause);
|
|
@@ -26031,15 +26076,15 @@ var forEachChildTable = {
|
|
|
26031
26076
|
return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.moduleReference);
|
|
26032
26077
|
},
|
|
26033
26078
|
[272 /* ImportDeclaration */]: function forEachChildInImportDeclaration(node, cbNode, cbNodes) {
|
|
26034
|
-
return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.importClause) || visitNode2(cbNode, node.moduleSpecifier) || visitNode2(cbNode, node.
|
|
26079
|
+
return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.importClause) || visitNode2(cbNode, node.moduleSpecifier) || visitNode2(cbNode, node.attributes);
|
|
26035
26080
|
},
|
|
26036
26081
|
[273 /* ImportClause */]: function forEachChildInImportClause(node, cbNode, _cbNodes) {
|
|
26037
26082
|
return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.namedBindings);
|
|
26038
26083
|
},
|
|
26039
|
-
[300 /*
|
|
26084
|
+
[300 /* ImportAttributes */]: function forEachChildInImportAttributes(node, cbNode, cbNodes) {
|
|
26040
26085
|
return visitNodes(cbNode, cbNodes, node.elements);
|
|
26041
26086
|
},
|
|
26042
|
-
[301 /*
|
|
26087
|
+
[301 /* ImportAttribute */]: function forEachChildInImportAttribute(node, cbNode, _cbNodes) {
|
|
26043
26088
|
return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.value);
|
|
26044
26089
|
},
|
|
26045
26090
|
[270 /* NamespaceExportDeclaration */]: function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) {
|
|
@@ -26054,7 +26099,7 @@ var forEachChildTable = {
|
|
|
26054
26099
|
[275 /* NamedImports */]: forEachChildInNamedImportsOrExports,
|
|
26055
26100
|
[279 /* NamedExports */]: forEachChildInNamedImportsOrExports,
|
|
26056
26101
|
[278 /* ExportDeclaration */]: function forEachChildInExportDeclaration(node, cbNode, cbNodes) {
|
|
26057
|
-
return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.exportClause) || visitNode2(cbNode, node.moduleSpecifier) || visitNode2(cbNode, node.
|
|
26102
|
+
return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.exportClause) || visitNode2(cbNode, node.moduleSpecifier) || visitNode2(cbNode, node.attributes);
|
|
26058
26103
|
},
|
|
26059
26104
|
[276 /* ImportSpecifier */]: forEachChildInImportOrExportSpecifier,
|
|
26060
26105
|
[281 /* ExportSpecifier */]: forEachChildInImportOrExportSpecifier,
|
|
@@ -27319,7 +27364,7 @@ var Parser;
|
|
|
27319
27364
|
function isLiteralPropertyName() {
|
|
27320
27365
|
return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */;
|
|
27321
27366
|
}
|
|
27322
|
-
function
|
|
27367
|
+
function isImportAttributeName2() {
|
|
27323
27368
|
return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */;
|
|
27324
27369
|
}
|
|
27325
27370
|
function parsePropertyNameWorker(allowComputedPropertyNames) {
|
|
@@ -27438,8 +27483,8 @@ var Parser;
|
|
|
27438
27483
|
return isLiteralPropertyName();
|
|
27439
27484
|
case 9 /* ObjectBindingElements */:
|
|
27440
27485
|
return token() === 23 /* OpenBracketToken */ || token() === 26 /* DotDotDotToken */ || isLiteralPropertyName();
|
|
27441
|
-
case 24 /*
|
|
27442
|
-
return
|
|
27486
|
+
case 24 /* ImportAttributes */:
|
|
27487
|
+
return isImportAttributeName2();
|
|
27443
27488
|
case 7 /* HeritageClauseElement */:
|
|
27444
27489
|
if (token() === 19 /* OpenBraceToken */) {
|
|
27445
27490
|
return lookAhead(isValidHeritageClauseObjectLiteral);
|
|
@@ -27542,7 +27587,7 @@ var Parser;
|
|
|
27542
27587
|
case 12 /* ObjectLiteralMembers */:
|
|
27543
27588
|
case 9 /* ObjectBindingElements */:
|
|
27544
27589
|
case 23 /* ImportOrExportSpecifiers */:
|
|
27545
|
-
case 24 /*
|
|
27590
|
+
case 24 /* ImportAttributes */:
|
|
27546
27591
|
return token() === 20 /* CloseBraceToken */;
|
|
27547
27592
|
case 3 /* SwitchClauseStatements */:
|
|
27548
27593
|
return token() === 20 /* CloseBraceToken */ || token() === 84 /* CaseKeyword */ || token() === 90 /* DefaultKeyword */;
|
|
@@ -27848,7 +27893,7 @@ var Parser;
|
|
|
27848
27893
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
27849
27894
|
case 14 /* JsxChildren */:
|
|
27850
27895
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
27851
|
-
case 24 /*
|
|
27896
|
+
case 24 /* ImportAttributes */:
|
|
27852
27897
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
|
|
27853
27898
|
case 25 /* JSDocComment */:
|
|
27854
27899
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
@@ -28723,28 +28768,6 @@ var Parser;
|
|
|
28723
28768
|
nextToken();
|
|
28724
28769
|
return token() === 102 /* ImportKeyword */;
|
|
28725
28770
|
}
|
|
28726
|
-
function parseImportTypeAssertions() {
|
|
28727
|
-
const pos = getNodePos();
|
|
28728
|
-
const openBracePosition = scanner.getTokenStart();
|
|
28729
|
-
parseExpected(19 /* OpenBraceToken */);
|
|
28730
|
-
const multiLine = scanner.hasPrecedingLineBreak();
|
|
28731
|
-
parseExpected(132 /* AssertKeyword */);
|
|
28732
|
-
parseExpected(59 /* ColonToken */);
|
|
28733
|
-
const clause = parseAssertClause(
|
|
28734
|
-
/*skipAssertKeyword*/
|
|
28735
|
-
true
|
|
28736
|
-
);
|
|
28737
|
-
if (!parseExpected(20 /* CloseBraceToken */)) {
|
|
28738
|
-
const lastError = lastOrUndefined(parseDiagnostics);
|
|
28739
|
-
if (lastError && lastError.code === Diagnostics._0_expected.code) {
|
|
28740
|
-
addRelatedInfo(
|
|
28741
|
-
lastError,
|
|
28742
|
-
createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
|
|
28743
|
-
);
|
|
28744
|
-
}
|
|
28745
|
-
}
|
|
28746
|
-
return finishNode(factory2.createImportTypeAssertionContainer(clause, multiLine), pos);
|
|
28747
|
-
}
|
|
28748
28771
|
function parseImportType() {
|
|
28749
28772
|
sourceFlags |= 4194304 /* PossiblyContainsDynamicImport */;
|
|
28750
28773
|
const pos = getNodePos();
|
|
@@ -28752,14 +28775,36 @@ var Parser;
|
|
|
28752
28775
|
parseExpected(102 /* ImportKeyword */);
|
|
28753
28776
|
parseExpected(21 /* OpenParenToken */);
|
|
28754
28777
|
const type = parseType();
|
|
28755
|
-
let
|
|
28778
|
+
let attributes;
|
|
28756
28779
|
if (parseOptional(28 /* CommaToken */)) {
|
|
28757
|
-
|
|
28780
|
+
const openBracePosition = scanner.getTokenStart();
|
|
28781
|
+
parseExpected(19 /* OpenBraceToken */);
|
|
28782
|
+
const currentToken2 = token();
|
|
28783
|
+
if (currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) {
|
|
28784
|
+
nextToken();
|
|
28785
|
+
} else {
|
|
28786
|
+
parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(118 /* WithKeyword */));
|
|
28787
|
+
}
|
|
28788
|
+
parseExpected(59 /* ColonToken */);
|
|
28789
|
+
attributes = parseImportAttributes(
|
|
28790
|
+
currentToken2,
|
|
28791
|
+
/*skipKeyword*/
|
|
28792
|
+
true
|
|
28793
|
+
);
|
|
28794
|
+
if (!parseExpected(20 /* CloseBraceToken */)) {
|
|
28795
|
+
const lastError = lastOrUndefined(parseDiagnostics);
|
|
28796
|
+
if (lastError && lastError.code === Diagnostics._0_expected.code) {
|
|
28797
|
+
addRelatedInfo(
|
|
28798
|
+
lastError,
|
|
28799
|
+
createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
|
|
28800
|
+
);
|
|
28801
|
+
}
|
|
28802
|
+
}
|
|
28758
28803
|
}
|
|
28759
28804
|
parseExpected(22 /* CloseParenToken */);
|
|
28760
28805
|
const qualifier = parseOptional(25 /* DotToken */) ? parseEntityNameOfTypeReference() : void 0;
|
|
28761
28806
|
const typeArguments = parseTypeArgumentsOfTypeReference();
|
|
28762
|
-
return finishNode(factory2.createImportTypeNode(type,
|
|
28807
|
+
return finishNode(factory2.createImportTypeNode(type, attributes, qualifier, typeArguments, isTypeOf), pos);
|
|
28763
28808
|
}
|
|
28764
28809
|
function nextTokenIsNumericOrBigIntLiteral() {
|
|
28765
28810
|
nextToken();
|
|
@@ -31821,15 +31866,16 @@ var Parser;
|
|
|
31821
31866
|
parseExpected(161 /* FromKeyword */);
|
|
31822
31867
|
}
|
|
31823
31868
|
const moduleSpecifier = parseModuleSpecifier();
|
|
31824
|
-
|
|
31825
|
-
|
|
31826
|
-
|
|
31869
|
+
const currentToken2 = token();
|
|
31870
|
+
let attributes;
|
|
31871
|
+
if ((currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) && !scanner.hasPrecedingLineBreak()) {
|
|
31872
|
+
attributes = parseImportAttributes(currentToken2);
|
|
31827
31873
|
}
|
|
31828
31874
|
parseSemicolon();
|
|
31829
|
-
const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier,
|
|
31875
|
+
const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes);
|
|
31830
31876
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
31831
31877
|
}
|
|
31832
|
-
function
|
|
31878
|
+
function parseImportAttribute() {
|
|
31833
31879
|
const pos = getNodePos();
|
|
31834
31880
|
const name = tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(11 /* StringLiteral */);
|
|
31835
31881
|
parseExpected(59 /* ColonToken */);
|
|
@@ -31837,19 +31883,19 @@ var Parser;
|
|
|
31837
31883
|
/*allowReturnTypeInArrowFunction*/
|
|
31838
31884
|
true
|
|
31839
31885
|
);
|
|
31840
|
-
return finishNode(factory2.
|
|
31886
|
+
return finishNode(factory2.createImportAttribute(name, value), pos);
|
|
31841
31887
|
}
|
|
31842
|
-
function
|
|
31888
|
+
function parseImportAttributes(token2, skipKeyword) {
|
|
31843
31889
|
const pos = getNodePos();
|
|
31844
|
-
if (!
|
|
31845
|
-
parseExpected(
|
|
31890
|
+
if (!skipKeyword) {
|
|
31891
|
+
parseExpected(token2);
|
|
31846
31892
|
}
|
|
31847
31893
|
const openBracePosition = scanner.getTokenStart();
|
|
31848
31894
|
if (parseExpected(19 /* OpenBraceToken */)) {
|
|
31849
31895
|
const multiLine = scanner.hasPrecedingLineBreak();
|
|
31850
31896
|
const elements = parseDelimitedList(
|
|
31851
|
-
24 /*
|
|
31852
|
-
|
|
31897
|
+
24 /* ImportAttributes */,
|
|
31898
|
+
parseImportAttribute,
|
|
31853
31899
|
/*considerSemicolonAsDelimiter*/
|
|
31854
31900
|
true
|
|
31855
31901
|
);
|
|
@@ -31862,7 +31908,7 @@ var Parser;
|
|
|
31862
31908
|
);
|
|
31863
31909
|
}
|
|
31864
31910
|
}
|
|
31865
|
-
return finishNode(factory2.
|
|
31911
|
+
return finishNode(factory2.createImportAttributes(elements, multiLine, token2), pos);
|
|
31866
31912
|
} else {
|
|
31867
31913
|
const elements = createNodeArray(
|
|
31868
31914
|
[],
|
|
@@ -31872,10 +31918,11 @@ var Parser;
|
|
|
31872
31918
|
/*hasTrailingComma*/
|
|
31873
31919
|
false
|
|
31874
31920
|
);
|
|
31875
|
-
return finishNode(factory2.
|
|
31921
|
+
return finishNode(factory2.createImportAttributes(
|
|
31876
31922
|
elements,
|
|
31877
31923
|
/*multiLine*/
|
|
31878
|
-
false
|
|
31924
|
+
false,
|
|
31925
|
+
token2
|
|
31879
31926
|
), pos);
|
|
31880
31927
|
}
|
|
31881
31928
|
}
|
|
@@ -32007,7 +32054,7 @@ var Parser;
|
|
|
32007
32054
|
);
|
|
32008
32055
|
let exportClause;
|
|
32009
32056
|
let moduleSpecifier;
|
|
32010
|
-
let
|
|
32057
|
+
let attributes;
|
|
32011
32058
|
const isTypeOnly = parseOptional(156 /* TypeKeyword */);
|
|
32012
32059
|
const namespaceExportPos = getNodePos();
|
|
32013
32060
|
if (parseOptional(42 /* AsteriskToken */)) {
|
|
@@ -32023,12 +32070,13 @@ var Parser;
|
|
|
32023
32070
|
moduleSpecifier = parseModuleSpecifier();
|
|
32024
32071
|
}
|
|
32025
32072
|
}
|
|
32026
|
-
|
|
32027
|
-
|
|
32073
|
+
const currentToken2 = token();
|
|
32074
|
+
if (moduleSpecifier && (currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) && !scanner.hasPrecedingLineBreak()) {
|
|
32075
|
+
attributes = parseImportAttributes(currentToken2);
|
|
32028
32076
|
}
|
|
32029
32077
|
parseSemicolon();
|
|
32030
32078
|
setAwaitContext(savedAwaitContext);
|
|
32031
|
-
const node = factory2.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier,
|
|
32079
|
+
const node = factory2.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes);
|
|
32032
32080
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
32033
32081
|
}
|
|
32034
32082
|
function parseExportAssignment(pos, hasJSDoc, modifiers) {
|
|
@@ -32078,7 +32126,7 @@ var Parser;
|
|
|
32078
32126
|
ParsingContext2[ParsingContext2["TupleElementTypes"] = 21] = "TupleElementTypes";
|
|
32079
32127
|
ParsingContext2[ParsingContext2["HeritageClauses"] = 22] = "HeritageClauses";
|
|
32080
32128
|
ParsingContext2[ParsingContext2["ImportOrExportSpecifiers"] = 23] = "ImportOrExportSpecifiers";
|
|
32081
|
-
ParsingContext2[ParsingContext2["
|
|
32129
|
+
ParsingContext2[ParsingContext2["ImportAttributes"] = 24] = "ImportAttributes";
|
|
32082
32130
|
ParsingContext2[ParsingContext2["JSDocComment"] = 25] = "JSDocComment";
|
|
32083
32131
|
ParsingContext2[ParsingContext2["Count"] = 26] = "Count";
|
|
32084
32132
|
})(ParsingContext || (ParsingContext = {}));
|
|
@@ -37061,10 +37109,15 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
37061
37109
|
const failedLookupLocations = [];
|
|
37062
37110
|
const affectingLocations = [];
|
|
37063
37111
|
let features = getNodeResolutionFeatures(options);
|
|
37064
|
-
if (resolutionMode
|
|
37112
|
+
if (resolutionMode !== void 0) {
|
|
37113
|
+
features |= 30 /* AllFeatures */;
|
|
37114
|
+
}
|
|
37115
|
+
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
37116
|
+
if (resolutionMode === 99 /* ESNext */ && (3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) {
|
|
37065
37117
|
features |= 32 /* EsmMode */;
|
|
37066
37118
|
}
|
|
37067
|
-
const
|
|
37119
|
+
const useImportCondition = resolutionMode === 99 /* ESNext */ || (resolutionMode !== void 0 ? false : void 0);
|
|
37120
|
+
const conditions = features & 8 /* Exports */ ? getConditions(options, useImportCondition) : [];
|
|
37068
37121
|
const diagnostics = [];
|
|
37069
37122
|
const moduleResolutionState = {
|
|
37070
37123
|
compilerOptions: options,
|
|
@@ -37233,11 +37286,19 @@ function getNodeResolutionFeatures(options) {
|
|
|
37233
37286
|
return features;
|
|
37234
37287
|
}
|
|
37235
37288
|
function getConditions(options, esmMode) {
|
|
37236
|
-
const
|
|
37289
|
+
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
37290
|
+
if (esmMode === void 0) {
|
|
37291
|
+
if (moduleResolution === 100 /* Bundler */) {
|
|
37292
|
+
esmMode ?? (esmMode = moduleResolution === 100 /* Bundler */);
|
|
37293
|
+
} else if (moduleResolution === 2 /* Node10 */) {
|
|
37294
|
+
return [];
|
|
37295
|
+
}
|
|
37296
|
+
}
|
|
37297
|
+
const conditions = esmMode ? ["import"] : ["require"];
|
|
37237
37298
|
if (!options.noDtsResolution) {
|
|
37238
37299
|
conditions.push("types");
|
|
37239
37300
|
}
|
|
37240
|
-
if (
|
|
37301
|
+
if (moduleResolution !== 100 /* Bundler */) {
|
|
37241
37302
|
conditions.push("node");
|
|
37242
37303
|
}
|
|
37243
37304
|
return concatenate(conditions, options.customConditions);
|
|
@@ -37655,13 +37716,13 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
37655
37716
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
37656
37717
|
break;
|
|
37657
37718
|
case 2 /* Node10 */:
|
|
37658
|
-
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
37719
|
+
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode ? getConditions(compilerOptions, resolutionMode === 99 /* ESNext */) : void 0);
|
|
37659
37720
|
break;
|
|
37660
37721
|
case 1 /* Classic */:
|
|
37661
37722
|
result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
37662
37723
|
break;
|
|
37663
37724
|
case 100 /* Bundler */:
|
|
37664
|
-
result = bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
37725
|
+
result = bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode ? getConditions(compilerOptions, resolutionMode === 99 /* ESNext */) : void 0);
|
|
37665
37726
|
break;
|
|
37666
37727
|
default:
|
|
37667
37728
|
return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`);
|
|
@@ -37826,7 +37887,7 @@ function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions,
|
|
|
37826
37887
|
resolutionMode
|
|
37827
37888
|
);
|
|
37828
37889
|
}
|
|
37829
|
-
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
37890
|
+
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode, conditions) {
|
|
37830
37891
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
37831
37892
|
const esmMode = resolutionMode === 99 /* ESNext */ ? 32 /* EsmMode */ : 0;
|
|
37832
37893
|
let extensions = compilerOptions.noDtsResolution ? 3 /* ImplementationFiles */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
|
|
@@ -37843,7 +37904,8 @@ function nodeNextModuleNameResolverWorker(features, moduleName, containingFile,
|
|
|
37843
37904
|
extensions,
|
|
37844
37905
|
/*isConfigLookup*/
|
|
37845
37906
|
false,
|
|
37846
|
-
redirectedReference
|
|
37907
|
+
redirectedReference,
|
|
37908
|
+
conditions
|
|
37847
37909
|
);
|
|
37848
37910
|
}
|
|
37849
37911
|
function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
@@ -37859,10 +37921,12 @@ function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
|
37859
37921
|
/*isConfigLookup*/
|
|
37860
37922
|
false,
|
|
37861
37923
|
/*redirectedReference*/
|
|
37924
|
+
void 0,
|
|
37925
|
+
/*conditions*/
|
|
37862
37926
|
void 0
|
|
37863
37927
|
);
|
|
37864
37928
|
}
|
|
37865
|
-
function bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
37929
|
+
function bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, conditions) {
|
|
37866
37930
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
37867
37931
|
let extensions = compilerOptions.noDtsResolution ? 3 /* ImplementationFiles */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
|
|
37868
37932
|
if (getResolveJsonModule(compilerOptions)) {
|
|
@@ -37878,10 +37942,11 @@ function bundlerModuleNameResolver(moduleName, containingFile, compilerOptions,
|
|
|
37878
37942
|
extensions,
|
|
37879
37943
|
/*isConfigLookup*/
|
|
37880
37944
|
false,
|
|
37881
|
-
redirectedReference
|
|
37945
|
+
redirectedReference,
|
|
37946
|
+
conditions
|
|
37882
37947
|
);
|
|
37883
37948
|
}
|
|
37884
|
-
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, isConfigLookup) {
|
|
37949
|
+
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, conditions, isConfigLookup) {
|
|
37885
37950
|
let extensions;
|
|
37886
37951
|
if (isConfigLookup) {
|
|
37887
37952
|
extensions = 8 /* Json */;
|
|
@@ -37892,7 +37957,7 @@ function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, hos
|
|
|
37892
37957
|
} else {
|
|
37893
37958
|
extensions = getResolveJsonModule(compilerOptions) ? 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */ | 8 /* Json */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
|
|
37894
37959
|
}
|
|
37895
|
-
return nodeModuleNameResolverWorker(0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference);
|
|
37960
|
+
return nodeModuleNameResolverWorker(conditions ? 30 /* AllFeatures */ : 0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference, conditions);
|
|
37896
37961
|
}
|
|
37897
37962
|
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
37898
37963
|
return nodeModuleNameResolverWorker(
|
|
@@ -37907,15 +37972,21 @@ function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
|
37907
37972
|
/*isConfigLookup*/
|
|
37908
37973
|
true,
|
|
37909
37974
|
/*redirectedReference*/
|
|
37975
|
+
void 0,
|
|
37976
|
+
/*conditions*/
|
|
37910
37977
|
void 0
|
|
37911
37978
|
);
|
|
37912
37979
|
}
|
|
37913
|
-
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference) {
|
|
37980
|
+
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference, conditions) {
|
|
37914
37981
|
var _a, _b, _c, _d;
|
|
37915
37982
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
37916
37983
|
const failedLookupLocations = [];
|
|
37917
37984
|
const affectingLocations = [];
|
|
37918
|
-
const
|
|
37985
|
+
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
37986
|
+
conditions ?? (conditions = getConditions(
|
|
37987
|
+
compilerOptions,
|
|
37988
|
+
moduleResolution === 100 /* Bundler */ || moduleResolution === 2 /* Node10 */ ? void 0 : !!(features & 32 /* EsmMode */)
|
|
37989
|
+
));
|
|
37919
37990
|
const diagnostics = [];
|
|
37920
37991
|
const state = {
|
|
37921
37992
|
compilerOptions,
|
|
@@ -37925,17 +37996,17 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37925
37996
|
affectingLocations,
|
|
37926
37997
|
packageJsonInfoCache: cache,
|
|
37927
37998
|
features,
|
|
37928
|
-
conditions,
|
|
37999
|
+
conditions: conditions ?? emptyArray,
|
|
37929
38000
|
requestContainingDirectory: containingDirectory,
|
|
37930
38001
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
37931
38002
|
isConfigLookup,
|
|
37932
38003
|
candidateIsFromPackageJsonField: false
|
|
37933
38004
|
};
|
|
37934
|
-
if (traceEnabled && moduleResolutionSupportsPackageJsonExportsAndImports(
|
|
37935
|
-
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
38005
|
+
if (traceEnabled && moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
38006
|
+
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", state.conditions.map((c) => `'${c}'`).join(", "));
|
|
37936
38007
|
}
|
|
37937
38008
|
let result;
|
|
37938
|
-
if (
|
|
38009
|
+
if (moduleResolution === 2 /* Node10 */) {
|
|
37939
38010
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
37940
38011
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
37941
38012
|
result = priorityExtensions && tryResolve(priorityExtensions, state) || secondaryExtensions && tryResolve(secondaryExtensions, state) || void 0;
|
|
@@ -37943,7 +38014,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37943
38014
|
result = tryResolve(extensions, state);
|
|
37944
38015
|
}
|
|
37945
38016
|
let legacyResult;
|
|
37946
|
-
if (((_a = result == null ? void 0 : result.value) == null ? void 0 : _a.isExternalLibraryImport) && !isConfigLookup && extensions & (1 /* TypeScript */ | 4 /* Declaration */) && features & 8 /* Exports */ && !isExternalModuleNameRelative(moduleName) && !extensionIsOk(1 /* TypeScript */ | 4 /* Declaration */, result.value.resolved.extension) && conditions.includes("import")) {
|
|
38017
|
+
if (((_a = result == null ? void 0 : result.value) == null ? void 0 : _a.isExternalLibraryImport) && !isConfigLookup && extensions & (1 /* TypeScript */ | 4 /* Declaration */) && features & 8 /* Exports */ && !isExternalModuleNameRelative(moduleName) && !extensionIsOk(1 /* TypeScript */ | 4 /* Declaration */, result.value.resolved.extension) && (conditions == null ? void 0 : conditions.includes("import"))) {
|
|
37947
38018
|
traceIfEnabled(state, Diagnostics.Resolution_of_non_relative_name_failed_trying_with_modern_Node_resolution_features_disabled_to_see_if_npm_library_needs_configuration_update);
|
|
37948
38019
|
const diagnosticState = {
|
|
37949
38020
|
...state,
|
|
@@ -38619,7 +38690,8 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38619
38690
|
extensions,
|
|
38620
38691
|
/*isConfigLookup*/
|
|
38621
38692
|
false,
|
|
38622
|
-
redirectedReference
|
|
38693
|
+
redirectedReference,
|
|
38694
|
+
state.conditions
|
|
38623
38695
|
);
|
|
38624
38696
|
return toSearchResult(
|
|
38625
38697
|
result.resolvedModule ? {
|
|
@@ -43279,24 +43351,7 @@ function createTypeChecker(host) {
|
|
|
43279
43351
|
getTypeOfPropertyOfContextualType,
|
|
43280
43352
|
getFullyQualifiedName,
|
|
43281
43353
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
43282
|
-
|
|
43283
|
-
if (checkMode & 32 /* IsForStringLiteralArgumentCompletions */) {
|
|
43284
|
-
return runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
|
|
43285
|
-
call,
|
|
43286
|
-
candidatesOutArray,
|
|
43287
|
-
/*argumentCount*/
|
|
43288
|
-
void 0,
|
|
43289
|
-
checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
|
|
43290
|
-
));
|
|
43291
|
-
}
|
|
43292
|
-
return runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker(
|
|
43293
|
-
call,
|
|
43294
|
-
candidatesOutArray,
|
|
43295
|
-
/*argumentCount*/
|
|
43296
|
-
void 0,
|
|
43297
|
-
checkMode & ~32 /* IsForStringLiteralArgumentCompletions */
|
|
43298
|
-
));
|
|
43299
|
-
},
|
|
43354
|
+
getCandidateSignaturesForStringLiteralCompletions,
|
|
43300
43355
|
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
43301
43356
|
getExpandedParameters,
|
|
43302
43357
|
hasEffectiveRestParameter,
|
|
@@ -43495,32 +43550,59 @@ function createTypeChecker(host) {
|
|
|
43495
43550
|
isTypeParameterPossiblyReferenced,
|
|
43496
43551
|
typeHasCallOrConstructSignatures
|
|
43497
43552
|
};
|
|
43553
|
+
function getCandidateSignaturesForStringLiteralCompletions(call, editingArgument) {
|
|
43554
|
+
const candidatesSet = /* @__PURE__ */ new Set();
|
|
43555
|
+
const candidates = [];
|
|
43556
|
+
runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
|
|
43557
|
+
call,
|
|
43558
|
+
candidates,
|
|
43559
|
+
/*argumentCount*/
|
|
43560
|
+
void 0,
|
|
43561
|
+
32 /* IsForStringLiteralArgumentCompletions */
|
|
43562
|
+
));
|
|
43563
|
+
for (const candidate of candidates) {
|
|
43564
|
+
candidatesSet.add(candidate);
|
|
43565
|
+
}
|
|
43566
|
+
candidates.length = 0;
|
|
43567
|
+
runWithoutResolvedSignatureCaching(editingArgument, () => getResolvedSignatureWorker(
|
|
43568
|
+
call,
|
|
43569
|
+
candidates,
|
|
43570
|
+
/*argumentCount*/
|
|
43571
|
+
void 0,
|
|
43572
|
+
0 /* Normal */
|
|
43573
|
+
));
|
|
43574
|
+
for (const candidate of candidates) {
|
|
43575
|
+
candidatesSet.add(candidate);
|
|
43576
|
+
}
|
|
43577
|
+
return arrayFrom(candidatesSet);
|
|
43578
|
+
}
|
|
43498
43579
|
function runWithoutResolvedSignatureCaching(node, fn) {
|
|
43499
|
-
|
|
43500
|
-
|
|
43501
|
-
|
|
43502
|
-
|
|
43580
|
+
node = findAncestor(node, isCallLikeOrFunctionLikeExpression);
|
|
43581
|
+
if (node) {
|
|
43582
|
+
const cachedResolvedSignatures = [];
|
|
43583
|
+
const cachedTypes2 = [];
|
|
43584
|
+
while (node) {
|
|
43503
43585
|
const nodeLinks2 = getNodeLinks(node);
|
|
43504
|
-
|
|
43505
|
-
cachedResolvedSignatures.push([nodeLinks2, resolvedSignature]);
|
|
43586
|
+
cachedResolvedSignatures.push([nodeLinks2, nodeLinks2.resolvedSignature]);
|
|
43506
43587
|
nodeLinks2.resolvedSignature = void 0;
|
|
43588
|
+
if (isFunctionLike(node)) {
|
|
43589
|
+
const symbolLinks2 = getSymbolLinks(getSymbolOfDeclaration(node));
|
|
43590
|
+
const type = symbolLinks2.type;
|
|
43591
|
+
cachedTypes2.push([symbolLinks2, type]);
|
|
43592
|
+
symbolLinks2.type = void 0;
|
|
43593
|
+
}
|
|
43594
|
+
node = findAncestor(node.parent, isCallLikeOrFunctionLikeExpression);
|
|
43507
43595
|
}
|
|
43508
|
-
|
|
43509
|
-
|
|
43510
|
-
|
|
43511
|
-
cachedTypes2.push([symbolLinks2, type]);
|
|
43512
|
-
symbolLinks2.type = void 0;
|
|
43596
|
+
const result = fn();
|
|
43597
|
+
for (const [nodeLinks2, resolvedSignature] of cachedResolvedSignatures) {
|
|
43598
|
+
nodeLinks2.resolvedSignature = resolvedSignature;
|
|
43513
43599
|
}
|
|
43514
|
-
|
|
43515
|
-
|
|
43516
|
-
|
|
43517
|
-
|
|
43518
|
-
nodeLinks2.resolvedSignature = resolvedSignature;
|
|
43519
|
-
}
|
|
43520
|
-
for (const [symbolLinks2, type] of cachedTypes2) {
|
|
43521
|
-
symbolLinks2.type = type;
|
|
43600
|
+
for (const [symbolLinks2, type] of cachedTypes2) {
|
|
43601
|
+
symbolLinks2.type = type;
|
|
43602
|
+
}
|
|
43603
|
+
return result;
|
|
43522
43604
|
}
|
|
43523
|
-
return
|
|
43605
|
+
return fn();
|
|
43524
43606
|
}
|
|
43525
43607
|
function runWithInferenceBlockedFromSourceNode(node, fn) {
|
|
43526
43608
|
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
@@ -46302,7 +46384,7 @@ function createTypeChecker(host) {
|
|
|
46302
46384
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
46303
46385
|
}
|
|
46304
46386
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
46305
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j
|
|
46387
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
46306
46388
|
if (startsWith(moduleReference, "@types/")) {
|
|
46307
46389
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
46308
46390
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -46357,9 +46439,8 @@ function createTypeChecker(host) {
|
|
|
46357
46439
|
}
|
|
46358
46440
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
46359
46441
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
46360
|
-
const
|
|
46361
|
-
|
|
46362
|
-
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
46442
|
+
const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
46443
|
+
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
|
|
46363
46444
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
46364
46445
|
error(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
|
|
46365
46446
|
} else {
|
|
@@ -46465,7 +46546,7 @@ function createTypeChecker(host) {
|
|
|
46465
46546
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
46466
46547
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
46467
46548
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
46468
|
-
const suggestedExt = (
|
|
46549
|
+
const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
|
|
46469
46550
|
if (suggestedExt) {
|
|
46470
46551
|
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
46471
46552
|
} else {
|
|
@@ -48230,7 +48311,7 @@ function createTypeChecker(host) {
|
|
|
48230
48311
|
return factory.updateImportTypeNode(
|
|
48231
48312
|
root,
|
|
48232
48313
|
root.argument,
|
|
48233
|
-
root.
|
|
48314
|
+
root.attributes,
|
|
48234
48315
|
qualifier,
|
|
48235
48316
|
typeArguments,
|
|
48236
48317
|
root.isTypeOf
|
|
@@ -48963,7 +49044,6 @@ function createTypeChecker(host) {
|
|
|
48963
49044
|
return symbol.parent ? factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
|
|
48964
49045
|
}
|
|
48965
49046
|
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
|
|
48966
|
-
var _a, _b, _c, _d;
|
|
48967
49047
|
const chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */));
|
|
48968
49048
|
const isTypeOf = meaning === 111551 /* Value */;
|
|
48969
49049
|
if (some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
@@ -48972,17 +49052,18 @@ function createTypeChecker(host) {
|
|
|
48972
49052
|
const contextFile = getSourceFileOfNode(getOriginalNode(context.enclosingDeclaration));
|
|
48973
49053
|
const targetFile = getSourceFileOfModule(chain[0]);
|
|
48974
49054
|
let specifier;
|
|
48975
|
-
let
|
|
49055
|
+
let attributes;
|
|
48976
49056
|
if (getEmitModuleResolutionKind(compilerOptions) === 3 /* Node16 */ || getEmitModuleResolutionKind(compilerOptions) === 99 /* NodeNext */) {
|
|
48977
49057
|
if ((targetFile == null ? void 0 : targetFile.impliedNodeFormat) === 99 /* ESNext */ && targetFile.impliedNodeFormat !== (contextFile == null ? void 0 : contextFile.impliedNodeFormat)) {
|
|
48978
49058
|
specifier = getSpecifierForModuleSymbol(chain[0], context, 99 /* ESNext */);
|
|
48979
|
-
|
|
48980
|
-
factory.
|
|
48981
|
-
factory.
|
|
48982
|
-
|
|
48983
|
-
|
|
48984
|
-
|
|
48985
|
-
|
|
49059
|
+
attributes = factory.createImportAttributes(
|
|
49060
|
+
factory.createNodeArray([
|
|
49061
|
+
factory.createImportAttribute(
|
|
49062
|
+
factory.createStringLiteral("resolution-mode"),
|
|
49063
|
+
factory.createStringLiteral("import")
|
|
49064
|
+
)
|
|
49065
|
+
])
|
|
49066
|
+
);
|
|
48986
49067
|
}
|
|
48987
49068
|
}
|
|
48988
49069
|
if (!specifier) {
|
|
@@ -48996,16 +49077,17 @@ function createTypeChecker(host) {
|
|
|
48996
49077
|
if (specifier.includes("/node_modules/")) {
|
|
48997
49078
|
specifier = oldSpecifier;
|
|
48998
49079
|
} else {
|
|
48999
|
-
|
|
49000
|
-
factory.
|
|
49001
|
-
factory.
|
|
49002
|
-
|
|
49003
|
-
|
|
49004
|
-
|
|
49005
|
-
|
|
49080
|
+
attributes = factory.createImportAttributes(
|
|
49081
|
+
factory.createNodeArray([
|
|
49082
|
+
factory.createImportAttribute(
|
|
49083
|
+
factory.createStringLiteral("resolution-mode"),
|
|
49084
|
+
factory.createStringLiteral(swappedMode === 99 /* ESNext */ ? "import" : "require")
|
|
49085
|
+
)
|
|
49086
|
+
])
|
|
49087
|
+
);
|
|
49006
49088
|
}
|
|
49007
49089
|
}
|
|
49008
|
-
if (!
|
|
49090
|
+
if (!attributes) {
|
|
49009
49091
|
context.encounteredError = true;
|
|
49010
49092
|
if (context.tracker.reportLikelyUnsafeImportRequiredError) {
|
|
49011
49093
|
context.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier);
|
|
@@ -49025,11 +49107,11 @@ function createTypeChecker(host) {
|
|
|
49025
49107
|
void 0
|
|
49026
49108
|
);
|
|
49027
49109
|
}
|
|
49028
|
-
return factory.createImportTypeNode(lit,
|
|
49110
|
+
return factory.createImportTypeNode(lit, attributes, nonRootParts, typeParameterNodes, isTypeOf);
|
|
49029
49111
|
} else {
|
|
49030
49112
|
const splitNode = getTopmostIndexedAccessType(nonRootParts);
|
|
49031
49113
|
const qualifier = splitNode.objectType.typeName;
|
|
49032
|
-
return factory.createIndexedAccessTypeNode(factory.createImportTypeNode(lit,
|
|
49114
|
+
return factory.createIndexedAccessTypeNode(factory.createImportTypeNode(lit, attributes, qualifier, typeParameterNodes, isTypeOf), splitNode.indexType);
|
|
49033
49115
|
}
|
|
49034
49116
|
}
|
|
49035
49117
|
const entityName = createAccessFromSymbolChain(chain, chain.length - 1, 0);
|
|
@@ -49505,7 +49587,7 @@ function createTypeChecker(host) {
|
|
|
49505
49587
|
return factory.updateImportTypeNode(
|
|
49506
49588
|
node,
|
|
49507
49589
|
factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)),
|
|
49508
|
-
node.
|
|
49590
|
+
node.attributes,
|
|
49509
49591
|
node.qualifier,
|
|
49510
49592
|
visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
|
|
49511
49593
|
node.isTypeOf
|
|
@@ -49725,7 +49807,7 @@ function createTypeChecker(host) {
|
|
|
49725
49807
|
return statements;
|
|
49726
49808
|
}
|
|
49727
49809
|
function inlineExportModifiers(statements) {
|
|
49728
|
-
const index = findIndex(statements, (d) => isExportDeclaration(d) && !d.moduleSpecifier && !d.
|
|
49810
|
+
const index = findIndex(statements, (d) => isExportDeclaration(d) && !d.moduleSpecifier && !d.attributes && !!d.exportClause && isNamedExports(d.exportClause));
|
|
49729
49811
|
if (index >= 0) {
|
|
49730
49812
|
const exportDecl = statements[index];
|
|
49731
49813
|
const replacements = mapDefined(exportDecl.exportClause.elements, (e) => {
|
|
@@ -49753,7 +49835,7 @@ function createTypeChecker(host) {
|
|
|
49753
49835
|
replacements
|
|
49754
49836
|
),
|
|
49755
49837
|
exportDecl.moduleSpecifier,
|
|
49756
|
-
exportDecl.
|
|
49838
|
+
exportDecl.attributes
|
|
49757
49839
|
);
|
|
49758
49840
|
}
|
|
49759
49841
|
}
|
|
@@ -50404,7 +50486,7 @@ function createTypeChecker(host) {
|
|
|
50404
50486
|
)])
|
|
50405
50487
|
),
|
|
50406
50488
|
factory.createStringLiteral(specifier2),
|
|
50407
|
-
/*
|
|
50489
|
+
/*attributes*/
|
|
50408
50490
|
void 0
|
|
50409
50491
|
),
|
|
50410
50492
|
0 /* None */
|
|
@@ -50492,7 +50574,7 @@ function createTypeChecker(host) {
|
|
|
50492
50574
|
void 0
|
|
50493
50575
|
),
|
|
50494
50576
|
specifier2,
|
|
50495
|
-
node.parent.
|
|
50577
|
+
node.parent.attributes
|
|
50496
50578
|
),
|
|
50497
50579
|
0 /* None */
|
|
50498
50580
|
);
|
|
@@ -50513,7 +50595,7 @@ function createTypeChecker(host) {
|
|
|
50513
50595
|
factory.createNamespaceImport(factory.createIdentifier(localName))
|
|
50514
50596
|
),
|
|
50515
50597
|
specifier2,
|
|
50516
|
-
node.parent.
|
|
50598
|
+
node.parent.attributes
|
|
50517
50599
|
),
|
|
50518
50600
|
0 /* None */
|
|
50519
50601
|
);
|
|
@@ -50554,7 +50636,7 @@ function createTypeChecker(host) {
|
|
|
50554
50636
|
])
|
|
50555
50637
|
),
|
|
50556
50638
|
specifier2,
|
|
50557
|
-
node.parent.parent.parent.
|
|
50639
|
+
node.parent.parent.parent.attributes
|
|
50558
50640
|
),
|
|
50559
50641
|
0 /* None */
|
|
50560
50642
|
);
|
|
@@ -60013,6 +60095,7 @@ function createTypeChecker(host) {
|
|
|
60013
60095
|
let skipParentCounter = 0;
|
|
60014
60096
|
let lastSkippedInfo;
|
|
60015
60097
|
let incompatibleStack;
|
|
60098
|
+
let relationCount = 16e6 - relation.size >> 3;
|
|
60016
60099
|
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
60017
60100
|
const result = isRelatedTo(
|
|
60018
60101
|
source,
|
|
@@ -60026,8 +60109,19 @@ function createTypeChecker(host) {
|
|
|
60026
60109
|
reportIncompatibleStack();
|
|
60027
60110
|
}
|
|
60028
60111
|
if (overflow) {
|
|
60112
|
+
const id = getRelationKey(
|
|
60113
|
+
source,
|
|
60114
|
+
target,
|
|
60115
|
+
/*intersectionState*/
|
|
60116
|
+
0 /* None */,
|
|
60117
|
+
relation,
|
|
60118
|
+
/*ignoreConstraints*/
|
|
60119
|
+
false
|
|
60120
|
+
);
|
|
60121
|
+
relation.set(id, 4 /* Reported */ | 2 /* Failed */);
|
|
60029
60122
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
|
|
60030
|
-
const
|
|
60123
|
+
const message = relationCount <= 0 ? Diagnostics.Excessive_complexity_comparing_types_0_and_1 : Diagnostics.Excessive_stack_depth_comparing_types_0_and_1;
|
|
60124
|
+
const diag2 = error(errorNode || currentNode, message, typeToString(source), typeToString(target));
|
|
60031
60125
|
if (errorOutputContainer) {
|
|
60032
60126
|
(errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag2);
|
|
60033
60127
|
}
|
|
@@ -60558,6 +60652,16 @@ function createTypeChecker(host) {
|
|
|
60558
60652
|
}
|
|
60559
60653
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
60560
60654
|
if (source2.flags & 1048576 /* Union */) {
|
|
60655
|
+
if (target2.flags & 1048576 /* Union */) {
|
|
60656
|
+
const sourceOrigin = source2.origin;
|
|
60657
|
+
if (sourceOrigin && sourceOrigin.flags & 2097152 /* Intersection */ && target2.aliasSymbol && contains(sourceOrigin.types, target2)) {
|
|
60658
|
+
return -1 /* True */;
|
|
60659
|
+
}
|
|
60660
|
+
const targetOrigin = target2.origin;
|
|
60661
|
+
if (targetOrigin && targetOrigin.flags & 1048576 /* Union */ && source2.aliasSymbol && contains(targetOrigin.types, source2)) {
|
|
60662
|
+
return -1 /* True */;
|
|
60663
|
+
}
|
|
60664
|
+
}
|
|
60561
60665
|
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState);
|
|
60562
60666
|
}
|
|
60563
60667
|
if (target2.flags & 1048576 /* Union */) {
|
|
@@ -60871,6 +60975,10 @@ function createTypeChecker(host) {
|
|
|
60871
60975
|
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
|
|
60872
60976
|
}
|
|
60873
60977
|
}
|
|
60978
|
+
if (relationCount <= 0) {
|
|
60979
|
+
overflow = true;
|
|
60980
|
+
return 0 /* False */;
|
|
60981
|
+
}
|
|
60874
60982
|
if (!maybeKeys) {
|
|
60875
60983
|
maybeKeys = [];
|
|
60876
60984
|
maybeKeysSet = /* @__PURE__ */ new Set();
|
|
@@ -60964,6 +61072,7 @@ function createTypeChecker(host) {
|
|
|
60964
61072
|
}
|
|
60965
61073
|
} else {
|
|
60966
61074
|
relation.set(id, (reportErrors2 ? 4 /* Reported */ : 0) | 2 /* Failed */ | propagatingVarianceFlags);
|
|
61075
|
+
relationCount--;
|
|
60967
61076
|
resetMaybeStack(
|
|
60968
61077
|
/*markAllAsSucceeded*/
|
|
60969
61078
|
false
|
|
@@ -60975,6 +61084,7 @@ function createTypeChecker(host) {
|
|
|
60975
61084
|
maybeKeysSet.delete(maybeKeys[i]);
|
|
60976
61085
|
if (markAllAsSucceeded) {
|
|
60977
61086
|
relation.set(maybeKeys[i], 1 /* Succeeded */ | propagatingVarianceFlags);
|
|
61087
|
+
relationCount--;
|
|
60978
61088
|
}
|
|
60979
61089
|
}
|
|
60980
61090
|
maybeCount = maybeStart;
|
|
@@ -70234,7 +70344,7 @@ function createTypeChecker(host) {
|
|
|
70234
70344
|
}
|
|
70235
70345
|
for (let i = 0; i < argCount; i++) {
|
|
70236
70346
|
const arg = args[i];
|
|
70237
|
-
if (arg.kind !== 232 /* OmittedExpression */) {
|
|
70347
|
+
if (arg.kind !== 232 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
70238
70348
|
const paramType = getTypeAtPosition(signature, i);
|
|
70239
70349
|
if (couldContainTypeVariables(paramType)) {
|
|
70240
70350
|
const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
@@ -70837,6 +70947,7 @@ function createTypeChecker(host) {
|
|
|
70837
70947
|
const args = getEffectiveCallArguments(node);
|
|
70838
70948
|
const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
70839
70949
|
let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
70950
|
+
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
70840
70951
|
let candidatesForArgumentError;
|
|
70841
70952
|
let candidateForArgumentArityError;
|
|
70842
70953
|
let candidateForTypeArgumentError;
|
|
@@ -75806,16 +75917,8 @@ function createTypeChecker(host) {
|
|
|
75806
75917
|
}
|
|
75807
75918
|
function checkImportType(node) {
|
|
75808
75919
|
checkSourceElement(node.argument);
|
|
75809
|
-
if (node.
|
|
75810
|
-
|
|
75811
|
-
if (override) {
|
|
75812
|
-
if (!isNightly()) {
|
|
75813
|
-
grammarErrorOnNode(node.assertions.assertClause, Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next);
|
|
75814
|
-
}
|
|
75815
|
-
if (getEmitModuleResolutionKind(compilerOptions) !== 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) !== 99 /* NodeNext */) {
|
|
75816
|
-
grammarErrorOnNode(node.assertions.assertClause, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
75817
|
-
}
|
|
75818
|
-
}
|
|
75920
|
+
if (node.attributes) {
|
|
75921
|
+
getResolutionModeOverride(node.attributes, grammarErrorOnNode);
|
|
75819
75922
|
}
|
|
75820
75923
|
checkTypeReferenceOrImport(node);
|
|
75821
75924
|
}
|
|
@@ -79779,12 +79882,13 @@ function createTypeChecker(host) {
|
|
|
79779
79882
|
return false;
|
|
79780
79883
|
}
|
|
79781
79884
|
}
|
|
79782
|
-
if (!isImportEqualsDeclaration(node) && node.
|
|
79885
|
+
if (!isImportEqualsDeclaration(node) && node.attributes) {
|
|
79886
|
+
const diagnostic = node.attributes.token === 118 /* WithKeyword */ ? Diagnostics.Import_attribute_values_must_be_string_literal_expressions : Diagnostics.Import_assertion_values_must_be_string_literal_expressions;
|
|
79783
79887
|
let hasError = false;
|
|
79784
|
-
for (const
|
|
79785
|
-
if (!isStringLiteral(
|
|
79888
|
+
for (const attr of node.attributes.elements) {
|
|
79889
|
+
if (!isStringLiteral(attr.value)) {
|
|
79786
79890
|
hasError = true;
|
|
79787
|
-
error(
|
|
79891
|
+
error(attr.value, diagnostic);
|
|
79788
79892
|
}
|
|
79789
79893
|
}
|
|
79790
79894
|
return !hasError;
|
|
@@ -79916,32 +80020,26 @@ function createTypeChecker(host) {
|
|
|
79916
80020
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
79917
80021
|
}
|
|
79918
80022
|
}
|
|
79919
|
-
function
|
|
80023
|
+
function checkImportAttributes(declaration) {
|
|
79920
80024
|
var _a;
|
|
79921
|
-
|
|
79922
|
-
|
|
79923
|
-
const
|
|
79924
|
-
|
|
79925
|
-
|
|
79926
|
-
|
|
79927
|
-
}
|
|
79928
|
-
if (getEmitModuleResolutionKind(compilerOptions) !== 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) !== 99 /* NodeNext */) {
|
|
79929
|
-
return grammarErrorOnNode(declaration.assertClause, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
79930
|
-
}
|
|
80025
|
+
const node = declaration.attributes;
|
|
80026
|
+
if (node) {
|
|
80027
|
+
const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
80028
|
+
const override = getResolutionModeOverride(node, validForTypeAttributes ? grammarErrorOnNode : void 0);
|
|
80029
|
+
const isImportAttributes2 = declaration.attributes.token === 118 /* WithKeyword */;
|
|
80030
|
+
if (validForTypeAttributes && override) {
|
|
79931
80031
|
return;
|
|
79932
80032
|
}
|
|
79933
80033
|
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
|
|
79934
80034
|
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */) {
|
|
79935
|
-
|
|
79936
|
-
|
|
79937
|
-
moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext
|
|
79938
|
-
);
|
|
80035
|
+
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext;
|
|
80036
|
+
return grammarErrorOnNode(node, message);
|
|
79939
80037
|
}
|
|
79940
80038
|
if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
|
|
79941
|
-
return grammarErrorOnNode(
|
|
80039
|
+
return grammarErrorOnNode(node, isImportAttributes2 ? Diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports : Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports);
|
|
79942
80040
|
}
|
|
79943
80041
|
if (override) {
|
|
79944
|
-
return grammarErrorOnNode(
|
|
80042
|
+
return grammarErrorOnNode(node, Diagnostics.resolution_mode_can_only_be_set_for_type_only_imports);
|
|
79945
80043
|
}
|
|
79946
80044
|
}
|
|
79947
80045
|
}
|
|
@@ -79973,7 +80071,7 @@ function createTypeChecker(host) {
|
|
|
79973
80071
|
}
|
|
79974
80072
|
}
|
|
79975
80073
|
}
|
|
79976
|
-
|
|
80074
|
+
checkImportAttributes(node);
|
|
79977
80075
|
}
|
|
79978
80076
|
function checkImportEqualsDeclaration(node) {
|
|
79979
80077
|
if (checkGrammarModuleElementContext(node, isInJSFile(node) ? Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module : Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
|
|
@@ -80046,7 +80144,7 @@ function createTypeChecker(host) {
|
|
|
80046
80144
|
}
|
|
80047
80145
|
}
|
|
80048
80146
|
}
|
|
80049
|
-
|
|
80147
|
+
checkImportAttributes(node);
|
|
80050
80148
|
}
|
|
80051
80149
|
function checkGrammarExportDeclaration(node) {
|
|
80052
80150
|
var _a;
|
|
@@ -83836,12 +83934,12 @@ function createTypeChecker(host) {
|
|
|
83836
83934
|
if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */) {
|
|
83837
83935
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
83838
83936
|
if (nodeArguments.length > 1) {
|
|
83839
|
-
const
|
|
83840
|
-
return grammarErrorOnNode(
|
|
83937
|
+
const importAttributesArgument = nodeArguments[1];
|
|
83938
|
+
return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
|
|
83841
83939
|
}
|
|
83842
83940
|
}
|
|
83843
83941
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
83844
|
-
return grammarErrorOnNode(node, Diagnostics.
|
|
83942
|
+
return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_set_of_attributes_as_arguments);
|
|
83845
83943
|
}
|
|
83846
83944
|
const spreadElement = find(nodeArguments, isSpreadElement);
|
|
83847
83945
|
if (spreadElement) {
|
|
@@ -84108,13 +84206,6 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
|
84108
84206
|
this.inner.reportNonSerializableProperty(propertyName);
|
|
84109
84207
|
}
|
|
84110
84208
|
}
|
|
84111
|
-
reportImportTypeNodeResolutionModeOverride() {
|
|
84112
|
-
var _a;
|
|
84113
|
-
if ((_a = this.inner) == null ? void 0 : _a.reportImportTypeNodeResolutionModeOverride) {
|
|
84114
|
-
this.onDiagnosticReported();
|
|
84115
|
-
this.inner.reportImportTypeNodeResolutionModeOverride();
|
|
84116
|
-
}
|
|
84117
|
-
}
|
|
84118
84209
|
onDiagnosticReported() {
|
|
84119
84210
|
this.context.reportedDiagnostic = true;
|
|
84120
84211
|
}
|
|
@@ -84623,7 +84714,7 @@ var visitEachChildTable = {
|
|
|
84623
84714
|
return context.factory.updateImportTypeNode(
|
|
84624
84715
|
node,
|
|
84625
84716
|
Debug.checkDefined(nodeVisitor(node.argument, visitor, isTypeNode)),
|
|
84626
|
-
nodeVisitor(node.
|
|
84717
|
+
nodeVisitor(node.attributes, visitor, isImportAttributes),
|
|
84627
84718
|
nodeVisitor(node.qualifier, visitor, isEntityName),
|
|
84628
84719
|
nodesVisitor(node.typeArguments, visitor, isTypeNode),
|
|
84629
84720
|
node.isTypeOf
|
|
@@ -85174,20 +85265,20 @@ var visitEachChildTable = {
|
|
|
85174
85265
|
nodesVisitor(node.modifiers, visitor, isModifierLike),
|
|
85175
85266
|
nodeVisitor(node.importClause, visitor, isImportClause),
|
|
85176
85267
|
Debug.checkDefined(nodeVisitor(node.moduleSpecifier, visitor, isExpression)),
|
|
85177
|
-
nodeVisitor(node.
|
|
85268
|
+
nodeVisitor(node.attributes, visitor, isImportAttributes)
|
|
85178
85269
|
);
|
|
85179
85270
|
},
|
|
85180
|
-
[300 /*
|
|
85181
|
-
return context.factory.
|
|
85271
|
+
[300 /* ImportAttributes */]: function visitEachChildOfImportAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
|
|
85272
|
+
return context.factory.updateImportAttributes(
|
|
85182
85273
|
node,
|
|
85183
|
-
nodesVisitor(node.elements, visitor,
|
|
85274
|
+
nodesVisitor(node.elements, visitor, isImportAttribute),
|
|
85184
85275
|
node.multiLine
|
|
85185
85276
|
);
|
|
85186
85277
|
},
|
|
85187
|
-
[301 /*
|
|
85188
|
-
return context.factory.
|
|
85278
|
+
[301 /* ImportAttribute */]: function visitEachChildOfImportAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
|
|
85279
|
+
return context.factory.updateImportAttribute(
|
|
85189
85280
|
node,
|
|
85190
|
-
Debug.checkDefined(nodeVisitor(node.name, visitor,
|
|
85281
|
+
Debug.checkDefined(nodeVisitor(node.name, visitor, isImportAttributeName)),
|
|
85191
85282
|
Debug.checkDefined(nodeVisitor(node.value, visitor, isExpression))
|
|
85192
85283
|
);
|
|
85193
85284
|
},
|
|
@@ -85239,7 +85330,7 @@ var visitEachChildTable = {
|
|
|
85239
85330
|
node.isTypeOnly,
|
|
85240
85331
|
nodeVisitor(node.exportClause, visitor, isNamedExportBindings),
|
|
85241
85332
|
nodeVisitor(node.moduleSpecifier, visitor, isExpression),
|
|
85242
|
-
nodeVisitor(node.
|
|
85333
|
+
nodeVisitor(node.attributes, visitor, isImportAttributes)
|
|
85243
85334
|
);
|
|
85244
85335
|
},
|
|
85245
85336
|
[279 /* NamedExports */]: function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
|
|
@@ -88558,7 +88649,7 @@ function transformTypeScript(context) {
|
|
|
88558
88649
|
void 0,
|
|
88559
88650
|
importClause,
|
|
88560
88651
|
node.moduleSpecifier,
|
|
88561
|
-
node.
|
|
88652
|
+
node.attributes
|
|
88562
88653
|
) : void 0;
|
|
88563
88654
|
}
|
|
88564
88655
|
function visitImportClause(node) {
|
|
@@ -88608,7 +88699,7 @@ function transformTypeScript(context) {
|
|
|
88608
88699
|
node.isTypeOnly,
|
|
88609
88700
|
exportClause,
|
|
88610
88701
|
node.moduleSpecifier,
|
|
88611
|
-
node.
|
|
88702
|
+
node.attributes
|
|
88612
88703
|
) : void 0;
|
|
88613
88704
|
}
|
|
88614
88705
|
function visitNamedExports(node, allowEmpty) {
|
|
@@ -88642,7 +88733,7 @@ function transformTypeScript(context) {
|
|
|
88642
88733
|
/*importClause*/
|
|
88643
88734
|
void 0,
|
|
88644
88735
|
node.moduleReference.expression,
|
|
88645
|
-
/*
|
|
88736
|
+
/*attributes*/
|
|
88646
88737
|
void 0
|
|
88647
88738
|
),
|
|
88648
88739
|
node
|
|
@@ -96812,7 +96903,7 @@ function transformJsx(context) {
|
|
|
96812
96903
|
factory2.createNamedImports(arrayFrom(importSpecifiersMap.values()))
|
|
96813
96904
|
),
|
|
96814
96905
|
factory2.createStringLiteral(importSource),
|
|
96815
|
-
/*
|
|
96906
|
+
/*attributes*/
|
|
96816
96907
|
void 0
|
|
96817
96908
|
);
|
|
96818
96909
|
setParentRecursive(
|
|
@@ -106219,7 +106310,9 @@ function transformECMAScriptModule(context) {
|
|
|
106219
106310
|
)
|
|
106220
106311
|
])
|
|
106221
106312
|
),
|
|
106222
|
-
factory2.createStringLiteral("module")
|
|
106313
|
+
factory2.createStringLiteral("module"),
|
|
106314
|
+
/*attributes*/
|
|
106315
|
+
void 0
|
|
106223
106316
|
);
|
|
106224
106317
|
const requireHelperName = factory2.createUniqueName("__require", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
106225
106318
|
const requireStatement = factory2.createVariableStatement(
|
|
@@ -106336,7 +106429,7 @@ function transformECMAScriptModule(context) {
|
|
|
106336
106429
|
)
|
|
106337
106430
|
),
|
|
106338
106431
|
node.moduleSpecifier,
|
|
106339
|
-
node.
|
|
106432
|
+
node.attributes
|
|
106340
106433
|
);
|
|
106341
106434
|
setOriginalNode(importDecl, node.exportClause);
|
|
106342
106435
|
const exportDecl = isExportNamespaceAsDefaultDeclaration(node) ? factory2.createExportDefault(synthName) : factory2.createExportDeclaration(
|
|
@@ -106789,8 +106882,7 @@ function transformDeclarations(context) {
|
|
|
106789
106882
|
trackReferencedAmbientModule,
|
|
106790
106883
|
trackExternalModuleSymbolOfImportTypeNode,
|
|
106791
106884
|
reportNonlocalAugmentation,
|
|
106792
|
-
reportNonSerializableProperty
|
|
106793
|
-
reportImportTypeNodeResolutionModeOverride
|
|
106885
|
+
reportNonSerializableProperty
|
|
106794
106886
|
};
|
|
106795
106887
|
let errorNameNode;
|
|
106796
106888
|
let errorFallbackNode;
|
|
@@ -106914,11 +107006,6 @@ function transformDeclarations(context) {
|
|
|
106914
107006
|
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
106915
107007
|
}
|
|
106916
107008
|
}
|
|
106917
|
-
function reportImportTypeNodeResolutionModeOverride() {
|
|
106918
|
-
if (!isNightly() && (errorNameNode || errorFallbackNode)) {
|
|
106919
|
-
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next));
|
|
106920
|
-
}
|
|
106921
|
-
}
|
|
106922
107009
|
function transformDeclarationsForJS(sourceFile, bundled) {
|
|
106923
107010
|
const oldDiag = getSymbolAccessibilityDiagnostic;
|
|
106924
107011
|
getSymbolAccessibilityDiagnostic = (s) => s.errorNode && canProduceDiagnostics(s.errorNode) ? createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : {
|
|
@@ -107423,7 +107510,7 @@ function transformDeclarations(context) {
|
|
|
107423
107510
|
decl.modifiers,
|
|
107424
107511
|
decl.importClause,
|
|
107425
107512
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107426
|
-
|
|
107513
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107427
107514
|
);
|
|
107428
107515
|
}
|
|
107429
107516
|
const visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : void 0;
|
|
@@ -107439,7 +107526,7 @@ function transformDeclarations(context) {
|
|
|
107439
107526
|
void 0
|
|
107440
107527
|
),
|
|
107441
107528
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107442
|
-
|
|
107529
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107443
107530
|
);
|
|
107444
107531
|
}
|
|
107445
107532
|
if (decl.importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
@@ -107457,7 +107544,7 @@ function transformDeclarations(context) {
|
|
|
107457
107544
|
namedBindings
|
|
107458
107545
|
),
|
|
107459
107546
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107460
|
-
|
|
107547
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107461
107548
|
) : void 0;
|
|
107462
107549
|
}
|
|
107463
107550
|
const bindingList = mapDefined(decl.importClause.namedBindings.elements, (b) => resolver.isDeclarationVisible(b) ? b : void 0);
|
|
@@ -107472,7 +107559,7 @@ function transformDeclarations(context) {
|
|
|
107472
107559
|
bindingList && bindingList.length ? factory2.updateNamedImports(decl.importClause.namedBindings, bindingList) : void 0
|
|
107473
107560
|
),
|
|
107474
107561
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107475
|
-
|
|
107562
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107476
107563
|
);
|
|
107477
107564
|
}
|
|
107478
107565
|
if (resolver.isImportRequiredByAugmentation(decl)) {
|
|
@@ -107482,19 +107569,13 @@ function transformDeclarations(context) {
|
|
|
107482
107569
|
/*importClause*/
|
|
107483
107570
|
void 0,
|
|
107484
107571
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107485
|
-
|
|
107572
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107486
107573
|
);
|
|
107487
107574
|
}
|
|
107488
107575
|
}
|
|
107489
|
-
function
|
|
107490
|
-
const mode =
|
|
107491
|
-
|
|
107492
|
-
if (!isNightly()) {
|
|
107493
|
-
context.addDiagnostic(createDiagnosticForNode(assertClause, Diagnostics.resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next));
|
|
107494
|
-
}
|
|
107495
|
-
return assertClause;
|
|
107496
|
-
}
|
|
107497
|
-
return void 0;
|
|
107576
|
+
function tryGetResolutionModeOverride(node) {
|
|
107577
|
+
const mode = getResolutionModeOverride(node);
|
|
107578
|
+
return node && mode !== void 0 ? node : void 0;
|
|
107498
107579
|
}
|
|
107499
107580
|
function transformAndReplaceLatePaintedStatements(statements) {
|
|
107500
107581
|
while (length(lateMarkedStatements)) {
|
|
@@ -107780,7 +107861,7 @@ function transformDeclarations(context) {
|
|
|
107780
107861
|
return cleanup(factory2.updateImportTypeNode(
|
|
107781
107862
|
input,
|
|
107782
107863
|
factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)),
|
|
107783
|
-
input.
|
|
107864
|
+
input.attributes,
|
|
107784
107865
|
input.qualifier,
|
|
107785
107866
|
visitNodes2(input.typeArguments, visitDeclarationSubtree, isTypeNode),
|
|
107786
107867
|
input.isTypeOf
|
|
@@ -107834,7 +107915,7 @@ function transformDeclarations(context) {
|
|
|
107834
107915
|
input.isTypeOnly,
|
|
107835
107916
|
input.exportClause,
|
|
107836
107917
|
rewriteModuleSpecifier(input, input.moduleSpecifier),
|
|
107837
|
-
|
|
107918
|
+
tryGetResolutionModeOverride(input.attributes)
|
|
107838
107919
|
);
|
|
107839
107920
|
}
|
|
107840
107921
|
case 277 /* ExportAssignment */: {
|
|
@@ -110329,10 +110410,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
110329
110410
|
return emitNamedExports(node);
|
|
110330
110411
|
case 281 /* ExportSpecifier */:
|
|
110331
110412
|
return emitExportSpecifier(node);
|
|
110332
|
-
case 300 /*
|
|
110333
|
-
return
|
|
110334
|
-
case 301 /*
|
|
110335
|
-
return
|
|
110413
|
+
case 300 /* ImportAttributes */:
|
|
110414
|
+
return emitImportAttributes(node);
|
|
110415
|
+
case 301 /* ImportAttribute */:
|
|
110416
|
+
return emitImportAttribute(node);
|
|
110336
110417
|
case 282 /* MissingDeclaration */:
|
|
110337
110418
|
return;
|
|
110338
110419
|
case 283 /* ExternalModuleReference */:
|
|
@@ -111107,16 +111188,16 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111107
111188
|
writeKeyword("import");
|
|
111108
111189
|
writePunctuation("(");
|
|
111109
111190
|
emit(node.argument);
|
|
111110
|
-
if (node.
|
|
111191
|
+
if (node.attributes) {
|
|
111111
111192
|
writePunctuation(",");
|
|
111112
111193
|
writeSpace();
|
|
111113
111194
|
writePunctuation("{");
|
|
111114
111195
|
writeSpace();
|
|
111115
|
-
writeKeyword("assert");
|
|
111196
|
+
writeKeyword(node.attributes.token === 132 /* AssertKeyword */ ? "assert" : "with");
|
|
111116
111197
|
writePunctuation(":");
|
|
111117
111198
|
writeSpace();
|
|
111118
|
-
const elements = node.
|
|
111119
|
-
emitList(node.
|
|
111199
|
+
const elements = node.attributes.elements;
|
|
111200
|
+
emitList(node.attributes, elements, 526226 /* ImportAttributes */);
|
|
111120
111201
|
writeSpace();
|
|
111121
111202
|
writePunctuation("}");
|
|
111122
111203
|
}
|
|
@@ -112105,8 +112186,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
112105
112186
|
writeSpace();
|
|
112106
112187
|
}
|
|
112107
112188
|
emitExpression(node.moduleSpecifier);
|
|
112108
|
-
if (node.
|
|
112109
|
-
emitWithLeadingSpace(node.
|
|
112189
|
+
if (node.attributes) {
|
|
112190
|
+
emitWithLeadingSpace(node.attributes);
|
|
112110
112191
|
}
|
|
112111
112192
|
writeTrailingSemicolon();
|
|
112112
112193
|
}
|
|
@@ -112175,18 +112256,18 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
112175
112256
|
writeSpace();
|
|
112176
112257
|
emitExpression(node.moduleSpecifier);
|
|
112177
112258
|
}
|
|
112178
|
-
if (node.
|
|
112179
|
-
emitWithLeadingSpace(node.
|
|
112259
|
+
if (node.attributes) {
|
|
112260
|
+
emitWithLeadingSpace(node.attributes);
|
|
112180
112261
|
}
|
|
112181
112262
|
writeTrailingSemicolon();
|
|
112182
112263
|
}
|
|
112183
|
-
function
|
|
112184
|
-
emitTokenWithComment(
|
|
112264
|
+
function emitImportAttributes(node) {
|
|
112265
|
+
emitTokenWithComment(node.token, node.pos, writeKeyword, node);
|
|
112185
112266
|
writeSpace();
|
|
112186
112267
|
const elements = node.elements;
|
|
112187
|
-
emitList(node, elements, 526226 /*
|
|
112268
|
+
emitList(node, elements, 526226 /* ImportAttributes */);
|
|
112188
112269
|
}
|
|
112189
|
-
function
|
|
112270
|
+
function emitImportAttribute(node) {
|
|
112190
112271
|
emit(node.name);
|
|
112191
112272
|
writePunctuation(":");
|
|
112192
112273
|
writeSpace();
|
|
@@ -115223,8 +115304,6 @@ function getModeForFileReference(ref, containingFileMode) {
|
|
|
115223
115304
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
115224
115305
|
}
|
|
115225
115306
|
function getModeForResolutionAtIndex(file, index) {
|
|
115226
|
-
if (file.impliedNodeFormat === void 0)
|
|
115227
|
-
return void 0;
|
|
115228
115307
|
return getModeForUsageLocation(file, getModuleNameStringLiteralAt(file, index));
|
|
115229
115308
|
}
|
|
115230
115309
|
function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
@@ -115238,42 +115317,48 @@ function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
|
115238
115317
|
return false;
|
|
115239
115318
|
}
|
|
115240
115319
|
function getModeForUsageLocation(file, usage) {
|
|
115241
|
-
var _a
|
|
115242
|
-
if (file.impliedNodeFormat === void 0)
|
|
115243
|
-
return void 0;
|
|
115320
|
+
var _a;
|
|
115244
115321
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
115245
115322
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
115246
115323
|
if (isTypeOnly) {
|
|
115247
|
-
const override =
|
|
115324
|
+
const override = getResolutionModeOverride(usage.parent.attributes);
|
|
115248
115325
|
if (override) {
|
|
115249
115326
|
return override;
|
|
115250
115327
|
}
|
|
115251
115328
|
}
|
|
115252
115329
|
}
|
|
115253
115330
|
if (usage.parent.parent && isImportTypeNode(usage.parent.parent)) {
|
|
115254
|
-
const override =
|
|
115331
|
+
const override = getResolutionModeOverride(usage.parent.parent.attributes);
|
|
115255
115332
|
if (override) {
|
|
115256
115333
|
return override;
|
|
115257
115334
|
}
|
|
115258
115335
|
}
|
|
115336
|
+
if (file.impliedNodeFormat === void 0)
|
|
115337
|
+
return void 0;
|
|
115259
115338
|
if (file.impliedNodeFormat !== 99 /* ESNext */) {
|
|
115260
115339
|
return isImportCall(walkUpParenthesizedExpressions(usage.parent)) ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
115261
115340
|
}
|
|
115262
|
-
const exprParentParent = (
|
|
115341
|
+
const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
|
|
115263
115342
|
return exprParentParent && isImportEqualsDeclaration(exprParentParent) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
115264
115343
|
}
|
|
115265
|
-
function
|
|
115266
|
-
if (!
|
|
115344
|
+
function getResolutionModeOverride(node, grammarErrorOnNode) {
|
|
115345
|
+
if (!node)
|
|
115267
115346
|
return void 0;
|
|
115268
|
-
if (length(
|
|
115269
|
-
grammarErrorOnNode == null ? void 0 : grammarErrorOnNode(
|
|
115347
|
+
if (length(node.elements) !== 1) {
|
|
115348
|
+
grammarErrorOnNode == null ? void 0 : grammarErrorOnNode(
|
|
115349
|
+
node,
|
|
115350
|
+
node.token === 118 /* WithKeyword */ ? Diagnostics.Type_import_attributes_should_have_exactly_one_key_resolution_mode_with_value_import_or_require : Diagnostics.Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require
|
|
115351
|
+
);
|
|
115270
115352
|
return void 0;
|
|
115271
115353
|
}
|
|
115272
|
-
const elem =
|
|
115354
|
+
const elem = node.elements[0];
|
|
115273
115355
|
if (!isStringLiteralLike(elem.name))
|
|
115274
115356
|
return void 0;
|
|
115275
115357
|
if (elem.name.text !== "resolution-mode") {
|
|
115276
|
-
grammarErrorOnNode == null ? void 0 : grammarErrorOnNode(
|
|
115358
|
+
grammarErrorOnNode == null ? void 0 : grammarErrorOnNode(
|
|
115359
|
+
elem.name,
|
|
115360
|
+
node.token === 118 /* WithKeyword */ ? Diagnostics.resolution_mode_is_the_only_valid_key_for_type_import_attributes : Diagnostics.resolution_mode_is_the_only_valid_key_for_type_import_assertions
|
|
115361
|
+
);
|
|
115277
115362
|
return void 0;
|
|
115278
115363
|
}
|
|
115279
115364
|
if (!isStringLiteralLike(elem.value))
|
|
@@ -115568,7 +115653,7 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
115568
115653
|
Diagnostics.Classes_may_not_have_a_field_named_constructor.code,
|
|
115569
115654
|
Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code,
|
|
115570
115655
|
Diagnostics.Duplicate_label_0.code,
|
|
115571
|
-
Diagnostics.
|
|
115656
|
+
Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_set_of_attributes_as_arguments.code,
|
|
115572
115657
|
Diagnostics.for_await_loops_cannot_be_used_inside_a_class_static_block.code,
|
|
115573
115658
|
Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code,
|
|
115574
115659
|
Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code,
|
|
@@ -117102,7 +117187,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117102
117187
|
/*importClause*/
|
|
117103
117188
|
void 0,
|
|
117104
117189
|
externalHelpersModuleReference,
|
|
117105
|
-
/*
|
|
117190
|
+
/*attributes*/
|
|
117106
117191
|
void 0
|
|
117107
117192
|
);
|
|
117108
117193
|
addInternalEmitFlags(importDecl, 2 /* NeverApplyImportHelper */);
|
|
@@ -117578,14 +117663,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117578
117663
|
const fileName = toFileNameLowerCase(ref.fileName);
|
|
117579
117664
|
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
117580
117665
|
const mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
117581
|
-
if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
|
|
117582
|
-
(fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({
|
|
117583
|
-
kind: 2 /* ResolutionDiagnostics */,
|
|
117584
|
-
diagnostics: [
|
|
117585
|
-
createDiagnosticForRange(file, ref, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)
|
|
117586
|
-
]
|
|
117587
|
-
});
|
|
117588
|
-
}
|
|
117589
117666
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
117590
117667
|
}
|
|
117591
117668
|
}
|