typescript 5.3.0-dev.20230926 → 5.3.0-dev.20230928
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 +319 -259
- package/lib/tsserver.js +363 -289
- package/lib/typescript.d.ts +51 -29
- package/lib/typescript.js +358 -286
- 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.20230928`;
|
|
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) {
|
|
@@ -14742,9 +14749,6 @@ function getIndentString(level) {
|
|
|
14742
14749
|
function getIndentSize() {
|
|
14743
14750
|
return indentStrings[1].length;
|
|
14744
14751
|
}
|
|
14745
|
-
function isNightly() {
|
|
14746
|
-
return version.includes("-dev") || version.includes("-insiders");
|
|
14747
|
-
}
|
|
14748
14752
|
function createTextWriter(newLine) {
|
|
14749
14753
|
var output;
|
|
14750
14754
|
var indent2;
|
|
@@ -17464,6 +17468,12 @@ function getPropertyNameFromType(type) {
|
|
|
17464
17468
|
function isExpandoPropertyDeclaration(declaration) {
|
|
17465
17469
|
return !!declaration && (isPropertyAccessExpression(declaration) || isElementAccessExpression(declaration) || isBinaryExpression(declaration));
|
|
17466
17470
|
}
|
|
17471
|
+
function hasResolutionModeOverride(node) {
|
|
17472
|
+
if (node === void 0) {
|
|
17473
|
+
return false;
|
|
17474
|
+
}
|
|
17475
|
+
return !!getResolutionModeOverride(node.attributes);
|
|
17476
|
+
}
|
|
17467
17477
|
|
|
17468
17478
|
// src/compiler/factory/baseNodeFactory.ts
|
|
17469
17479
|
function createBaseNodeFactory() {
|
|
@@ -18335,6 +18345,10 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
18335
18345
|
updateAssertEntry,
|
|
18336
18346
|
createImportTypeAssertionContainer,
|
|
18337
18347
|
updateImportTypeAssertionContainer,
|
|
18348
|
+
createImportAttributes,
|
|
18349
|
+
updateImportAttributes,
|
|
18350
|
+
createImportAttribute,
|
|
18351
|
+
updateImportAttribute,
|
|
18338
18352
|
createNamespaceImport,
|
|
18339
18353
|
updateNamespaceImport,
|
|
18340
18354
|
createNamespaceExport,
|
|
@@ -19603,18 +19617,21 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
19603
19617
|
function updateTemplateLiteralType(node, head, templateSpans) {
|
|
19604
19618
|
return node.head !== head || node.templateSpans !== templateSpans ? update(createTemplateLiteralType(head, templateSpans), node) : node;
|
|
19605
19619
|
}
|
|
19606
|
-
function createImportTypeNode(argument,
|
|
19620
|
+
function createImportTypeNode(argument, attributes, qualifier, typeArguments, isTypeOf = false) {
|
|
19607
19621
|
const node = createBaseNode(205 /* ImportType */);
|
|
19608
19622
|
node.argument = argument;
|
|
19609
|
-
node.
|
|
19623
|
+
node.attributes = attributes;
|
|
19624
|
+
if (node.assertions && node.assertions.assertClause && node.attributes) {
|
|
19625
|
+
node.assertions.assertClause = node.attributes;
|
|
19626
|
+
}
|
|
19610
19627
|
node.qualifier = qualifier;
|
|
19611
19628
|
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
19612
19629
|
node.isTypeOf = isTypeOf;
|
|
19613
19630
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
19614
19631
|
return node;
|
|
19615
19632
|
}
|
|
19616
|
-
function updateImportTypeNode(node, argument,
|
|
19617
|
-
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;
|
|
19618
19635
|
}
|
|
19619
19636
|
function createParenthesizedType(type) {
|
|
19620
19637
|
const node = createBaseNode(196 /* ParenthesizedType */);
|
|
@@ -20744,19 +20761,19 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20744
20761
|
function updateImportEqualsDeclaration(node, modifiers, isTypeOnly, name, moduleReference) {
|
|
20745
20762
|
return node.modifiers !== modifiers || node.isTypeOnly !== isTypeOnly || node.name !== name || node.moduleReference !== moduleReference ? update(createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference), node) : node;
|
|
20746
20763
|
}
|
|
20747
|
-
function createImportDeclaration(modifiers, importClause, moduleSpecifier,
|
|
20764
|
+
function createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes) {
|
|
20748
20765
|
const node = createBaseNode(272 /* ImportDeclaration */);
|
|
20749
20766
|
node.modifiers = asNodeArray(modifiers);
|
|
20750
20767
|
node.importClause = importClause;
|
|
20751
20768
|
node.moduleSpecifier = moduleSpecifier;
|
|
20752
|
-
node.assertClause =
|
|
20769
|
+
node.attributes = node.assertClause = attributes;
|
|
20753
20770
|
node.transformFlags |= propagateChildFlags(node.importClause) | propagateChildFlags(node.moduleSpecifier);
|
|
20754
20771
|
node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */;
|
|
20755
20772
|
node.jsDoc = void 0;
|
|
20756
20773
|
return node;
|
|
20757
20774
|
}
|
|
20758
|
-
function updateImportDeclaration(node, modifiers, importClause, moduleSpecifier,
|
|
20759
|
-
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;
|
|
20760
20777
|
}
|
|
20761
20778
|
function createImportClause(isTypeOnly, name, namedBindings) {
|
|
20762
20779
|
const node = createBaseDeclaration(273 /* ImportClause */);
|
|
@@ -20777,6 +20794,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20777
20794
|
const node = createBaseNode(300 /* AssertClause */);
|
|
20778
20795
|
node.elements = createNodeArray(elements);
|
|
20779
20796
|
node.multiLine = multiLine;
|
|
20797
|
+
node.token = 132 /* AssertKeyword */;
|
|
20780
20798
|
node.transformFlags |= 4 /* ContainsESNext */;
|
|
20781
20799
|
return node;
|
|
20782
20800
|
}
|
|
@@ -20802,6 +20820,27 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20802
20820
|
function updateImportTypeAssertionContainer(node, clause, multiLine) {
|
|
20803
20821
|
return node.assertClause !== clause || node.multiLine !== multiLine ? update(createImportTypeAssertionContainer(clause, multiLine), node) : node;
|
|
20804
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
|
+
}
|
|
20805
20844
|
function createNamespaceImport(name) {
|
|
20806
20845
|
const node = createBaseDeclaration(274 /* NamespaceImport */);
|
|
20807
20846
|
node.name = name;
|
|
@@ -20862,20 +20901,20 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20862
20901
|
function updateExportAssignment(node, modifiers, expression) {
|
|
20863
20902
|
return node.modifiers !== modifiers || node.expression !== expression ? update(createExportAssignment(modifiers, node.isExportEquals, expression), node) : node;
|
|
20864
20903
|
}
|
|
20865
|
-
function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier,
|
|
20904
|
+
function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes) {
|
|
20866
20905
|
const node = createBaseDeclaration(278 /* ExportDeclaration */);
|
|
20867
20906
|
node.modifiers = asNodeArray(modifiers);
|
|
20868
20907
|
node.isTypeOnly = isTypeOnly;
|
|
20869
20908
|
node.exportClause = exportClause;
|
|
20870
20909
|
node.moduleSpecifier = moduleSpecifier;
|
|
20871
|
-
node.assertClause =
|
|
20910
|
+
node.attributes = node.assertClause = attributes;
|
|
20872
20911
|
node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.exportClause) | propagateChildFlags(node.moduleSpecifier);
|
|
20873
20912
|
node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */;
|
|
20874
20913
|
node.jsDoc = void 0;
|
|
20875
20914
|
return node;
|
|
20876
20915
|
}
|
|
20877
|
-
function updateExportDeclaration(node, modifiers, isTypeOnly, exportClause, moduleSpecifier,
|
|
20878
|
-
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;
|
|
20879
20918
|
}
|
|
20880
20919
|
function finishUpdateExportDeclaration(updated, original) {
|
|
20881
20920
|
if (updated !== original) {
|
|
@@ -22202,7 +22241,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22202
22241
|
} else {
|
|
22203
22242
|
modifierArray = modifiers;
|
|
22204
22243
|
}
|
|
22205
|
-
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);
|
|
22206
22245
|
}
|
|
22207
22246
|
function updateModifierLike(node, modifierArray) {
|
|
22208
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);
|
|
@@ -24426,14 +24465,14 @@ function isImportDeclaration(node) {
|
|
|
24426
24465
|
function isImportClause(node) {
|
|
24427
24466
|
return node.kind === 273 /* ImportClause */;
|
|
24428
24467
|
}
|
|
24429
|
-
function isImportTypeAssertionContainer(node) {
|
|
24430
|
-
return node.kind === 302 /* ImportTypeAssertionContainer */;
|
|
24431
|
-
}
|
|
24432
24468
|
function isAssertClause(node) {
|
|
24433
24469
|
return node.kind === 300 /* AssertClause */;
|
|
24434
24470
|
}
|
|
24435
|
-
function
|
|
24436
|
-
return node.kind ===
|
|
24471
|
+
function isImportAttributes(node) {
|
|
24472
|
+
return node.kind === 300 /* ImportAttributes */;
|
|
24473
|
+
}
|
|
24474
|
+
function isImportAttribute(node) {
|
|
24475
|
+
return node.kind === 301 /* ImportAttribute */;
|
|
24437
24476
|
}
|
|
24438
24477
|
function isNamespaceImport(node) {
|
|
24439
24478
|
return node.kind === 274 /* NamespaceImport */;
|
|
@@ -25109,7 +25148,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
25109
25148
|
namedBindings
|
|
25110
25149
|
),
|
|
25111
25150
|
nodeFactory.createStringLiteral(externalHelpersModuleNameText),
|
|
25112
|
-
/*
|
|
25151
|
+
/*attributes*/
|
|
25113
25152
|
void 0
|
|
25114
25153
|
);
|
|
25115
25154
|
addInternalEmitFlags(externalHelpersImportDeclaration, 2 /* NeverApplyImportHelper */);
|
|
@@ -25863,7 +25902,7 @@ var forEachChildTable = {
|
|
|
25863
25902
|
return visitNode2(cbNode, node.typeParameter);
|
|
25864
25903
|
},
|
|
25865
25904
|
[205 /* ImportType */]: function forEachChildInImportType(node, cbNode, cbNodes) {
|
|
25866
|
-
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);
|
|
25867
25906
|
},
|
|
25868
25907
|
[302 /* ImportTypeAssertionContainer */]: function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) {
|
|
25869
25908
|
return visitNode2(cbNode, node.assertClause);
|
|
@@ -26037,15 +26076,15 @@ var forEachChildTable = {
|
|
|
26037
26076
|
return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.moduleReference);
|
|
26038
26077
|
},
|
|
26039
26078
|
[272 /* ImportDeclaration */]: function forEachChildInImportDeclaration(node, cbNode, cbNodes) {
|
|
26040
|
-
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);
|
|
26041
26080
|
},
|
|
26042
26081
|
[273 /* ImportClause */]: function forEachChildInImportClause(node, cbNode, _cbNodes) {
|
|
26043
26082
|
return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.namedBindings);
|
|
26044
26083
|
},
|
|
26045
|
-
[300 /*
|
|
26084
|
+
[300 /* ImportAttributes */]: function forEachChildInImportAttributes(node, cbNode, cbNodes) {
|
|
26046
26085
|
return visitNodes(cbNode, cbNodes, node.elements);
|
|
26047
26086
|
},
|
|
26048
|
-
[301 /*
|
|
26087
|
+
[301 /* ImportAttribute */]: function forEachChildInImportAttribute(node, cbNode, _cbNodes) {
|
|
26049
26088
|
return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.value);
|
|
26050
26089
|
},
|
|
26051
26090
|
[270 /* NamespaceExportDeclaration */]: function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) {
|
|
@@ -26060,7 +26099,7 @@ var forEachChildTable = {
|
|
|
26060
26099
|
[275 /* NamedImports */]: forEachChildInNamedImportsOrExports,
|
|
26061
26100
|
[279 /* NamedExports */]: forEachChildInNamedImportsOrExports,
|
|
26062
26101
|
[278 /* ExportDeclaration */]: function forEachChildInExportDeclaration(node, cbNode, cbNodes) {
|
|
26063
|
-
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);
|
|
26064
26103
|
},
|
|
26065
26104
|
[276 /* ImportSpecifier */]: forEachChildInImportOrExportSpecifier,
|
|
26066
26105
|
[281 /* ExportSpecifier */]: forEachChildInImportOrExportSpecifier,
|
|
@@ -27325,7 +27364,7 @@ var Parser;
|
|
|
27325
27364
|
function isLiteralPropertyName() {
|
|
27326
27365
|
return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */;
|
|
27327
27366
|
}
|
|
27328
|
-
function
|
|
27367
|
+
function isImportAttributeName2() {
|
|
27329
27368
|
return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */;
|
|
27330
27369
|
}
|
|
27331
27370
|
function parsePropertyNameWorker(allowComputedPropertyNames) {
|
|
@@ -27444,8 +27483,8 @@ var Parser;
|
|
|
27444
27483
|
return isLiteralPropertyName();
|
|
27445
27484
|
case 9 /* ObjectBindingElements */:
|
|
27446
27485
|
return token() === 23 /* OpenBracketToken */ || token() === 26 /* DotDotDotToken */ || isLiteralPropertyName();
|
|
27447
|
-
case 24 /*
|
|
27448
|
-
return
|
|
27486
|
+
case 24 /* ImportAttributes */:
|
|
27487
|
+
return isImportAttributeName2();
|
|
27449
27488
|
case 7 /* HeritageClauseElement */:
|
|
27450
27489
|
if (token() === 19 /* OpenBraceToken */) {
|
|
27451
27490
|
return lookAhead(isValidHeritageClauseObjectLiteral);
|
|
@@ -27548,7 +27587,7 @@ var Parser;
|
|
|
27548
27587
|
case 12 /* ObjectLiteralMembers */:
|
|
27549
27588
|
case 9 /* ObjectBindingElements */:
|
|
27550
27589
|
case 23 /* ImportOrExportSpecifiers */:
|
|
27551
|
-
case 24 /*
|
|
27590
|
+
case 24 /* ImportAttributes */:
|
|
27552
27591
|
return token() === 20 /* CloseBraceToken */;
|
|
27553
27592
|
case 3 /* SwitchClauseStatements */:
|
|
27554
27593
|
return token() === 20 /* CloseBraceToken */ || token() === 84 /* CaseKeyword */ || token() === 90 /* DefaultKeyword */;
|
|
@@ -27854,7 +27893,7 @@ var Parser;
|
|
|
27854
27893
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
27855
27894
|
case 14 /* JsxChildren */:
|
|
27856
27895
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
27857
|
-
case 24 /*
|
|
27896
|
+
case 24 /* ImportAttributes */:
|
|
27858
27897
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
|
|
27859
27898
|
case 25 /* JSDocComment */:
|
|
27860
27899
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
@@ -28729,28 +28768,6 @@ var Parser;
|
|
|
28729
28768
|
nextToken();
|
|
28730
28769
|
return token() === 102 /* ImportKeyword */;
|
|
28731
28770
|
}
|
|
28732
|
-
function parseImportTypeAssertions() {
|
|
28733
|
-
const pos = getNodePos();
|
|
28734
|
-
const openBracePosition = scanner.getTokenStart();
|
|
28735
|
-
parseExpected(19 /* OpenBraceToken */);
|
|
28736
|
-
const multiLine = scanner.hasPrecedingLineBreak();
|
|
28737
|
-
parseExpected(132 /* AssertKeyword */);
|
|
28738
|
-
parseExpected(59 /* ColonToken */);
|
|
28739
|
-
const clause = parseAssertClause(
|
|
28740
|
-
/*skipAssertKeyword*/
|
|
28741
|
-
true
|
|
28742
|
-
);
|
|
28743
|
-
if (!parseExpected(20 /* CloseBraceToken */)) {
|
|
28744
|
-
const lastError = lastOrUndefined(parseDiagnostics);
|
|
28745
|
-
if (lastError && lastError.code === Diagnostics._0_expected.code) {
|
|
28746
|
-
addRelatedInfo(
|
|
28747
|
-
lastError,
|
|
28748
|
-
createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
|
|
28749
|
-
);
|
|
28750
|
-
}
|
|
28751
|
-
}
|
|
28752
|
-
return finishNode(factory2.createImportTypeAssertionContainer(clause, multiLine), pos);
|
|
28753
|
-
}
|
|
28754
28771
|
function parseImportType() {
|
|
28755
28772
|
sourceFlags |= 4194304 /* PossiblyContainsDynamicImport */;
|
|
28756
28773
|
const pos = getNodePos();
|
|
@@ -28758,14 +28775,36 @@ var Parser;
|
|
|
28758
28775
|
parseExpected(102 /* ImportKeyword */);
|
|
28759
28776
|
parseExpected(21 /* OpenParenToken */);
|
|
28760
28777
|
const type = parseType();
|
|
28761
|
-
let
|
|
28778
|
+
let attributes;
|
|
28762
28779
|
if (parseOptional(28 /* CommaToken */)) {
|
|
28763
|
-
|
|
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
|
+
}
|
|
28764
28803
|
}
|
|
28765
28804
|
parseExpected(22 /* CloseParenToken */);
|
|
28766
28805
|
const qualifier = parseOptional(25 /* DotToken */) ? parseEntityNameOfTypeReference() : void 0;
|
|
28767
28806
|
const typeArguments = parseTypeArgumentsOfTypeReference();
|
|
28768
|
-
return finishNode(factory2.createImportTypeNode(type,
|
|
28807
|
+
return finishNode(factory2.createImportTypeNode(type, attributes, qualifier, typeArguments, isTypeOf), pos);
|
|
28769
28808
|
}
|
|
28770
28809
|
function nextTokenIsNumericOrBigIntLiteral() {
|
|
28771
28810
|
nextToken();
|
|
@@ -31827,15 +31866,16 @@ var Parser;
|
|
|
31827
31866
|
parseExpected(161 /* FromKeyword */);
|
|
31828
31867
|
}
|
|
31829
31868
|
const moduleSpecifier = parseModuleSpecifier();
|
|
31830
|
-
|
|
31831
|
-
|
|
31832
|
-
|
|
31869
|
+
const currentToken2 = token();
|
|
31870
|
+
let attributes;
|
|
31871
|
+
if ((currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) && !scanner.hasPrecedingLineBreak()) {
|
|
31872
|
+
attributes = parseImportAttributes(currentToken2);
|
|
31833
31873
|
}
|
|
31834
31874
|
parseSemicolon();
|
|
31835
|
-
const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier,
|
|
31875
|
+
const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes);
|
|
31836
31876
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
31837
31877
|
}
|
|
31838
|
-
function
|
|
31878
|
+
function parseImportAttribute() {
|
|
31839
31879
|
const pos = getNodePos();
|
|
31840
31880
|
const name = tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(11 /* StringLiteral */);
|
|
31841
31881
|
parseExpected(59 /* ColonToken */);
|
|
@@ -31843,19 +31883,19 @@ var Parser;
|
|
|
31843
31883
|
/*allowReturnTypeInArrowFunction*/
|
|
31844
31884
|
true
|
|
31845
31885
|
);
|
|
31846
|
-
return finishNode(factory2.
|
|
31886
|
+
return finishNode(factory2.createImportAttribute(name, value), pos);
|
|
31847
31887
|
}
|
|
31848
|
-
function
|
|
31888
|
+
function parseImportAttributes(token2, skipKeyword) {
|
|
31849
31889
|
const pos = getNodePos();
|
|
31850
|
-
if (!
|
|
31851
|
-
parseExpected(
|
|
31890
|
+
if (!skipKeyword) {
|
|
31891
|
+
parseExpected(token2);
|
|
31852
31892
|
}
|
|
31853
31893
|
const openBracePosition = scanner.getTokenStart();
|
|
31854
31894
|
if (parseExpected(19 /* OpenBraceToken */)) {
|
|
31855
31895
|
const multiLine = scanner.hasPrecedingLineBreak();
|
|
31856
31896
|
const elements = parseDelimitedList(
|
|
31857
|
-
24 /*
|
|
31858
|
-
|
|
31897
|
+
24 /* ImportAttributes */,
|
|
31898
|
+
parseImportAttribute,
|
|
31859
31899
|
/*considerSemicolonAsDelimiter*/
|
|
31860
31900
|
true
|
|
31861
31901
|
);
|
|
@@ -31868,7 +31908,7 @@ var Parser;
|
|
|
31868
31908
|
);
|
|
31869
31909
|
}
|
|
31870
31910
|
}
|
|
31871
|
-
return finishNode(factory2.
|
|
31911
|
+
return finishNode(factory2.createImportAttributes(elements, multiLine, token2), pos);
|
|
31872
31912
|
} else {
|
|
31873
31913
|
const elements = createNodeArray(
|
|
31874
31914
|
[],
|
|
@@ -31878,10 +31918,11 @@ var Parser;
|
|
|
31878
31918
|
/*hasTrailingComma*/
|
|
31879
31919
|
false
|
|
31880
31920
|
);
|
|
31881
|
-
return finishNode(factory2.
|
|
31921
|
+
return finishNode(factory2.createImportAttributes(
|
|
31882
31922
|
elements,
|
|
31883
31923
|
/*multiLine*/
|
|
31884
|
-
false
|
|
31924
|
+
false,
|
|
31925
|
+
token2
|
|
31885
31926
|
), pos);
|
|
31886
31927
|
}
|
|
31887
31928
|
}
|
|
@@ -32013,7 +32054,7 @@ var Parser;
|
|
|
32013
32054
|
);
|
|
32014
32055
|
let exportClause;
|
|
32015
32056
|
let moduleSpecifier;
|
|
32016
|
-
let
|
|
32057
|
+
let attributes;
|
|
32017
32058
|
const isTypeOnly = parseOptional(156 /* TypeKeyword */);
|
|
32018
32059
|
const namespaceExportPos = getNodePos();
|
|
32019
32060
|
if (parseOptional(42 /* AsteriskToken */)) {
|
|
@@ -32029,12 +32070,13 @@ var Parser;
|
|
|
32029
32070
|
moduleSpecifier = parseModuleSpecifier();
|
|
32030
32071
|
}
|
|
32031
32072
|
}
|
|
32032
|
-
|
|
32033
|
-
|
|
32073
|
+
const currentToken2 = token();
|
|
32074
|
+
if (moduleSpecifier && (currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) && !scanner.hasPrecedingLineBreak()) {
|
|
32075
|
+
attributes = parseImportAttributes(currentToken2);
|
|
32034
32076
|
}
|
|
32035
32077
|
parseSemicolon();
|
|
32036
32078
|
setAwaitContext(savedAwaitContext);
|
|
32037
|
-
const node = factory2.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier,
|
|
32079
|
+
const node = factory2.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes);
|
|
32038
32080
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
32039
32081
|
}
|
|
32040
32082
|
function parseExportAssignment(pos, hasJSDoc, modifiers) {
|
|
@@ -32084,7 +32126,7 @@ var Parser;
|
|
|
32084
32126
|
ParsingContext2[ParsingContext2["TupleElementTypes"] = 21] = "TupleElementTypes";
|
|
32085
32127
|
ParsingContext2[ParsingContext2["HeritageClauses"] = 22] = "HeritageClauses";
|
|
32086
32128
|
ParsingContext2[ParsingContext2["ImportOrExportSpecifiers"] = 23] = "ImportOrExportSpecifiers";
|
|
32087
|
-
ParsingContext2[ParsingContext2["
|
|
32129
|
+
ParsingContext2[ParsingContext2["ImportAttributes"] = 24] = "ImportAttributes";
|
|
32088
32130
|
ParsingContext2[ParsingContext2["JSDocComment"] = 25] = "JSDocComment";
|
|
32089
32131
|
ParsingContext2[ParsingContext2["Count"] = 26] = "Count";
|
|
32090
32132
|
})(ParsingContext || (ParsingContext = {}));
|
|
@@ -37067,10 +37109,15 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
37067
37109
|
const failedLookupLocations = [];
|
|
37068
37110
|
const affectingLocations = [];
|
|
37069
37111
|
let features = getNodeResolutionFeatures(options);
|
|
37070
|
-
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 */)) {
|
|
37071
37117
|
features |= 32 /* EsmMode */;
|
|
37072
37118
|
}
|
|
37073
|
-
const
|
|
37119
|
+
const useImportCondition = resolutionMode === 99 /* ESNext */ || (resolutionMode !== void 0 ? false : void 0);
|
|
37120
|
+
const conditions = features & 8 /* Exports */ ? getConditions(options, useImportCondition) : [];
|
|
37074
37121
|
const diagnostics = [];
|
|
37075
37122
|
const moduleResolutionState = {
|
|
37076
37123
|
compilerOptions: options,
|
|
@@ -37239,11 +37286,19 @@ function getNodeResolutionFeatures(options) {
|
|
|
37239
37286
|
return features;
|
|
37240
37287
|
}
|
|
37241
37288
|
function getConditions(options, esmMode) {
|
|
37242
|
-
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"];
|
|
37243
37298
|
if (!options.noDtsResolution) {
|
|
37244
37299
|
conditions.push("types");
|
|
37245
37300
|
}
|
|
37246
|
-
if (
|
|
37301
|
+
if (moduleResolution !== 100 /* Bundler */) {
|
|
37247
37302
|
conditions.push("node");
|
|
37248
37303
|
}
|
|
37249
37304
|
return concatenate(conditions, options.customConditions);
|
|
@@ -37661,13 +37716,13 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
37661
37716
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
37662
37717
|
break;
|
|
37663
37718
|
case 2 /* Node10 */:
|
|
37664
|
-
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);
|
|
37665
37720
|
break;
|
|
37666
37721
|
case 1 /* Classic */:
|
|
37667
37722
|
result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
37668
37723
|
break;
|
|
37669
37724
|
case 100 /* Bundler */:
|
|
37670
|
-
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);
|
|
37671
37726
|
break;
|
|
37672
37727
|
default:
|
|
37673
37728
|
return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`);
|
|
@@ -37832,7 +37887,7 @@ function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions,
|
|
|
37832
37887
|
resolutionMode
|
|
37833
37888
|
);
|
|
37834
37889
|
}
|
|
37835
|
-
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
37890
|
+
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode, conditions) {
|
|
37836
37891
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
37837
37892
|
const esmMode = resolutionMode === 99 /* ESNext */ ? 32 /* EsmMode */ : 0;
|
|
37838
37893
|
let extensions = compilerOptions.noDtsResolution ? 3 /* ImplementationFiles */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
|
|
@@ -37849,7 +37904,8 @@ function nodeNextModuleNameResolverWorker(features, moduleName, containingFile,
|
|
|
37849
37904
|
extensions,
|
|
37850
37905
|
/*isConfigLookup*/
|
|
37851
37906
|
false,
|
|
37852
|
-
redirectedReference
|
|
37907
|
+
redirectedReference,
|
|
37908
|
+
conditions
|
|
37853
37909
|
);
|
|
37854
37910
|
}
|
|
37855
37911
|
function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
@@ -37865,10 +37921,12 @@ function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
|
37865
37921
|
/*isConfigLookup*/
|
|
37866
37922
|
false,
|
|
37867
37923
|
/*redirectedReference*/
|
|
37924
|
+
void 0,
|
|
37925
|
+
/*conditions*/
|
|
37868
37926
|
void 0
|
|
37869
37927
|
);
|
|
37870
37928
|
}
|
|
37871
|
-
function bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
37929
|
+
function bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, conditions) {
|
|
37872
37930
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
37873
37931
|
let extensions = compilerOptions.noDtsResolution ? 3 /* ImplementationFiles */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
|
|
37874
37932
|
if (getResolveJsonModule(compilerOptions)) {
|
|
@@ -37884,10 +37942,11 @@ function bundlerModuleNameResolver(moduleName, containingFile, compilerOptions,
|
|
|
37884
37942
|
extensions,
|
|
37885
37943
|
/*isConfigLookup*/
|
|
37886
37944
|
false,
|
|
37887
|
-
redirectedReference
|
|
37945
|
+
redirectedReference,
|
|
37946
|
+
conditions
|
|
37888
37947
|
);
|
|
37889
37948
|
}
|
|
37890
|
-
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, isConfigLookup) {
|
|
37949
|
+
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, conditions, isConfigLookup) {
|
|
37891
37950
|
let extensions;
|
|
37892
37951
|
if (isConfigLookup) {
|
|
37893
37952
|
extensions = 8 /* Json */;
|
|
@@ -37898,7 +37957,7 @@ function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, hos
|
|
|
37898
37957
|
} else {
|
|
37899
37958
|
extensions = getResolveJsonModule(compilerOptions) ? 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */ | 8 /* Json */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
|
|
37900
37959
|
}
|
|
37901
|
-
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);
|
|
37902
37961
|
}
|
|
37903
37962
|
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
37904
37963
|
return nodeModuleNameResolverWorker(
|
|
@@ -37913,15 +37972,21 @@ function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
|
37913
37972
|
/*isConfigLookup*/
|
|
37914
37973
|
true,
|
|
37915
37974
|
/*redirectedReference*/
|
|
37975
|
+
void 0,
|
|
37976
|
+
/*conditions*/
|
|
37916
37977
|
void 0
|
|
37917
37978
|
);
|
|
37918
37979
|
}
|
|
37919
|
-
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference) {
|
|
37980
|
+
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference, conditions) {
|
|
37920
37981
|
var _a, _b, _c, _d;
|
|
37921
37982
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
37922
37983
|
const failedLookupLocations = [];
|
|
37923
37984
|
const affectingLocations = [];
|
|
37924
|
-
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
|
+
));
|
|
37925
37990
|
const diagnostics = [];
|
|
37926
37991
|
const state = {
|
|
37927
37992
|
compilerOptions,
|
|
@@ -37931,17 +37996,17 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37931
37996
|
affectingLocations,
|
|
37932
37997
|
packageJsonInfoCache: cache,
|
|
37933
37998
|
features,
|
|
37934
|
-
conditions,
|
|
37999
|
+
conditions: conditions ?? emptyArray,
|
|
37935
38000
|
requestContainingDirectory: containingDirectory,
|
|
37936
38001
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
37937
38002
|
isConfigLookup,
|
|
37938
38003
|
candidateIsFromPackageJsonField: false
|
|
37939
38004
|
};
|
|
37940
|
-
if (traceEnabled && moduleResolutionSupportsPackageJsonExportsAndImports(
|
|
37941
|
-
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(", "));
|
|
37942
38007
|
}
|
|
37943
38008
|
let result;
|
|
37944
|
-
if (
|
|
38009
|
+
if (moduleResolution === 2 /* Node10 */) {
|
|
37945
38010
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
37946
38011
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
37947
38012
|
result = priorityExtensions && tryResolve(priorityExtensions, state) || secondaryExtensions && tryResolve(secondaryExtensions, state) || void 0;
|
|
@@ -37949,7 +38014,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37949
38014
|
result = tryResolve(extensions, state);
|
|
37950
38015
|
}
|
|
37951
38016
|
let legacyResult;
|
|
37952
|
-
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"))) {
|
|
37953
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);
|
|
37954
38019
|
const diagnosticState = {
|
|
37955
38020
|
...state,
|
|
@@ -38625,7 +38690,8 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38625
38690
|
extensions,
|
|
38626
38691
|
/*isConfigLookup*/
|
|
38627
38692
|
false,
|
|
38628
|
-
redirectedReference
|
|
38693
|
+
redirectedReference,
|
|
38694
|
+
state.conditions
|
|
38629
38695
|
);
|
|
38630
38696
|
return toSearchResult(
|
|
38631
38697
|
result.resolvedModule ? {
|
|
@@ -46318,7 +46384,7 @@ function createTypeChecker(host) {
|
|
|
46318
46384
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
46319
46385
|
}
|
|
46320
46386
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
46321
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j
|
|
46387
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
46322
46388
|
if (startsWith(moduleReference, "@types/")) {
|
|
46323
46389
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
46324
46390
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -46373,9 +46439,8 @@ function createTypeChecker(host) {
|
|
|
46373
46439
|
}
|
|
46374
46440
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
46375
46441
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
46376
|
-
const
|
|
46377
|
-
|
|
46378
|
-
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)) {
|
|
46379
46444
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
46380
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);
|
|
46381
46446
|
} else {
|
|
@@ -46481,7 +46546,7 @@ function createTypeChecker(host) {
|
|
|
46481
46546
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
46482
46547
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
46483
46548
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
46484
|
-
const suggestedExt = (
|
|
46549
|
+
const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
|
|
46485
46550
|
if (suggestedExt) {
|
|
46486
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);
|
|
46487
46552
|
} else {
|
|
@@ -48246,7 +48311,7 @@ function createTypeChecker(host) {
|
|
|
48246
48311
|
return factory.updateImportTypeNode(
|
|
48247
48312
|
root,
|
|
48248
48313
|
root.argument,
|
|
48249
|
-
root.
|
|
48314
|
+
root.attributes,
|
|
48250
48315
|
qualifier,
|
|
48251
48316
|
typeArguments,
|
|
48252
48317
|
root.isTypeOf
|
|
@@ -48979,7 +49044,6 @@ function createTypeChecker(host) {
|
|
|
48979
49044
|
return symbol.parent ? factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
|
|
48980
49045
|
}
|
|
48981
49046
|
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
|
|
48982
|
-
var _a, _b, _c, _d;
|
|
48983
49047
|
const chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */));
|
|
48984
49048
|
const isTypeOf = meaning === 111551 /* Value */;
|
|
48985
49049
|
if (some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
@@ -48988,17 +49052,18 @@ function createTypeChecker(host) {
|
|
|
48988
49052
|
const contextFile = getSourceFileOfNode(getOriginalNode(context.enclosingDeclaration));
|
|
48989
49053
|
const targetFile = getSourceFileOfModule(chain[0]);
|
|
48990
49054
|
let specifier;
|
|
48991
|
-
let
|
|
49055
|
+
let attributes;
|
|
48992
49056
|
if (getEmitModuleResolutionKind(compilerOptions) === 3 /* Node16 */ || getEmitModuleResolutionKind(compilerOptions) === 99 /* NodeNext */) {
|
|
48993
49057
|
if ((targetFile == null ? void 0 : targetFile.impliedNodeFormat) === 99 /* ESNext */ && targetFile.impliedNodeFormat !== (contextFile == null ? void 0 : contextFile.impliedNodeFormat)) {
|
|
48994
49058
|
specifier = getSpecifierForModuleSymbol(chain[0], context, 99 /* ESNext */);
|
|
48995
|
-
|
|
48996
|
-
factory.
|
|
48997
|
-
factory.
|
|
48998
|
-
|
|
48999
|
-
|
|
49000
|
-
|
|
49001
|
-
|
|
49059
|
+
attributes = factory.createImportAttributes(
|
|
49060
|
+
factory.createNodeArray([
|
|
49061
|
+
factory.createImportAttribute(
|
|
49062
|
+
factory.createStringLiteral("resolution-mode"),
|
|
49063
|
+
factory.createStringLiteral("import")
|
|
49064
|
+
)
|
|
49065
|
+
])
|
|
49066
|
+
);
|
|
49002
49067
|
}
|
|
49003
49068
|
}
|
|
49004
49069
|
if (!specifier) {
|
|
@@ -49012,16 +49077,17 @@ function createTypeChecker(host) {
|
|
|
49012
49077
|
if (specifier.includes("/node_modules/")) {
|
|
49013
49078
|
specifier = oldSpecifier;
|
|
49014
49079
|
} else {
|
|
49015
|
-
|
|
49016
|
-
factory.
|
|
49017
|
-
factory.
|
|
49018
|
-
|
|
49019
|
-
|
|
49020
|
-
|
|
49021
|
-
|
|
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
|
+
);
|
|
49022
49088
|
}
|
|
49023
49089
|
}
|
|
49024
|
-
if (!
|
|
49090
|
+
if (!attributes) {
|
|
49025
49091
|
context.encounteredError = true;
|
|
49026
49092
|
if (context.tracker.reportLikelyUnsafeImportRequiredError) {
|
|
49027
49093
|
context.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier);
|
|
@@ -49041,11 +49107,11 @@ function createTypeChecker(host) {
|
|
|
49041
49107
|
void 0
|
|
49042
49108
|
);
|
|
49043
49109
|
}
|
|
49044
|
-
return factory.createImportTypeNode(lit,
|
|
49110
|
+
return factory.createImportTypeNode(lit, attributes, nonRootParts, typeParameterNodes, isTypeOf);
|
|
49045
49111
|
} else {
|
|
49046
49112
|
const splitNode = getTopmostIndexedAccessType(nonRootParts);
|
|
49047
49113
|
const qualifier = splitNode.objectType.typeName;
|
|
49048
|
-
return factory.createIndexedAccessTypeNode(factory.createImportTypeNode(lit,
|
|
49114
|
+
return factory.createIndexedAccessTypeNode(factory.createImportTypeNode(lit, attributes, qualifier, typeParameterNodes, isTypeOf), splitNode.indexType);
|
|
49049
49115
|
}
|
|
49050
49116
|
}
|
|
49051
49117
|
const entityName = createAccessFromSymbolChain(chain, chain.length - 1, 0);
|
|
@@ -49521,7 +49587,7 @@ function createTypeChecker(host) {
|
|
|
49521
49587
|
return factory.updateImportTypeNode(
|
|
49522
49588
|
node,
|
|
49523
49589
|
factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)),
|
|
49524
|
-
node.
|
|
49590
|
+
node.attributes,
|
|
49525
49591
|
node.qualifier,
|
|
49526
49592
|
visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
|
|
49527
49593
|
node.isTypeOf
|
|
@@ -49741,7 +49807,7 @@ function createTypeChecker(host) {
|
|
|
49741
49807
|
return statements;
|
|
49742
49808
|
}
|
|
49743
49809
|
function inlineExportModifiers(statements) {
|
|
49744
|
-
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));
|
|
49745
49811
|
if (index >= 0) {
|
|
49746
49812
|
const exportDecl = statements[index];
|
|
49747
49813
|
const replacements = mapDefined(exportDecl.exportClause.elements, (e) => {
|
|
@@ -49769,7 +49835,7 @@ function createTypeChecker(host) {
|
|
|
49769
49835
|
replacements
|
|
49770
49836
|
),
|
|
49771
49837
|
exportDecl.moduleSpecifier,
|
|
49772
|
-
exportDecl.
|
|
49838
|
+
exportDecl.attributes
|
|
49773
49839
|
);
|
|
49774
49840
|
}
|
|
49775
49841
|
}
|
|
@@ -50420,7 +50486,7 @@ function createTypeChecker(host) {
|
|
|
50420
50486
|
)])
|
|
50421
50487
|
),
|
|
50422
50488
|
factory.createStringLiteral(specifier2),
|
|
50423
|
-
/*
|
|
50489
|
+
/*attributes*/
|
|
50424
50490
|
void 0
|
|
50425
50491
|
),
|
|
50426
50492
|
0 /* None */
|
|
@@ -50508,7 +50574,7 @@ function createTypeChecker(host) {
|
|
|
50508
50574
|
void 0
|
|
50509
50575
|
),
|
|
50510
50576
|
specifier2,
|
|
50511
|
-
node.parent.
|
|
50577
|
+
node.parent.attributes
|
|
50512
50578
|
),
|
|
50513
50579
|
0 /* None */
|
|
50514
50580
|
);
|
|
@@ -50529,7 +50595,7 @@ function createTypeChecker(host) {
|
|
|
50529
50595
|
factory.createNamespaceImport(factory.createIdentifier(localName))
|
|
50530
50596
|
),
|
|
50531
50597
|
specifier2,
|
|
50532
|
-
node.parent.
|
|
50598
|
+
node.parent.attributes
|
|
50533
50599
|
),
|
|
50534
50600
|
0 /* None */
|
|
50535
50601
|
);
|
|
@@ -50570,7 +50636,7 @@ function createTypeChecker(host) {
|
|
|
50570
50636
|
])
|
|
50571
50637
|
),
|
|
50572
50638
|
specifier2,
|
|
50573
|
-
node.parent.parent.parent.
|
|
50639
|
+
node.parent.parent.parent.attributes
|
|
50574
50640
|
),
|
|
50575
50641
|
0 /* None */
|
|
50576
50642
|
);
|
|
@@ -60029,6 +60095,7 @@ function createTypeChecker(host) {
|
|
|
60029
60095
|
let skipParentCounter = 0;
|
|
60030
60096
|
let lastSkippedInfo;
|
|
60031
60097
|
let incompatibleStack;
|
|
60098
|
+
let relationCount = 16e6 - relation.size >> 3;
|
|
60032
60099
|
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
60033
60100
|
const result = isRelatedTo(
|
|
60034
60101
|
source,
|
|
@@ -60042,8 +60109,19 @@ function createTypeChecker(host) {
|
|
|
60042
60109
|
reportIncompatibleStack();
|
|
60043
60110
|
}
|
|
60044
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 */);
|
|
60045
60122
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
|
|
60046
|
-
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));
|
|
60047
60125
|
if (errorOutputContainer) {
|
|
60048
60126
|
(errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag2);
|
|
60049
60127
|
}
|
|
@@ -60574,6 +60652,16 @@ function createTypeChecker(host) {
|
|
|
60574
60652
|
}
|
|
60575
60653
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
60576
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
|
+
}
|
|
60577
60665
|
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState);
|
|
60578
60666
|
}
|
|
60579
60667
|
if (target2.flags & 1048576 /* Union */) {
|
|
@@ -60887,6 +60975,10 @@ function createTypeChecker(host) {
|
|
|
60887
60975
|
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
|
|
60888
60976
|
}
|
|
60889
60977
|
}
|
|
60978
|
+
if (relationCount <= 0) {
|
|
60979
|
+
overflow = true;
|
|
60980
|
+
return 0 /* False */;
|
|
60981
|
+
}
|
|
60890
60982
|
if (!maybeKeys) {
|
|
60891
60983
|
maybeKeys = [];
|
|
60892
60984
|
maybeKeysSet = /* @__PURE__ */ new Set();
|
|
@@ -60980,6 +61072,7 @@ function createTypeChecker(host) {
|
|
|
60980
61072
|
}
|
|
60981
61073
|
} else {
|
|
60982
61074
|
relation.set(id, (reportErrors2 ? 4 /* Reported */ : 0) | 2 /* Failed */ | propagatingVarianceFlags);
|
|
61075
|
+
relationCount--;
|
|
60983
61076
|
resetMaybeStack(
|
|
60984
61077
|
/*markAllAsSucceeded*/
|
|
60985
61078
|
false
|
|
@@ -60991,6 +61084,7 @@ function createTypeChecker(host) {
|
|
|
60991
61084
|
maybeKeysSet.delete(maybeKeys[i]);
|
|
60992
61085
|
if (markAllAsSucceeded) {
|
|
60993
61086
|
relation.set(maybeKeys[i], 1 /* Succeeded */ | propagatingVarianceFlags);
|
|
61087
|
+
relationCount--;
|
|
60994
61088
|
}
|
|
60995
61089
|
}
|
|
60996
61090
|
maybeCount = maybeStart;
|
|
@@ -75823,16 +75917,8 @@ function createTypeChecker(host) {
|
|
|
75823
75917
|
}
|
|
75824
75918
|
function checkImportType(node) {
|
|
75825
75919
|
checkSourceElement(node.argument);
|
|
75826
|
-
if (node.
|
|
75827
|
-
|
|
75828
|
-
if (override) {
|
|
75829
|
-
if (!isNightly()) {
|
|
75830
|
-
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);
|
|
75831
|
-
}
|
|
75832
|
-
if (getEmitModuleResolutionKind(compilerOptions) !== 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) !== 99 /* NodeNext */) {
|
|
75833
|
-
grammarErrorOnNode(node.assertions.assertClause, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
75834
|
-
}
|
|
75835
|
-
}
|
|
75920
|
+
if (node.attributes) {
|
|
75921
|
+
getResolutionModeOverride(node.attributes, grammarErrorOnNode);
|
|
75836
75922
|
}
|
|
75837
75923
|
checkTypeReferenceOrImport(node);
|
|
75838
75924
|
}
|
|
@@ -79796,12 +79882,13 @@ function createTypeChecker(host) {
|
|
|
79796
79882
|
return false;
|
|
79797
79883
|
}
|
|
79798
79884
|
}
|
|
79799
|
-
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;
|
|
79800
79887
|
let hasError = false;
|
|
79801
|
-
for (const
|
|
79802
|
-
if (!isStringLiteral(
|
|
79888
|
+
for (const attr of node.attributes.elements) {
|
|
79889
|
+
if (!isStringLiteral(attr.value)) {
|
|
79803
79890
|
hasError = true;
|
|
79804
|
-
error(
|
|
79891
|
+
error(attr.value, diagnostic);
|
|
79805
79892
|
}
|
|
79806
79893
|
}
|
|
79807
79894
|
return !hasError;
|
|
@@ -79933,32 +80020,26 @@ function createTypeChecker(host) {
|
|
|
79933
80020
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
79934
80021
|
}
|
|
79935
80022
|
}
|
|
79936
|
-
function
|
|
80023
|
+
function checkImportAttributes(declaration) {
|
|
79937
80024
|
var _a;
|
|
79938
|
-
|
|
79939
|
-
|
|
79940
|
-
const
|
|
79941
|
-
|
|
79942
|
-
|
|
79943
|
-
|
|
79944
|
-
}
|
|
79945
|
-
if (getEmitModuleResolutionKind(compilerOptions) !== 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) !== 99 /* NodeNext */) {
|
|
79946
|
-
return grammarErrorOnNode(declaration.assertClause, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
79947
|
-
}
|
|
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) {
|
|
79948
80031
|
return;
|
|
79949
80032
|
}
|
|
79950
80033
|
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
|
|
79951
80034
|
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */) {
|
|
79952
|
-
|
|
79953
|
-
|
|
79954
|
-
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
|
|
79955
|
-
);
|
|
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);
|
|
79956
80037
|
}
|
|
79957
80038
|
if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
|
|
79958
|
-
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);
|
|
79959
80040
|
}
|
|
79960
80041
|
if (override) {
|
|
79961
|
-
return grammarErrorOnNode(
|
|
80042
|
+
return grammarErrorOnNode(node, Diagnostics.resolution_mode_can_only_be_set_for_type_only_imports);
|
|
79962
80043
|
}
|
|
79963
80044
|
}
|
|
79964
80045
|
}
|
|
@@ -79990,7 +80071,7 @@ function createTypeChecker(host) {
|
|
|
79990
80071
|
}
|
|
79991
80072
|
}
|
|
79992
80073
|
}
|
|
79993
|
-
|
|
80074
|
+
checkImportAttributes(node);
|
|
79994
80075
|
}
|
|
79995
80076
|
function checkImportEqualsDeclaration(node) {
|
|
79996
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)) {
|
|
@@ -80063,7 +80144,7 @@ function createTypeChecker(host) {
|
|
|
80063
80144
|
}
|
|
80064
80145
|
}
|
|
80065
80146
|
}
|
|
80066
|
-
|
|
80147
|
+
checkImportAttributes(node);
|
|
80067
80148
|
}
|
|
80068
80149
|
function checkGrammarExportDeclaration(node) {
|
|
80069
80150
|
var _a;
|
|
@@ -83853,12 +83934,12 @@ function createTypeChecker(host) {
|
|
|
83853
83934
|
if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */) {
|
|
83854
83935
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
83855
83936
|
if (nodeArguments.length > 1) {
|
|
83856
|
-
const
|
|
83857
|
-
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);
|
|
83858
83939
|
}
|
|
83859
83940
|
}
|
|
83860
83941
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
83861
|
-
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);
|
|
83862
83943
|
}
|
|
83863
83944
|
const spreadElement = find(nodeArguments, isSpreadElement);
|
|
83864
83945
|
if (spreadElement) {
|
|
@@ -84125,13 +84206,6 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
|
84125
84206
|
this.inner.reportNonSerializableProperty(propertyName);
|
|
84126
84207
|
}
|
|
84127
84208
|
}
|
|
84128
|
-
reportImportTypeNodeResolutionModeOverride() {
|
|
84129
|
-
var _a;
|
|
84130
|
-
if ((_a = this.inner) == null ? void 0 : _a.reportImportTypeNodeResolutionModeOverride) {
|
|
84131
|
-
this.onDiagnosticReported();
|
|
84132
|
-
this.inner.reportImportTypeNodeResolutionModeOverride();
|
|
84133
|
-
}
|
|
84134
|
-
}
|
|
84135
84209
|
onDiagnosticReported() {
|
|
84136
84210
|
this.context.reportedDiagnostic = true;
|
|
84137
84211
|
}
|
|
@@ -84640,7 +84714,7 @@ var visitEachChildTable = {
|
|
|
84640
84714
|
return context.factory.updateImportTypeNode(
|
|
84641
84715
|
node,
|
|
84642
84716
|
Debug.checkDefined(nodeVisitor(node.argument, visitor, isTypeNode)),
|
|
84643
|
-
nodeVisitor(node.
|
|
84717
|
+
nodeVisitor(node.attributes, visitor, isImportAttributes),
|
|
84644
84718
|
nodeVisitor(node.qualifier, visitor, isEntityName),
|
|
84645
84719
|
nodesVisitor(node.typeArguments, visitor, isTypeNode),
|
|
84646
84720
|
node.isTypeOf
|
|
@@ -85191,20 +85265,20 @@ var visitEachChildTable = {
|
|
|
85191
85265
|
nodesVisitor(node.modifiers, visitor, isModifierLike),
|
|
85192
85266
|
nodeVisitor(node.importClause, visitor, isImportClause),
|
|
85193
85267
|
Debug.checkDefined(nodeVisitor(node.moduleSpecifier, visitor, isExpression)),
|
|
85194
|
-
nodeVisitor(node.
|
|
85268
|
+
nodeVisitor(node.attributes, visitor, isImportAttributes)
|
|
85195
85269
|
);
|
|
85196
85270
|
},
|
|
85197
|
-
[300 /*
|
|
85198
|
-
return context.factory.
|
|
85271
|
+
[300 /* ImportAttributes */]: function visitEachChildOfImportAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
|
|
85272
|
+
return context.factory.updateImportAttributes(
|
|
85199
85273
|
node,
|
|
85200
|
-
nodesVisitor(node.elements, visitor,
|
|
85274
|
+
nodesVisitor(node.elements, visitor, isImportAttribute),
|
|
85201
85275
|
node.multiLine
|
|
85202
85276
|
);
|
|
85203
85277
|
},
|
|
85204
|
-
[301 /*
|
|
85205
|
-
return context.factory.
|
|
85278
|
+
[301 /* ImportAttribute */]: function visitEachChildOfImportAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
|
|
85279
|
+
return context.factory.updateImportAttribute(
|
|
85206
85280
|
node,
|
|
85207
|
-
Debug.checkDefined(nodeVisitor(node.name, visitor,
|
|
85281
|
+
Debug.checkDefined(nodeVisitor(node.name, visitor, isImportAttributeName)),
|
|
85208
85282
|
Debug.checkDefined(nodeVisitor(node.value, visitor, isExpression))
|
|
85209
85283
|
);
|
|
85210
85284
|
},
|
|
@@ -85256,7 +85330,7 @@ var visitEachChildTable = {
|
|
|
85256
85330
|
node.isTypeOnly,
|
|
85257
85331
|
nodeVisitor(node.exportClause, visitor, isNamedExportBindings),
|
|
85258
85332
|
nodeVisitor(node.moduleSpecifier, visitor, isExpression),
|
|
85259
|
-
nodeVisitor(node.
|
|
85333
|
+
nodeVisitor(node.attributes, visitor, isImportAttributes)
|
|
85260
85334
|
);
|
|
85261
85335
|
},
|
|
85262
85336
|
[279 /* NamedExports */]: function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
|
|
@@ -88575,7 +88649,7 @@ function transformTypeScript(context) {
|
|
|
88575
88649
|
void 0,
|
|
88576
88650
|
importClause,
|
|
88577
88651
|
node.moduleSpecifier,
|
|
88578
|
-
node.
|
|
88652
|
+
node.attributes
|
|
88579
88653
|
) : void 0;
|
|
88580
88654
|
}
|
|
88581
88655
|
function visitImportClause(node) {
|
|
@@ -88625,7 +88699,7 @@ function transformTypeScript(context) {
|
|
|
88625
88699
|
node.isTypeOnly,
|
|
88626
88700
|
exportClause,
|
|
88627
88701
|
node.moduleSpecifier,
|
|
88628
|
-
node.
|
|
88702
|
+
node.attributes
|
|
88629
88703
|
) : void 0;
|
|
88630
88704
|
}
|
|
88631
88705
|
function visitNamedExports(node, allowEmpty) {
|
|
@@ -88659,7 +88733,7 @@ function transformTypeScript(context) {
|
|
|
88659
88733
|
/*importClause*/
|
|
88660
88734
|
void 0,
|
|
88661
88735
|
node.moduleReference.expression,
|
|
88662
|
-
/*
|
|
88736
|
+
/*attributes*/
|
|
88663
88737
|
void 0
|
|
88664
88738
|
),
|
|
88665
88739
|
node
|
|
@@ -96829,7 +96903,7 @@ function transformJsx(context) {
|
|
|
96829
96903
|
factory2.createNamedImports(arrayFrom(importSpecifiersMap.values()))
|
|
96830
96904
|
),
|
|
96831
96905
|
factory2.createStringLiteral(importSource),
|
|
96832
|
-
/*
|
|
96906
|
+
/*attributes*/
|
|
96833
96907
|
void 0
|
|
96834
96908
|
);
|
|
96835
96909
|
setParentRecursive(
|
|
@@ -106236,7 +106310,9 @@ function transformECMAScriptModule(context) {
|
|
|
106236
106310
|
)
|
|
106237
106311
|
])
|
|
106238
106312
|
),
|
|
106239
|
-
factory2.createStringLiteral("module")
|
|
106313
|
+
factory2.createStringLiteral("module"),
|
|
106314
|
+
/*attributes*/
|
|
106315
|
+
void 0
|
|
106240
106316
|
);
|
|
106241
106317
|
const requireHelperName = factory2.createUniqueName("__require", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
106242
106318
|
const requireStatement = factory2.createVariableStatement(
|
|
@@ -106353,7 +106429,7 @@ function transformECMAScriptModule(context) {
|
|
|
106353
106429
|
)
|
|
106354
106430
|
),
|
|
106355
106431
|
node.moduleSpecifier,
|
|
106356
|
-
node.
|
|
106432
|
+
node.attributes
|
|
106357
106433
|
);
|
|
106358
106434
|
setOriginalNode(importDecl, node.exportClause);
|
|
106359
106435
|
const exportDecl = isExportNamespaceAsDefaultDeclaration(node) ? factory2.createExportDefault(synthName) : factory2.createExportDeclaration(
|
|
@@ -106806,8 +106882,7 @@ function transformDeclarations(context) {
|
|
|
106806
106882
|
trackReferencedAmbientModule,
|
|
106807
106883
|
trackExternalModuleSymbolOfImportTypeNode,
|
|
106808
106884
|
reportNonlocalAugmentation,
|
|
106809
|
-
reportNonSerializableProperty
|
|
106810
|
-
reportImportTypeNodeResolutionModeOverride
|
|
106885
|
+
reportNonSerializableProperty
|
|
106811
106886
|
};
|
|
106812
106887
|
let errorNameNode;
|
|
106813
106888
|
let errorFallbackNode;
|
|
@@ -106931,11 +107006,6 @@ function transformDeclarations(context) {
|
|
|
106931
107006
|
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
106932
107007
|
}
|
|
106933
107008
|
}
|
|
106934
|
-
function reportImportTypeNodeResolutionModeOverride() {
|
|
106935
|
-
if (!isNightly() && (errorNameNode || errorFallbackNode)) {
|
|
106936
|
-
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));
|
|
106937
|
-
}
|
|
106938
|
-
}
|
|
106939
107009
|
function transformDeclarationsForJS(sourceFile, bundled) {
|
|
106940
107010
|
const oldDiag = getSymbolAccessibilityDiagnostic;
|
|
106941
107011
|
getSymbolAccessibilityDiagnostic = (s) => s.errorNode && canProduceDiagnostics(s.errorNode) ? createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : {
|
|
@@ -107440,7 +107510,7 @@ function transformDeclarations(context) {
|
|
|
107440
107510
|
decl.modifiers,
|
|
107441
107511
|
decl.importClause,
|
|
107442
107512
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107443
|
-
|
|
107513
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107444
107514
|
);
|
|
107445
107515
|
}
|
|
107446
107516
|
const visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : void 0;
|
|
@@ -107456,7 +107526,7 @@ function transformDeclarations(context) {
|
|
|
107456
107526
|
void 0
|
|
107457
107527
|
),
|
|
107458
107528
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107459
|
-
|
|
107529
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107460
107530
|
);
|
|
107461
107531
|
}
|
|
107462
107532
|
if (decl.importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
@@ -107474,7 +107544,7 @@ function transformDeclarations(context) {
|
|
|
107474
107544
|
namedBindings
|
|
107475
107545
|
),
|
|
107476
107546
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107477
|
-
|
|
107547
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107478
107548
|
) : void 0;
|
|
107479
107549
|
}
|
|
107480
107550
|
const bindingList = mapDefined(decl.importClause.namedBindings.elements, (b) => resolver.isDeclarationVisible(b) ? b : void 0);
|
|
@@ -107489,7 +107559,7 @@ function transformDeclarations(context) {
|
|
|
107489
107559
|
bindingList && bindingList.length ? factory2.updateNamedImports(decl.importClause.namedBindings, bindingList) : void 0
|
|
107490
107560
|
),
|
|
107491
107561
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107492
|
-
|
|
107562
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107493
107563
|
);
|
|
107494
107564
|
}
|
|
107495
107565
|
if (resolver.isImportRequiredByAugmentation(decl)) {
|
|
@@ -107499,19 +107569,13 @@ function transformDeclarations(context) {
|
|
|
107499
107569
|
/*importClause*/
|
|
107500
107570
|
void 0,
|
|
107501
107571
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107502
|
-
|
|
107572
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107503
107573
|
);
|
|
107504
107574
|
}
|
|
107505
107575
|
}
|
|
107506
|
-
function
|
|
107507
|
-
const mode =
|
|
107508
|
-
|
|
107509
|
-
if (!isNightly()) {
|
|
107510
|
-
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));
|
|
107511
|
-
}
|
|
107512
|
-
return assertClause;
|
|
107513
|
-
}
|
|
107514
|
-
return void 0;
|
|
107576
|
+
function tryGetResolutionModeOverride(node) {
|
|
107577
|
+
const mode = getResolutionModeOverride(node);
|
|
107578
|
+
return node && mode !== void 0 ? node : void 0;
|
|
107515
107579
|
}
|
|
107516
107580
|
function transformAndReplaceLatePaintedStatements(statements) {
|
|
107517
107581
|
while (length(lateMarkedStatements)) {
|
|
@@ -107797,7 +107861,7 @@ function transformDeclarations(context) {
|
|
|
107797
107861
|
return cleanup(factory2.updateImportTypeNode(
|
|
107798
107862
|
input,
|
|
107799
107863
|
factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)),
|
|
107800
|
-
input.
|
|
107864
|
+
input.attributes,
|
|
107801
107865
|
input.qualifier,
|
|
107802
107866
|
visitNodes2(input.typeArguments, visitDeclarationSubtree, isTypeNode),
|
|
107803
107867
|
input.isTypeOf
|
|
@@ -107851,7 +107915,7 @@ function transformDeclarations(context) {
|
|
|
107851
107915
|
input.isTypeOnly,
|
|
107852
107916
|
input.exportClause,
|
|
107853
107917
|
rewriteModuleSpecifier(input, input.moduleSpecifier),
|
|
107854
|
-
|
|
107918
|
+
tryGetResolutionModeOverride(input.attributes)
|
|
107855
107919
|
);
|
|
107856
107920
|
}
|
|
107857
107921
|
case 277 /* ExportAssignment */: {
|
|
@@ -110346,10 +110410,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
110346
110410
|
return emitNamedExports(node);
|
|
110347
110411
|
case 281 /* ExportSpecifier */:
|
|
110348
110412
|
return emitExportSpecifier(node);
|
|
110349
|
-
case 300 /*
|
|
110350
|
-
return
|
|
110351
|
-
case 301 /*
|
|
110352
|
-
return
|
|
110413
|
+
case 300 /* ImportAttributes */:
|
|
110414
|
+
return emitImportAttributes(node);
|
|
110415
|
+
case 301 /* ImportAttribute */:
|
|
110416
|
+
return emitImportAttribute(node);
|
|
110353
110417
|
case 282 /* MissingDeclaration */:
|
|
110354
110418
|
return;
|
|
110355
110419
|
case 283 /* ExternalModuleReference */:
|
|
@@ -111124,16 +111188,16 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111124
111188
|
writeKeyword("import");
|
|
111125
111189
|
writePunctuation("(");
|
|
111126
111190
|
emit(node.argument);
|
|
111127
|
-
if (node.
|
|
111191
|
+
if (node.attributes) {
|
|
111128
111192
|
writePunctuation(",");
|
|
111129
111193
|
writeSpace();
|
|
111130
111194
|
writePunctuation("{");
|
|
111131
111195
|
writeSpace();
|
|
111132
|
-
writeKeyword("assert");
|
|
111196
|
+
writeKeyword(node.attributes.token === 132 /* AssertKeyword */ ? "assert" : "with");
|
|
111133
111197
|
writePunctuation(":");
|
|
111134
111198
|
writeSpace();
|
|
111135
|
-
const elements = node.
|
|
111136
|
-
emitList(node.
|
|
111199
|
+
const elements = node.attributes.elements;
|
|
111200
|
+
emitList(node.attributes, elements, 526226 /* ImportAttributes */);
|
|
111137
111201
|
writeSpace();
|
|
111138
111202
|
writePunctuation("}");
|
|
111139
111203
|
}
|
|
@@ -112122,8 +112186,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
112122
112186
|
writeSpace();
|
|
112123
112187
|
}
|
|
112124
112188
|
emitExpression(node.moduleSpecifier);
|
|
112125
|
-
if (node.
|
|
112126
|
-
emitWithLeadingSpace(node.
|
|
112189
|
+
if (node.attributes) {
|
|
112190
|
+
emitWithLeadingSpace(node.attributes);
|
|
112127
112191
|
}
|
|
112128
112192
|
writeTrailingSemicolon();
|
|
112129
112193
|
}
|
|
@@ -112192,18 +112256,18 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
112192
112256
|
writeSpace();
|
|
112193
112257
|
emitExpression(node.moduleSpecifier);
|
|
112194
112258
|
}
|
|
112195
|
-
if (node.
|
|
112196
|
-
emitWithLeadingSpace(node.
|
|
112259
|
+
if (node.attributes) {
|
|
112260
|
+
emitWithLeadingSpace(node.attributes);
|
|
112197
112261
|
}
|
|
112198
112262
|
writeTrailingSemicolon();
|
|
112199
112263
|
}
|
|
112200
|
-
function
|
|
112201
|
-
emitTokenWithComment(
|
|
112264
|
+
function emitImportAttributes(node) {
|
|
112265
|
+
emitTokenWithComment(node.token, node.pos, writeKeyword, node);
|
|
112202
112266
|
writeSpace();
|
|
112203
112267
|
const elements = node.elements;
|
|
112204
|
-
emitList(node, elements, 526226 /*
|
|
112268
|
+
emitList(node, elements, 526226 /* ImportAttributes */);
|
|
112205
112269
|
}
|
|
112206
|
-
function
|
|
112270
|
+
function emitImportAttribute(node) {
|
|
112207
112271
|
emit(node.name);
|
|
112208
112272
|
writePunctuation(":");
|
|
112209
112273
|
writeSpace();
|
|
@@ -115240,8 +115304,6 @@ function getModeForFileReference(ref, containingFileMode) {
|
|
|
115240
115304
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
115241
115305
|
}
|
|
115242
115306
|
function getModeForResolutionAtIndex(file, index) {
|
|
115243
|
-
if (file.impliedNodeFormat === void 0)
|
|
115244
|
-
return void 0;
|
|
115245
115307
|
return getModeForUsageLocation(file, getModuleNameStringLiteralAt(file, index));
|
|
115246
115308
|
}
|
|
115247
115309
|
function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
@@ -115255,42 +115317,48 @@ function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
|
115255
115317
|
return false;
|
|
115256
115318
|
}
|
|
115257
115319
|
function getModeForUsageLocation(file, usage) {
|
|
115258
|
-
var _a
|
|
115259
|
-
if (file.impliedNodeFormat === void 0)
|
|
115260
|
-
return void 0;
|
|
115320
|
+
var _a;
|
|
115261
115321
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
115262
115322
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
115263
115323
|
if (isTypeOnly) {
|
|
115264
|
-
const override =
|
|
115324
|
+
const override = getResolutionModeOverride(usage.parent.attributes);
|
|
115265
115325
|
if (override) {
|
|
115266
115326
|
return override;
|
|
115267
115327
|
}
|
|
115268
115328
|
}
|
|
115269
115329
|
}
|
|
115270
115330
|
if (usage.parent.parent && isImportTypeNode(usage.parent.parent)) {
|
|
115271
|
-
const override =
|
|
115331
|
+
const override = getResolutionModeOverride(usage.parent.parent.attributes);
|
|
115272
115332
|
if (override) {
|
|
115273
115333
|
return override;
|
|
115274
115334
|
}
|
|
115275
115335
|
}
|
|
115336
|
+
if (file.impliedNodeFormat === void 0)
|
|
115337
|
+
return void 0;
|
|
115276
115338
|
if (file.impliedNodeFormat !== 99 /* ESNext */) {
|
|
115277
115339
|
return isImportCall(walkUpParenthesizedExpressions(usage.parent)) ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
115278
115340
|
}
|
|
115279
|
-
const exprParentParent = (
|
|
115341
|
+
const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
|
|
115280
115342
|
return exprParentParent && isImportEqualsDeclaration(exprParentParent) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
115281
115343
|
}
|
|
115282
|
-
function
|
|
115283
|
-
if (!
|
|
115344
|
+
function getResolutionModeOverride(node, grammarErrorOnNode) {
|
|
115345
|
+
if (!node)
|
|
115284
115346
|
return void 0;
|
|
115285
|
-
if (length(
|
|
115286
|
-
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
|
+
);
|
|
115287
115352
|
return void 0;
|
|
115288
115353
|
}
|
|
115289
|
-
const elem =
|
|
115354
|
+
const elem = node.elements[0];
|
|
115290
115355
|
if (!isStringLiteralLike(elem.name))
|
|
115291
115356
|
return void 0;
|
|
115292
115357
|
if (elem.name.text !== "resolution-mode") {
|
|
115293
|
-
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
|
+
);
|
|
115294
115362
|
return void 0;
|
|
115295
115363
|
}
|
|
115296
115364
|
if (!isStringLiteralLike(elem.value))
|
|
@@ -115585,7 +115653,7 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
115585
115653
|
Diagnostics.Classes_may_not_have_a_field_named_constructor.code,
|
|
115586
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,
|
|
115587
115655
|
Diagnostics.Duplicate_label_0.code,
|
|
115588
|
-
Diagnostics.
|
|
115656
|
+
Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_set_of_attributes_as_arguments.code,
|
|
115589
115657
|
Diagnostics.for_await_loops_cannot_be_used_inside_a_class_static_block.code,
|
|
115590
115658
|
Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code,
|
|
115591
115659
|
Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code,
|
|
@@ -117119,7 +117187,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117119
117187
|
/*importClause*/
|
|
117120
117188
|
void 0,
|
|
117121
117189
|
externalHelpersModuleReference,
|
|
117122
|
-
/*
|
|
117190
|
+
/*attributes*/
|
|
117123
117191
|
void 0
|
|
117124
117192
|
);
|
|
117125
117193
|
addInternalEmitFlags(importDecl, 2 /* NeverApplyImportHelper */);
|
|
@@ -117595,14 +117663,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117595
117663
|
const fileName = toFileNameLowerCase(ref.fileName);
|
|
117596
117664
|
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
117597
117665
|
const mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
117598
|
-
if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
|
|
117599
|
-
(fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({
|
|
117600
|
-
kind: 2 /* ResolutionDiagnostics */,
|
|
117601
|
-
diagnostics: [
|
|
117602
|
-
createDiagnosticForRange(file, ref, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)
|
|
117603
|
-
]
|
|
117604
|
-
});
|
|
117605
|
-
}
|
|
117606
117666
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
117607
117667
|
}
|
|
117608
117668
|
}
|