@typescript-deploys/pr-build 5.3.0-pr-55880-5 → 5.3.0-pr-55887-9
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 +424 -311
- package/lib/tsserver.js +468 -341
- package/lib/typescript.d.ts +51 -29
- package/lib/typescript.js +463 -338
- package/lib/typingsInstaller.js +166 -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-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230927`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3312,8 +3312,10 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind4) => {
|
|
|
3312
3312
|
SyntaxKind4[SyntaxKind4["DefaultClause"] = 297] = "DefaultClause";
|
|
3313
3313
|
SyntaxKind4[SyntaxKind4["HeritageClause"] = 298] = "HeritageClause";
|
|
3314
3314
|
SyntaxKind4[SyntaxKind4["CatchClause"] = 299] = "CatchClause";
|
|
3315
|
-
SyntaxKind4[SyntaxKind4["
|
|
3316
|
-
SyntaxKind4[SyntaxKind4["
|
|
3315
|
+
SyntaxKind4[SyntaxKind4["ImportAttributes"] = 300] = "ImportAttributes";
|
|
3316
|
+
SyntaxKind4[SyntaxKind4["ImportAttribute"] = 301] = "ImportAttribute";
|
|
3317
|
+
SyntaxKind4[SyntaxKind4["AssertClause"] = 300 /* ImportAttributes */] = "AssertClause";
|
|
3318
|
+
SyntaxKind4[SyntaxKind4["AssertEntry"] = 301 /* ImportAttribute */] = "AssertEntry";
|
|
3317
3319
|
SyntaxKind4[SyntaxKind4["ImportTypeAssertionContainer"] = 302] = "ImportTypeAssertionContainer";
|
|
3318
3320
|
SyntaxKind4[SyntaxKind4["PropertyAssignment"] = 303] = "PropertyAssignment";
|
|
3319
3321
|
SyntaxKind4[SyntaxKind4["ShorthandPropertyAssignment"] = 304] = "ShorthandPropertyAssignment";
|
|
@@ -6054,9 +6056,8 @@ var Diagnostics = {
|
|
|
6054
6056
|
_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled: diag(1446, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveVa_1446", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled."),
|
|
6055
6057
|
_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_enabled: diag(1448, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_1448", "'{0}' resolves to a type-only declaration and must be re-exported using a type-only re-export when '{1}' is enabled."),
|
|
6056
6058
|
Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, 3 /* Message */, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."),
|
|
6057
|
-
|
|
6059
|
+
Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_set_of_attributes_as_arguments: diag(1450, 3 /* Message */, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_set_of_attributes_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional set of attributes as arguments"),
|
|
6058
6060
|
Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression: diag(1451, 1 /* Error */, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),
|
|
6059
|
-
resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext: diag(1452, 1 /* Error */, "resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452", "'resolution-mode' assertions are only supported when `moduleResolution` is `node16` or `nodenext`."),
|
|
6060
6061
|
resolution_mode_should_be_either_require_or_import: diag(1453, 1 /* Error */, "resolution_mode_should_be_either_require_or_import_1453", "`resolution-mode` should be either `require` or `import`."),
|
|
6061
6062
|
resolution_mode_can_only_be_set_for_type_only_imports: diag(1454, 1 /* Error */, "resolution_mode_can_only_be_set_for_type_only_imports_1454", "`resolution-mode` can only be set for type-only imports."),
|
|
6062
6063
|
resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, 1 /* Error */, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
|
|
@@ -6066,6 +6067,8 @@ var Diagnostics = {
|
|
|
6066
6067
|
File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module: diag(1459, 3 /* Message */, "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459", `File is CommonJS module because '{0}' has field "type" whose value is not "module"`),
|
|
6067
6068
|
File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, 3 /* Message */, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", `File is CommonJS module because '{0}' does not have field "type"`),
|
|
6068
6069
|
File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, 3 /* Message */, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"),
|
|
6070
|
+
resolution_mode_is_the_only_valid_key_for_type_import_attributes: diag(1463, 1 /* Error */, "resolution_mode_is_the_only_valid_key_for_type_import_attributes_1463", "'resolution-mode' is the only valid key for type import attributes."),
|
|
6071
|
+
Type_import_attributes_should_have_exactly_one_key_resolution_mode_with_value_import_or_require: diag(1464, 1 /* Error */, "Type_import_attributes_should_have_exactly_one_key_resolution_mode_with_value_import_or_require_1464", "Type import attributes should have exactly one key - 'resolution-mode' - with value 'import' or 'require'."),
|
|
6069
6072
|
The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, 1 /* Error */, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
|
|
6070
6073
|
Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead: diag(1471, 1 /* Error */, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead."),
|
|
6071
6074
|
catch_or_finally_expected: diag(1472, 1 /* Error */, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
@@ -6092,6 +6095,7 @@ var Diagnostics = {
|
|
|
6092
6095
|
The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration: diag(1493, 1 /* Error */, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration_1493", "The left-hand side of a 'for...in' statement cannot be a 'using' declaration."),
|
|
6093
6096
|
The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration: diag(1494, 1 /* Error */, "The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration_1494", "The left-hand side of a 'for...in' statement cannot be an 'await using' declaration."),
|
|
6094
6097
|
_0_modifier_cannot_appear_on_an_await_using_declaration: diag(1495, 1 /* Error */, "_0_modifier_cannot_appear_on_an_await_using_declaration_1495", "'{0}' modifier cannot appear on an 'await using' declaration."),
|
|
6098
|
+
Identifier_string_literal_or_number_literal_expected: diag(1496, 1 /* Error */, "Identifier_string_literal_or_number_literal_expected_1496", "Identifier, string literal, or number literal expected."),
|
|
6095
6099
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
6096
6100
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
6097
6101
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -6621,15 +6625,15 @@ var Diagnostics = {
|
|
|
6621
6625
|
Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, 1 /* Error */, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
|
|
6622
6626
|
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, 1 /* Error */, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
|
|
6623
6627
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, 1 /* Error */, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
6628
|
+
Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2823, 1 /* Error */, "Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2823", "Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
|
|
6624
6629
|
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, 1 /* Error */, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
6625
6630
|
Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."),
|
|
6626
6631
|
Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),
|
|
6627
|
-
|
|
6632
|
+
Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls: diag(2836, 1 /* Error */, "Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls_2836", "Import assertions are not allowed on statements that compile to CommonJS 'require' calls."),
|
|
6628
6633
|
Import_assertion_values_must_be_string_literal_expressions: diag(2837, 1 /* Error */, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
|
|
6629
6634
|
All_declarations_of_0_must_have_identical_constraints: diag(2838, 1 /* Error */, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
|
|
6630
6635
|
This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value: diag(2839, 1 /* Error */, "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839", "This condition will always return '{0}' since JavaScript compares objects by reference, not value."),
|
|
6631
6636
|
An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes: diag(2840, 1 /* Error */, "An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_clas_2840", "An interface cannot extend a primitive type like '{0}'; an interface can only extend named types and classes"),
|
|
6632
|
-
The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(2841, 1 /* Error */, "The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_2841", "The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6633
6637
|
_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, 1 /* Error */, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"),
|
|
6634
6638
|
We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, 1 /* Error */, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."),
|
|
6635
6639
|
Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, 1 /* Error */, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
@@ -6643,6 +6647,10 @@ var Diagnostics = {
|
|
|
6643
6647
|
await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(2853, 1 /* Error */, "await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853", "'await using' statements are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
6644
6648
|
Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
6645
6649
|
Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super: diag(2855, 1 /* Error */, "Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855", "Class field '{0}' defined by the parent class is not accessible in the child class via super."),
|
|
6650
|
+
Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls: diag(2856, 1 /* Error */, "Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls_2856", "Import attributes are not allowed on statements that compile to CommonJS 'require' calls."),
|
|
6651
|
+
Import_attributes_cannot_be_used_with_type_only_imports_or_exports: diag(2857, 1 /* Error */, "Import_attributes_cannot_be_used_with_type_only_imports_or_exports_2857", "Import attributes cannot be used with type-only imports or exports."),
|
|
6652
|
+
Import_attribute_values_must_be_string_literal_expressions: diag(2858, 1 /* Error */, "Import_attribute_values_must_be_string_literal_expressions_2858", "Import attribute values must be string literal expressions."),
|
|
6653
|
+
Excessive_complexity_comparing_types_0_and_1: diag(2859, 1 /* Error */, "Excessive_complexity_comparing_types_0_and_1_2859", "Excessive complexity comparing types '{0}' and '{1}'."),
|
|
6646
6654
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6647
6655
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
6648
6656
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -6751,7 +6759,6 @@ var Diagnostics = {
|
|
|
6751
6759
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
|
|
6752
6760
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
6753
6761
|
Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, 1 /* Error */, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6754
|
-
resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4125, 1 /* Error */, "resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125", "'resolution-mode' assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6755
6762
|
The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
6756
6763
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
6757
6764
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
@@ -10686,7 +10693,7 @@ function isTypeOnlyExportDeclaration(node) {
|
|
|
10686
10693
|
function isTypeOnlyImportOrExportDeclaration(node) {
|
|
10687
10694
|
return isTypeOnlyImportDeclaration(node) || isTypeOnlyExportDeclaration(node);
|
|
10688
10695
|
}
|
|
10689
|
-
function
|
|
10696
|
+
function isImportAttributeName(node) {
|
|
10690
10697
|
return isStringLiteral(node) || isIdentifier(node);
|
|
10691
10698
|
}
|
|
10692
10699
|
function isGeneratedIdentifier(node) {
|
|
@@ -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;
|
|
@@ -16005,6 +16009,7 @@ function Symbol4(flags, name) {
|
|
|
16005
16009
|
this.exportSymbol = void 0;
|
|
16006
16010
|
this.constEnumOnlyModule = void 0;
|
|
16007
16011
|
this.isReferenced = void 0;
|
|
16012
|
+
this.isInitialized = void 0;
|
|
16008
16013
|
this.isAssigned = void 0;
|
|
16009
16014
|
this.links = void 0;
|
|
16010
16015
|
}
|
|
@@ -17464,6 +17469,12 @@ function getPropertyNameFromType(type) {
|
|
|
17464
17469
|
function isExpandoPropertyDeclaration(declaration) {
|
|
17465
17470
|
return !!declaration && (isPropertyAccessExpression(declaration) || isElementAccessExpression(declaration) || isBinaryExpression(declaration));
|
|
17466
17471
|
}
|
|
17472
|
+
function hasResolutionModeOverride(node) {
|
|
17473
|
+
if (node === void 0) {
|
|
17474
|
+
return false;
|
|
17475
|
+
}
|
|
17476
|
+
return !!getResolutionModeOverride(node.attributes);
|
|
17477
|
+
}
|
|
17467
17478
|
|
|
17468
17479
|
// src/compiler/factory/baseNodeFactory.ts
|
|
17469
17480
|
function createBaseNodeFactory() {
|
|
@@ -18335,6 +18346,10 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
18335
18346
|
updateAssertEntry,
|
|
18336
18347
|
createImportTypeAssertionContainer,
|
|
18337
18348
|
updateImportTypeAssertionContainer,
|
|
18349
|
+
createImportAttributes,
|
|
18350
|
+
updateImportAttributes,
|
|
18351
|
+
createImportAttribute,
|
|
18352
|
+
updateImportAttribute,
|
|
18338
18353
|
createNamespaceImport,
|
|
18339
18354
|
updateNamespaceImport,
|
|
18340
18355
|
createNamespaceExport,
|
|
@@ -19603,18 +19618,21 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
19603
19618
|
function updateTemplateLiteralType(node, head, templateSpans) {
|
|
19604
19619
|
return node.head !== head || node.templateSpans !== templateSpans ? update(createTemplateLiteralType(head, templateSpans), node) : node;
|
|
19605
19620
|
}
|
|
19606
|
-
function createImportTypeNode(argument,
|
|
19621
|
+
function createImportTypeNode(argument, attributes, qualifier, typeArguments, isTypeOf = false) {
|
|
19607
19622
|
const node = createBaseNode(205 /* ImportType */);
|
|
19608
19623
|
node.argument = argument;
|
|
19609
|
-
node.
|
|
19624
|
+
node.attributes = attributes;
|
|
19625
|
+
if (node.assertions && node.assertions.assertClause && node.attributes) {
|
|
19626
|
+
node.assertions.assertClause = node.attributes;
|
|
19627
|
+
}
|
|
19610
19628
|
node.qualifier = qualifier;
|
|
19611
19629
|
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
19612
19630
|
node.isTypeOf = isTypeOf;
|
|
19613
19631
|
node.transformFlags = 1 /* ContainsTypeScript */;
|
|
19614
19632
|
return node;
|
|
19615
19633
|
}
|
|
19616
|
-
function updateImportTypeNode(node, argument,
|
|
19617
|
-
return node.argument !== argument || node.
|
|
19634
|
+
function updateImportTypeNode(node, argument, attributes, qualifier, typeArguments, isTypeOf = node.isTypeOf) {
|
|
19635
|
+
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
19636
|
}
|
|
19619
19637
|
function createParenthesizedType(type) {
|
|
19620
19638
|
const node = createBaseNode(196 /* ParenthesizedType */);
|
|
@@ -20744,19 +20762,19 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20744
20762
|
function updateImportEqualsDeclaration(node, modifiers, isTypeOnly, name, moduleReference) {
|
|
20745
20763
|
return node.modifiers !== modifiers || node.isTypeOnly !== isTypeOnly || node.name !== name || node.moduleReference !== moduleReference ? update(createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference), node) : node;
|
|
20746
20764
|
}
|
|
20747
|
-
function createImportDeclaration(modifiers, importClause, moduleSpecifier,
|
|
20765
|
+
function createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes) {
|
|
20748
20766
|
const node = createBaseNode(272 /* ImportDeclaration */);
|
|
20749
20767
|
node.modifiers = asNodeArray(modifiers);
|
|
20750
20768
|
node.importClause = importClause;
|
|
20751
20769
|
node.moduleSpecifier = moduleSpecifier;
|
|
20752
|
-
node.assertClause =
|
|
20770
|
+
node.attributes = node.assertClause = attributes;
|
|
20753
20771
|
node.transformFlags |= propagateChildFlags(node.importClause) | propagateChildFlags(node.moduleSpecifier);
|
|
20754
20772
|
node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */;
|
|
20755
20773
|
node.jsDoc = void 0;
|
|
20756
20774
|
return node;
|
|
20757
20775
|
}
|
|
20758
|
-
function updateImportDeclaration(node, modifiers, importClause, moduleSpecifier,
|
|
20759
|
-
return node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.
|
|
20776
|
+
function updateImportDeclaration(node, modifiers, importClause, moduleSpecifier, attributes) {
|
|
20777
|
+
return node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.attributes !== attributes ? update(createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes), node) : node;
|
|
20760
20778
|
}
|
|
20761
20779
|
function createImportClause(isTypeOnly, name, namedBindings) {
|
|
20762
20780
|
const node = createBaseDeclaration(273 /* ImportClause */);
|
|
@@ -20777,6 +20795,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20777
20795
|
const node = createBaseNode(300 /* AssertClause */);
|
|
20778
20796
|
node.elements = createNodeArray(elements);
|
|
20779
20797
|
node.multiLine = multiLine;
|
|
20798
|
+
node.token = 132 /* AssertKeyword */;
|
|
20780
20799
|
node.transformFlags |= 4 /* ContainsESNext */;
|
|
20781
20800
|
return node;
|
|
20782
20801
|
}
|
|
@@ -20802,6 +20821,27 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20802
20821
|
function updateImportTypeAssertionContainer(node, clause, multiLine) {
|
|
20803
20822
|
return node.assertClause !== clause || node.multiLine !== multiLine ? update(createImportTypeAssertionContainer(clause, multiLine), node) : node;
|
|
20804
20823
|
}
|
|
20824
|
+
function createImportAttributes(elements, multiLine, token) {
|
|
20825
|
+
const node = createBaseNode(300 /* ImportAttributes */);
|
|
20826
|
+
node.token = token ?? 118 /* WithKeyword */;
|
|
20827
|
+
node.elements = createNodeArray(elements);
|
|
20828
|
+
node.multiLine = multiLine;
|
|
20829
|
+
node.transformFlags |= 4 /* ContainsESNext */;
|
|
20830
|
+
return node;
|
|
20831
|
+
}
|
|
20832
|
+
function updateImportAttributes(node, elements, multiLine) {
|
|
20833
|
+
return node.elements !== elements || node.multiLine !== multiLine ? update(createImportAttributes(elements, multiLine, node.token), node) : node;
|
|
20834
|
+
}
|
|
20835
|
+
function createImportAttribute(name, value) {
|
|
20836
|
+
const node = createBaseNode(301 /* ImportAttribute */);
|
|
20837
|
+
node.name = name;
|
|
20838
|
+
node.value = value;
|
|
20839
|
+
node.transformFlags |= 4 /* ContainsESNext */;
|
|
20840
|
+
return node;
|
|
20841
|
+
}
|
|
20842
|
+
function updateImportAttribute(node, name, value) {
|
|
20843
|
+
return node.name !== name || node.value !== value ? update(createImportAttribute(name, value), node) : node;
|
|
20844
|
+
}
|
|
20805
20845
|
function createNamespaceImport(name) {
|
|
20806
20846
|
const node = createBaseDeclaration(274 /* NamespaceImport */);
|
|
20807
20847
|
node.name = name;
|
|
@@ -20862,20 +20902,20 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
20862
20902
|
function updateExportAssignment(node, modifiers, expression) {
|
|
20863
20903
|
return node.modifiers !== modifiers || node.expression !== expression ? update(createExportAssignment(modifiers, node.isExportEquals, expression), node) : node;
|
|
20864
20904
|
}
|
|
20865
|
-
function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier,
|
|
20905
|
+
function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes) {
|
|
20866
20906
|
const node = createBaseDeclaration(278 /* ExportDeclaration */);
|
|
20867
20907
|
node.modifiers = asNodeArray(modifiers);
|
|
20868
20908
|
node.isTypeOnly = isTypeOnly;
|
|
20869
20909
|
node.exportClause = exportClause;
|
|
20870
20910
|
node.moduleSpecifier = moduleSpecifier;
|
|
20871
|
-
node.assertClause =
|
|
20911
|
+
node.attributes = node.assertClause = attributes;
|
|
20872
20912
|
node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.exportClause) | propagateChildFlags(node.moduleSpecifier);
|
|
20873
20913
|
node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */;
|
|
20874
20914
|
node.jsDoc = void 0;
|
|
20875
20915
|
return node;
|
|
20876
20916
|
}
|
|
20877
|
-
function updateExportDeclaration(node, modifiers, isTypeOnly, exportClause, moduleSpecifier,
|
|
20878
|
-
return node.modifiers !== modifiers || node.isTypeOnly !== isTypeOnly || node.exportClause !== exportClause || node.moduleSpecifier !== moduleSpecifier || node.
|
|
20917
|
+
function updateExportDeclaration(node, modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes) {
|
|
20918
|
+
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
20919
|
}
|
|
20880
20920
|
function finishUpdateExportDeclaration(updated, original) {
|
|
20881
20921
|
if (updated !== original) {
|
|
@@ -22202,7 +22242,7 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
22202
22242
|
} else {
|
|
22203
22243
|
modifierArray = modifiers;
|
|
22204
22244
|
}
|
|
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.
|
|
22245
|
+
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
22246
|
}
|
|
22207
22247
|
function updateModifierLike(node, modifierArray) {
|
|
22208
22248
|
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 +24466,14 @@ function isImportDeclaration(node) {
|
|
|
24426
24466
|
function isImportClause(node) {
|
|
24427
24467
|
return node.kind === 273 /* ImportClause */;
|
|
24428
24468
|
}
|
|
24429
|
-
function isImportTypeAssertionContainer(node) {
|
|
24430
|
-
return node.kind === 302 /* ImportTypeAssertionContainer */;
|
|
24431
|
-
}
|
|
24432
24469
|
function isAssertClause(node) {
|
|
24433
24470
|
return node.kind === 300 /* AssertClause */;
|
|
24434
24471
|
}
|
|
24435
|
-
function
|
|
24436
|
-
return node.kind ===
|
|
24472
|
+
function isImportAttributes(node) {
|
|
24473
|
+
return node.kind === 300 /* ImportAttributes */;
|
|
24474
|
+
}
|
|
24475
|
+
function isImportAttribute(node) {
|
|
24476
|
+
return node.kind === 301 /* ImportAttribute */;
|
|
24437
24477
|
}
|
|
24438
24478
|
function isNamespaceImport(node) {
|
|
24439
24479
|
return node.kind === 274 /* NamespaceImport */;
|
|
@@ -25109,7 +25149,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
25109
25149
|
namedBindings
|
|
25110
25150
|
),
|
|
25111
25151
|
nodeFactory.createStringLiteral(externalHelpersModuleNameText),
|
|
25112
|
-
/*
|
|
25152
|
+
/*attributes*/
|
|
25113
25153
|
void 0
|
|
25114
25154
|
);
|
|
25115
25155
|
addInternalEmitFlags(externalHelpersImportDeclaration, 2 /* NeverApplyImportHelper */);
|
|
@@ -25863,7 +25903,7 @@ var forEachChildTable = {
|
|
|
25863
25903
|
return visitNode2(cbNode, node.typeParameter);
|
|
25864
25904
|
},
|
|
25865
25905
|
[205 /* ImportType */]: function forEachChildInImportType(node, cbNode, cbNodes) {
|
|
25866
|
-
return visitNode2(cbNode, node.argument) || visitNode2(cbNode, node.
|
|
25906
|
+
return visitNode2(cbNode, node.argument) || visitNode2(cbNode, node.attributes) || visitNode2(cbNode, node.qualifier) || visitNodes(cbNode, cbNodes, node.typeArguments);
|
|
25867
25907
|
},
|
|
25868
25908
|
[302 /* ImportTypeAssertionContainer */]: function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) {
|
|
25869
25909
|
return visitNode2(cbNode, node.assertClause);
|
|
@@ -26037,15 +26077,15 @@ var forEachChildTable = {
|
|
|
26037
26077
|
return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.moduleReference);
|
|
26038
26078
|
},
|
|
26039
26079
|
[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.
|
|
26080
|
+
return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.importClause) || visitNode2(cbNode, node.moduleSpecifier) || visitNode2(cbNode, node.attributes);
|
|
26041
26081
|
},
|
|
26042
26082
|
[273 /* ImportClause */]: function forEachChildInImportClause(node, cbNode, _cbNodes) {
|
|
26043
26083
|
return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.namedBindings);
|
|
26044
26084
|
},
|
|
26045
|
-
[300 /*
|
|
26085
|
+
[300 /* ImportAttributes */]: function forEachChildInImportAttributes(node, cbNode, cbNodes) {
|
|
26046
26086
|
return visitNodes(cbNode, cbNodes, node.elements);
|
|
26047
26087
|
},
|
|
26048
|
-
[301 /*
|
|
26088
|
+
[301 /* ImportAttribute */]: function forEachChildInImportAttribute(node, cbNode, _cbNodes) {
|
|
26049
26089
|
return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.value);
|
|
26050
26090
|
},
|
|
26051
26091
|
[270 /* NamespaceExportDeclaration */]: function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) {
|
|
@@ -26060,7 +26100,7 @@ var forEachChildTable = {
|
|
|
26060
26100
|
[275 /* NamedImports */]: forEachChildInNamedImportsOrExports,
|
|
26061
26101
|
[279 /* NamedExports */]: forEachChildInNamedImportsOrExports,
|
|
26062
26102
|
[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.
|
|
26103
|
+
return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.exportClause) || visitNode2(cbNode, node.moduleSpecifier) || visitNode2(cbNode, node.attributes);
|
|
26064
26104
|
},
|
|
26065
26105
|
[276 /* ImportSpecifier */]: forEachChildInImportOrExportSpecifier,
|
|
26066
26106
|
[281 /* ExportSpecifier */]: forEachChildInImportOrExportSpecifier,
|
|
@@ -27325,7 +27365,7 @@ var Parser;
|
|
|
27325
27365
|
function isLiteralPropertyName() {
|
|
27326
27366
|
return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */;
|
|
27327
27367
|
}
|
|
27328
|
-
function
|
|
27368
|
+
function isImportAttributeName2() {
|
|
27329
27369
|
return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */;
|
|
27330
27370
|
}
|
|
27331
27371
|
function parsePropertyNameWorker(allowComputedPropertyNames) {
|
|
@@ -27444,8 +27484,8 @@ var Parser;
|
|
|
27444
27484
|
return isLiteralPropertyName();
|
|
27445
27485
|
case 9 /* ObjectBindingElements */:
|
|
27446
27486
|
return token() === 23 /* OpenBracketToken */ || token() === 26 /* DotDotDotToken */ || isLiteralPropertyName();
|
|
27447
|
-
case 24 /*
|
|
27448
|
-
return
|
|
27487
|
+
case 24 /* ImportAttributes */:
|
|
27488
|
+
return isImportAttributeName2();
|
|
27449
27489
|
case 7 /* HeritageClauseElement */:
|
|
27450
27490
|
if (token() === 19 /* OpenBraceToken */) {
|
|
27451
27491
|
return lookAhead(isValidHeritageClauseObjectLiteral);
|
|
@@ -27548,7 +27588,7 @@ var Parser;
|
|
|
27548
27588
|
case 12 /* ObjectLiteralMembers */:
|
|
27549
27589
|
case 9 /* ObjectBindingElements */:
|
|
27550
27590
|
case 23 /* ImportOrExportSpecifiers */:
|
|
27551
|
-
case 24 /*
|
|
27591
|
+
case 24 /* ImportAttributes */:
|
|
27552
27592
|
return token() === 20 /* CloseBraceToken */;
|
|
27553
27593
|
case 3 /* SwitchClauseStatements */:
|
|
27554
27594
|
return token() === 20 /* CloseBraceToken */ || token() === 84 /* CaseKeyword */ || token() === 90 /* DefaultKeyword */;
|
|
@@ -27854,7 +27894,7 @@ var Parser;
|
|
|
27854
27894
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
27855
27895
|
case 14 /* JsxChildren */:
|
|
27856
27896
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
27857
|
-
case 24 /*
|
|
27897
|
+
case 24 /* ImportAttributes */:
|
|
27858
27898
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected);
|
|
27859
27899
|
case 25 /* JSDocComment */:
|
|
27860
27900
|
return parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
|
@@ -28729,28 +28769,6 @@ var Parser;
|
|
|
28729
28769
|
nextToken();
|
|
28730
28770
|
return token() === 102 /* ImportKeyword */;
|
|
28731
28771
|
}
|
|
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
28772
|
function parseImportType() {
|
|
28755
28773
|
sourceFlags |= 4194304 /* PossiblyContainsDynamicImport */;
|
|
28756
28774
|
const pos = getNodePos();
|
|
@@ -28758,14 +28776,36 @@ var Parser;
|
|
|
28758
28776
|
parseExpected(102 /* ImportKeyword */);
|
|
28759
28777
|
parseExpected(21 /* OpenParenToken */);
|
|
28760
28778
|
const type = parseType();
|
|
28761
|
-
let
|
|
28779
|
+
let attributes;
|
|
28762
28780
|
if (parseOptional(28 /* CommaToken */)) {
|
|
28763
|
-
|
|
28781
|
+
const openBracePosition = scanner.getTokenStart();
|
|
28782
|
+
parseExpected(19 /* OpenBraceToken */);
|
|
28783
|
+
const currentToken2 = token();
|
|
28784
|
+
if (currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) {
|
|
28785
|
+
nextToken();
|
|
28786
|
+
} else {
|
|
28787
|
+
parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(118 /* WithKeyword */));
|
|
28788
|
+
}
|
|
28789
|
+
parseExpected(59 /* ColonToken */);
|
|
28790
|
+
attributes = parseImportAttributes(
|
|
28791
|
+
currentToken2,
|
|
28792
|
+
/*skipKeyword*/
|
|
28793
|
+
true
|
|
28794
|
+
);
|
|
28795
|
+
if (!parseExpected(20 /* CloseBraceToken */)) {
|
|
28796
|
+
const lastError = lastOrUndefined(parseDiagnostics);
|
|
28797
|
+
if (lastError && lastError.code === Diagnostics._0_expected.code) {
|
|
28798
|
+
addRelatedInfo(
|
|
28799
|
+
lastError,
|
|
28800
|
+
createDetachedDiagnostic(fileName, sourceText, openBracePosition, 1, Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, "{", "}")
|
|
28801
|
+
);
|
|
28802
|
+
}
|
|
28803
|
+
}
|
|
28764
28804
|
}
|
|
28765
28805
|
parseExpected(22 /* CloseParenToken */);
|
|
28766
28806
|
const qualifier = parseOptional(25 /* DotToken */) ? parseEntityNameOfTypeReference() : void 0;
|
|
28767
28807
|
const typeArguments = parseTypeArgumentsOfTypeReference();
|
|
28768
|
-
return finishNode(factory2.createImportTypeNode(type,
|
|
28808
|
+
return finishNode(factory2.createImportTypeNode(type, attributes, qualifier, typeArguments, isTypeOf), pos);
|
|
28769
28809
|
}
|
|
28770
28810
|
function nextTokenIsNumericOrBigIntLiteral() {
|
|
28771
28811
|
nextToken();
|
|
@@ -31827,15 +31867,16 @@ var Parser;
|
|
|
31827
31867
|
parseExpected(161 /* FromKeyword */);
|
|
31828
31868
|
}
|
|
31829
31869
|
const moduleSpecifier = parseModuleSpecifier();
|
|
31830
|
-
|
|
31831
|
-
|
|
31832
|
-
|
|
31870
|
+
const currentToken2 = token();
|
|
31871
|
+
let attributes;
|
|
31872
|
+
if ((currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) && !scanner.hasPrecedingLineBreak()) {
|
|
31873
|
+
attributes = parseImportAttributes(currentToken2);
|
|
31833
31874
|
}
|
|
31834
31875
|
parseSemicolon();
|
|
31835
|
-
const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier,
|
|
31876
|
+
const node = factory2.createImportDeclaration(modifiers, importClause, moduleSpecifier, attributes);
|
|
31836
31877
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
31837
31878
|
}
|
|
31838
|
-
function
|
|
31879
|
+
function parseImportAttribute() {
|
|
31839
31880
|
const pos = getNodePos();
|
|
31840
31881
|
const name = tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(11 /* StringLiteral */);
|
|
31841
31882
|
parseExpected(59 /* ColonToken */);
|
|
@@ -31843,19 +31884,19 @@ var Parser;
|
|
|
31843
31884
|
/*allowReturnTypeInArrowFunction*/
|
|
31844
31885
|
true
|
|
31845
31886
|
);
|
|
31846
|
-
return finishNode(factory2.
|
|
31887
|
+
return finishNode(factory2.createImportAttribute(name, value), pos);
|
|
31847
31888
|
}
|
|
31848
|
-
function
|
|
31889
|
+
function parseImportAttributes(token2, skipKeyword) {
|
|
31849
31890
|
const pos = getNodePos();
|
|
31850
|
-
if (!
|
|
31851
|
-
parseExpected(
|
|
31891
|
+
if (!skipKeyword) {
|
|
31892
|
+
parseExpected(token2);
|
|
31852
31893
|
}
|
|
31853
31894
|
const openBracePosition = scanner.getTokenStart();
|
|
31854
31895
|
if (parseExpected(19 /* OpenBraceToken */)) {
|
|
31855
31896
|
const multiLine = scanner.hasPrecedingLineBreak();
|
|
31856
31897
|
const elements = parseDelimitedList(
|
|
31857
|
-
24 /*
|
|
31858
|
-
|
|
31898
|
+
24 /* ImportAttributes */,
|
|
31899
|
+
parseImportAttribute,
|
|
31859
31900
|
/*considerSemicolonAsDelimiter*/
|
|
31860
31901
|
true
|
|
31861
31902
|
);
|
|
@@ -31868,7 +31909,7 @@ var Parser;
|
|
|
31868
31909
|
);
|
|
31869
31910
|
}
|
|
31870
31911
|
}
|
|
31871
|
-
return finishNode(factory2.
|
|
31912
|
+
return finishNode(factory2.createImportAttributes(elements, multiLine, token2), pos);
|
|
31872
31913
|
} else {
|
|
31873
31914
|
const elements = createNodeArray(
|
|
31874
31915
|
[],
|
|
@@ -31878,10 +31919,11 @@ var Parser;
|
|
|
31878
31919
|
/*hasTrailingComma*/
|
|
31879
31920
|
false
|
|
31880
31921
|
);
|
|
31881
|
-
return finishNode(factory2.
|
|
31922
|
+
return finishNode(factory2.createImportAttributes(
|
|
31882
31923
|
elements,
|
|
31883
31924
|
/*multiLine*/
|
|
31884
|
-
false
|
|
31925
|
+
false,
|
|
31926
|
+
token2
|
|
31885
31927
|
), pos);
|
|
31886
31928
|
}
|
|
31887
31929
|
}
|
|
@@ -32013,7 +32055,7 @@ var Parser;
|
|
|
32013
32055
|
);
|
|
32014
32056
|
let exportClause;
|
|
32015
32057
|
let moduleSpecifier;
|
|
32016
|
-
let
|
|
32058
|
+
let attributes;
|
|
32017
32059
|
const isTypeOnly = parseOptional(156 /* TypeKeyword */);
|
|
32018
32060
|
const namespaceExportPos = getNodePos();
|
|
32019
32061
|
if (parseOptional(42 /* AsteriskToken */)) {
|
|
@@ -32029,12 +32071,13 @@ var Parser;
|
|
|
32029
32071
|
moduleSpecifier = parseModuleSpecifier();
|
|
32030
32072
|
}
|
|
32031
32073
|
}
|
|
32032
|
-
|
|
32033
|
-
|
|
32074
|
+
const currentToken2 = token();
|
|
32075
|
+
if (moduleSpecifier && (currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) && !scanner.hasPrecedingLineBreak()) {
|
|
32076
|
+
attributes = parseImportAttributes(currentToken2);
|
|
32034
32077
|
}
|
|
32035
32078
|
parseSemicolon();
|
|
32036
32079
|
setAwaitContext(savedAwaitContext);
|
|
32037
|
-
const node = factory2.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier,
|
|
32080
|
+
const node = factory2.createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, attributes);
|
|
32038
32081
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
32039
32082
|
}
|
|
32040
32083
|
function parseExportAssignment(pos, hasJSDoc, modifiers) {
|
|
@@ -32084,7 +32127,7 @@ var Parser;
|
|
|
32084
32127
|
ParsingContext2[ParsingContext2["TupleElementTypes"] = 21] = "TupleElementTypes";
|
|
32085
32128
|
ParsingContext2[ParsingContext2["HeritageClauses"] = 22] = "HeritageClauses";
|
|
32086
32129
|
ParsingContext2[ParsingContext2["ImportOrExportSpecifiers"] = 23] = "ImportOrExportSpecifiers";
|
|
32087
|
-
ParsingContext2[ParsingContext2["
|
|
32130
|
+
ParsingContext2[ParsingContext2["ImportAttributes"] = 24] = "ImportAttributes";
|
|
32088
32131
|
ParsingContext2[ParsingContext2["JSDocComment"] = 25] = "JSDocComment";
|
|
32089
32132
|
ParsingContext2[ParsingContext2["Count"] = 26] = "Count";
|
|
32090
32133
|
})(ParsingContext || (ParsingContext = {}));
|
|
@@ -37067,10 +37110,15 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
37067
37110
|
const failedLookupLocations = [];
|
|
37068
37111
|
const affectingLocations = [];
|
|
37069
37112
|
let features = getNodeResolutionFeatures(options);
|
|
37070
|
-
if (resolutionMode
|
|
37113
|
+
if (resolutionMode !== void 0) {
|
|
37114
|
+
features |= 30 /* AllFeatures */;
|
|
37115
|
+
}
|
|
37116
|
+
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
37117
|
+
if (resolutionMode === 99 /* ESNext */ && (3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) {
|
|
37071
37118
|
features |= 32 /* EsmMode */;
|
|
37072
37119
|
}
|
|
37073
|
-
const
|
|
37120
|
+
const useImportCondition = resolutionMode === 99 /* ESNext */ || (resolutionMode !== void 0 ? false : void 0);
|
|
37121
|
+
const conditions = features & 8 /* Exports */ ? getConditions(options, useImportCondition) : [];
|
|
37074
37122
|
const diagnostics = [];
|
|
37075
37123
|
const moduleResolutionState = {
|
|
37076
37124
|
compilerOptions: options,
|
|
@@ -37239,11 +37287,19 @@ function getNodeResolutionFeatures(options) {
|
|
|
37239
37287
|
return features;
|
|
37240
37288
|
}
|
|
37241
37289
|
function getConditions(options, esmMode) {
|
|
37242
|
-
const
|
|
37290
|
+
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
37291
|
+
if (esmMode === void 0) {
|
|
37292
|
+
if (moduleResolution === 100 /* Bundler */) {
|
|
37293
|
+
esmMode ?? (esmMode = moduleResolution === 100 /* Bundler */);
|
|
37294
|
+
} else if (moduleResolution === 2 /* Node10 */) {
|
|
37295
|
+
return [];
|
|
37296
|
+
}
|
|
37297
|
+
}
|
|
37298
|
+
const conditions = esmMode ? ["import"] : ["require"];
|
|
37243
37299
|
if (!options.noDtsResolution) {
|
|
37244
37300
|
conditions.push("types");
|
|
37245
37301
|
}
|
|
37246
|
-
if (
|
|
37302
|
+
if (moduleResolution !== 100 /* Bundler */) {
|
|
37247
37303
|
conditions.push("node");
|
|
37248
37304
|
}
|
|
37249
37305
|
return concatenate(conditions, options.customConditions);
|
|
@@ -37661,13 +37717,13 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
37661
37717
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
37662
37718
|
break;
|
|
37663
37719
|
case 2 /* Node10 */:
|
|
37664
|
-
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
37720
|
+
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode ? getConditions(compilerOptions, resolutionMode === 99 /* ESNext */) : void 0);
|
|
37665
37721
|
break;
|
|
37666
37722
|
case 1 /* Classic */:
|
|
37667
37723
|
result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
37668
37724
|
break;
|
|
37669
37725
|
case 100 /* Bundler */:
|
|
37670
|
-
result = bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
37726
|
+
result = bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode ? getConditions(compilerOptions, resolutionMode === 99 /* ESNext */) : void 0);
|
|
37671
37727
|
break;
|
|
37672
37728
|
default:
|
|
37673
37729
|
return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`);
|
|
@@ -37832,7 +37888,7 @@ function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions,
|
|
|
37832
37888
|
resolutionMode
|
|
37833
37889
|
);
|
|
37834
37890
|
}
|
|
37835
|
-
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
37891
|
+
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode, conditions) {
|
|
37836
37892
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
37837
37893
|
const esmMode = resolutionMode === 99 /* ESNext */ ? 32 /* EsmMode */ : 0;
|
|
37838
37894
|
let extensions = compilerOptions.noDtsResolution ? 3 /* ImplementationFiles */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
|
|
@@ -37849,7 +37905,8 @@ function nodeNextModuleNameResolverWorker(features, moduleName, containingFile,
|
|
|
37849
37905
|
extensions,
|
|
37850
37906
|
/*isConfigLookup*/
|
|
37851
37907
|
false,
|
|
37852
|
-
redirectedReference
|
|
37908
|
+
redirectedReference,
|
|
37909
|
+
conditions
|
|
37853
37910
|
);
|
|
37854
37911
|
}
|
|
37855
37912
|
function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
@@ -37865,10 +37922,12 @@ function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
|
37865
37922
|
/*isConfigLookup*/
|
|
37866
37923
|
false,
|
|
37867
37924
|
/*redirectedReference*/
|
|
37925
|
+
void 0,
|
|
37926
|
+
/*conditions*/
|
|
37868
37927
|
void 0
|
|
37869
37928
|
);
|
|
37870
37929
|
}
|
|
37871
|
-
function bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
37930
|
+
function bundlerModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, conditions) {
|
|
37872
37931
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
37873
37932
|
let extensions = compilerOptions.noDtsResolution ? 3 /* ImplementationFiles */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
|
|
37874
37933
|
if (getResolveJsonModule(compilerOptions)) {
|
|
@@ -37884,10 +37943,11 @@ function bundlerModuleNameResolver(moduleName, containingFile, compilerOptions,
|
|
|
37884
37943
|
extensions,
|
|
37885
37944
|
/*isConfigLookup*/
|
|
37886
37945
|
false,
|
|
37887
|
-
redirectedReference
|
|
37946
|
+
redirectedReference,
|
|
37947
|
+
conditions
|
|
37888
37948
|
);
|
|
37889
37949
|
}
|
|
37890
|
-
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, isConfigLookup) {
|
|
37950
|
+
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, conditions, isConfigLookup) {
|
|
37891
37951
|
let extensions;
|
|
37892
37952
|
if (isConfigLookup) {
|
|
37893
37953
|
extensions = 8 /* Json */;
|
|
@@ -37898,7 +37958,7 @@ function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, hos
|
|
|
37898
37958
|
} else {
|
|
37899
37959
|
extensions = getResolveJsonModule(compilerOptions) ? 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */ | 8 /* Json */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
|
|
37900
37960
|
}
|
|
37901
|
-
return nodeModuleNameResolverWorker(0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference);
|
|
37961
|
+
return nodeModuleNameResolverWorker(conditions ? 30 /* AllFeatures */ : 0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference, conditions);
|
|
37902
37962
|
}
|
|
37903
37963
|
function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
37904
37964
|
return nodeModuleNameResolverWorker(
|
|
@@ -37913,15 +37973,21 @@ function nodeNextJsonConfigResolver(moduleName, containingFile, host) {
|
|
|
37913
37973
|
/*isConfigLookup*/
|
|
37914
37974
|
true,
|
|
37915
37975
|
/*redirectedReference*/
|
|
37976
|
+
void 0,
|
|
37977
|
+
/*conditions*/
|
|
37916
37978
|
void 0
|
|
37917
37979
|
);
|
|
37918
37980
|
}
|
|
37919
|
-
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference) {
|
|
37981
|
+
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference, conditions) {
|
|
37920
37982
|
var _a, _b, _c, _d;
|
|
37921
37983
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
37922
37984
|
const failedLookupLocations = [];
|
|
37923
37985
|
const affectingLocations = [];
|
|
37924
|
-
const
|
|
37986
|
+
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
37987
|
+
conditions ?? (conditions = getConditions(
|
|
37988
|
+
compilerOptions,
|
|
37989
|
+
moduleResolution === 100 /* Bundler */ || moduleResolution === 2 /* Node10 */ ? void 0 : !!(features & 32 /* EsmMode */)
|
|
37990
|
+
));
|
|
37925
37991
|
const diagnostics = [];
|
|
37926
37992
|
const state = {
|
|
37927
37993
|
compilerOptions,
|
|
@@ -37931,17 +37997,17 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37931
37997
|
affectingLocations,
|
|
37932
37998
|
packageJsonInfoCache: cache,
|
|
37933
37999
|
features,
|
|
37934
|
-
conditions,
|
|
38000
|
+
conditions: conditions ?? emptyArray,
|
|
37935
38001
|
requestContainingDirectory: containingDirectory,
|
|
37936
38002
|
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
37937
38003
|
isConfigLookup,
|
|
37938
38004
|
candidateIsFromPackageJsonField: false
|
|
37939
38005
|
};
|
|
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(", "));
|
|
38006
|
+
if (traceEnabled && moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
38007
|
+
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", state.conditions.map((c) => `'${c}'`).join(", "));
|
|
37942
38008
|
}
|
|
37943
38009
|
let result;
|
|
37944
|
-
if (
|
|
38010
|
+
if (moduleResolution === 2 /* Node10 */) {
|
|
37945
38011
|
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
37946
38012
|
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
37947
38013
|
result = priorityExtensions && tryResolve(priorityExtensions, state) || secondaryExtensions && tryResolve(secondaryExtensions, state) || void 0;
|
|
@@ -37949,7 +38015,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
37949
38015
|
result = tryResolve(extensions, state);
|
|
37950
38016
|
}
|
|
37951
38017
|
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")) {
|
|
38018
|
+
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
38019
|
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
38020
|
const diagnosticState = {
|
|
37955
38021
|
...state,
|
|
@@ -38625,7 +38691,8 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
38625
38691
|
extensions,
|
|
38626
38692
|
/*isConfigLookup*/
|
|
38627
38693
|
false,
|
|
38628
|
-
redirectedReference
|
|
38694
|
+
redirectedReference,
|
|
38695
|
+
state.conditions
|
|
38629
38696
|
);
|
|
38630
38697
|
return toSearchResult(
|
|
38631
38698
|
result.resolvedModule ? {
|
|
@@ -43458,11 +43525,16 @@ function createTypeChecker(host) {
|
|
|
43458
43525
|
checkSourceFileWithEagerDiagnostics(file);
|
|
43459
43526
|
Debug.assert(!!(getNodeLinks(file).flags & 1 /* TypeChecked */));
|
|
43460
43527
|
diagnostics2 = addRange(diagnostics2, suggestionDiagnostics.getDiagnostics(file.fileName));
|
|
43461
|
-
|
|
43462
|
-
|
|
43463
|
-
|
|
43464
|
-
|
|
43465
|
-
|
|
43528
|
+
checkUnusedOrUninitializedIdentifiers(
|
|
43529
|
+
getPotentiallyUnusedOrUninitializedIdentifiers(file),
|
|
43530
|
+
(containingNode, kind, diag2) => {
|
|
43531
|
+
if (!containsParseError(containingNode) && !unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
|
|
43532
|
+
(diagnostics2 || (diagnostics2 = [])).push({ ...diag2, category: 2 /* Suggestion */ });
|
|
43533
|
+
}
|
|
43534
|
+
},
|
|
43535
|
+
/*checkUnused*/
|
|
43536
|
+
true
|
|
43537
|
+
);
|
|
43466
43538
|
return diagnostics2 || emptyArray;
|
|
43467
43539
|
} finally {
|
|
43468
43540
|
cancellationToken = void 0;
|
|
@@ -43959,7 +44031,7 @@ function createTypeChecker(host) {
|
|
|
43959
44031
|
var deferredGlobalClassAccessorDecoratorTargetType;
|
|
43960
44032
|
var deferredGlobalClassAccessorDecoratorResultType;
|
|
43961
44033
|
var deferredGlobalClassFieldDecoratorContextType;
|
|
43962
|
-
var
|
|
44034
|
+
var allPotentiallyUnusedOrUninitializedIdentifiers = /* @__PURE__ */ new Map();
|
|
43963
44035
|
var flowLoopStart = 0;
|
|
43964
44036
|
var flowLoopCount = 0;
|
|
43965
44037
|
var sharedFlowCount = 0;
|
|
@@ -44670,10 +44742,10 @@ function createTypeChecker(host) {
|
|
|
44670
44742
|
function isConstAssertion(location) {
|
|
44671
44743
|
return isAssertionExpression(location) && isConstTypeReference(location.type) || isJSDocTypeTag(location) && isConstTypeReference(location.typeExpression);
|
|
44672
44744
|
}
|
|
44673
|
-
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true) {
|
|
44674
|
-
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
|
|
44745
|
+
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals = false, getSpellingSuggestions = true, isWritten = false) {
|
|
44746
|
+
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, isWritten, getSymbol);
|
|
44675
44747
|
}
|
|
44676
|
-
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
|
|
44748
|
+
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, isWritten, lookup) {
|
|
44677
44749
|
var _a, _b, _c;
|
|
44678
44750
|
const originalLocation = location;
|
|
44679
44751
|
let result;
|
|
@@ -44899,6 +44971,9 @@ function createTypeChecker(host) {
|
|
|
44899
44971
|
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
|
|
44900
44972
|
result.isReferenced |= meaning;
|
|
44901
44973
|
}
|
|
44974
|
+
if (isWritten && result) {
|
|
44975
|
+
result.isInitialized = true;
|
|
44976
|
+
}
|
|
44902
44977
|
if (!result) {
|
|
44903
44978
|
if (lastLocation) {
|
|
44904
44979
|
Debug.assertNode(lastLocation, isSourceFile);
|
|
@@ -46318,7 +46393,7 @@ function createTypeChecker(host) {
|
|
|
46318
46393
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
46319
46394
|
}
|
|
46320
46395
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
46321
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j
|
|
46396
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
46322
46397
|
if (startsWith(moduleReference, "@types/")) {
|
|
46323
46398
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
46324
46399
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -46373,9 +46448,8 @@ function createTypeChecker(host) {
|
|
|
46373
46448
|
}
|
|
46374
46449
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
46375
46450
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
46376
|
-
const
|
|
46377
|
-
|
|
46378
|
-
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
46451
|
+
const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
46452
|
+
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
|
|
46379
46453
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
46380
46454
|
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
46455
|
} else {
|
|
@@ -46481,7 +46555,7 @@ function createTypeChecker(host) {
|
|
|
46481
46555
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
46482
46556
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
46483
46557
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
46484
|
-
const suggestedExt = (
|
|
46558
|
+
const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
|
|
46485
46559
|
if (suggestedExt) {
|
|
46486
46560
|
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
46561
|
} else {
|
|
@@ -48246,7 +48320,7 @@ function createTypeChecker(host) {
|
|
|
48246
48320
|
return factory.updateImportTypeNode(
|
|
48247
48321
|
root,
|
|
48248
48322
|
root.argument,
|
|
48249
|
-
root.
|
|
48323
|
+
root.attributes,
|
|
48250
48324
|
qualifier,
|
|
48251
48325
|
typeArguments,
|
|
48252
48326
|
root.isTypeOf
|
|
@@ -48979,7 +49053,6 @@ function createTypeChecker(host) {
|
|
|
48979
49053
|
return symbol.parent ? factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
|
|
48980
49054
|
}
|
|
48981
49055
|
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
|
|
48982
|
-
var _a, _b, _c, _d;
|
|
48983
49056
|
const chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */));
|
|
48984
49057
|
const isTypeOf = meaning === 111551 /* Value */;
|
|
48985
49058
|
if (some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
@@ -48988,17 +49061,18 @@ function createTypeChecker(host) {
|
|
|
48988
49061
|
const contextFile = getSourceFileOfNode(getOriginalNode(context.enclosingDeclaration));
|
|
48989
49062
|
const targetFile = getSourceFileOfModule(chain[0]);
|
|
48990
49063
|
let specifier;
|
|
48991
|
-
let
|
|
49064
|
+
let attributes;
|
|
48992
49065
|
if (getEmitModuleResolutionKind(compilerOptions) === 3 /* Node16 */ || getEmitModuleResolutionKind(compilerOptions) === 99 /* NodeNext */) {
|
|
48993
49066
|
if ((targetFile == null ? void 0 : targetFile.impliedNodeFormat) === 99 /* ESNext */ && targetFile.impliedNodeFormat !== (contextFile == null ? void 0 : contextFile.impliedNodeFormat)) {
|
|
48994
49067
|
specifier = getSpecifierForModuleSymbol(chain[0], context, 99 /* ESNext */);
|
|
48995
|
-
|
|
48996
|
-
factory.
|
|
48997
|
-
factory.
|
|
48998
|
-
|
|
48999
|
-
|
|
49000
|
-
|
|
49001
|
-
|
|
49068
|
+
attributes = factory.createImportAttributes(
|
|
49069
|
+
factory.createNodeArray([
|
|
49070
|
+
factory.createImportAttribute(
|
|
49071
|
+
factory.createStringLiteral("resolution-mode"),
|
|
49072
|
+
factory.createStringLiteral("import")
|
|
49073
|
+
)
|
|
49074
|
+
])
|
|
49075
|
+
);
|
|
49002
49076
|
}
|
|
49003
49077
|
}
|
|
49004
49078
|
if (!specifier) {
|
|
@@ -49012,16 +49086,17 @@ function createTypeChecker(host) {
|
|
|
49012
49086
|
if (specifier.includes("/node_modules/")) {
|
|
49013
49087
|
specifier = oldSpecifier;
|
|
49014
49088
|
} else {
|
|
49015
|
-
|
|
49016
|
-
factory.
|
|
49017
|
-
factory.
|
|
49018
|
-
|
|
49019
|
-
|
|
49020
|
-
|
|
49021
|
-
|
|
49089
|
+
attributes = factory.createImportAttributes(
|
|
49090
|
+
factory.createNodeArray([
|
|
49091
|
+
factory.createImportAttribute(
|
|
49092
|
+
factory.createStringLiteral("resolution-mode"),
|
|
49093
|
+
factory.createStringLiteral(swappedMode === 99 /* ESNext */ ? "import" : "require")
|
|
49094
|
+
)
|
|
49095
|
+
])
|
|
49096
|
+
);
|
|
49022
49097
|
}
|
|
49023
49098
|
}
|
|
49024
|
-
if (!
|
|
49099
|
+
if (!attributes) {
|
|
49025
49100
|
context.encounteredError = true;
|
|
49026
49101
|
if (context.tracker.reportLikelyUnsafeImportRequiredError) {
|
|
49027
49102
|
context.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier);
|
|
@@ -49041,11 +49116,11 @@ function createTypeChecker(host) {
|
|
|
49041
49116
|
void 0
|
|
49042
49117
|
);
|
|
49043
49118
|
}
|
|
49044
|
-
return factory.createImportTypeNode(lit,
|
|
49119
|
+
return factory.createImportTypeNode(lit, attributes, nonRootParts, typeParameterNodes, isTypeOf);
|
|
49045
49120
|
} else {
|
|
49046
49121
|
const splitNode = getTopmostIndexedAccessType(nonRootParts);
|
|
49047
49122
|
const qualifier = splitNode.objectType.typeName;
|
|
49048
|
-
return factory.createIndexedAccessTypeNode(factory.createImportTypeNode(lit,
|
|
49123
|
+
return factory.createIndexedAccessTypeNode(factory.createImportTypeNode(lit, attributes, qualifier, typeParameterNodes, isTypeOf), splitNode.indexType);
|
|
49049
49124
|
}
|
|
49050
49125
|
}
|
|
49051
49126
|
const entityName = createAccessFromSymbolChain(chain, chain.length - 1, 0);
|
|
@@ -49521,7 +49596,7 @@ function createTypeChecker(host) {
|
|
|
49521
49596
|
return factory.updateImportTypeNode(
|
|
49522
49597
|
node,
|
|
49523
49598
|
factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)),
|
|
49524
|
-
node.
|
|
49599
|
+
node.attributes,
|
|
49525
49600
|
node.qualifier,
|
|
49526
49601
|
visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
|
|
49527
49602
|
node.isTypeOf
|
|
@@ -49741,7 +49816,7 @@ function createTypeChecker(host) {
|
|
|
49741
49816
|
return statements;
|
|
49742
49817
|
}
|
|
49743
49818
|
function inlineExportModifiers(statements) {
|
|
49744
|
-
const index = findIndex(statements, (d) => isExportDeclaration(d) && !d.moduleSpecifier && !d.
|
|
49819
|
+
const index = findIndex(statements, (d) => isExportDeclaration(d) && !d.moduleSpecifier && !d.attributes && !!d.exportClause && isNamedExports(d.exportClause));
|
|
49745
49820
|
if (index >= 0) {
|
|
49746
49821
|
const exportDecl = statements[index];
|
|
49747
49822
|
const replacements = mapDefined(exportDecl.exportClause.elements, (e) => {
|
|
@@ -49769,7 +49844,7 @@ function createTypeChecker(host) {
|
|
|
49769
49844
|
replacements
|
|
49770
49845
|
),
|
|
49771
49846
|
exportDecl.moduleSpecifier,
|
|
49772
|
-
exportDecl.
|
|
49847
|
+
exportDecl.attributes
|
|
49773
49848
|
);
|
|
49774
49849
|
}
|
|
49775
49850
|
}
|
|
@@ -50420,7 +50495,7 @@ function createTypeChecker(host) {
|
|
|
50420
50495
|
)])
|
|
50421
50496
|
),
|
|
50422
50497
|
factory.createStringLiteral(specifier2),
|
|
50423
|
-
/*
|
|
50498
|
+
/*attributes*/
|
|
50424
50499
|
void 0
|
|
50425
50500
|
),
|
|
50426
50501
|
0 /* None */
|
|
@@ -50508,7 +50583,7 @@ function createTypeChecker(host) {
|
|
|
50508
50583
|
void 0
|
|
50509
50584
|
),
|
|
50510
50585
|
specifier2,
|
|
50511
|
-
node.parent.
|
|
50586
|
+
node.parent.attributes
|
|
50512
50587
|
),
|
|
50513
50588
|
0 /* None */
|
|
50514
50589
|
);
|
|
@@ -50529,7 +50604,7 @@ function createTypeChecker(host) {
|
|
|
50529
50604
|
factory.createNamespaceImport(factory.createIdentifier(localName))
|
|
50530
50605
|
),
|
|
50531
50606
|
specifier2,
|
|
50532
|
-
node.parent.
|
|
50607
|
+
node.parent.attributes
|
|
50533
50608
|
),
|
|
50534
50609
|
0 /* None */
|
|
50535
50610
|
);
|
|
@@ -50570,7 +50645,7 @@ function createTypeChecker(host) {
|
|
|
50570
50645
|
])
|
|
50571
50646
|
),
|
|
50572
50647
|
specifier2,
|
|
50573
|
-
node.parent.parent.parent.
|
|
50648
|
+
node.parent.parent.parent.attributes
|
|
50574
50649
|
),
|
|
50575
50650
|
0 /* None */
|
|
50576
50651
|
);
|
|
@@ -60029,6 +60104,7 @@ function createTypeChecker(host) {
|
|
|
60029
60104
|
let skipParentCounter = 0;
|
|
60030
60105
|
let lastSkippedInfo;
|
|
60031
60106
|
let incompatibleStack;
|
|
60107
|
+
let relationCount = 16e6 - relation.size >> 3;
|
|
60032
60108
|
Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
60033
60109
|
const result = isRelatedTo(
|
|
60034
60110
|
source,
|
|
@@ -60042,8 +60118,19 @@ function createTypeChecker(host) {
|
|
|
60042
60118
|
reportIncompatibleStack();
|
|
60043
60119
|
}
|
|
60044
60120
|
if (overflow) {
|
|
60121
|
+
const id = getRelationKey(
|
|
60122
|
+
source,
|
|
60123
|
+
target,
|
|
60124
|
+
/*intersectionState*/
|
|
60125
|
+
0 /* None */,
|
|
60126
|
+
relation,
|
|
60127
|
+
/*ignoreConstraints*/
|
|
60128
|
+
false
|
|
60129
|
+
);
|
|
60130
|
+
relation.set(id, 4 /* Reported */ | 2 /* Failed */);
|
|
60045
60131
|
(_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth });
|
|
60046
|
-
const
|
|
60132
|
+
const message = relationCount <= 0 ? Diagnostics.Excessive_complexity_comparing_types_0_and_1 : Diagnostics.Excessive_stack_depth_comparing_types_0_and_1;
|
|
60133
|
+
const diag2 = error(errorNode || currentNode, message, typeToString(source), typeToString(target));
|
|
60047
60134
|
if (errorOutputContainer) {
|
|
60048
60135
|
(errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag2);
|
|
60049
60136
|
}
|
|
@@ -60574,6 +60661,16 @@ function createTypeChecker(host) {
|
|
|
60574
60661
|
}
|
|
60575
60662
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
60576
60663
|
if (source2.flags & 1048576 /* Union */) {
|
|
60664
|
+
if (target2.flags & 1048576 /* Union */) {
|
|
60665
|
+
const sourceOrigin = source2.origin;
|
|
60666
|
+
if (sourceOrigin && sourceOrigin.flags & 2097152 /* Intersection */ && target2.aliasSymbol && contains(sourceOrigin.types, target2)) {
|
|
60667
|
+
return -1 /* True */;
|
|
60668
|
+
}
|
|
60669
|
+
const targetOrigin = target2.origin;
|
|
60670
|
+
if (targetOrigin && targetOrigin.flags & 1048576 /* Union */ && source2.aliasSymbol && contains(targetOrigin.types, source2)) {
|
|
60671
|
+
return -1 /* True */;
|
|
60672
|
+
}
|
|
60673
|
+
}
|
|
60577
60674
|
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState);
|
|
60578
60675
|
}
|
|
60579
60676
|
if (target2.flags & 1048576 /* Union */) {
|
|
@@ -60887,6 +60984,10 @@ function createTypeChecker(host) {
|
|
|
60887
60984
|
return entry & 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */;
|
|
60888
60985
|
}
|
|
60889
60986
|
}
|
|
60987
|
+
if (relationCount <= 0) {
|
|
60988
|
+
overflow = true;
|
|
60989
|
+
return 0 /* False */;
|
|
60990
|
+
}
|
|
60890
60991
|
if (!maybeKeys) {
|
|
60891
60992
|
maybeKeys = [];
|
|
60892
60993
|
maybeKeysSet = /* @__PURE__ */ new Set();
|
|
@@ -60980,6 +61081,7 @@ function createTypeChecker(host) {
|
|
|
60980
61081
|
}
|
|
60981
61082
|
} else {
|
|
60982
61083
|
relation.set(id, (reportErrors2 ? 4 /* Reported */ : 0) | 2 /* Failed */ | propagatingVarianceFlags);
|
|
61084
|
+
relationCount--;
|
|
60983
61085
|
resetMaybeStack(
|
|
60984
61086
|
/*markAllAsSucceeded*/
|
|
60985
61087
|
false
|
|
@@ -60991,6 +61093,7 @@ function createTypeChecker(host) {
|
|
|
60991
61093
|
maybeKeysSet.delete(maybeKeys[i]);
|
|
60992
61094
|
if (markAllAsSucceeded) {
|
|
60993
61095
|
relation.set(maybeKeys[i], 1 /* Succeeded */ | propagatingVarianceFlags);
|
|
61096
|
+
relationCount--;
|
|
60994
61097
|
}
|
|
60995
61098
|
}
|
|
60996
61099
|
maybeCount = maybeStart;
|
|
@@ -62386,10 +62489,7 @@ function createTypeChecker(host) {
|
|
|
62386
62489
|
return false;
|
|
62387
62490
|
}
|
|
62388
62491
|
function getVariances(type) {
|
|
62389
|
-
return type === globalArrayType || type === globalReadonlyArrayType || type.objectFlags & 8 /* Tuple */
|
|
62390
|
-
}
|
|
62391
|
-
function isArraySubtype(type) {
|
|
62392
|
-
return length(type.typeParameters) === 1 && length(getBaseTypes(type)) === 1 && isTypeReferenceWithGenericArguments(getBaseTypes(type)[0]) && getVariances(getBaseTypes(type)[0].target) === arrayVariances && length(getTypeArguments(getBaseTypes(type)[0])) === 1 && getTypeArguments(getBaseTypes(type)[0])[0] === type.typeParameters[0];
|
|
62492
|
+
return type === globalArrayType || type === globalReadonlyArrayType || type.objectFlags & 8 /* Tuple */ ? arrayVariances : getVariancesWorker(type.symbol, type.typeParameters);
|
|
62393
62493
|
}
|
|
62394
62494
|
function getAliasVariances(symbol) {
|
|
62395
62495
|
return getVariancesWorker(symbol, getSymbolLinks(symbol).typeParameters);
|
|
@@ -64381,7 +64481,10 @@ function createTypeChecker(host) {
|
|
|
64381
64481
|
node,
|
|
64382
64482
|
!isWriteOnlyAccess(node),
|
|
64383
64483
|
/*excludeGlobals*/
|
|
64384
|
-
false
|
|
64484
|
+
false,
|
|
64485
|
+
/*getSpellingSuggestions*/
|
|
64486
|
+
void 0,
|
|
64487
|
+
isWriteAccess(node)
|
|
64385
64488
|
) || unknownSymbol;
|
|
64386
64489
|
}
|
|
64387
64490
|
return links.resolvedSymbol;
|
|
@@ -69815,6 +69918,8 @@ function createTypeChecker(host) {
|
|
|
69815
69918
|
false,
|
|
69816
69919
|
/*getSpellingSuggestions*/
|
|
69817
69920
|
true,
|
|
69921
|
+
/*isWritten*/
|
|
69922
|
+
false,
|
|
69818
69923
|
(symbols, name, meaning2) => {
|
|
69819
69924
|
Debug.assertEqual(outerName, name, "name should equal outerName");
|
|
69820
69925
|
const symbol = getSymbol(symbols, name, meaning2);
|
|
@@ -75269,7 +75374,7 @@ function createTypeChecker(host) {
|
|
|
75269
75374
|
}
|
|
75270
75375
|
}
|
|
75271
75376
|
if (node.kind !== 181 /* IndexSignature */ && node.kind !== 324 /* JSDocFunctionType */) {
|
|
75272
|
-
|
|
75377
|
+
registerForUnusedOrUninitializedIdentifiersCheck(node);
|
|
75273
75378
|
}
|
|
75274
75379
|
}
|
|
75275
75380
|
}
|
|
@@ -75814,7 +75919,7 @@ function createTypeChecker(host) {
|
|
|
75814
75919
|
}
|
|
75815
75920
|
}
|
|
75816
75921
|
}
|
|
75817
|
-
|
|
75922
|
+
registerForUnusedOrUninitializedIdentifiersCheck(node);
|
|
75818
75923
|
}
|
|
75819
75924
|
function checkTemplateLiteralType(node) {
|
|
75820
75925
|
for (const span of node.templateSpans) {
|
|
@@ -75826,16 +75931,8 @@ function createTypeChecker(host) {
|
|
|
75826
75931
|
}
|
|
75827
75932
|
function checkImportType(node) {
|
|
75828
75933
|
checkSourceElement(node.argument);
|
|
75829
|
-
if (node.
|
|
75830
|
-
|
|
75831
|
-
if (override) {
|
|
75832
|
-
if (!isNightly()) {
|
|
75833
|
-
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);
|
|
75834
|
-
}
|
|
75835
|
-
if (getEmitModuleResolutionKind(compilerOptions) !== 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) !== 99 /* NodeNext */) {
|
|
75836
|
-
grammarErrorOnNode(node.assertions.assertClause, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
75837
|
-
}
|
|
75838
|
-
}
|
|
75934
|
+
if (node.attributes) {
|
|
75935
|
+
getResolutionModeOverride(node.attributes, grammarErrorOnNode);
|
|
75839
75936
|
}
|
|
75840
75937
|
checkTypeReferenceOrImport(node);
|
|
75841
75938
|
}
|
|
@@ -76808,25 +76905,27 @@ function createTypeChecker(host) {
|
|
|
76808
76905
|
}
|
|
76809
76906
|
}
|
|
76810
76907
|
}
|
|
76811
|
-
function
|
|
76812
|
-
addLazyDiagnostic(
|
|
76813
|
-
function
|
|
76908
|
+
function registerForUnusedOrUninitializedIdentifiersCheck(node) {
|
|
76909
|
+
addLazyDiagnostic(registerForUnusedOrUninitializedIdentifiersCheckDiagnostics);
|
|
76910
|
+
function registerForUnusedOrUninitializedIdentifiersCheckDiagnostics() {
|
|
76814
76911
|
const sourceFile = getSourceFileOfNode(node);
|
|
76815
|
-
let
|
|
76816
|
-
if (!
|
|
76817
|
-
|
|
76818
|
-
|
|
76912
|
+
let potentiallyUnusedOrUninitializedIdentifiers = allPotentiallyUnusedOrUninitializedIdentifiers.get(sourceFile.path);
|
|
76913
|
+
if (!potentiallyUnusedOrUninitializedIdentifiers) {
|
|
76914
|
+
potentiallyUnusedOrUninitializedIdentifiers = [];
|
|
76915
|
+
allPotentiallyUnusedOrUninitializedIdentifiers.set(sourceFile.path, potentiallyUnusedOrUninitializedIdentifiers);
|
|
76819
76916
|
}
|
|
76820
|
-
|
|
76917
|
+
potentiallyUnusedOrUninitializedIdentifiers.push(node);
|
|
76821
76918
|
}
|
|
76822
76919
|
}
|
|
76823
|
-
function
|
|
76920
|
+
function checkUnusedOrUninitializedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic, checkUnused, checkUninitialized) {
|
|
76824
76921
|
for (const node of potentiallyUnusedIdentifiers) {
|
|
76825
76922
|
switch (node.kind) {
|
|
76826
76923
|
case 263 /* ClassDeclaration */:
|
|
76827
76924
|
case 231 /* ClassExpression */:
|
|
76828
|
-
|
|
76829
|
-
|
|
76925
|
+
if (checkUnused) {
|
|
76926
|
+
checkUnusedClassMembers(node, addDiagnostic);
|
|
76927
|
+
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76928
|
+
}
|
|
76830
76929
|
break;
|
|
76831
76930
|
case 312 /* SourceFile */:
|
|
76832
76931
|
case 267 /* ModuleDeclaration */:
|
|
@@ -76835,7 +76934,12 @@ function createTypeChecker(host) {
|
|
|
76835
76934
|
case 248 /* ForStatement */:
|
|
76836
76935
|
case 249 /* ForInStatement */:
|
|
76837
76936
|
case 250 /* ForOfStatement */:
|
|
76838
|
-
|
|
76937
|
+
if (checkUnused) {
|
|
76938
|
+
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
76939
|
+
}
|
|
76940
|
+
if (checkUninitialized) {
|
|
76941
|
+
checkUninitializedLocals(node);
|
|
76942
|
+
}
|
|
76839
76943
|
break;
|
|
76840
76944
|
case 176 /* Constructor */:
|
|
76841
76945
|
case 218 /* FunctionExpression */:
|
|
@@ -76844,10 +76948,15 @@ function createTypeChecker(host) {
|
|
|
76844
76948
|
case 174 /* MethodDeclaration */:
|
|
76845
76949
|
case 177 /* GetAccessor */:
|
|
76846
76950
|
case 178 /* SetAccessor */:
|
|
76847
|
-
if (
|
|
76848
|
-
|
|
76951
|
+
if (checkUnused) {
|
|
76952
|
+
if (node.body) {
|
|
76953
|
+
checkUnusedLocalsAndParameters(node, addDiagnostic);
|
|
76954
|
+
}
|
|
76955
|
+
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76956
|
+
}
|
|
76957
|
+
if (checkUninitialized) {
|
|
76958
|
+
checkUninitializedLocals(node);
|
|
76849
76959
|
}
|
|
76850
|
-
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76851
76960
|
break;
|
|
76852
76961
|
case 173 /* MethodSignature */:
|
|
76853
76962
|
case 179 /* CallSignature */:
|
|
@@ -76856,10 +76965,14 @@ function createTypeChecker(host) {
|
|
|
76856
76965
|
case 185 /* ConstructorType */:
|
|
76857
76966
|
case 265 /* TypeAliasDeclaration */:
|
|
76858
76967
|
case 264 /* InterfaceDeclaration */:
|
|
76859
|
-
|
|
76968
|
+
if (checkUnused) {
|
|
76969
|
+
checkUnusedTypeParameters(node, addDiagnostic);
|
|
76970
|
+
}
|
|
76860
76971
|
break;
|
|
76861
76972
|
case 195 /* InferType */:
|
|
76862
|
-
|
|
76973
|
+
if (checkUnused) {
|
|
76974
|
+
checkUnusedInferTypeParameter(node, addDiagnostic);
|
|
76975
|
+
}
|
|
76863
76976
|
break;
|
|
76864
76977
|
default:
|
|
76865
76978
|
Debug.assertNever(node, "Node should not have been registered for unused identifiers check");
|
|
@@ -77049,6 +77162,26 @@ function createTypeChecker(host) {
|
|
|
77049
77162
|
}
|
|
77050
77163
|
});
|
|
77051
77164
|
}
|
|
77165
|
+
function checkUninitializedLocals(nodeWithLocals) {
|
|
77166
|
+
nodeWithLocals.locals.forEach((local) => {
|
|
77167
|
+
if (!(local.flags & 3 /* Variable */) || local.isInitialized || !local.isReferenced) {
|
|
77168
|
+
return;
|
|
77169
|
+
}
|
|
77170
|
+
const declaration = local.valueDeclaration;
|
|
77171
|
+
if (!declaration) {
|
|
77172
|
+
return;
|
|
77173
|
+
}
|
|
77174
|
+
if (isVariableDeclaration(declaration)) {
|
|
77175
|
+
if (getCombinedNodeFlagsCached(declaration) & 33554432 /* Ambient */ || declaration.exclamationToken || declaration.initializer || !declaration.type) {
|
|
77176
|
+
return;
|
|
77177
|
+
}
|
|
77178
|
+
const type = getTypeFromTypeNode(declaration.type);
|
|
77179
|
+
if (!(type.flags & 3 /* AnyOrUnknown */) && !containsUndefinedType(type)) {
|
|
77180
|
+
error(declaration, Diagnostics.Variable_0_is_used_before_being_assigned, idText(declaration.name));
|
|
77181
|
+
}
|
|
77182
|
+
}
|
|
77183
|
+
});
|
|
77184
|
+
}
|
|
77052
77185
|
function checkPotentialUncheckedRenamedBindingElementsInTypes() {
|
|
77053
77186
|
var _a;
|
|
77054
77187
|
for (const node of potentialUnusedRenamedBindingElementsInTypes) {
|
|
@@ -77095,7 +77228,7 @@ function createTypeChecker(host) {
|
|
|
77095
77228
|
forEach(node.statements, checkSourceElement);
|
|
77096
77229
|
}
|
|
77097
77230
|
if (node.locals) {
|
|
77098
|
-
|
|
77231
|
+
registerForUnusedOrUninitializedIdentifiersCheck(node);
|
|
77099
77232
|
}
|
|
77100
77233
|
}
|
|
77101
77234
|
function checkCollisionWithArgumentsInGeneratedCode(node) {
|
|
@@ -77645,7 +77778,7 @@ function createTypeChecker(host) {
|
|
|
77645
77778
|
checkExpression(node.incrementor);
|
|
77646
77779
|
checkSourceElement(node.statement);
|
|
77647
77780
|
if (node.locals) {
|
|
77648
|
-
|
|
77781
|
+
registerForUnusedOrUninitializedIdentifiersCheck(node);
|
|
77649
77782
|
}
|
|
77650
77783
|
}
|
|
77651
77784
|
function checkForOfStatement(node) {
|
|
@@ -77684,7 +77817,7 @@ function createTypeChecker(host) {
|
|
|
77684
77817
|
}
|
|
77685
77818
|
checkSourceElement(node.statement);
|
|
77686
77819
|
if (node.locals) {
|
|
77687
|
-
|
|
77820
|
+
registerForUnusedOrUninitializedIdentifiersCheck(node);
|
|
77688
77821
|
}
|
|
77689
77822
|
}
|
|
77690
77823
|
function checkForInStatement(node) {
|
|
@@ -77716,7 +77849,7 @@ function createTypeChecker(host) {
|
|
|
77716
77849
|
}
|
|
77717
77850
|
checkSourceElement(node.statement);
|
|
77718
77851
|
if (node.locals) {
|
|
77719
|
-
|
|
77852
|
+
registerForUnusedOrUninitializedIdentifiersCheck(node);
|
|
77720
77853
|
}
|
|
77721
77854
|
}
|
|
77722
77855
|
function checkRightHandSideOfForOf(statement) {
|
|
@@ -78448,7 +78581,7 @@ function createTypeChecker(host) {
|
|
|
78448
78581
|
}
|
|
78449
78582
|
});
|
|
78450
78583
|
if (node.caseBlock.locals) {
|
|
78451
|
-
|
|
78584
|
+
registerForUnusedOrUninitializedIdentifiersCheck(node.caseBlock);
|
|
78452
78585
|
}
|
|
78453
78586
|
}
|
|
78454
78587
|
function checkLabeledStatement(node) {
|
|
@@ -78788,7 +78921,7 @@ function createTypeChecker(host) {
|
|
|
78788
78921
|
}
|
|
78789
78922
|
function checkClassExpressionDeferred(node) {
|
|
78790
78923
|
forEach(node.members, checkSourceElement);
|
|
78791
|
-
|
|
78924
|
+
registerForUnusedOrUninitializedIdentifiersCheck(node);
|
|
78792
78925
|
}
|
|
78793
78926
|
function checkClassDeclaration(node) {
|
|
78794
78927
|
const firstDecorator = find(node.modifiers, isDecorator);
|
|
@@ -78800,7 +78933,7 @@ function createTypeChecker(host) {
|
|
|
78800
78933
|
}
|
|
78801
78934
|
checkClassLikeDeclaration(node);
|
|
78802
78935
|
forEach(node.members, checkSourceElement);
|
|
78803
|
-
|
|
78936
|
+
registerForUnusedOrUninitializedIdentifiersCheck(node);
|
|
78804
78937
|
}
|
|
78805
78938
|
function checkClassLikeDeclaration(node) {
|
|
78806
78939
|
checkGrammarClassLikeDeclaration(node);
|
|
@@ -79361,7 +79494,7 @@ function createTypeChecker(host) {
|
|
|
79361
79494
|
forEach(node.members, checkSourceElement);
|
|
79362
79495
|
addLazyDiagnostic(() => {
|
|
79363
79496
|
checkTypeForDuplicateIndexSignatures(node);
|
|
79364
|
-
|
|
79497
|
+
registerForUnusedOrUninitializedIdentifiersCheck(node);
|
|
79365
79498
|
});
|
|
79366
79499
|
}
|
|
79367
79500
|
function checkTypeAliasDeclaration(node) {
|
|
@@ -79375,7 +79508,7 @@ function createTypeChecker(host) {
|
|
|
79375
79508
|
}
|
|
79376
79509
|
} else {
|
|
79377
79510
|
checkSourceElement(node.type);
|
|
79378
|
-
|
|
79511
|
+
registerForUnusedOrUninitializedIdentifiersCheck(node);
|
|
79379
79512
|
}
|
|
79380
79513
|
}
|
|
79381
79514
|
function computeEnumMemberValues(node) {
|
|
@@ -79646,7 +79779,7 @@ function createTypeChecker(host) {
|
|
|
79646
79779
|
if (node.body) {
|
|
79647
79780
|
checkSourceElement(node.body);
|
|
79648
79781
|
if (!isGlobalScopeAugmentation(node)) {
|
|
79649
|
-
|
|
79782
|
+
registerForUnusedOrUninitializedIdentifiersCheck(node);
|
|
79650
79783
|
}
|
|
79651
79784
|
}
|
|
79652
79785
|
addLazyDiagnostic(checkModuleDeclarationDiagnostics);
|
|
@@ -79799,12 +79932,13 @@ function createTypeChecker(host) {
|
|
|
79799
79932
|
return false;
|
|
79800
79933
|
}
|
|
79801
79934
|
}
|
|
79802
|
-
if (!isImportEqualsDeclaration(node) && node.
|
|
79935
|
+
if (!isImportEqualsDeclaration(node) && node.attributes) {
|
|
79936
|
+
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;
|
|
79803
79937
|
let hasError = false;
|
|
79804
|
-
for (const
|
|
79805
|
-
if (!isStringLiteral(
|
|
79938
|
+
for (const attr of node.attributes.elements) {
|
|
79939
|
+
if (!isStringLiteral(attr.value)) {
|
|
79806
79940
|
hasError = true;
|
|
79807
|
-
error(
|
|
79941
|
+
error(attr.value, diagnostic);
|
|
79808
79942
|
}
|
|
79809
79943
|
}
|
|
79810
79944
|
return !hasError;
|
|
@@ -79936,32 +80070,26 @@ function createTypeChecker(host) {
|
|
|
79936
80070
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
79937
80071
|
}
|
|
79938
80072
|
}
|
|
79939
|
-
function
|
|
80073
|
+
function checkImportAttributes(declaration) {
|
|
79940
80074
|
var _a;
|
|
79941
|
-
|
|
79942
|
-
|
|
79943
|
-
const
|
|
79944
|
-
|
|
79945
|
-
|
|
79946
|
-
|
|
79947
|
-
}
|
|
79948
|
-
if (getEmitModuleResolutionKind(compilerOptions) !== 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) !== 99 /* NodeNext */) {
|
|
79949
|
-
return grammarErrorOnNode(declaration.assertClause, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
79950
|
-
}
|
|
80075
|
+
const node = declaration.attributes;
|
|
80076
|
+
if (node) {
|
|
80077
|
+
const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
80078
|
+
const override = getResolutionModeOverride(node, validForTypeAttributes ? grammarErrorOnNode : void 0);
|
|
80079
|
+
const isImportAttributes2 = declaration.attributes.token === 118 /* WithKeyword */;
|
|
80080
|
+
if (validForTypeAttributes && override) {
|
|
79951
80081
|
return;
|
|
79952
80082
|
}
|
|
79953
80083
|
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
|
|
79954
80084
|
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */) {
|
|
79955
|
-
|
|
79956
|
-
|
|
79957
|
-
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
|
|
79958
|
-
);
|
|
80085
|
+
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;
|
|
80086
|
+
return grammarErrorOnNode(node, message);
|
|
79959
80087
|
}
|
|
79960
80088
|
if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
|
|
79961
|
-
return grammarErrorOnNode(
|
|
80089
|
+
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);
|
|
79962
80090
|
}
|
|
79963
80091
|
if (override) {
|
|
79964
|
-
return grammarErrorOnNode(
|
|
80092
|
+
return grammarErrorOnNode(node, Diagnostics.resolution_mode_can_only_be_set_for_type_only_imports);
|
|
79965
80093
|
}
|
|
79966
80094
|
}
|
|
79967
80095
|
}
|
|
@@ -79993,7 +80121,7 @@ function createTypeChecker(host) {
|
|
|
79993
80121
|
}
|
|
79994
80122
|
}
|
|
79995
80123
|
}
|
|
79996
|
-
|
|
80124
|
+
checkImportAttributes(node);
|
|
79997
80125
|
}
|
|
79998
80126
|
function checkImportEqualsDeclaration(node) {
|
|
79999
80127
|
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)) {
|
|
@@ -80066,7 +80194,7 @@ function createTypeChecker(host) {
|
|
|
80066
80194
|
}
|
|
80067
80195
|
}
|
|
80068
80196
|
}
|
|
80069
|
-
|
|
80197
|
+
checkImportAttributes(node);
|
|
80070
80198
|
}
|
|
80071
80199
|
function checkGrammarExportDeclaration(node) {
|
|
80072
80200
|
var _a;
|
|
@@ -80649,8 +80777,8 @@ function createTypeChecker(host) {
|
|
|
80649
80777
|
return Debug.assertNever(kind);
|
|
80650
80778
|
}
|
|
80651
80779
|
}
|
|
80652
|
-
function
|
|
80653
|
-
return
|
|
80780
|
+
function getPotentiallyUnusedOrUninitializedIdentifiers(sourceFile) {
|
|
80781
|
+
return allPotentiallyUnusedOrUninitializedIdentifiers.get(sourceFile.path) || emptyArray;
|
|
80654
80782
|
}
|
|
80655
80783
|
function checkSourceFileWorker(node) {
|
|
80656
80784
|
const links = getNodeLinks(node);
|
|
@@ -80668,15 +80796,21 @@ function createTypeChecker(host) {
|
|
|
80668
80796
|
checkSourceElement(node.endOfFileToken);
|
|
80669
80797
|
checkDeferredNodes(node);
|
|
80670
80798
|
if (isExternalOrCommonJsModule(node)) {
|
|
80671
|
-
|
|
80799
|
+
registerForUnusedOrUninitializedIdentifiersCheck(node);
|
|
80672
80800
|
}
|
|
80673
80801
|
addLazyDiagnostic(() => {
|
|
80674
|
-
|
|
80675
|
-
|
|
80676
|
-
|
|
80677
|
-
|
|
80678
|
-
|
|
80679
|
-
|
|
80802
|
+
const checkUnused = !node.isDeclarationFile && (compilerOptions.noUnusedLocals || compilerOptions.noUnusedParameters);
|
|
80803
|
+
if (checkUnused || strictNullChecks) {
|
|
80804
|
+
checkUnusedOrUninitializedIdentifiers(
|
|
80805
|
+
getPotentiallyUnusedOrUninitializedIdentifiers(node),
|
|
80806
|
+
(containingNode, kind, diag2) => {
|
|
80807
|
+
if (!containsParseError(containingNode) && unusedIsError(kind, !!(containingNode.flags & 33554432 /* Ambient */))) {
|
|
80808
|
+
diagnostics.add(diag2);
|
|
80809
|
+
}
|
|
80810
|
+
},
|
|
80811
|
+
checkUnused,
|
|
80812
|
+
strictNullChecks
|
|
80813
|
+
);
|
|
80680
80814
|
}
|
|
80681
80815
|
if (!node.isDeclarationFile) {
|
|
80682
80816
|
checkPotentialUncheckedRenamedBindingElementsInTypes();
|
|
@@ -83856,12 +83990,12 @@ function createTypeChecker(host) {
|
|
|
83856
83990
|
if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */) {
|
|
83857
83991
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
83858
83992
|
if (nodeArguments.length > 1) {
|
|
83859
|
-
const
|
|
83860
|
-
return grammarErrorOnNode(
|
|
83993
|
+
const importAttributesArgument = nodeArguments[1];
|
|
83994
|
+
return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
|
|
83861
83995
|
}
|
|
83862
83996
|
}
|
|
83863
83997
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
83864
|
-
return grammarErrorOnNode(node, Diagnostics.
|
|
83998
|
+
return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_set_of_attributes_as_arguments);
|
|
83865
83999
|
}
|
|
83866
84000
|
const spreadElement = find(nodeArguments, isSpreadElement);
|
|
83867
84001
|
if (spreadElement) {
|
|
@@ -84128,13 +84262,6 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
|
84128
84262
|
this.inner.reportNonSerializableProperty(propertyName);
|
|
84129
84263
|
}
|
|
84130
84264
|
}
|
|
84131
|
-
reportImportTypeNodeResolutionModeOverride() {
|
|
84132
|
-
var _a;
|
|
84133
|
-
if ((_a = this.inner) == null ? void 0 : _a.reportImportTypeNodeResolutionModeOverride) {
|
|
84134
|
-
this.onDiagnosticReported();
|
|
84135
|
-
this.inner.reportImportTypeNodeResolutionModeOverride();
|
|
84136
|
-
}
|
|
84137
|
-
}
|
|
84138
84265
|
onDiagnosticReported() {
|
|
84139
84266
|
this.context.reportedDiagnostic = true;
|
|
84140
84267
|
}
|
|
@@ -84643,7 +84770,7 @@ var visitEachChildTable = {
|
|
|
84643
84770
|
return context.factory.updateImportTypeNode(
|
|
84644
84771
|
node,
|
|
84645
84772
|
Debug.checkDefined(nodeVisitor(node.argument, visitor, isTypeNode)),
|
|
84646
|
-
nodeVisitor(node.
|
|
84773
|
+
nodeVisitor(node.attributes, visitor, isImportAttributes),
|
|
84647
84774
|
nodeVisitor(node.qualifier, visitor, isEntityName),
|
|
84648
84775
|
nodesVisitor(node.typeArguments, visitor, isTypeNode),
|
|
84649
84776
|
node.isTypeOf
|
|
@@ -85194,20 +85321,20 @@ var visitEachChildTable = {
|
|
|
85194
85321
|
nodesVisitor(node.modifiers, visitor, isModifierLike),
|
|
85195
85322
|
nodeVisitor(node.importClause, visitor, isImportClause),
|
|
85196
85323
|
Debug.checkDefined(nodeVisitor(node.moduleSpecifier, visitor, isExpression)),
|
|
85197
|
-
nodeVisitor(node.
|
|
85324
|
+
nodeVisitor(node.attributes, visitor, isImportAttributes)
|
|
85198
85325
|
);
|
|
85199
85326
|
},
|
|
85200
|
-
[300 /*
|
|
85201
|
-
return context.factory.
|
|
85327
|
+
[300 /* ImportAttributes */]: function visitEachChildOfImportAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
|
|
85328
|
+
return context.factory.updateImportAttributes(
|
|
85202
85329
|
node,
|
|
85203
|
-
nodesVisitor(node.elements, visitor,
|
|
85330
|
+
nodesVisitor(node.elements, visitor, isImportAttribute),
|
|
85204
85331
|
node.multiLine
|
|
85205
85332
|
);
|
|
85206
85333
|
},
|
|
85207
|
-
[301 /*
|
|
85208
|
-
return context.factory.
|
|
85334
|
+
[301 /* ImportAttribute */]: function visitEachChildOfImportAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
|
|
85335
|
+
return context.factory.updateImportAttribute(
|
|
85209
85336
|
node,
|
|
85210
|
-
Debug.checkDefined(nodeVisitor(node.name, visitor,
|
|
85337
|
+
Debug.checkDefined(nodeVisitor(node.name, visitor, isImportAttributeName)),
|
|
85211
85338
|
Debug.checkDefined(nodeVisitor(node.value, visitor, isExpression))
|
|
85212
85339
|
);
|
|
85213
85340
|
},
|
|
@@ -85259,7 +85386,7 @@ var visitEachChildTable = {
|
|
|
85259
85386
|
node.isTypeOnly,
|
|
85260
85387
|
nodeVisitor(node.exportClause, visitor, isNamedExportBindings),
|
|
85261
85388
|
nodeVisitor(node.moduleSpecifier, visitor, isExpression),
|
|
85262
|
-
nodeVisitor(node.
|
|
85389
|
+
nodeVisitor(node.attributes, visitor, isImportAttributes)
|
|
85263
85390
|
);
|
|
85264
85391
|
},
|
|
85265
85392
|
[279 /* NamedExports */]: function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
|
|
@@ -88578,7 +88705,7 @@ function transformTypeScript(context) {
|
|
|
88578
88705
|
void 0,
|
|
88579
88706
|
importClause,
|
|
88580
88707
|
node.moduleSpecifier,
|
|
88581
|
-
node.
|
|
88708
|
+
node.attributes
|
|
88582
88709
|
) : void 0;
|
|
88583
88710
|
}
|
|
88584
88711
|
function visitImportClause(node) {
|
|
@@ -88628,7 +88755,7 @@ function transformTypeScript(context) {
|
|
|
88628
88755
|
node.isTypeOnly,
|
|
88629
88756
|
exportClause,
|
|
88630
88757
|
node.moduleSpecifier,
|
|
88631
|
-
node.
|
|
88758
|
+
node.attributes
|
|
88632
88759
|
) : void 0;
|
|
88633
88760
|
}
|
|
88634
88761
|
function visitNamedExports(node, allowEmpty) {
|
|
@@ -88662,7 +88789,7 @@ function transformTypeScript(context) {
|
|
|
88662
88789
|
/*importClause*/
|
|
88663
88790
|
void 0,
|
|
88664
88791
|
node.moduleReference.expression,
|
|
88665
|
-
/*
|
|
88792
|
+
/*attributes*/
|
|
88666
88793
|
void 0
|
|
88667
88794
|
),
|
|
88668
88795
|
node
|
|
@@ -96832,7 +96959,7 @@ function transformJsx(context) {
|
|
|
96832
96959
|
factory2.createNamedImports(arrayFrom(importSpecifiersMap.values()))
|
|
96833
96960
|
),
|
|
96834
96961
|
factory2.createStringLiteral(importSource),
|
|
96835
|
-
/*
|
|
96962
|
+
/*attributes*/
|
|
96836
96963
|
void 0
|
|
96837
96964
|
);
|
|
96838
96965
|
setParentRecursive(
|
|
@@ -106239,7 +106366,9 @@ function transformECMAScriptModule(context) {
|
|
|
106239
106366
|
)
|
|
106240
106367
|
])
|
|
106241
106368
|
),
|
|
106242
|
-
factory2.createStringLiteral("module")
|
|
106369
|
+
factory2.createStringLiteral("module"),
|
|
106370
|
+
/*attributes*/
|
|
106371
|
+
void 0
|
|
106243
106372
|
);
|
|
106244
106373
|
const requireHelperName = factory2.createUniqueName("__require", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
106245
106374
|
const requireStatement = factory2.createVariableStatement(
|
|
@@ -106356,7 +106485,7 @@ function transformECMAScriptModule(context) {
|
|
|
106356
106485
|
)
|
|
106357
106486
|
),
|
|
106358
106487
|
node.moduleSpecifier,
|
|
106359
|
-
node.
|
|
106488
|
+
node.attributes
|
|
106360
106489
|
);
|
|
106361
106490
|
setOriginalNode(importDecl, node.exportClause);
|
|
106362
106491
|
const exportDecl = isExportNamespaceAsDefaultDeclaration(node) ? factory2.createExportDefault(synthName) : factory2.createExportDeclaration(
|
|
@@ -106809,8 +106938,7 @@ function transformDeclarations(context) {
|
|
|
106809
106938
|
trackReferencedAmbientModule,
|
|
106810
106939
|
trackExternalModuleSymbolOfImportTypeNode,
|
|
106811
106940
|
reportNonlocalAugmentation,
|
|
106812
|
-
reportNonSerializableProperty
|
|
106813
|
-
reportImportTypeNodeResolutionModeOverride
|
|
106941
|
+
reportNonSerializableProperty
|
|
106814
106942
|
};
|
|
106815
106943
|
let errorNameNode;
|
|
106816
106944
|
let errorFallbackNode;
|
|
@@ -106934,11 +107062,6 @@ function transformDeclarations(context) {
|
|
|
106934
107062
|
context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized, propertyName));
|
|
106935
107063
|
}
|
|
106936
107064
|
}
|
|
106937
|
-
function reportImportTypeNodeResolutionModeOverride() {
|
|
106938
|
-
if (!isNightly() && (errorNameNode || errorFallbackNode)) {
|
|
106939
|
-
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));
|
|
106940
|
-
}
|
|
106941
|
-
}
|
|
106942
107065
|
function transformDeclarationsForJS(sourceFile, bundled) {
|
|
106943
107066
|
const oldDiag = getSymbolAccessibilityDiagnostic;
|
|
106944
107067
|
getSymbolAccessibilityDiagnostic = (s) => s.errorNode && canProduceDiagnostics(s.errorNode) ? createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : {
|
|
@@ -107443,7 +107566,7 @@ function transformDeclarations(context) {
|
|
|
107443
107566
|
decl.modifiers,
|
|
107444
107567
|
decl.importClause,
|
|
107445
107568
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107446
|
-
|
|
107569
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107447
107570
|
);
|
|
107448
107571
|
}
|
|
107449
107572
|
const visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : void 0;
|
|
@@ -107459,7 +107582,7 @@ function transformDeclarations(context) {
|
|
|
107459
107582
|
void 0
|
|
107460
107583
|
),
|
|
107461
107584
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107462
|
-
|
|
107585
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107463
107586
|
);
|
|
107464
107587
|
}
|
|
107465
107588
|
if (decl.importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
@@ -107477,7 +107600,7 @@ function transformDeclarations(context) {
|
|
|
107477
107600
|
namedBindings
|
|
107478
107601
|
),
|
|
107479
107602
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107480
|
-
|
|
107603
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107481
107604
|
) : void 0;
|
|
107482
107605
|
}
|
|
107483
107606
|
const bindingList = mapDefined(decl.importClause.namedBindings.elements, (b) => resolver.isDeclarationVisible(b) ? b : void 0);
|
|
@@ -107492,7 +107615,7 @@ function transformDeclarations(context) {
|
|
|
107492
107615
|
bindingList && bindingList.length ? factory2.updateNamedImports(decl.importClause.namedBindings, bindingList) : void 0
|
|
107493
107616
|
),
|
|
107494
107617
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107495
|
-
|
|
107618
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107496
107619
|
);
|
|
107497
107620
|
}
|
|
107498
107621
|
if (resolver.isImportRequiredByAugmentation(decl)) {
|
|
@@ -107502,19 +107625,13 @@ function transformDeclarations(context) {
|
|
|
107502
107625
|
/*importClause*/
|
|
107503
107626
|
void 0,
|
|
107504
107627
|
rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
107505
|
-
|
|
107628
|
+
tryGetResolutionModeOverride(decl.attributes)
|
|
107506
107629
|
);
|
|
107507
107630
|
}
|
|
107508
107631
|
}
|
|
107509
|
-
function
|
|
107510
|
-
const mode =
|
|
107511
|
-
|
|
107512
|
-
if (!isNightly()) {
|
|
107513
|
-
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));
|
|
107514
|
-
}
|
|
107515
|
-
return assertClause;
|
|
107516
|
-
}
|
|
107517
|
-
return void 0;
|
|
107632
|
+
function tryGetResolutionModeOverride(node) {
|
|
107633
|
+
const mode = getResolutionModeOverride(node);
|
|
107634
|
+
return node && mode !== void 0 ? node : void 0;
|
|
107518
107635
|
}
|
|
107519
107636
|
function transformAndReplaceLatePaintedStatements(statements) {
|
|
107520
107637
|
while (length(lateMarkedStatements)) {
|
|
@@ -107800,7 +107917,7 @@ function transformDeclarations(context) {
|
|
|
107800
107917
|
return cleanup(factory2.updateImportTypeNode(
|
|
107801
107918
|
input,
|
|
107802
107919
|
factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)),
|
|
107803
|
-
input.
|
|
107920
|
+
input.attributes,
|
|
107804
107921
|
input.qualifier,
|
|
107805
107922
|
visitNodes2(input.typeArguments, visitDeclarationSubtree, isTypeNode),
|
|
107806
107923
|
input.isTypeOf
|
|
@@ -107854,7 +107971,7 @@ function transformDeclarations(context) {
|
|
|
107854
107971
|
input.isTypeOnly,
|
|
107855
107972
|
input.exportClause,
|
|
107856
107973
|
rewriteModuleSpecifier(input, input.moduleSpecifier),
|
|
107857
|
-
|
|
107974
|
+
tryGetResolutionModeOverride(input.attributes)
|
|
107858
107975
|
);
|
|
107859
107976
|
}
|
|
107860
107977
|
case 277 /* ExportAssignment */: {
|
|
@@ -110349,10 +110466,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
110349
110466
|
return emitNamedExports(node);
|
|
110350
110467
|
case 281 /* ExportSpecifier */:
|
|
110351
110468
|
return emitExportSpecifier(node);
|
|
110352
|
-
case 300 /*
|
|
110353
|
-
return
|
|
110354
|
-
case 301 /*
|
|
110355
|
-
return
|
|
110469
|
+
case 300 /* ImportAttributes */:
|
|
110470
|
+
return emitImportAttributes(node);
|
|
110471
|
+
case 301 /* ImportAttribute */:
|
|
110472
|
+
return emitImportAttribute(node);
|
|
110356
110473
|
case 282 /* MissingDeclaration */:
|
|
110357
110474
|
return;
|
|
110358
110475
|
case 283 /* ExternalModuleReference */:
|
|
@@ -111127,16 +111244,16 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
111127
111244
|
writeKeyword("import");
|
|
111128
111245
|
writePunctuation("(");
|
|
111129
111246
|
emit(node.argument);
|
|
111130
|
-
if (node.
|
|
111247
|
+
if (node.attributes) {
|
|
111131
111248
|
writePunctuation(",");
|
|
111132
111249
|
writeSpace();
|
|
111133
111250
|
writePunctuation("{");
|
|
111134
111251
|
writeSpace();
|
|
111135
|
-
writeKeyword("assert");
|
|
111252
|
+
writeKeyword(node.attributes.token === 132 /* AssertKeyword */ ? "assert" : "with");
|
|
111136
111253
|
writePunctuation(":");
|
|
111137
111254
|
writeSpace();
|
|
111138
|
-
const elements = node.
|
|
111139
|
-
emitList(node.
|
|
111255
|
+
const elements = node.attributes.elements;
|
|
111256
|
+
emitList(node.attributes, elements, 526226 /* ImportAttributes */);
|
|
111140
111257
|
writeSpace();
|
|
111141
111258
|
writePunctuation("}");
|
|
111142
111259
|
}
|
|
@@ -112125,8 +112242,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
112125
112242
|
writeSpace();
|
|
112126
112243
|
}
|
|
112127
112244
|
emitExpression(node.moduleSpecifier);
|
|
112128
|
-
if (node.
|
|
112129
|
-
emitWithLeadingSpace(node.
|
|
112245
|
+
if (node.attributes) {
|
|
112246
|
+
emitWithLeadingSpace(node.attributes);
|
|
112130
112247
|
}
|
|
112131
112248
|
writeTrailingSemicolon();
|
|
112132
112249
|
}
|
|
@@ -112195,18 +112312,18 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
112195
112312
|
writeSpace();
|
|
112196
112313
|
emitExpression(node.moduleSpecifier);
|
|
112197
112314
|
}
|
|
112198
|
-
if (node.
|
|
112199
|
-
emitWithLeadingSpace(node.
|
|
112315
|
+
if (node.attributes) {
|
|
112316
|
+
emitWithLeadingSpace(node.attributes);
|
|
112200
112317
|
}
|
|
112201
112318
|
writeTrailingSemicolon();
|
|
112202
112319
|
}
|
|
112203
|
-
function
|
|
112204
|
-
emitTokenWithComment(
|
|
112320
|
+
function emitImportAttributes(node) {
|
|
112321
|
+
emitTokenWithComment(node.token, node.pos, writeKeyword, node);
|
|
112205
112322
|
writeSpace();
|
|
112206
112323
|
const elements = node.elements;
|
|
112207
|
-
emitList(node, elements, 526226 /*
|
|
112324
|
+
emitList(node, elements, 526226 /* ImportAttributes */);
|
|
112208
112325
|
}
|
|
112209
|
-
function
|
|
112326
|
+
function emitImportAttribute(node) {
|
|
112210
112327
|
emit(node.name);
|
|
112211
112328
|
writePunctuation(":");
|
|
112212
112329
|
writeSpace();
|
|
@@ -115243,8 +115360,6 @@ function getModeForFileReference(ref, containingFileMode) {
|
|
|
115243
115360
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
115244
115361
|
}
|
|
115245
115362
|
function getModeForResolutionAtIndex(file, index) {
|
|
115246
|
-
if (file.impliedNodeFormat === void 0)
|
|
115247
|
-
return void 0;
|
|
115248
115363
|
return getModeForUsageLocation(file, getModuleNameStringLiteralAt(file, index));
|
|
115249
115364
|
}
|
|
115250
115365
|
function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
@@ -115258,42 +115373,48 @@ function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
|
115258
115373
|
return false;
|
|
115259
115374
|
}
|
|
115260
115375
|
function getModeForUsageLocation(file, usage) {
|
|
115261
|
-
var _a
|
|
115262
|
-
if (file.impliedNodeFormat === void 0)
|
|
115263
|
-
return void 0;
|
|
115376
|
+
var _a;
|
|
115264
115377
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
115265
115378
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
115266
115379
|
if (isTypeOnly) {
|
|
115267
|
-
const override =
|
|
115380
|
+
const override = getResolutionModeOverride(usage.parent.attributes);
|
|
115268
115381
|
if (override) {
|
|
115269
115382
|
return override;
|
|
115270
115383
|
}
|
|
115271
115384
|
}
|
|
115272
115385
|
}
|
|
115273
115386
|
if (usage.parent.parent && isImportTypeNode(usage.parent.parent)) {
|
|
115274
|
-
const override =
|
|
115387
|
+
const override = getResolutionModeOverride(usage.parent.parent.attributes);
|
|
115275
115388
|
if (override) {
|
|
115276
115389
|
return override;
|
|
115277
115390
|
}
|
|
115278
115391
|
}
|
|
115392
|
+
if (file.impliedNodeFormat === void 0)
|
|
115393
|
+
return void 0;
|
|
115279
115394
|
if (file.impliedNodeFormat !== 99 /* ESNext */) {
|
|
115280
115395
|
return isImportCall(walkUpParenthesizedExpressions(usage.parent)) ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
115281
115396
|
}
|
|
115282
|
-
const exprParentParent = (
|
|
115397
|
+
const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
|
|
115283
115398
|
return exprParentParent && isImportEqualsDeclaration(exprParentParent) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
115284
115399
|
}
|
|
115285
|
-
function
|
|
115286
|
-
if (!
|
|
115400
|
+
function getResolutionModeOverride(node, grammarErrorOnNode) {
|
|
115401
|
+
if (!node)
|
|
115287
115402
|
return void 0;
|
|
115288
|
-
if (length(
|
|
115289
|
-
grammarErrorOnNode == null ? void 0 : grammarErrorOnNode(
|
|
115403
|
+
if (length(node.elements) !== 1) {
|
|
115404
|
+
grammarErrorOnNode == null ? void 0 : grammarErrorOnNode(
|
|
115405
|
+
node,
|
|
115406
|
+
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
|
|
115407
|
+
);
|
|
115290
115408
|
return void 0;
|
|
115291
115409
|
}
|
|
115292
|
-
const elem =
|
|
115410
|
+
const elem = node.elements[0];
|
|
115293
115411
|
if (!isStringLiteralLike(elem.name))
|
|
115294
115412
|
return void 0;
|
|
115295
115413
|
if (elem.name.text !== "resolution-mode") {
|
|
115296
|
-
grammarErrorOnNode == null ? void 0 : grammarErrorOnNode(
|
|
115414
|
+
grammarErrorOnNode == null ? void 0 : grammarErrorOnNode(
|
|
115415
|
+
elem.name,
|
|
115416
|
+
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
|
|
115417
|
+
);
|
|
115297
115418
|
return void 0;
|
|
115298
115419
|
}
|
|
115299
115420
|
if (!isStringLiteralLike(elem.value))
|
|
@@ -115588,7 +115709,7 @@ var plainJSErrors = /* @__PURE__ */ new Set([
|
|
|
115588
115709
|
Diagnostics.Classes_may_not_have_a_field_named_constructor.code,
|
|
115589
115710
|
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,
|
|
115590
115711
|
Diagnostics.Duplicate_label_0.code,
|
|
115591
|
-
Diagnostics.
|
|
115712
|
+
Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_set_of_attributes_as_arguments.code,
|
|
115592
115713
|
Diagnostics.for_await_loops_cannot_be_used_inside_a_class_static_block.code,
|
|
115593
115714
|
Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code,
|
|
115594
115715
|
Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code,
|
|
@@ -117122,7 +117243,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117122
117243
|
/*importClause*/
|
|
117123
117244
|
void 0,
|
|
117124
117245
|
externalHelpersModuleReference,
|
|
117125
|
-
/*
|
|
117246
|
+
/*attributes*/
|
|
117126
117247
|
void 0
|
|
117127
117248
|
);
|
|
117128
117249
|
addInternalEmitFlags(importDecl, 2 /* NeverApplyImportHelper */);
|
|
@@ -117598,14 +117719,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117598
117719
|
const fileName = toFileNameLowerCase(ref.fileName);
|
|
117599
117720
|
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
117600
117721
|
const mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
117601
|
-
if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
|
|
117602
|
-
(fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({
|
|
117603
|
-
kind: 2 /* ResolutionDiagnostics */,
|
|
117604
|
-
diagnostics: [
|
|
117605
|
-
createDiagnosticForRange(file, ref, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)
|
|
117606
|
-
]
|
|
117607
|
-
});
|
|
117608
|
-
}
|
|
117609
117722
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
117610
117723
|
}
|
|
117611
117724
|
}
|