@typescript-deploys/pr-build 4.5.0-pr-45884-2 → 4.5.0-pr-45903-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cs/diagnosticMessages.generated.json +6 -0
- package/lib/de/diagnosticMessages.generated.json +1 -0
- package/lib/es/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +6 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +6 -0
- package/lib/lib.es2018.intl.d.ts +2 -2
- package/lib/lib.es5.d.ts +5 -7
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/protocol.d.ts +1 -0
- package/lib/pt-br/diagnosticMessages.generated.json +6 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +6 -0
- package/lib/tsc.js +336 -973
- package/lib/tsserver.js +430 -1125
- package/lib/tsserverlibrary.d.ts +18 -67
- package/lib/tsserverlibrary.js +430 -1125
- package/lib/typescript.d.ts +15 -65
- package/lib/typescript.js +424 -1120
- package/lib/typescriptServices.d.ts +15 -65
- package/lib/typescriptServices.js +424 -1120
- package/lib/typingsInstaller.js +368 -1075
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +6 -0
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20210916";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -5108,12 +5108,6 @@ var ts;
|
|
|
5108
5108
|
(function (ModuleResolutionKind) {
|
|
5109
5109
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5110
5110
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5111
|
-
// Starting with node12, node's module resolver has significant departures from tranditional cjs resolution
|
|
5112
|
-
// to better support ecmascript modules and their use within node - more features are still being added, so
|
|
5113
|
-
// we can expect it to change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12`
|
|
5114
|
-
// version-anchored resolution target
|
|
5115
|
-
ModuleResolutionKind[ModuleResolutionKind["Node12"] = 3] = "Node12";
|
|
5116
|
-
ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
|
|
5117
5111
|
})(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
|
|
5118
5112
|
var WatchFileKind;
|
|
5119
5113
|
(function (WatchFileKind) {
|
|
@@ -5151,9 +5145,6 @@ var ts;
|
|
|
5151
5145
|
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
|
|
5152
5146
|
ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
|
|
5153
5147
|
ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
|
|
5154
|
-
// Node12+ is an amalgam of commonjs (albeit updated) and es2020+, and represents a distinct module system from es2020/esnext
|
|
5155
|
-
ModuleKind[ModuleKind["Node12"] = 100] = "Node12";
|
|
5156
|
-
ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
|
|
5157
5148
|
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
|
|
5158
5149
|
var JsxEmit;
|
|
5159
5150
|
(function (JsxEmit) {
|
|
@@ -5353,12 +5344,6 @@ var ts;
|
|
|
5353
5344
|
Extension["Jsx"] = ".jsx";
|
|
5354
5345
|
Extension["Json"] = ".json";
|
|
5355
5346
|
Extension["TsBuildInfo"] = ".tsbuildinfo";
|
|
5356
|
-
Extension["Mjs"] = ".mjs";
|
|
5357
|
-
Extension["Mts"] = ".mts";
|
|
5358
|
-
Extension["Dmts"] = ".d.mts";
|
|
5359
|
-
Extension["Cjs"] = ".cjs";
|
|
5360
|
-
Extension["Cts"] = ".cts";
|
|
5361
|
-
Extension["Dcts"] = ".d.cts";
|
|
5362
5347
|
})(Extension = ts.Extension || (ts.Extension = {}));
|
|
5363
5348
|
/* @internal */
|
|
5364
5349
|
var TransformFlags;
|
|
@@ -8065,7 +8050,7 @@ var ts;
|
|
|
8065
8050
|
Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, ts.DiagnosticCategory.Error, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
8066
8051
|
Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts.DiagnosticCategory.Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
|
|
8067
8052
|
Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, ts.DiagnosticCategory.Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
8068
|
-
|
|
8053
|
+
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_or_umd: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'."),
|
|
8069
8054
|
Dynamic_import_must_have_one_specifier_as_an_argument: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_import_must_have_one_specifier_as_an_argument_1324", "Dynamic import must have one specifier as an argument."),
|
|
8070
8055
|
Specifier_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Specifier_of_dynamic_import_cannot_be_spread_element_1325", "Specifier of dynamic import cannot be spread element."),
|
|
8071
8056
|
Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."),
|
|
@@ -8083,7 +8068,7 @@ var ts;
|
|
|
8083
8068
|
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
|
|
8084
8069
|
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
|
|
8085
8070
|
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
8086
|
-
|
|
8071
|
+
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_or_system: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_or_system_1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'."),
|
|
8087
8072
|
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
8088
8073
|
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
|
|
8089
8074
|
This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
|
|
@@ -8114,7 +8099,7 @@ var ts;
|
|
|
8114
8099
|
await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
8115
8100
|
_0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
8116
8101
|
_0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
8117
|
-
|
|
8102
|
+
Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, ts.DiagnosticCategory.Error, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_t_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher."),
|
|
8118
8103
|
An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379", "An import alias cannot reference a declaration that was exported using 'export type'."),
|
|
8119
8104
|
An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
|
|
8120
8105
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
@@ -8166,7 +8151,7 @@ var ts;
|
|
|
8166
8151
|
File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
8167
8152
|
The_file_is_in_the_program_because_Colon: diag(1430, ts.DiagnosticCategory.Message, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
|
|
8168
8153
|
for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1431, ts.DiagnosticCategory.Error, "for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431", "'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
8169
|
-
|
|
8154
|
+
Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, ts.DiagnosticCategory.Error, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher."),
|
|
8170
8155
|
Decorators_may_not_be_applied_to_this_parameters: diag(1433, ts.DiagnosticCategory.Error, "Decorators_may_not_be_applied_to_this_parameters_1433", "Decorators may not be applied to 'this' parameters."),
|
|
8171
8156
|
Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
8172
8157
|
Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, ts.DiagnosticCategory.Error, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
|
|
@@ -8182,8 +8167,6 @@ var ts;
|
|
|
8182
8167
|
_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, ts.DiagnosticCategory.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."),
|
|
8183
8168
|
_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isolatedModules_is_enabled: diag(1448, ts.DiagnosticCategory.Error, "_0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_isol_1448", "'{0}' resolves to a type-only declaration and must be re-exported using a type-only re-export when 'isolatedModules' is enabled."),
|
|
8184
8169
|
Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, ts.DiagnosticCategory.Message, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."),
|
|
8185
|
-
The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
|
|
8186
|
-
Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_es_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_es_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead."),
|
|
8187
8170
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
8188
8171
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
8189
8172
|
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
@@ -8762,6 +8745,11 @@ var ts;
|
|
|
8762
8745
|
This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0: diag(4116, ts.DiagnosticCategory.Error, "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116", "This member must have an 'override' modifier because it overrides an abstract method that is declared in the base class '{0}'."),
|
|
8763
8746
|
This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4117, ts.DiagnosticCategory.Error, "This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you__4117", "This member cannot have an 'override' modifier because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
8764
8747
|
The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized: diag(4118, ts.DiagnosticCategory.Error, "The_type_of_this_node_cannot_be_serialized_because_its_property_0_cannot_be_serialized_4118", "The type of this node cannot be serialized because its property '{0}' cannot be serialized."),
|
|
8748
|
+
This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0: diag(4119, ts.DiagnosticCategory.Error, "This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_4119", "This member must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),
|
|
8749
|
+
This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0: diag(4120, ts.DiagnosticCategory.Error, "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120", "This parameter property must have a JSDoc comment with an '@override' tag because it overrides a member in the base class '{0}'."),
|
|
8750
|
+
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class: diag(4121, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_4121", "This member cannot have a JSDoc comment with an '@override' tag because its containing class '{0}' does not extend another class."),
|
|
8751
|
+
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.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}'."),
|
|
8752
|
+
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, ts.DiagnosticCategory.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}'?"),
|
|
8765
8753
|
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
8766
8754
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
8767
8755
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.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}'."),
|
|
@@ -9046,13 +9034,6 @@ var ts;
|
|
|
9046
9034
|
Output_Formatting: diag(6256, ts.DiagnosticCategory.Message, "Output_Formatting_6256", "Output Formatting"),
|
|
9047
9035
|
Completeness: diag(6257, ts.DiagnosticCategory.Message, "Completeness_6257", "Completeness"),
|
|
9048
9036
|
_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file: diag(6258, ts.DiagnosticCategory.Error, "_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258", "'{0}' should be set inside the 'compilerOptions' object of the config json file"),
|
|
9049
|
-
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, ts.DiagnosticCategory.Message, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
|
|
9050
|
-
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, ts.DiagnosticCategory.Message, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
9051
|
-
Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, ts.DiagnosticCategory.Message, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
|
|
9052
|
-
package_json_scope_0_has_no_imports_defined: diag(6273, ts.DiagnosticCategory.Message, "package_json_scope_0_has_no_imports_defined_6273", "package.json scope '{0}' has no imports defined."),
|
|
9053
|
-
package_json_scope_0_explicitly_maps_specifier_1_to_null: diag(6274, ts.DiagnosticCategory.Message, "package_json_scope_0_explicitly_maps_specifier_1_to_null_6274", "package.json scope '{0}' explicitly maps specifier '{1}' to null."),
|
|
9054
|
-
package_json_scope_0_has_invalid_type_for_target_of_specifier_1: diag(6275, ts.DiagnosticCategory.Message, "package_json_scope_0_has_invalid_type_for_target_of_specifier_1_6275", "package.json scope '{0}' has invalid type for target of specifier '{1}'"),
|
|
9055
|
-
Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6276, ts.DiagnosticCategory.Message, "Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6276", "Export specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
9056
9037
|
Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"),
|
|
9057
9038
|
Composite_projects_may_not_disable_declaration_emit: diag(6304, ts.DiagnosticCategory.Error, "Composite_projects_may_not_disable_declaration_emit_6304", "Composite projects may not disable declaration emit."),
|
|
9058
9039
|
Output_file_0_has_not_been_built_from_source_file_1: diag(6305, ts.DiagnosticCategory.Error, "Output_file_0_has_not_been_built_from_source_file_1_6305", "Output file '{0}' has not been built from source file '{1}'."),
|
|
@@ -9312,8 +9293,6 @@ var ts;
|
|
|
9312
9293
|
The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_type_annotation_is_needed: diag(7056, ts.DiagnosticCategory.Error, "The_inferred_type_of_this_node_exceeds_the_maximum_length_the_compiler_will_serialize_An_explicit_ty_7056", "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed."),
|
|
9313
9294
|
yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation: diag(7057, ts.DiagnosticCategory.Error, "yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_t_7057", "'yield' expression implicitly results in an 'any' type because its containing generator lacks a return-type annotation."),
|
|
9314
9295
|
If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1: diag(7058, ts.DiagnosticCategory.Error, "If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_decl_7058", "If the '{0}' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module '{1}';`"),
|
|
9315
|
-
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead: diag(7059, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),
|
|
9316
|
-
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint: diag(7060, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),
|
|
9317
9296
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9318
9297
|
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
|
|
9319
9298
|
import_can_only_be_used_in_TypeScript_files: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."),
|
|
@@ -11919,7 +11898,7 @@ var ts;
|
|
|
11919
11898
|
}
|
|
11920
11899
|
ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics;
|
|
11921
11900
|
function getDefaultLibFileName(options) {
|
|
11922
|
-
switch (
|
|
11901
|
+
switch (options.target) {
|
|
11923
11902
|
case 99 /* ESNext */:
|
|
11924
11903
|
return "lib.esnext.full.d.ts";
|
|
11925
11904
|
case 8 /* ES2021 */:
|
|
@@ -13978,22 +13957,22 @@ var ts;
|
|
|
13978
13957
|
return node.end - node.pos;
|
|
13979
13958
|
}
|
|
13980
13959
|
ts.getFullWidth = getFullWidth;
|
|
13981
|
-
function getResolvedModule(sourceFile, moduleNameText
|
|
13982
|
-
return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText
|
|
13960
|
+
function getResolvedModule(sourceFile, moduleNameText) {
|
|
13961
|
+
return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText);
|
|
13983
13962
|
}
|
|
13984
13963
|
ts.getResolvedModule = getResolvedModule;
|
|
13985
|
-
function setResolvedModule(sourceFile, moduleNameText, resolvedModule
|
|
13964
|
+
function setResolvedModule(sourceFile, moduleNameText, resolvedModule) {
|
|
13986
13965
|
if (!sourceFile.resolvedModules) {
|
|
13987
|
-
sourceFile.resolvedModules = ts.
|
|
13966
|
+
sourceFile.resolvedModules = new ts.Map();
|
|
13988
13967
|
}
|
|
13989
|
-
sourceFile.resolvedModules.set(moduleNameText,
|
|
13968
|
+
sourceFile.resolvedModules.set(moduleNameText, resolvedModule);
|
|
13990
13969
|
}
|
|
13991
13970
|
ts.setResolvedModule = setResolvedModule;
|
|
13992
13971
|
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
|
|
13993
13972
|
if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
13994
|
-
sourceFile.resolvedTypeReferenceDirectiveNames = ts.
|
|
13973
|
+
sourceFile.resolvedTypeReferenceDirectiveNames = new ts.Map();
|
|
13995
13974
|
}
|
|
13996
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName,
|
|
13975
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective);
|
|
13997
13976
|
}
|
|
13998
13977
|
ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
|
|
13999
13978
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
@@ -14025,11 +14004,11 @@ var ts;
|
|
|
14025
14004
|
&& oldResolution.originalPath === newResolution.originalPath;
|
|
14026
14005
|
}
|
|
14027
14006
|
ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
|
|
14028
|
-
function hasChangesInResolutions(names, newResolutions, oldResolutions,
|
|
14007
|
+
function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) {
|
|
14029
14008
|
ts.Debug.assert(names.length === newResolutions.length);
|
|
14030
14009
|
for (var i = 0; i < names.length; i++) {
|
|
14031
14010
|
var newResolution = newResolutions[i];
|
|
14032
|
-
var oldResolution = oldResolutions && oldResolutions.get(names[i]
|
|
14011
|
+
var oldResolution = oldResolutions && oldResolutions.get(names[i]);
|
|
14033
14012
|
var changed = oldResolution
|
|
14034
14013
|
? !newResolution || !comparer(oldResolution, newResolution)
|
|
14035
14014
|
: newResolution;
|
|
@@ -14564,11 +14543,8 @@ var ts;
|
|
|
14564
14543
|
return (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return !isExternalModuleAugmentation(d) && !(ts.isModuleDeclaration(d) && isGlobalScopeAugmentation(d)); });
|
|
14565
14544
|
}
|
|
14566
14545
|
ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
|
|
14567
|
-
function isCommonJSContainingModuleKind(kind) {
|
|
14568
|
-
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node12 || kind === ts.ModuleKind.NodeNext;
|
|
14569
|
-
}
|
|
14570
14546
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
14571
|
-
return ts.isExternalModule(node) || compilerOptions.isolatedModules || (
|
|
14547
|
+
return ts.isExternalModule(node) || compilerOptions.isolatedModules || ((getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS) && !!node.commonJsModuleIndicator);
|
|
14572
14548
|
}
|
|
14573
14549
|
ts.isEffectiveExternalModule = isEffectiveExternalModule;
|
|
14574
14550
|
/**
|
|
@@ -17858,17 +17834,9 @@ var ts;
|
|
|
17858
17834
|
var path = outputDir
|
|
17859
17835
|
? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName)
|
|
17860
17836
|
: fileName;
|
|
17861
|
-
|
|
17862
|
-
return removeFileExtension(path) + declarationExtension;
|
|
17837
|
+
return removeFileExtension(path) + ".d.ts" /* Dts */;
|
|
17863
17838
|
}
|
|
17864
17839
|
ts.getDeclarationEmitOutputFilePathWorker = getDeclarationEmitOutputFilePathWorker;
|
|
17865
|
-
function getDeclarationEmitExtensionForPath(path) {
|
|
17866
|
-
return ts.fileExtensionIsOneOf(path, [".mjs" /* Mjs */, ".mts" /* Mts */]) ? ".d.mts" /* Dmts */ :
|
|
17867
|
-
ts.fileExtensionIsOneOf(path, [".cjs" /* Cjs */, ".cts" /* Cts */]) ? ".d.cts" /* Dcts */ :
|
|
17868
|
-
ts.fileExtensionIsOneOf(path, [".json" /* Json */]) ? ".json.d.ts" : // Drive-by redefinition of json declaration file output name so if it's ever enabled, it behaves well
|
|
17869
|
-
".d.ts" /* Dts */;
|
|
17870
|
-
}
|
|
17871
|
-
ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
|
|
17872
17840
|
function outFile(options) {
|
|
17873
17841
|
return options.outFile || options.out;
|
|
17874
17842
|
}
|
|
@@ -18608,7 +18576,7 @@ var ts;
|
|
|
18608
18576
|
}
|
|
18609
18577
|
/** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */
|
|
18610
18578
|
function tryExtractTSExtension(fileName) {
|
|
18611
|
-
return ts.find(supportedTSExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
18579
|
+
return ts.find(ts.supportedTSExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
18612
18580
|
}
|
|
18613
18581
|
ts.tryExtractTSExtension = tryExtractTSExtension;
|
|
18614
18582
|
/**
|
|
@@ -19560,10 +19528,7 @@ var ts;
|
|
|
19560
19528
|
}
|
|
19561
19529
|
ts.getLanguageVariant = getLanguageVariant;
|
|
19562
19530
|
function getEmitScriptTarget(compilerOptions) {
|
|
19563
|
-
return compilerOptions.target ||
|
|
19564
|
-
(compilerOptions.module === ts.ModuleKind.Node12 && 7 /* ES2020 */) ||
|
|
19565
|
-
(compilerOptions.module === ts.ModuleKind.NodeNext && 99 /* ESNext */) ||
|
|
19566
|
-
0 /* ES3 */;
|
|
19531
|
+
return compilerOptions.target || 0 /* ES3 */;
|
|
19567
19532
|
}
|
|
19568
19533
|
ts.getEmitScriptTarget = getEmitScriptTarget;
|
|
19569
19534
|
function getEmitModuleKind(compilerOptions) {
|
|
@@ -19575,20 +19540,7 @@ var ts;
|
|
|
19575
19540
|
function getEmitModuleResolutionKind(compilerOptions) {
|
|
19576
19541
|
var moduleResolution = compilerOptions.moduleResolution;
|
|
19577
19542
|
if (moduleResolution === undefined) {
|
|
19578
|
-
|
|
19579
|
-
case ts.ModuleKind.CommonJS:
|
|
19580
|
-
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
19581
|
-
break;
|
|
19582
|
-
case ts.ModuleKind.Node12:
|
|
19583
|
-
moduleResolution = ts.ModuleResolutionKind.Node12;
|
|
19584
|
-
break;
|
|
19585
|
-
case ts.ModuleKind.NodeNext:
|
|
19586
|
-
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
19587
|
-
break;
|
|
19588
|
-
default:
|
|
19589
|
-
moduleResolution = ts.ModuleResolutionKind.Classic;
|
|
19590
|
-
break;
|
|
19591
|
-
}
|
|
19543
|
+
moduleResolution = getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
|
|
19592
19544
|
}
|
|
19593
19545
|
return moduleResolution;
|
|
19594
19546
|
}
|
|
@@ -19618,23 +19570,11 @@ var ts;
|
|
|
19618
19570
|
return !!(getEmitDeclarations(options) && options.declarationMap);
|
|
19619
19571
|
}
|
|
19620
19572
|
ts.getAreDeclarationMapsEnabled = getAreDeclarationMapsEnabled;
|
|
19621
|
-
function getESModuleInterop(compilerOptions) {
|
|
19622
|
-
if (compilerOptions.esModuleInterop !== undefined) {
|
|
19623
|
-
return compilerOptions.esModuleInterop;
|
|
19624
|
-
}
|
|
19625
|
-
switch (getEmitModuleKind(compilerOptions)) {
|
|
19626
|
-
case ts.ModuleKind.Node12:
|
|
19627
|
-
case ts.ModuleKind.NodeNext:
|
|
19628
|
-
return true;
|
|
19629
|
-
}
|
|
19630
|
-
return undefined;
|
|
19631
|
-
}
|
|
19632
|
-
ts.getESModuleInterop = getESModuleInterop;
|
|
19633
19573
|
function getAllowSyntheticDefaultImports(compilerOptions) {
|
|
19634
19574
|
var moduleKind = getEmitModuleKind(compilerOptions);
|
|
19635
19575
|
return compilerOptions.allowSyntheticDefaultImports !== undefined
|
|
19636
19576
|
? compilerOptions.allowSyntheticDefaultImports
|
|
19637
|
-
:
|
|
19577
|
+
: compilerOptions.esModuleInterop ||
|
|
19638
19578
|
moduleKind === ts.ModuleKind.System;
|
|
19639
19579
|
}
|
|
19640
19580
|
ts.getAllowSyntheticDefaultImports = getAllowSyntheticDefaultImports;
|
|
@@ -19659,7 +19599,7 @@ var ts;
|
|
|
19659
19599
|
}
|
|
19660
19600
|
ts.getAllowJSCompilerOption = getAllowJSCompilerOption;
|
|
19661
19601
|
function getUseDefineForClassFields(compilerOptions) {
|
|
19662
|
-
return compilerOptions.useDefineForClassFields === undefined ?
|
|
19602
|
+
return compilerOptions.useDefineForClassFields === undefined ? compilerOptions.target === 99 /* ESNext */ : compilerOptions.useDefineForClassFields;
|
|
19663
19603
|
}
|
|
19664
19604
|
ts.getUseDefineForClassFields = getUseDefineForClassFields;
|
|
19665
19605
|
function compilerOptionsAffectSemanticDiagnostics(newOptions, oldOptions) {
|
|
@@ -20099,54 +20039,51 @@ var ts;
|
|
|
20099
20039
|
}
|
|
20100
20040
|
ts.getScriptKindFromFileName = getScriptKindFromFileName;
|
|
20101
20041
|
/**
|
|
20102
|
-
*
|
|
20042
|
+
* List of supported extensions in order of file resolution precedence.
|
|
20103
20043
|
*/
|
|
20104
|
-
ts.supportedTSExtensions = [
|
|
20105
|
-
ts.
|
|
20106
|
-
var supportedTSExtensionsWithJson = __spreadArray(__spreadArray([], ts.supportedTSExtensions, true), [[".json" /* Json */]], false);
|
|
20044
|
+
ts.supportedTSExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */];
|
|
20045
|
+
ts.supportedTSExtensionsWithJson = [".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".json" /* Json */];
|
|
20107
20046
|
/** Must have ".d.ts" first because if ".ts" goes first, that will be detected as the extension instead of ".d.ts". */
|
|
20108
|
-
|
|
20109
|
-
ts.supportedJSExtensions = [
|
|
20110
|
-
ts.
|
|
20111
|
-
var allSupportedExtensions = [
|
|
20112
|
-
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([],
|
|
20047
|
+
ts.supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
|
|
20048
|
+
ts.supportedJSExtensions = [".js" /* Js */, ".jsx" /* Jsx */];
|
|
20049
|
+
ts.supportedJSAndJsonExtensions = [".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */];
|
|
20050
|
+
var allSupportedExtensions = __spreadArray(__spreadArray([], ts.supportedTSExtensions, true), ts.supportedJSExtensions, true);
|
|
20051
|
+
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray(__spreadArray([], ts.supportedTSExtensions, true), ts.supportedJSExtensions, true), [".json" /* Json */], false);
|
|
20113
20052
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
20114
20053
|
var needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
20115
20054
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
20116
20055
|
return needJsExtensions ? allSupportedExtensions : ts.supportedTSExtensions;
|
|
20117
20056
|
}
|
|
20118
|
-
var
|
|
20119
|
-
|
|
20120
|
-
var extensions = __spreadArray(__spreadArray([], builtins, true), ts.mapDefined(extraFileExtensions, function (x) { return x.scriptKind === 7 /* Deferred */ || needJsExtensions && isJSLike(x.scriptKind) && flatBuiltins.indexOf(x.extension) === -1 ? [x.extension] : undefined; }), true);
|
|
20121
|
-
return extensions;
|
|
20057
|
+
var extensions = __spreadArray(__spreadArray([], needJsExtensions ? allSupportedExtensions : ts.supportedTSExtensions, true), ts.mapDefined(extraFileExtensions, function (x) { return x.scriptKind === 7 /* Deferred */ || needJsExtensions && isJSLike(x.scriptKind) ? x.extension : undefined; }), true);
|
|
20058
|
+
return ts.deduplicate(extensions, ts.equateStringsCaseSensitive, ts.compareStringsCaseSensitive);
|
|
20122
20059
|
}
|
|
20123
20060
|
ts.getSupportedExtensions = getSupportedExtensions;
|
|
20124
|
-
function
|
|
20061
|
+
function getSuppoertedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions) {
|
|
20125
20062
|
if (!options || !options.resolveJsonModule)
|
|
20126
20063
|
return supportedExtensions;
|
|
20127
20064
|
if (supportedExtensions === allSupportedExtensions)
|
|
20128
20065
|
return allSupportedExtensionsWithJson;
|
|
20129
20066
|
if (supportedExtensions === ts.supportedTSExtensions)
|
|
20130
|
-
return supportedTSExtensionsWithJson;
|
|
20131
|
-
return __spreadArray(__spreadArray([], supportedExtensions, true), [
|
|
20067
|
+
return ts.supportedTSExtensionsWithJson;
|
|
20068
|
+
return __spreadArray(__spreadArray([], supportedExtensions, true), [".json" /* Json */], false);
|
|
20132
20069
|
}
|
|
20133
|
-
ts.
|
|
20070
|
+
ts.getSuppoertedExtensionsWithJsonIfResolveJsonModule = getSuppoertedExtensionsWithJsonIfResolveJsonModule;
|
|
20134
20071
|
function isJSLike(scriptKind) {
|
|
20135
20072
|
return scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */;
|
|
20136
20073
|
}
|
|
20137
20074
|
function hasJSFileExtension(fileName) {
|
|
20138
|
-
return ts.some(ts.
|
|
20075
|
+
return ts.some(ts.supportedJSExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
20139
20076
|
}
|
|
20140
20077
|
ts.hasJSFileExtension = hasJSFileExtension;
|
|
20141
20078
|
function hasTSFileExtension(fileName) {
|
|
20142
|
-
return ts.some(ts.
|
|
20079
|
+
return ts.some(ts.supportedTSExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
20143
20080
|
}
|
|
20144
20081
|
ts.hasTSFileExtension = hasTSFileExtension;
|
|
20145
20082
|
function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) {
|
|
20146
20083
|
if (!fileName)
|
|
20147
20084
|
return false;
|
|
20148
20085
|
var supportedExtensions = getSupportedExtensions(compilerOptions, extraFileExtensions);
|
|
20149
|
-
for (var _i = 0, _a =
|
|
20086
|
+
for (var _i = 0, _a = getSuppoertedExtensionsWithJsonIfResolveJsonModule(compilerOptions, supportedExtensions); _i < _a.length; _i++) {
|
|
20150
20087
|
var extension = _a[_i];
|
|
20151
20088
|
if (ts.fileExtensionIs(fileName, extension)) {
|
|
20152
20089
|
return true;
|
|
@@ -20163,7 +20100,57 @@ var ts;
|
|
|
20163
20100
|
return ts.compareValues(numberOfDirectorySeparators(path1), numberOfDirectorySeparators(path2));
|
|
20164
20101
|
}
|
|
20165
20102
|
ts.compareNumberOfDirectorySeparators = compareNumberOfDirectorySeparators;
|
|
20166
|
-
|
|
20103
|
+
/**
|
|
20104
|
+
* Extension boundaries by priority. Lower numbers indicate higher priorities, and are
|
|
20105
|
+
* aligned to the offset of the highest priority extension in the
|
|
20106
|
+
* allSupportedExtensions array.
|
|
20107
|
+
*/
|
|
20108
|
+
var ExtensionPriority;
|
|
20109
|
+
(function (ExtensionPriority) {
|
|
20110
|
+
ExtensionPriority[ExtensionPriority["TypeScriptFiles"] = 0] = "TypeScriptFiles";
|
|
20111
|
+
ExtensionPriority[ExtensionPriority["DeclarationAndJavaScriptFiles"] = 2] = "DeclarationAndJavaScriptFiles";
|
|
20112
|
+
ExtensionPriority[ExtensionPriority["Highest"] = 0] = "Highest";
|
|
20113
|
+
ExtensionPriority[ExtensionPriority["Lowest"] = 2] = "Lowest";
|
|
20114
|
+
})(ExtensionPriority = ts.ExtensionPriority || (ts.ExtensionPriority = {}));
|
|
20115
|
+
function getExtensionPriority(path, supportedExtensions) {
|
|
20116
|
+
for (var i = supportedExtensions.length - 1; i >= 0; i--) {
|
|
20117
|
+
if (ts.fileExtensionIs(path, supportedExtensions[i])) {
|
|
20118
|
+
return adjustExtensionPriority(i, supportedExtensions);
|
|
20119
|
+
}
|
|
20120
|
+
}
|
|
20121
|
+
// If its not in the list of supported extensions, this is likely a
|
|
20122
|
+
// TypeScript file with a non-ts extension
|
|
20123
|
+
return 0 /* Highest */;
|
|
20124
|
+
}
|
|
20125
|
+
ts.getExtensionPriority = getExtensionPriority;
|
|
20126
|
+
/**
|
|
20127
|
+
* Adjusts an extension priority to be the highest priority within the same range.
|
|
20128
|
+
*/
|
|
20129
|
+
function adjustExtensionPriority(extensionPriority, supportedExtensions) {
|
|
20130
|
+
if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) {
|
|
20131
|
+
return 0 /* TypeScriptFiles */;
|
|
20132
|
+
}
|
|
20133
|
+
else if (extensionPriority < supportedExtensions.length) {
|
|
20134
|
+
return 2 /* DeclarationAndJavaScriptFiles */;
|
|
20135
|
+
}
|
|
20136
|
+
else {
|
|
20137
|
+
return supportedExtensions.length;
|
|
20138
|
+
}
|
|
20139
|
+
}
|
|
20140
|
+
ts.adjustExtensionPriority = adjustExtensionPriority;
|
|
20141
|
+
/**
|
|
20142
|
+
* Gets the next lowest extension priority for a given priority.
|
|
20143
|
+
*/
|
|
20144
|
+
function getNextLowestExtensionPriority(extensionPriority, supportedExtensions) {
|
|
20145
|
+
if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) {
|
|
20146
|
+
return 2 /* DeclarationAndJavaScriptFiles */;
|
|
20147
|
+
}
|
|
20148
|
+
else {
|
|
20149
|
+
return supportedExtensions.length;
|
|
20150
|
+
}
|
|
20151
|
+
}
|
|
20152
|
+
ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority;
|
|
20153
|
+
var extensionsToRemove = [".d.ts" /* Dts */, ".ts" /* Ts */, ".js" /* Js */, ".tsx" /* Tsx */, ".jsx" /* Jsx */, ".json" /* Json */];
|
|
20167
20154
|
function removeFileExtension(path) {
|
|
20168
20155
|
for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) {
|
|
20169
20156
|
var ext = extensionsToRemove_1[_i];
|
|
@@ -25339,7 +25326,6 @@ var ts;
|
|
|
25339
25326
|
node.transformFlags =
|
|
25340
25327
|
propagateChildrenFlags(node.statements) |
|
|
25341
25328
|
propagateChildFlags(node.endOfFileToken);
|
|
25342
|
-
node.impliedNodeFormat = source.impliedNodeFormat;
|
|
25343
25329
|
return node;
|
|
25344
25330
|
}
|
|
25345
25331
|
// @api
|
|
@@ -26953,7 +26939,7 @@ var ts;
|
|
|
26953
26939
|
}
|
|
26954
26940
|
// ES2018 Helpers
|
|
26955
26941
|
function createAssignHelper(attributesSegments) {
|
|
26956
|
-
if (
|
|
26942
|
+
if (context.getCompilerOptions().target >= 2 /* ES2015 */) {
|
|
26957
26943
|
return factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "assign"),
|
|
26958
26944
|
/*typeArguments*/ undefined, attributesSegments);
|
|
26959
26945
|
}
|
|
@@ -28815,7 +28801,7 @@ var ts;
|
|
|
28815
28801
|
if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
28816
28802
|
var namedBindings = void 0;
|
|
28817
28803
|
var moduleKind = ts.getEmitModuleKind(compilerOptions);
|
|
28818
|
-
if (
|
|
28804
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && moduleKind <= ts.ModuleKind.ESNext) {
|
|
28819
28805
|
// use named imports
|
|
28820
28806
|
var helpers = ts.getEmitHelpers(sourceFile);
|
|
28821
28807
|
if (helpers) {
|
|
@@ -28866,9 +28852,9 @@ var ts;
|
|
|
28866
28852
|
return externalHelpersModuleName;
|
|
28867
28853
|
}
|
|
28868
28854
|
var moduleKind = ts.getEmitModuleKind(compilerOptions);
|
|
28869
|
-
var create = (hasExportStarsToExportValues || (
|
|
28855
|
+
var create = (hasExportStarsToExportValues || (compilerOptions.esModuleInterop && hasImportStarOrImportDefault))
|
|
28870
28856
|
&& moduleKind !== ts.ModuleKind.System
|
|
28871
|
-
&&
|
|
28857
|
+
&& moduleKind < ts.ModuleKind.ES2015;
|
|
28872
28858
|
if (!create) {
|
|
28873
28859
|
var helpers = ts.getEmitHelpers(node);
|
|
28874
28860
|
if (helpers) {
|
|
@@ -38138,9 +38124,7 @@ var ts;
|
|
|
38138
38124
|
es6: ts.ModuleKind.ES2015,
|
|
38139
38125
|
es2015: ts.ModuleKind.ES2015,
|
|
38140
38126
|
es2020: ts.ModuleKind.ES2020,
|
|
38141
|
-
esnext: ts.ModuleKind.ESNext
|
|
38142
|
-
node12: ts.ModuleKind.Node12,
|
|
38143
|
-
nodenext: ts.ModuleKind.NodeNext,
|
|
38127
|
+
esnext: ts.ModuleKind.ESNext
|
|
38144
38128
|
})),
|
|
38145
38129
|
affectsModuleResolution: true,
|
|
38146
38130
|
affectsEmit: true,
|
|
@@ -40566,7 +40550,7 @@ var ts;
|
|
|
40566
40550
|
// Rather than re-query this for each file and filespec, we query the supported extensions
|
|
40567
40551
|
// once and store it on the expansion context.
|
|
40568
40552
|
var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions);
|
|
40569
|
-
var supportedExtensionsWithJsonIfResolveJsonModule = ts.
|
|
40553
|
+
var supportedExtensionsWithJsonIfResolveJsonModule = ts.getSuppoertedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
|
|
40570
40554
|
// Literal files are always included verbatim. An "include" or "exclude" specification cannot
|
|
40571
40555
|
// remove a literal file.
|
|
40572
40556
|
if (validatedFilesSpec) {
|
|
@@ -40614,7 +40598,7 @@ var ts;
|
|
|
40614
40598
|
wildcardFileMap.set(key, file);
|
|
40615
40599
|
}
|
|
40616
40600
|
};
|
|
40617
|
-
for (var _a = 0, _b = host.readDirectory(basePath,
|
|
40601
|
+
for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensionsWithJsonIfResolveJsonModule, validatedExcludeSpecs, validatedIncludeSpecs, /*depth*/ undefined); _a < _b.length; _a++) {
|
|
40618
40602
|
var file = _b[_a];
|
|
40619
40603
|
_loop_6(file);
|
|
40620
40604
|
}
|
|
@@ -40777,25 +40761,16 @@ var ts;
|
|
|
40777
40761
|
* extension priority.
|
|
40778
40762
|
*
|
|
40779
40763
|
* @param file The path to the file.
|
|
40764
|
+
* @param extensionPriority The priority of the extension.
|
|
40765
|
+
* @param context The expansion context.
|
|
40780
40766
|
*/
|
|
40781
40767
|
function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) {
|
|
40782
|
-
var
|
|
40783
|
-
|
|
40784
|
-
|
|
40785
|
-
|
|
40786
|
-
|
|
40787
|
-
var ext = extensionGroup_1[_i];
|
|
40788
|
-
if (ts.fileExtensionIs(file, ext)) {
|
|
40789
|
-
return false;
|
|
40790
|
-
}
|
|
40791
|
-
var higherPriorityPath = keyMapper(ts.changeExtension(file, ext));
|
|
40768
|
+
var extensionPriority = ts.getExtensionPriority(file, extensions);
|
|
40769
|
+
var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority, extensions);
|
|
40770
|
+
for (var i = 0 /* Highest */; i < adjustedExtensionPriority; i++) {
|
|
40771
|
+
var higherPriorityExtension = extensions[i];
|
|
40772
|
+
var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension));
|
|
40792
40773
|
if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) {
|
|
40793
|
-
if (ext === ".d.ts" /* Dts */ && (ts.fileExtensionIs(file, ".js" /* Js */) || ts.fileExtensionIs(file, ".jsx" /* Jsx */))) {
|
|
40794
|
-
// LEGACY BEHAVIOR: An off-by-one bug somewhere in the extension priority system for wildcard module loading allowed declaration
|
|
40795
|
-
// files to be loaded alongside their js(x) counterparts. We regard this as generally undesirable, but retain the behavior to
|
|
40796
|
-
// prevent breakage.
|
|
40797
|
-
continue;
|
|
40798
|
-
}
|
|
40799
40774
|
return true;
|
|
40800
40775
|
}
|
|
40801
40776
|
}
|
|
@@ -40806,18 +40781,15 @@ var ts;
|
|
|
40806
40781
|
* already been included.
|
|
40807
40782
|
*
|
|
40808
40783
|
* @param file The path to the file.
|
|
40784
|
+
* @param extensionPriority The priority of the extension.
|
|
40785
|
+
* @param context The expansion context.
|
|
40809
40786
|
*/
|
|
40810
40787
|
function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) {
|
|
40811
|
-
var
|
|
40812
|
-
|
|
40813
|
-
|
|
40814
|
-
|
|
40815
|
-
|
|
40816
|
-
var ext = extensionGroup[i];
|
|
40817
|
-
if (ts.fileExtensionIs(file, ext)) {
|
|
40818
|
-
return;
|
|
40819
|
-
}
|
|
40820
|
-
var lowerPriorityPath = keyMapper(ts.changeExtension(file, ext));
|
|
40788
|
+
var extensionPriority = ts.getExtensionPriority(file, extensions);
|
|
40789
|
+
var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority, extensions);
|
|
40790
|
+
for (var i = nextExtensionPriority; i < extensions.length; i++) {
|
|
40791
|
+
var lowerPriorityExtension = extensions[i];
|
|
40792
|
+
var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension));
|
|
40821
40793
|
wildcardFiles.delete(lowerPriorityPath);
|
|
40822
40794
|
}
|
|
40823
40795
|
}
|
|
@@ -41077,7 +41049,7 @@ var ts;
|
|
|
41077
41049
|
}
|
|
41078
41050
|
var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
|
|
41079
41051
|
var perFolderCache = containingDirectory ? cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference) : undefined;
|
|
41080
|
-
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName
|
|
41052
|
+
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName);
|
|
41081
41053
|
if (result) {
|
|
41082
41054
|
if (traceEnabled) {
|
|
41083
41055
|
trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -41111,7 +41083,7 @@ var ts;
|
|
|
41111
41083
|
}
|
|
41112
41084
|
}
|
|
41113
41085
|
var failedLookupLocations = [];
|
|
41114
|
-
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache
|
|
41086
|
+
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache };
|
|
41115
41087
|
var resolved = primaryLookup();
|
|
41116
41088
|
var primary = true;
|
|
41117
41089
|
if (!resolved) {
|
|
@@ -41131,7 +41103,7 @@ var ts;
|
|
|
41131
41103
|
};
|
|
41132
41104
|
}
|
|
41133
41105
|
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
|
|
41134
|
-
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName,
|
|
41106
|
+
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, result);
|
|
41135
41107
|
if (traceEnabled)
|
|
41136
41108
|
traceResult(result);
|
|
41137
41109
|
return result;
|
|
@@ -41344,56 +41316,9 @@ var ts;
|
|
|
41344
41316
|
}
|
|
41345
41317
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
41346
41318
|
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
41347
|
-
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function () { return
|
|
41319
|
+
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function () { return new ts.Map(); });
|
|
41348
41320
|
}
|
|
41349
41321
|
}
|
|
41350
|
-
/* @internal */
|
|
41351
|
-
function createModeAwareCache() {
|
|
41352
|
-
var underlying = new ts.Map();
|
|
41353
|
-
var memoizedReverseKeys = new ts.Map();
|
|
41354
|
-
var cache = {
|
|
41355
|
-
get: function (specifier, mode) {
|
|
41356
|
-
return underlying.get(getUnderlyingCacheKey(specifier, mode));
|
|
41357
|
-
},
|
|
41358
|
-
set: function (specifier, mode, value) {
|
|
41359
|
-
underlying.set(getUnderlyingCacheKey(specifier, mode), value);
|
|
41360
|
-
return cache;
|
|
41361
|
-
},
|
|
41362
|
-
delete: function (specifier, mode) {
|
|
41363
|
-
underlying.delete(getUnderlyingCacheKey(specifier, mode));
|
|
41364
|
-
return cache;
|
|
41365
|
-
},
|
|
41366
|
-
has: function (specifier, mode) {
|
|
41367
|
-
return underlying.has(getUnderlyingCacheKey(specifier, mode));
|
|
41368
|
-
},
|
|
41369
|
-
forEach: function (cb) {
|
|
41370
|
-
return underlying.forEach(function (elem, key) {
|
|
41371
|
-
var _a = memoizedReverseKeys.get(key), specifier = _a[0], mode = _a[1];
|
|
41372
|
-
return cb(elem, specifier, mode);
|
|
41373
|
-
});
|
|
41374
|
-
},
|
|
41375
|
-
size: function () {
|
|
41376
|
-
return underlying.size;
|
|
41377
|
-
}
|
|
41378
|
-
};
|
|
41379
|
-
return cache;
|
|
41380
|
-
function getUnderlyingCacheKey(specifier, mode) {
|
|
41381
|
-
var result = mode === undefined ? specifier : mode + "|" + specifier;
|
|
41382
|
-
memoizedReverseKeys.set(result, [specifier, mode]);
|
|
41383
|
-
return result;
|
|
41384
|
-
}
|
|
41385
|
-
}
|
|
41386
|
-
ts.createModeAwareCache = createModeAwareCache;
|
|
41387
|
-
/* @internal */
|
|
41388
|
-
function zipToModeAwareCache(file, keys, values) {
|
|
41389
|
-
ts.Debug.assert(keys.length === values.length);
|
|
41390
|
-
var map = createModeAwareCache();
|
|
41391
|
-
for (var i = 0; i < keys.length; ++i) {
|
|
41392
|
-
map.set(keys[i], ts.getModeForResolutionAtIndex(file, i), values[i]);
|
|
41393
|
-
}
|
|
41394
|
-
return map;
|
|
41395
|
-
}
|
|
41396
|
-
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
41397
41322
|
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
41398
41323
|
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
41399
41324
|
moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
|
|
@@ -41407,9 +41332,9 @@ var ts;
|
|
|
41407
41332
|
function update(options) {
|
|
41408
41333
|
updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap);
|
|
41409
41334
|
}
|
|
41410
|
-
function getOrCreateCacheForModuleName(nonRelativeModuleName,
|
|
41335
|
+
function getOrCreateCacheForModuleName(nonRelativeModuleName, redirectedReference) {
|
|
41411
41336
|
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
41412
|
-
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference,
|
|
41337
|
+
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, nonRelativeModuleName, createPerModuleNameCache);
|
|
41413
41338
|
}
|
|
41414
41339
|
function createPerModuleNameCache() {
|
|
41415
41340
|
var directoryPathMap = new ts.Map();
|
|
@@ -41488,15 +41413,13 @@ var ts;
|
|
|
41488
41413
|
}
|
|
41489
41414
|
}
|
|
41490
41415
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
41491
|
-
function resolveModuleNameFromCache(moduleName, containingFile, cache
|
|
41416
|
+
function resolveModuleNameFromCache(moduleName, containingFile, cache) {
|
|
41492
41417
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
41493
41418
|
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory);
|
|
41494
|
-
|
|
41495
|
-
return undefined;
|
|
41496
|
-
return perFolderCache.get(moduleName, mode);
|
|
41419
|
+
return perFolderCache && perFolderCache.get(moduleName);
|
|
41497
41420
|
}
|
|
41498
41421
|
ts.resolveModuleNameFromCache = resolveModuleNameFromCache;
|
|
41499
|
-
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference
|
|
41422
|
+
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
41500
41423
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
41501
41424
|
if (redirectedReference) {
|
|
41502
41425
|
compilerOptions = redirectedReference.commandLine.options;
|
|
@@ -41509,7 +41432,7 @@ var ts;
|
|
|
41509
41432
|
}
|
|
41510
41433
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
41511
41434
|
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference);
|
|
41512
|
-
var result = perFolderCache && perFolderCache.get(moduleName
|
|
41435
|
+
var result = perFolderCache && perFolderCache.get(moduleName);
|
|
41513
41436
|
if (result) {
|
|
41514
41437
|
if (traceEnabled) {
|
|
41515
41438
|
trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -41518,20 +41441,7 @@ var ts;
|
|
|
41518
41441
|
else {
|
|
41519
41442
|
var moduleResolution = compilerOptions.moduleResolution;
|
|
41520
41443
|
if (moduleResolution === undefined) {
|
|
41521
|
-
|
|
41522
|
-
case ts.ModuleKind.CommonJS:
|
|
41523
|
-
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
41524
|
-
break;
|
|
41525
|
-
case ts.ModuleKind.Node12:
|
|
41526
|
-
moduleResolution = ts.ModuleResolutionKind.Node12;
|
|
41527
|
-
break;
|
|
41528
|
-
case ts.ModuleKind.NodeNext:
|
|
41529
|
-
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
41530
|
-
break;
|
|
41531
|
-
default:
|
|
41532
|
-
moduleResolution = ts.ModuleResolutionKind.Classic;
|
|
41533
|
-
break;
|
|
41534
|
-
}
|
|
41444
|
+
moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic;
|
|
41535
41445
|
if (traceEnabled) {
|
|
41536
41446
|
trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]);
|
|
41537
41447
|
}
|
|
@@ -41543,12 +41453,6 @@ var ts;
|
|
|
41543
41453
|
}
|
|
41544
41454
|
ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
|
|
41545
41455
|
switch (moduleResolution) {
|
|
41546
|
-
case ts.ModuleResolutionKind.Node12:
|
|
41547
|
-
result = node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
41548
|
-
break;
|
|
41549
|
-
case ts.ModuleResolutionKind.NodeNext:
|
|
41550
|
-
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
41551
|
-
break;
|
|
41552
41456
|
case ts.ModuleResolutionKind.NodeJs:
|
|
41553
41457
|
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
41554
41458
|
break;
|
|
@@ -41562,10 +41466,10 @@ var ts;
|
|
|
41562
41466
|
ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
|
|
41563
41467
|
ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
41564
41468
|
if (perFolderCache) {
|
|
41565
|
-
perFolderCache.set(moduleName,
|
|
41469
|
+
perFolderCache.set(moduleName, result);
|
|
41566
41470
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
41567
41471
|
// put result in per-module name cache
|
|
41568
|
-
cache.getOrCreateCacheForModuleName(moduleName,
|
|
41472
|
+
cache.getOrCreateCacheForModuleName(moduleName, redirectedReference).set(containingDirectory, result);
|
|
41569
41473
|
}
|
|
41570
41474
|
}
|
|
41571
41475
|
}
|
|
@@ -41772,51 +41676,22 @@ var ts;
|
|
|
41772
41676
|
return tryResolveJSModuleWorker(moduleName, initialDir, host).resolvedModule;
|
|
41773
41677
|
}
|
|
41774
41678
|
ts.tryResolveJSModule = tryResolveJSModule;
|
|
41775
|
-
/* @internal */
|
|
41776
|
-
var NodeResolutionFeatures;
|
|
41777
|
-
(function (NodeResolutionFeatures) {
|
|
41778
|
-
NodeResolutionFeatures[NodeResolutionFeatures["None"] = 0] = "None";
|
|
41779
|
-
// resolving `#local` names in your own package.json
|
|
41780
|
-
NodeResolutionFeatures[NodeResolutionFeatures["Imports"] = 2] = "Imports";
|
|
41781
|
-
// resolving `your-own-name` from your own package.json
|
|
41782
|
-
NodeResolutionFeatures[NodeResolutionFeatures["SelfName"] = 4] = "SelfName";
|
|
41783
|
-
// respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
|
|
41784
|
-
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
41785
|
-
// allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
|
|
41786
|
-
// not currently backported to node 12 - https://github.com/nodejs/Release/issues/690
|
|
41787
|
-
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
41788
|
-
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
41789
|
-
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
41790
|
-
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
41791
|
-
function node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
41792
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Imports | NodeResolutionFeatures.SelfName | NodeResolutionFeatures.Exports, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
41793
|
-
}
|
|
41794
|
-
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
41795
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.AllFeatures, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
41796
|
-
}
|
|
41797
|
-
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
41798
|
-
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
41799
|
-
// es module file or cjs-like input file, use a variant of the legacy cjs resolver that supports the selected modern features
|
|
41800
|
-
var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
|
|
41801
|
-
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions, redirectedReference);
|
|
41802
|
-
}
|
|
41803
41679
|
var jsOnlyExtensions = [Extensions.JavaScript];
|
|
41804
41680
|
var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
|
|
41805
41681
|
var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
|
|
41806
41682
|
var tsconfigExtensions = [Extensions.TSConfig];
|
|
41807
41683
|
function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
41808
|
-
return nodeModuleNameResolverWorker(
|
|
41684
|
+
return nodeModuleNameResolverWorker(moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
41809
41685
|
}
|
|
41810
41686
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
41811
|
-
return nodeModuleNameResolverWorker(
|
|
41687
|
+
return nodeModuleNameResolverWorker(moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
|
|
41812
41688
|
}
|
|
41813
41689
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
41814
|
-
function nodeModuleNameResolverWorker(
|
|
41690
|
+
function nodeModuleNameResolverWorker(moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
41815
41691
|
var _a, _b;
|
|
41816
41692
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
41817
41693
|
var failedLookupLocations = [];
|
|
41818
|
-
|
|
41819
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: features, conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] };
|
|
41694
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache };
|
|
41820
41695
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
41821
41696
|
return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, state.resultFromCache);
|
|
41822
41697
|
function tryResolve(extensions) {
|
|
@@ -41826,19 +41701,10 @@ var ts;
|
|
|
41826
41701
|
return toSearchResult({ resolved: resolved, isExternalLibraryImport: pathContainsNodeModules(resolved.path) });
|
|
41827
41702
|
}
|
|
41828
41703
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
41829
|
-
|
|
41830
|
-
|
|
41831
|
-
resolved_1 = loadModuleFromImports(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
41832
|
-
}
|
|
41833
|
-
if (!resolved_1 && features & NodeResolutionFeatures.SelfName) {
|
|
41834
|
-
resolved_1 = loadModuleFromSelfNameReference(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
41835
|
-
}
|
|
41836
|
-
if (!resolved_1) {
|
|
41837
|
-
if (traceEnabled) {
|
|
41838
|
-
trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]);
|
|
41839
|
-
}
|
|
41840
|
-
resolved_1 = loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
41704
|
+
if (traceEnabled) {
|
|
41705
|
+
trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]);
|
|
41841
41706
|
}
|
|
41707
|
+
var resolved_1 = loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
41842
41708
|
if (!resolved_1)
|
|
41843
41709
|
return undefined;
|
|
41844
41710
|
var resolvedValue = resolved_1.value;
|
|
@@ -41947,33 +41813,26 @@ var ts;
|
|
|
41947
41813
|
function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
|
|
41948
41814
|
if (extensions === Extensions.Json || extensions === Extensions.TSConfig) {
|
|
41949
41815
|
var extensionLess = ts.tryRemoveExtension(candidate, ".json" /* Json */);
|
|
41950
|
-
|
|
41951
|
-
return (extensionLess === undefined && extensions === Extensions.Json) ? undefined : tryAddingExtensions(extensionLess || candidate, extensions, extension, onlyRecordFailures, state);
|
|
41816
|
+
return (extensionLess === undefined && extensions === Extensions.Json) ? undefined : tryAddingExtensions(extensionLess || candidate, extensions, onlyRecordFailures, state);
|
|
41952
41817
|
}
|
|
41953
|
-
//
|
|
41954
|
-
|
|
41955
|
-
|
|
41956
|
-
|
|
41957
|
-
if (resolvedByAddingExtension) {
|
|
41958
|
-
return resolvedByAddingExtension;
|
|
41959
|
-
}
|
|
41818
|
+
// First, try adding an extension. An import of "foo" could be matched by a file "foo.ts", or "foo.js" by "foo.js.ts"
|
|
41819
|
+
var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, onlyRecordFailures, state);
|
|
41820
|
+
if (resolvedByAddingExtension) {
|
|
41821
|
+
return resolvedByAddingExtension;
|
|
41960
41822
|
}
|
|
41961
|
-
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
41962
|
-
}
|
|
41963
|
-
function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
|
|
41964
41823
|
// If that didn't work, try stripping a ".js" or ".jsx" extension and replacing it with a TypeScript one;
|
|
41965
41824
|
// e.g. "./foo.js" can be matched by "./foo.ts" or "./foo.d.ts"
|
|
41966
|
-
if (ts.hasJSFileExtension(candidate)
|
|
41825
|
+
if (ts.hasJSFileExtension(candidate)) {
|
|
41967
41826
|
var extensionless = ts.removeFileExtension(candidate);
|
|
41968
|
-
var extension = candidate.substring(extensionless.length);
|
|
41969
41827
|
if (state.traceEnabled) {
|
|
41828
|
+
var extension = candidate.substring(extensionless.length);
|
|
41970
41829
|
trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
|
|
41971
41830
|
}
|
|
41972
|
-
return tryAddingExtensions(extensionless, extensions,
|
|
41831
|
+
return tryAddingExtensions(extensionless, extensions, onlyRecordFailures, state);
|
|
41973
41832
|
}
|
|
41974
41833
|
}
|
|
41975
41834
|
/** Try to return an existing file that adds one of the `extensions` to `candidate`. */
|
|
41976
|
-
function tryAddingExtensions(candidate, extensions,
|
|
41835
|
+
function tryAddingExtensions(candidate, extensions, onlyRecordFailures, state) {
|
|
41977
41836
|
if (!onlyRecordFailures) {
|
|
41978
41837
|
// check if containing folder exists - if it doesn't then just record failures for all supported extensions without disk probing
|
|
41979
41838
|
var directory = ts.getDirectoryPath(candidate);
|
|
@@ -41983,51 +41842,11 @@ var ts;
|
|
|
41983
41842
|
}
|
|
41984
41843
|
switch (extensions) {
|
|
41985
41844
|
case Extensions.DtsOnly:
|
|
41986
|
-
|
|
41987
|
-
case ".mjs" /* Mjs */:
|
|
41988
|
-
case ".mts" /* Mts */:
|
|
41989
|
-
case ".d.mts" /* Dmts */:
|
|
41990
|
-
return tryExtension(".d.mts" /* Dmts */);
|
|
41991
|
-
case ".cjs" /* Cjs */:
|
|
41992
|
-
case ".cts" /* Cts */:
|
|
41993
|
-
case ".d.cts" /* Dcts */:
|
|
41994
|
-
return tryExtension(".d.cts" /* Dcts */);
|
|
41995
|
-
case ".json" /* Json */:
|
|
41996
|
-
candidate += ".json" /* Json */;
|
|
41997
|
-
return tryExtension(".d.ts" /* Dts */);
|
|
41998
|
-
default: return tryExtension(".d.ts" /* Dts */);
|
|
41999
|
-
}
|
|
41845
|
+
return tryExtension(".d.ts" /* Dts */);
|
|
42000
41846
|
case Extensions.TypeScript:
|
|
42001
|
-
|
|
42002
|
-
case ".mjs" /* Mjs */:
|
|
42003
|
-
case ".mts" /* Mts */:
|
|
42004
|
-
case ".d.mts" /* Dmts */:
|
|
42005
|
-
return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
|
|
42006
|
-
case ".cjs" /* Cjs */:
|
|
42007
|
-
case ".cts" /* Cts */:
|
|
42008
|
-
case ".d.cts" /* Dcts */:
|
|
42009
|
-
return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
|
|
42010
|
-
case ".json" /* Json */:
|
|
42011
|
-
candidate += ".json" /* Json */;
|
|
42012
|
-
return tryExtension(".d.ts" /* Dts */);
|
|
42013
|
-
default:
|
|
42014
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
42015
|
-
}
|
|
41847
|
+
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
42016
41848
|
case Extensions.JavaScript:
|
|
42017
|
-
|
|
42018
|
-
case ".mjs" /* Mjs */:
|
|
42019
|
-
case ".mts" /* Mts */:
|
|
42020
|
-
case ".d.mts" /* Dmts */:
|
|
42021
|
-
return tryExtension(".mjs" /* Mjs */);
|
|
42022
|
-
case ".cjs" /* Cjs */:
|
|
42023
|
-
case ".cts" /* Cts */:
|
|
42024
|
-
case ".d.cts" /* Dcts */:
|
|
42025
|
-
return tryExtension(".cjs" /* Cjs */);
|
|
42026
|
-
case ".json" /* Json */:
|
|
42027
|
-
return tryExtension(".json" /* Json */);
|
|
42028
|
-
default:
|
|
42029
|
-
return tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */);
|
|
42030
|
-
}
|
|
41849
|
+
return tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */);
|
|
42031
41850
|
case Extensions.TSConfig:
|
|
42032
41851
|
case Extensions.Json:
|
|
42033
41852
|
return tryExtension(".json" /* Json */);
|
|
@@ -42062,33 +41881,6 @@ var ts;
|
|
|
42062
41881
|
var versionPaths = packageInfo && packageInfo.versionPaths;
|
|
42063
41882
|
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
|
|
42064
41883
|
}
|
|
42065
|
-
/**
|
|
42066
|
-
* A function for locating the package.json scope for a given path
|
|
42067
|
-
*/
|
|
42068
|
-
/*@internal*/
|
|
42069
|
-
function getPackageScopeForPath(fileName, packageJsonInfoCache, host, options) {
|
|
42070
|
-
var state = {
|
|
42071
|
-
host: host,
|
|
42072
|
-
compilerOptions: options,
|
|
42073
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
42074
|
-
failedLookupLocations: [],
|
|
42075
|
-
packageJsonInfoCache: packageJsonInfoCache,
|
|
42076
|
-
features: 0,
|
|
42077
|
-
conditions: [],
|
|
42078
|
-
};
|
|
42079
|
-
var parts = ts.getPathComponents(fileName);
|
|
42080
|
-
parts.pop();
|
|
42081
|
-
while (parts.length > 0) {
|
|
42082
|
-
var pkg = getPackageJsonInfo(ts.getPathFromPathComponents(parts), /*onlyRecordFailures*/ false, state);
|
|
42083
|
-
if (pkg) {
|
|
42084
|
-
return pkg;
|
|
42085
|
-
}
|
|
42086
|
-
parts.pop();
|
|
42087
|
-
}
|
|
42088
|
-
return undefined;
|
|
42089
|
-
}
|
|
42090
|
-
ts.getPackageScopeForPath = getPackageScopeForPath;
|
|
42091
|
-
/*@internal*/
|
|
42092
41884
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
42093
41885
|
var _a, _b, _c;
|
|
42094
41886
|
var host = state.host, traceEnabled = state.traceEnabled;
|
|
@@ -42131,7 +41923,6 @@ var ts;
|
|
|
42131
41923
|
state.failedLookupLocations.push(packageJsonPath);
|
|
42132
41924
|
}
|
|
42133
41925
|
}
|
|
42134
|
-
ts.getPackageJsonInfo = getPackageJsonInfo;
|
|
42135
41926
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
42136
41927
|
var packageFile;
|
|
42137
41928
|
if (jsonContent) {
|
|
@@ -42187,10 +41978,7 @@ var ts;
|
|
|
42187
41978
|
var packageFileResult = packageFile && removeIgnoredPackageId(loader(extensions, packageFile, onlyRecordFailuresForPackageFile, state));
|
|
42188
41979
|
if (packageFileResult)
|
|
42189
41980
|
return packageFileResult;
|
|
42190
|
-
|
|
42191
|
-
if (!(state.features & NodeResolutionFeatures.EsmMode)) {
|
|
42192
|
-
return loadModuleFromFile(extensions, indexPath, onlyRecordFailuresForIndex, state);
|
|
42193
|
-
}
|
|
41981
|
+
return loadModuleFromFile(extensions, indexPath, onlyRecordFailuresForIndex, state);
|
|
42194
41982
|
}
|
|
42195
41983
|
/** Resolve from an arbitrarily specified file. Return `undefined` if it has an unsupported extension. */
|
|
42196
41984
|
function resolvedIfExtensionMatches(extensions, path) {
|
|
@@ -42220,216 +42008,6 @@ var ts;
|
|
|
42220
42008
|
return idx === -1 ? { packageName: moduleName, rest: "" } : { packageName: moduleName.slice(0, idx), rest: moduleName.slice(idx + 1) };
|
|
42221
42009
|
}
|
|
42222
42010
|
ts.parsePackageName = parsePackageName;
|
|
42223
|
-
function allKeysStartWithDot(obj) {
|
|
42224
|
-
return ts.every(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
|
|
42225
|
-
}
|
|
42226
|
-
function noKeyStartsWithDot(obj) {
|
|
42227
|
-
return !ts.some(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
|
|
42228
|
-
}
|
|
42229
|
-
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
42230
|
-
var _a, _b;
|
|
42231
|
-
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
42232
|
-
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
42233
|
-
var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
|
|
42234
|
-
if (!scope || !scope.packageJsonContent.exports) {
|
|
42235
|
-
return undefined;
|
|
42236
|
-
}
|
|
42237
|
-
var parts = ts.getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry
|
|
42238
|
-
if (scope.packageJsonContent.name !== parts[1]) {
|
|
42239
|
-
return undefined;
|
|
42240
|
-
}
|
|
42241
|
-
var trailingParts = parts.slice(2);
|
|
42242
|
-
return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : "." + ts.directorySeparator + trailingParts.join(ts.directorySeparator), state, cache, redirectedReference);
|
|
42243
|
-
}
|
|
42244
|
-
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
42245
|
-
if (!scope.packageJsonContent.exports) {
|
|
42246
|
-
return undefined;
|
|
42247
|
-
}
|
|
42248
|
-
if (subpath === ".") {
|
|
42249
|
-
var mainExport = void 0;
|
|
42250
|
-
if (typeof scope.packageJsonContent.exports === "string" || Array.isArray(scope.packageJsonContent.exports) || (typeof scope.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.packageJsonContent.exports))) {
|
|
42251
|
-
mainExport = scope.packageJsonContent.exports;
|
|
42252
|
-
}
|
|
42253
|
-
else if (ts.hasProperty(scope.packageJsonContent.exports, ".")) {
|
|
42254
|
-
mainExport = scope.packageJsonContent.exports["."];
|
|
42255
|
-
}
|
|
42256
|
-
if (mainExport) {
|
|
42257
|
-
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false);
|
|
42258
|
-
return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false);
|
|
42259
|
-
}
|
|
42260
|
-
}
|
|
42261
|
-
else if (allKeysStartWithDot(scope.packageJsonContent.exports)) {
|
|
42262
|
-
if (typeof scope.packageJsonContent.exports !== "object") {
|
|
42263
|
-
if (state.traceEnabled) {
|
|
42264
|
-
trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory);
|
|
42265
|
-
}
|
|
42266
|
-
return toSearchResult(/*value*/ undefined);
|
|
42267
|
-
}
|
|
42268
|
-
var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.packageJsonContent.exports, scope, /*isImports*/ false);
|
|
42269
|
-
if (result) {
|
|
42270
|
-
return result;
|
|
42271
|
-
}
|
|
42272
|
-
}
|
|
42273
|
-
if (state.traceEnabled) {
|
|
42274
|
-
trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory);
|
|
42275
|
-
}
|
|
42276
|
-
return toSearchResult(/*value*/ undefined);
|
|
42277
|
-
}
|
|
42278
|
-
function loadModuleFromImports(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
42279
|
-
var _a, _b;
|
|
42280
|
-
if (moduleName === "#" || ts.startsWith(moduleName, "#/")) {
|
|
42281
|
-
if (state.traceEnabled) {
|
|
42282
|
-
trace(state.host, ts.Diagnostics.Invalid_import_specifier_0_has_no_possible_resolutions, moduleName);
|
|
42283
|
-
}
|
|
42284
|
-
return toSearchResult(/*value*/ undefined);
|
|
42285
|
-
}
|
|
42286
|
-
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
42287
|
-
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
42288
|
-
var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
|
|
42289
|
-
if (!scope) {
|
|
42290
|
-
if (state.traceEnabled) {
|
|
42291
|
-
trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
|
|
42292
|
-
}
|
|
42293
|
-
return toSearchResult(/*value*/ undefined);
|
|
42294
|
-
}
|
|
42295
|
-
if (!scope.packageJsonContent.imports) {
|
|
42296
|
-
if (state.traceEnabled) {
|
|
42297
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory);
|
|
42298
|
-
}
|
|
42299
|
-
return toSearchResult(/*value*/ undefined);
|
|
42300
|
-
}
|
|
42301
|
-
var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.packageJsonContent.imports, scope, /*isImports*/ true);
|
|
42302
|
-
if (result) {
|
|
42303
|
-
return result;
|
|
42304
|
-
}
|
|
42305
|
-
if (state.traceEnabled) {
|
|
42306
|
-
trace(state.host, ts.Diagnostics.Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1, moduleName, scope.packageDirectory);
|
|
42307
|
-
}
|
|
42308
|
-
return toSearchResult(/*value*/ undefined);
|
|
42309
|
-
}
|
|
42310
|
-
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
42311
|
-
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
42312
|
-
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
42313
|
-
var target = lookupTable[moduleName];
|
|
42314
|
-
return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
|
|
42315
|
-
}
|
|
42316
|
-
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), function (a, b) { return a.length - b.length; });
|
|
42317
|
-
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
42318
|
-
var potentialTarget = expandingKeys_1[_i];
|
|
42319
|
-
if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
42320
|
-
var target = lookupTable[potentialTarget];
|
|
42321
|
-
var starPos = potentialTarget.indexOf("*");
|
|
42322
|
-
var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos));
|
|
42323
|
-
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
|
|
42324
|
-
}
|
|
42325
|
-
else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) {
|
|
42326
|
-
var target = lookupTable[potentialTarget];
|
|
42327
|
-
var subpath = moduleName.substring(potentialTarget.length - 1);
|
|
42328
|
-
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
|
|
42329
|
-
}
|
|
42330
|
-
else if (ts.startsWith(moduleName, potentialTarget)) {
|
|
42331
|
-
var target = lookupTable[potentialTarget];
|
|
42332
|
-
var subpath = moduleName.substring(potentialTarget.length);
|
|
42333
|
-
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false);
|
|
42334
|
-
}
|
|
42335
|
-
}
|
|
42336
|
-
function matchesPatternWithTrailer(target, name) {
|
|
42337
|
-
if (ts.endsWith(target, "*"))
|
|
42338
|
-
return false; // handled by next case in loop
|
|
42339
|
-
var starPos = target.indexOf("*");
|
|
42340
|
-
if (starPos === -1)
|
|
42341
|
-
return false; // handled by last case in loop
|
|
42342
|
-
return ts.startsWith(name, target.substring(0, starPos)) && ts.endsWith(name, target.substring(starPos + 1));
|
|
42343
|
-
}
|
|
42344
|
-
}
|
|
42345
|
-
/**
|
|
42346
|
-
* Gets the self-recursive function specialized to retrieving the targeted import/export element for the given resolution configuration
|
|
42347
|
-
*/
|
|
42348
|
-
function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
|
42349
|
-
return loadModuleFromTargetImportOrExport;
|
|
42350
|
-
function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
|
|
42351
|
-
var _a, _b;
|
|
42352
|
-
if (typeof target === "string") {
|
|
42353
|
-
if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
|
|
42354
|
-
if (state.traceEnabled) {
|
|
42355
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42356
|
-
}
|
|
42357
|
-
return toSearchResult(/*value*/ undefined);
|
|
42358
|
-
}
|
|
42359
|
-
if (!ts.startsWith(target, "./")) {
|
|
42360
|
-
if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) {
|
|
42361
|
-
var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath;
|
|
42362
|
-
var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference);
|
|
42363
|
-
return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined);
|
|
42364
|
-
}
|
|
42365
|
-
if (state.traceEnabled) {
|
|
42366
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42367
|
-
}
|
|
42368
|
-
return toSearchResult(/*value*/ undefined);
|
|
42369
|
-
}
|
|
42370
|
-
var parts = ts.pathIsRelative(target) ? ts.getPathComponents(target).slice(1) : ts.getPathComponents(target);
|
|
42371
|
-
var partsAfterFirst = parts.slice(1);
|
|
42372
|
-
if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) {
|
|
42373
|
-
if (state.traceEnabled) {
|
|
42374
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42375
|
-
}
|
|
42376
|
-
return toSearchResult(/*value*/ undefined);
|
|
42377
|
-
}
|
|
42378
|
-
var resolvedTarget = ts.combinePaths(scope.packageDirectory, target);
|
|
42379
|
-
// TODO: Assert that `resolvedTarget` is actually within the package directory? That's what the spec says.... but I'm not sure we need
|
|
42380
|
-
// to be in the business of validating everyone's import and export map correctness.
|
|
42381
|
-
var subpathParts = ts.getPathComponents(subpath);
|
|
42382
|
-
if (subpathParts.indexOf("..") >= 0 || subpathParts.indexOf(".") >= 0 || subpathParts.indexOf("node_modules") >= 0) {
|
|
42383
|
-
if (state.traceEnabled) {
|
|
42384
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42385
|
-
}
|
|
42386
|
-
return toSearchResult(/*value*/ undefined);
|
|
42387
|
-
}
|
|
42388
|
-
var finalPath = ts.getNormalizedAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
42389
|
-
return toSearchResult(withPackageId(scope, loadModuleFromFileNoImplicitExtensions(extensions, finalPath, /*onlyRecordFailures*/ false, state)));
|
|
42390
|
-
}
|
|
42391
|
-
else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
|
|
42392
|
-
if (!Array.isArray(target)) {
|
|
42393
|
-
for (var _i = 0, _c = ts.getOwnKeys(target); _i < _c.length; _i++) {
|
|
42394
|
-
var key = _c[_i];
|
|
42395
|
-
if (key === "default" || state.conditions.indexOf(key) >= 0) {
|
|
42396
|
-
var subTarget = target[key];
|
|
42397
|
-
var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
|
|
42398
|
-
if (result) {
|
|
42399
|
-
return result;
|
|
42400
|
-
}
|
|
42401
|
-
}
|
|
42402
|
-
}
|
|
42403
|
-
return undefined;
|
|
42404
|
-
}
|
|
42405
|
-
else {
|
|
42406
|
-
if (!ts.length(target)) {
|
|
42407
|
-
if (state.traceEnabled) {
|
|
42408
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42409
|
-
}
|
|
42410
|
-
return toSearchResult(/*value*/ undefined);
|
|
42411
|
-
}
|
|
42412
|
-
for (var _d = 0, target_1 = target; _d < target_1.length; _d++) {
|
|
42413
|
-
var elem = target_1[_d];
|
|
42414
|
-
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
42415
|
-
if (result) {
|
|
42416
|
-
return result;
|
|
42417
|
-
}
|
|
42418
|
-
}
|
|
42419
|
-
}
|
|
42420
|
-
}
|
|
42421
|
-
else if (target === null) { // eslint-disable-line no-null/no-null
|
|
42422
|
-
if (state.traceEnabled) {
|
|
42423
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_explicitly_maps_specifier_1_to_null, scope.packageDirectory, moduleName);
|
|
42424
|
-
}
|
|
42425
|
-
return toSearchResult(/*value*/ undefined);
|
|
42426
|
-
}
|
|
42427
|
-
if (state.traceEnabled) {
|
|
42428
|
-
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42429
|
-
}
|
|
42430
|
-
return toSearchResult(/*value*/ undefined);
|
|
42431
|
-
}
|
|
42432
|
-
}
|
|
42433
42011
|
function loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
42434
42012
|
return loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, /*typesScopeOnly*/ false, cache, redirectedReference);
|
|
42435
42013
|
}
|
|
@@ -42438,24 +42016,24 @@ var ts;
|
|
|
42438
42016
|
return loadModuleFromNearestNodeModulesDirectoryWorker(Extensions.DtsOnly, moduleName, directory, state, /*typesScopeOnly*/ true, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
42439
42017
|
}
|
|
42440
42018
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
42441
|
-
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName,
|
|
42019
|
+
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, redirectedReference);
|
|
42442
42020
|
return ts.forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {
|
|
42443
42021
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
42444
42022
|
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state);
|
|
42445
42023
|
if (resolutionFromCache) {
|
|
42446
42024
|
return resolutionFromCache;
|
|
42447
42025
|
}
|
|
42448
|
-
return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, ancestorDirectory, state, typesScopeOnly
|
|
42026
|
+
return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, ancestorDirectory, state, typesScopeOnly));
|
|
42449
42027
|
}
|
|
42450
42028
|
});
|
|
42451
42029
|
}
|
|
42452
|
-
function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly
|
|
42030
|
+
function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly) {
|
|
42453
42031
|
var nodeModulesFolder = ts.combinePaths(directory, "node_modules");
|
|
42454
42032
|
var nodeModulesFolderExists = ts.directoryProbablyExists(nodeModulesFolder, state.host);
|
|
42455
42033
|
if (!nodeModulesFolderExists && state.traceEnabled) {
|
|
42456
42034
|
trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder);
|
|
42457
42035
|
}
|
|
42458
|
-
var packageResult = typesScopeOnly ? undefined : loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state
|
|
42036
|
+
var packageResult = typesScopeOnly ? undefined : loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state);
|
|
42459
42037
|
if (packageResult) {
|
|
42460
42038
|
return packageResult;
|
|
42461
42039
|
}
|
|
@@ -42468,35 +42046,27 @@ var ts;
|
|
|
42468
42046
|
}
|
|
42469
42047
|
nodeModulesAtTypesExists = false;
|
|
42470
42048
|
}
|
|
42471
|
-
return loadModuleFromSpecificNodeModulesDirectory(Extensions.DtsOnly, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, state
|
|
42049
|
+
return loadModuleFromSpecificNodeModulesDirectory(Extensions.DtsOnly, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, state);
|
|
42472
42050
|
}
|
|
42473
42051
|
}
|
|
42474
|
-
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state
|
|
42052
|
+
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state) {
|
|
42475
42053
|
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
|
|
42476
42054
|
// First look for a nested package.json, as in `node_modules/foo/bar/package.json`.
|
|
42477
42055
|
var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
42478
|
-
|
|
42479
|
-
|
|
42480
|
-
if (
|
|
42481
|
-
|
|
42482
|
-
if (fromFile) {
|
|
42483
|
-
return noPackageId(fromFile);
|
|
42484
|
-
}
|
|
42485
|
-
var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
|
|
42486
|
-
return withPackageId(packageInfo, fromDirectory);
|
|
42056
|
+
if (packageInfo) {
|
|
42057
|
+
var fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
42058
|
+
if (fromFile) {
|
|
42059
|
+
return noPackageId(fromFile);
|
|
42487
42060
|
}
|
|
42061
|
+
var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
|
|
42062
|
+
return withPackageId(packageInfo, fromDirectory);
|
|
42488
42063
|
}
|
|
42489
|
-
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
|
|
42490
42064
|
var loader = function (extensions, candidate, onlyRecordFailures, state) {
|
|
42491
|
-
var _a;
|
|
42492
|
-
// package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them)
|
|
42493
|
-
if (packageInfo && packageInfo.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
|
|
42494
|
-
return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
|
|
42495
|
-
}
|
|
42496
42065
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
42497
42066
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
42498
42067
|
return withPackageId(packageInfo, pathAndExtension);
|
|
42499
42068
|
};
|
|
42069
|
+
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
|
|
42500
42070
|
if (rest !== "") { // If "rest" is empty, we just did this search above.
|
|
42501
42071
|
var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
|
|
42502
42072
|
// Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings.
|
|
@@ -42598,7 +42168,7 @@ var ts;
|
|
|
42598
42168
|
function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
42599
42169
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
42600
42170
|
var failedLookupLocations = [];
|
|
42601
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache
|
|
42171
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache };
|
|
42602
42172
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
42603
42173
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
42604
42174
|
// No originalPath because classic resolution doesn't resolve realPath
|
|
@@ -42609,7 +42179,7 @@ var ts;
|
|
|
42609
42179
|
return { value: resolvedUsingSettings };
|
|
42610
42180
|
}
|
|
42611
42181
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
42612
|
-
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName,
|
|
42182
|
+
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, redirectedReference);
|
|
42613
42183
|
// Climb up parent directories looking for a module.
|
|
42614
42184
|
var resolved_3 = ts.forEachAncestorDirectory(containingDirectory, function (directory) {
|
|
42615
42185
|
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache_1, moduleName, directory, state);
|
|
@@ -42645,8 +42215,8 @@ var ts;
|
|
|
42645
42215
|
trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache);
|
|
42646
42216
|
}
|
|
42647
42217
|
var failedLookupLocations = [];
|
|
42648
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache
|
|
42649
|
-
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false
|
|
42218
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache };
|
|
42219
|
+
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false);
|
|
42650
42220
|
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, state.resultFromCache);
|
|
42651
42221
|
}
|
|
42652
42222
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
@@ -44827,7 +44397,7 @@ var ts;
|
|
|
44827
44397
|
}
|
|
44828
44398
|
function checkStrictModeLabeledStatement(node) {
|
|
44829
44399
|
// Grammar checking for labeledStatement
|
|
44830
|
-
if (inStrictMode &&
|
|
44400
|
+
if (inStrictMode && options.target >= 2 /* ES2015 */) {
|
|
44831
44401
|
if (ts.isDeclarationStatement(node.statement) || ts.isVariableStatement(node.statement)) {
|
|
44832
44402
|
errorOnFirstToken(node.label, ts.Diagnostics.A_label_is_not_allowed_here);
|
|
44833
44403
|
}
|
|
@@ -46343,7 +45913,7 @@ var ts;
|
|
|
46343
45913
|
host.getSourceFiles().forEach(function (sf) {
|
|
46344
45914
|
if (!sf.resolvedModules)
|
|
46345
45915
|
return;
|
|
46346
|
-
sf.resolvedModules
|
|
45916
|
+
ts.forEachEntry(sf.resolvedModules, function (r) {
|
|
46347
45917
|
if (r && r.packageId)
|
|
46348
45918
|
map.set(r.packageId.name, r.extension === ".d.ts" /* Dts */ || !!map.get(r.packageId.name));
|
|
46349
45919
|
});
|
|
@@ -47485,7 +47055,7 @@ var ts;
|
|
|
47485
47055
|
}
|
|
47486
47056
|
else if (ts.isParameterPropertyDeclaration(declaration, declaration.parent)) {
|
|
47487
47057
|
// foo = this.bar is illegal in esnext+useDefineForClassFields when bar is a parameter property
|
|
47488
|
-
return !(
|
|
47058
|
+
return !(compilerOptions.target === 99 /* ESNext */ && useDefineForClassFields
|
|
47489
47059
|
&& ts.getContainingClass(declaration) === ts.getContainingClass(usage)
|
|
47490
47060
|
&& isUsedInFunctionOrInstanceProperty(usage, declaration));
|
|
47491
47061
|
}
|
|
@@ -47513,7 +47083,7 @@ var ts;
|
|
|
47513
47083
|
return true;
|
|
47514
47084
|
}
|
|
47515
47085
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
47516
|
-
if (
|
|
47086
|
+
if (compilerOptions.target === 99 /* ESNext */ && useDefineForClassFields
|
|
47517
47087
|
&& ts.getContainingClass(declaration)
|
|
47518
47088
|
&& (ts.isPropertyDeclaration(declaration) || ts.isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
47519
47089
|
return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage, /*stopAtAnyPropertyDeclaration*/ true);
|
|
@@ -47884,7 +47454,7 @@ var ts;
|
|
|
47884
47454
|
case 212 /* ArrowFunction */:
|
|
47885
47455
|
// when targeting ES6 or higher there is no 'arguments' in an arrow function
|
|
47886
47456
|
// for lower compile targets the resolved symbol is used to emit an error
|
|
47887
|
-
if (
|
|
47457
|
+
if (compilerOptions.target >= 2 /* ES2015 */) {
|
|
47888
47458
|
break;
|
|
47889
47459
|
}
|
|
47890
47460
|
// falls through
|
|
@@ -48052,7 +47622,7 @@ var ts;
|
|
|
48052
47622
|
}
|
|
48053
47623
|
// Perform extra checks only if error reporting was requested
|
|
48054
47624
|
if (nameNotFoundMessage) {
|
|
48055
|
-
if (propertyWithInvalidInitializer && !(
|
|
47625
|
+
if (propertyWithInvalidInitializer && !(compilerOptions.target === 99 /* ESNext */ && useDefineForClassFields)) {
|
|
48056
47626
|
// We have a match, but the reference occurred within a property initializer and the identifier also binds
|
|
48057
47627
|
// to a local variable in the constructor where the code will be emitted. Note that this is actually allowed
|
|
48058
47628
|
// with ESNext+useDefineForClassFields because the scope semantics are different.
|
|
@@ -48630,7 +48200,7 @@ var ts;
|
|
|
48630
48200
|
if (!ts.isIdentifier(name)) {
|
|
48631
48201
|
return undefined;
|
|
48632
48202
|
}
|
|
48633
|
-
var suppressInteropError = name.escapedText === "default" /* Default */ && !!(compilerOptions.allowSyntheticDefaultImports ||
|
|
48203
|
+
var suppressInteropError = name.escapedText === "default" /* Default */ && !!(compilerOptions.allowSyntheticDefaultImports || compilerOptions.esModuleInterop);
|
|
48634
48204
|
var targetSymbol = resolveESModuleSymbol(moduleSymbol, moduleSpecifier, /*dontResolveAlias*/ false, suppressInteropError);
|
|
48635
48205
|
if (targetSymbol) {
|
|
48636
48206
|
if (name.escapedText) {
|
|
@@ -48708,18 +48278,18 @@ var ts;
|
|
|
48708
48278
|
}
|
|
48709
48279
|
function reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) {
|
|
48710
48280
|
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
48711
|
-
var message =
|
|
48281
|
+
var message = compilerOptions.esModuleInterop ? ts.Diagnostics._0_can_only_be_imported_by_using_a_default_import :
|
|
48712
48282
|
ts.Diagnostics._0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
48713
48283
|
error(name, message, declarationName);
|
|
48714
48284
|
}
|
|
48715
48285
|
else {
|
|
48716
48286
|
if (ts.isInJSFile(node)) {
|
|
48717
|
-
var message =
|
|
48287
|
+
var message = compilerOptions.esModuleInterop ? ts.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import :
|
|
48718
48288
|
ts.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
48719
48289
|
error(name, message, declarationName);
|
|
48720
48290
|
}
|
|
48721
48291
|
else {
|
|
48722
|
-
var message =
|
|
48292
|
+
var message = compilerOptions.esModuleInterop ? ts.Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import :
|
|
48723
48293
|
ts.Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
48724
48294
|
error(name, message, declarationName, declarationName, moduleName);
|
|
48725
48295
|
}
|
|
@@ -49160,7 +48730,6 @@ var ts;
|
|
|
49160
48730
|
: undefined;
|
|
49161
48731
|
}
|
|
49162
48732
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
|
|
49163
|
-
var _a, _b, _c, _d;
|
|
49164
48733
|
if (isForAugmentation === void 0) { isForAugmentation = false; }
|
|
49165
48734
|
if (ts.startsWith(moduleReference, "@types/")) {
|
|
49166
48735
|
var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
@@ -49172,13 +48741,7 @@ var ts;
|
|
|
49172
48741
|
return ambientModule;
|
|
49173
48742
|
}
|
|
49174
48743
|
var currentSourceFile = ts.getSourceFileOfNode(location);
|
|
49175
|
-
var
|
|
49176
|
-
? location
|
|
49177
|
-
: ((_a = (ts.isImportCall(location) ? location : ts.findAncestor(location, ts.isImportCall))) === null || _a === void 0 ? void 0 : _a.arguments[0]) ||
|
|
49178
|
-
((_b = (ts.isImportDeclaration(location) ? location : ts.findAncestor(location, ts.isImportDeclaration))) === null || _b === void 0 ? void 0 : _b.moduleSpecifier) ||
|
|
49179
|
-
((_c = (ts.isExternalModuleImportEqualsDeclaration(location) ? location : ts.findAncestor(location, ts.isExternalModuleImportEqualsDeclaration))) === null || _c === void 0 ? void 0 : _c.moduleReference.expression) ||
|
|
49180
|
-
((_d = (ts.isExportDeclaration(location) ? location : ts.findAncestor(location, ts.isExportDeclaration))) === null || _d === void 0 ? void 0 : _d.moduleSpecifier);
|
|
49181
|
-
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : undefined); // TODO: GH#18217
|
|
48744
|
+
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference); // TODO: GH#18217
|
|
49182
48745
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
49183
48746
|
var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
49184
48747
|
if (sourceFile) {
|
|
@@ -49186,12 +48749,6 @@ var ts;
|
|
|
49186
48749
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
49187
48750
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
49188
48751
|
}
|
|
49189
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
49190
|
-
var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
|
|
49191
|
-
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
49192
|
-
error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_es_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
|
|
49193
|
-
}
|
|
49194
|
-
}
|
|
49195
48752
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
49196
48753
|
return getMergedSymbol(sourceFile.symbol);
|
|
49197
48754
|
}
|
|
@@ -49249,14 +48806,15 @@ var ts;
|
|
|
49249
48806
|
* Direct users to import source with .js extension if outputting an ES module.
|
|
49250
48807
|
* @see https://github.com/microsoft/TypeScript/issues/42151
|
|
49251
48808
|
*/
|
|
49252
|
-
|
|
48809
|
+
var moduleKind_1 = ts.getEmitModuleKind(compilerOptions);
|
|
48810
|
+
if (moduleKind_1 >= ts.ModuleKind.ES2015) {
|
|
49253
48811
|
replacedImportSource += ".js";
|
|
49254
48812
|
}
|
|
49255
48813
|
error(errorNode, diag, tsExtension, replacedImportSource);
|
|
49256
48814
|
}
|
|
49257
48815
|
else if (!compilerOptions.resolveJsonModule &&
|
|
49258
48816
|
ts.fileExtensionIs(moduleReference, ".json" /* Json */) &&
|
|
49259
|
-
ts.getEmitModuleResolutionKind(compilerOptions)
|
|
48817
|
+
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs &&
|
|
49260
48818
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
49261
48819
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
49262
48820
|
}
|
|
@@ -49329,7 +48887,7 @@ var ts;
|
|
|
49329
48887
|
error(referencingLocation, ts.Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName);
|
|
49330
48888
|
return symbol;
|
|
49331
48889
|
}
|
|
49332
|
-
if (
|
|
48890
|
+
if (compilerOptions.esModuleInterop) {
|
|
49333
48891
|
var referenceParent = referencingLocation.parent;
|
|
49334
48892
|
if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) ||
|
|
49335
48893
|
ts.isImportCall(referenceParent)) {
|
|
@@ -51455,7 +51013,7 @@ var ts;
|
|
|
51455
51013
|
var nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined;
|
|
51456
51014
|
var typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain, 0, context);
|
|
51457
51015
|
var specifier = getSpecifierForModuleSymbol(chain[0], context);
|
|
51458
|
-
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions)
|
|
51016
|
+
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs && specifier.indexOf("/node_modules/") >= 0) {
|
|
51459
51017
|
// If ultimately we can only name the symbol with a reference that dives into a `node_modules` folder, we should error
|
|
51460
51018
|
// since declaration files with these kinds of references are liable to fail when published :(
|
|
51461
51019
|
context.encounteredError = true;
|
|
@@ -51678,7 +51236,7 @@ var ts;
|
|
|
51678
51236
|
if (nameType) {
|
|
51679
51237
|
if (nameType.flags & 384 /* StringOrNumberLiteral */) {
|
|
51680
51238
|
var name = "" + nameType.value;
|
|
51681
|
-
if (!ts.isIdentifierText(name,
|
|
51239
|
+
if (!ts.isIdentifierText(name, compilerOptions.target) && !isNumericLiteralName(name)) {
|
|
51682
51240
|
return ts.factory.createStringLiteral(name, !!singleQuote);
|
|
51683
51241
|
}
|
|
51684
51242
|
if (isNumericLiteralName(name) && ts.startsWith(name, "-")) {
|
|
@@ -51692,7 +51250,7 @@ var ts;
|
|
|
51692
51250
|
}
|
|
51693
51251
|
}
|
|
51694
51252
|
function createPropertyNameNodeForIdentifierOrLiteral(name, stringNamed, singleQuote) {
|
|
51695
|
-
return ts.isIdentifierText(name,
|
|
51253
|
+
return ts.isIdentifierText(name, compilerOptions.target) ? ts.factory.createIdentifier(name) :
|
|
51696
51254
|
!stringNamed && isNumericLiteralName(name) && +name >= 0 ? ts.factory.createNumericLiteral(+name) :
|
|
51697
51255
|
ts.factory.createStringLiteral(name, !!singleQuote);
|
|
51698
51256
|
}
|
|
@@ -52626,27 +52184,6 @@ var ts;
|
|
|
52626
52184
|
/*decorators*/ undefined,
|
|
52627
52185
|
/*modifiers*/ undefined, localName, typeParamDecls, heritageClauses, __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], indexSignatures, true), staticMembers, true), constructors, true), publicProperties, true), privateProperties, true)), symbol.declarations && ts.filter(symbol.declarations, function (d) { return ts.isClassDeclaration(d) || ts.isClassExpression(d); })[0]), modifierFlags);
|
|
52628
52186
|
}
|
|
52629
|
-
function getSomeTargetNameFromDeclarations(declarations) {
|
|
52630
|
-
return ts.firstDefined(declarations, function (d) {
|
|
52631
|
-
if (ts.isImportSpecifier(d) || ts.isExportSpecifier(d)) {
|
|
52632
|
-
return ts.idText(d.propertyName || d.name);
|
|
52633
|
-
}
|
|
52634
|
-
if (ts.isBinaryExpression(d) || ts.isExportAssignment(d)) {
|
|
52635
|
-
var expression = ts.isExportAssignment(d) ? d.expression : d.right;
|
|
52636
|
-
if (ts.isPropertyAccessExpression(expression)) {
|
|
52637
|
-
return ts.idText(expression.name);
|
|
52638
|
-
}
|
|
52639
|
-
}
|
|
52640
|
-
if (isAliasSymbolDeclaration(d)) {
|
|
52641
|
-
// This is... heuristic, at best. But it's probably better than always printing the name of the shorthand ambient module.
|
|
52642
|
-
var name = ts.getNameOfDeclaration(d);
|
|
52643
|
-
if (name && ts.isIdentifier(name)) {
|
|
52644
|
-
return ts.idText(name);
|
|
52645
|
-
}
|
|
52646
|
-
}
|
|
52647
|
-
return undefined;
|
|
52648
|
-
});
|
|
52649
|
-
}
|
|
52650
52187
|
function serializeAsAlias(symbol, localName, modifierFlags) {
|
|
52651
52188
|
var _a, _b, _c, _d, _e;
|
|
52652
52189
|
// synthesize an alias, eg `export { symbolName as Name }`
|
|
@@ -52659,10 +52196,8 @@ var ts;
|
|
|
52659
52196
|
if (!target) {
|
|
52660
52197
|
return;
|
|
52661
52198
|
}
|
|
52662
|
-
|
|
52663
|
-
|
|
52664
|
-
var verbatimTargetName = ts.isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || ts.unescapeLeadingUnderscores(target.escapedName);
|
|
52665
|
-
if (verbatimTargetName === "export=" /* ExportEquals */ && (ts.getESModuleInterop(compilerOptions) || compilerOptions.allowSyntheticDefaultImports)) {
|
|
52199
|
+
var verbatimTargetName = ts.unescapeLeadingUnderscores(target.escapedName);
|
|
52200
|
+
if (verbatimTargetName === "export=" /* ExportEquals */ && (compilerOptions.esModuleInterop || compilerOptions.allowSyntheticDefaultImports)) {
|
|
52666
52201
|
// target refers to an `export=` symbol that was hoisted into a synthetic default - rename here to match
|
|
52667
52202
|
verbatimTargetName = "default" /* Default */;
|
|
52668
52203
|
}
|
|
@@ -53205,7 +52740,7 @@ var ts;
|
|
|
53205
52740
|
if (nameType) {
|
|
53206
52741
|
if (nameType.flags & 384 /* StringOrNumberLiteral */) {
|
|
53207
52742
|
var name = "" + nameType.value;
|
|
53208
|
-
if (!ts.isIdentifierText(name,
|
|
52743
|
+
if (!ts.isIdentifierText(name, compilerOptions.target) && !isNumericLiteralName(name)) {
|
|
53209
52744
|
return "\"" + ts.escapeString(name, 34 /* doubleQuote */) + "\"";
|
|
53210
52745
|
}
|
|
53211
52746
|
if (isNumericLiteralName(name) && ts.startsWith(name, "-")) {
|
|
@@ -62293,7 +61828,7 @@ var ts;
|
|
|
62293
61828
|
path = "" + str;
|
|
62294
61829
|
}
|
|
62295
61830
|
// Otherwise write a dotted name if possible
|
|
62296
|
-
else if (ts.isIdentifierText(str,
|
|
61831
|
+
else if (ts.isIdentifierText(str, compilerOptions.target)) {
|
|
62297
61832
|
path = path + "." + str;
|
|
62298
61833
|
}
|
|
62299
61834
|
// Failing that, check if the name is already a computed name
|
|
@@ -68760,7 +68295,19 @@ var ts;
|
|
|
68760
68295
|
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t; }) : type;
|
|
68761
68296
|
}
|
|
68762
68297
|
function isExportOrExportExpression(location) {
|
|
68763
|
-
return !!ts.findAncestor(location, function (
|
|
68298
|
+
return !!ts.findAncestor(location, function (n) {
|
|
68299
|
+
var parent = n.parent;
|
|
68300
|
+
if (parent === undefined) {
|
|
68301
|
+
return "quit";
|
|
68302
|
+
}
|
|
68303
|
+
if (ts.isExportAssignment(parent)) {
|
|
68304
|
+
return parent.expression === n && ts.isEntityNameExpression(n);
|
|
68305
|
+
}
|
|
68306
|
+
if (ts.isExportSpecifier(parent)) {
|
|
68307
|
+
return parent.name === n || parent.propertyName === n;
|
|
68308
|
+
}
|
|
68309
|
+
return false;
|
|
68310
|
+
});
|
|
68764
68311
|
}
|
|
68765
68312
|
function markAliasReferenced(symbol, location) {
|
|
68766
68313
|
if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) {
|
|
@@ -71728,7 +71275,7 @@ var ts;
|
|
|
71728
71275
|
if (assignmentKind && lexicallyScopedSymbol && lexicallyScopedSymbol.valueDeclaration && ts.isMethodDeclaration(lexicallyScopedSymbol.valueDeclaration)) {
|
|
71729
71276
|
grammarErrorOnNode(right, ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable, ts.idText(right));
|
|
71730
71277
|
}
|
|
71731
|
-
if ((lexicallyScopedSymbol === null || lexicallyScopedSymbol === void 0 ? void 0 : lexicallyScopedSymbol.valueDeclaration) && (
|
|
71278
|
+
if ((lexicallyScopedSymbol === null || lexicallyScopedSymbol === void 0 ? void 0 : lexicallyScopedSymbol.valueDeclaration) && (compilerOptions.target === 99 /* ESNext */ && !useDefineForClassFields)) {
|
|
71732
71279
|
var lexicalClass_1 = ts.getContainingClass(lexicallyScopedSymbol.valueDeclaration);
|
|
71733
71280
|
var parentStaticFieldInitializer = ts.findAncestor(node, function (n) {
|
|
71734
71281
|
if (n === lexicalClass_1)
|
|
@@ -74329,12 +73876,6 @@ var ts;
|
|
|
74329
73876
|
return getReturnTypeOfSignature(signature);
|
|
74330
73877
|
}
|
|
74331
73878
|
function checkAssertion(node) {
|
|
74332
|
-
if (node.kind === 209 /* TypeAssertionExpression */) {
|
|
74333
|
-
var file = ts.getSourceFileOfNode(node);
|
|
74334
|
-
if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Cts */, ".mts" /* Mts */])) {
|
|
74335
|
-
grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
|
|
74336
|
-
}
|
|
74337
|
-
}
|
|
74338
73879
|
return checkAssertionWorker(node, node.type, node.expression);
|
|
74339
73880
|
}
|
|
74340
73881
|
function isValidConstAssertionArgument(node) {
|
|
@@ -74435,14 +73976,7 @@ var ts;
|
|
|
74435
73976
|
}
|
|
74436
73977
|
function checkImportMetaProperty(node) {
|
|
74437
73978
|
if (moduleKind !== ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) {
|
|
74438
|
-
|
|
74439
|
-
if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
74440
|
-
error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
74441
|
-
}
|
|
74442
|
-
}
|
|
74443
|
-
else {
|
|
74444
|
-
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12_or_nodenext);
|
|
74445
|
-
}
|
|
73979
|
+
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_or_system);
|
|
74446
73980
|
}
|
|
74447
73981
|
var file = ts.getSourceFileOfNode(node);
|
|
74448
73982
|
ts.Debug.assert(!!(file.flags & 2097152 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -75384,9 +74918,9 @@ var ts;
|
|
|
75384
74918
|
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module);
|
|
75385
74919
|
diagnostics.add(diagnostic);
|
|
75386
74920
|
}
|
|
75387
|
-
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System
|
|
74921
|
+
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) || languageVersion < 4 /* ES2017 */) {
|
|
75388
74922
|
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
75389
|
-
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.
|
|
74923
|
+
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher);
|
|
75390
74924
|
diagnostics.add(diagnostic);
|
|
75391
74925
|
}
|
|
75392
74926
|
}
|
|
@@ -77424,7 +76958,7 @@ var ts;
|
|
|
77424
76958
|
// - The containing class is a derived class.
|
|
77425
76959
|
// - The constructor declares parameter properties
|
|
77426
76960
|
// or the containing class declares instance member variables with initializers.
|
|
77427
|
-
var superCallShouldBeFirst = (
|
|
76961
|
+
var superCallShouldBeFirst = (compilerOptions.target !== 99 /* ESNext */ || !useDefineForClassFields) &&
|
|
77428
76962
|
(ts.some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
|
|
77429
76963
|
ts.some(node.parameters, function (p) { return ts.hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */); }));
|
|
77430
76964
|
// Skip past any prologue directives to find the first statement
|
|
@@ -79156,7 +78690,7 @@ var ts;
|
|
|
79156
78690
|
}
|
|
79157
78691
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
79158
78692
|
// No need to check for require or exports for ES6 modules and later
|
|
79159
|
-
if (moduleKind >= ts.ModuleKind.ES2015
|
|
78693
|
+
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
79160
78694
|
return;
|
|
79161
78695
|
}
|
|
79162
78696
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -80717,8 +80251,8 @@ var ts;
|
|
|
80717
80251
|
* The name cannot be used as 'Object' of user defined types with special target.
|
|
80718
80252
|
*/
|
|
80719
80253
|
function checkClassNameCollisionWithObject(name) {
|
|
80720
|
-
if (languageVersion
|
|
80721
|
-
&&
|
|
80254
|
+
if (languageVersion === 1 /* ES5 */ && name.escapedText === "Object"
|
|
80255
|
+
&& moduleKind < ts.ModuleKind.ES2015) {
|
|
80722
80256
|
error(name, ts.Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ts.ModuleKind[moduleKind]); // https://github.com/Microsoft/TypeScript/issues/17494
|
|
80723
80257
|
}
|
|
80724
80258
|
}
|
|
@@ -80984,6 +80518,7 @@ var ts;
|
|
|
80984
80518
|
function checkClassMember(member, memberIsParameterProperty) {
|
|
80985
80519
|
var hasOverride = ts.hasOverrideModifier(member);
|
|
80986
80520
|
var hasStatic = ts.isStatic(member);
|
|
80521
|
+
var isJs = ts.isInJSFile(member);
|
|
80987
80522
|
if (baseWithThis && (hasOverride || compilerOptions.noImplicitOverride)) {
|
|
80988
80523
|
var declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member);
|
|
80989
80524
|
if (!declaredProp) {
|
|
@@ -80997,8 +80532,12 @@ var ts;
|
|
|
80997
80532
|
if (prop && !baseProp && hasOverride) {
|
|
80998
80533
|
var suggestion = getSuggestedSymbolForNonexistentClassMember(ts.symbolName(declaredProp), baseType);
|
|
80999
80534
|
suggestion ?
|
|
81000
|
-
error(member,
|
|
81001
|
-
|
|
80535
|
+
error(member, isJs ?
|
|
80536
|
+
ts.Diagnostics.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 :
|
|
80537
|
+
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion)) :
|
|
80538
|
+
error(member, isJs ?
|
|
80539
|
+
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 :
|
|
80540
|
+
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
|
|
81002
80541
|
}
|
|
81003
80542
|
else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
|
|
81004
80543
|
var baseHasAbstract = ts.some(baseProp.declarations, ts.hasAbstractModifier);
|
|
@@ -81007,8 +80546,12 @@ var ts;
|
|
|
81007
80546
|
}
|
|
81008
80547
|
if (!baseHasAbstract) {
|
|
81009
80548
|
var diag = memberIsParameterProperty ?
|
|
81010
|
-
|
|
81011
|
-
|
|
80549
|
+
isJs ?
|
|
80550
|
+
ts.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
|
|
80551
|
+
ts.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0 :
|
|
80552
|
+
isJs ?
|
|
80553
|
+
ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
|
|
80554
|
+
ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
|
|
81012
80555
|
error(member, diag, baseClassName);
|
|
81013
80556
|
}
|
|
81014
80557
|
else if (ts.hasAbstractModifier(member) && baseHasAbstract) {
|
|
@@ -81018,7 +80561,9 @@ var ts;
|
|
|
81018
80561
|
}
|
|
81019
80562
|
else if (hasOverride) {
|
|
81020
80563
|
var className = typeToString(type);
|
|
81021
|
-
error(member,
|
|
80564
|
+
error(member, isJs ?
|
|
80565
|
+
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class :
|
|
80566
|
+
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className);
|
|
81022
80567
|
}
|
|
81023
80568
|
}
|
|
81024
80569
|
}
|
|
@@ -81877,8 +81422,8 @@ var ts;
|
|
|
81877
81422
|
checkAliasSymbol(node);
|
|
81878
81423
|
if (node.kind === 268 /* ImportSpecifier */ &&
|
|
81879
81424
|
ts.idText(node.propertyName || node.name) === "default" &&
|
|
81880
|
-
|
|
81881
|
-
moduleKind !== ts.ModuleKind.System &&
|
|
81425
|
+
compilerOptions.esModuleInterop &&
|
|
81426
|
+
moduleKind !== ts.ModuleKind.System && moduleKind < ts.ModuleKind.ES2015) {
|
|
81882
81427
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
81883
81428
|
}
|
|
81884
81429
|
}
|
|
@@ -81899,7 +81444,7 @@ var ts;
|
|
|
81899
81444
|
if (importClause.namedBindings) {
|
|
81900
81445
|
if (importClause.namedBindings.kind === 266 /* NamespaceImport */) {
|
|
81901
81446
|
checkImportBinding(importClause.namedBindings);
|
|
81902
|
-
if (moduleKind !== ts.ModuleKind.System &&
|
|
81447
|
+
if (moduleKind !== ts.ModuleKind.System && moduleKind < ts.ModuleKind.ES2015 && compilerOptions.esModuleInterop) {
|
|
81903
81448
|
// import * as ns from "foo";
|
|
81904
81449
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
81905
81450
|
}
|
|
@@ -81944,7 +81489,7 @@ var ts;
|
|
|
81944
81489
|
}
|
|
81945
81490
|
}
|
|
81946
81491
|
else {
|
|
81947
|
-
if (moduleKind >= ts.ModuleKind.ES2015 &&
|
|
81492
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && !node.isTypeOnly && !(node.flags & 8388608 /* Ambient */)) {
|
|
81948
81493
|
// Import equals declaration is deprecated in es6 or above
|
|
81949
81494
|
grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
81950
81495
|
}
|
|
@@ -81985,12 +81530,12 @@ var ts;
|
|
|
81985
81530
|
else if (node.exportClause) {
|
|
81986
81531
|
checkAliasSymbol(node.exportClause);
|
|
81987
81532
|
}
|
|
81988
|
-
if (moduleKind !== ts.ModuleKind.System &&
|
|
81533
|
+
if (moduleKind !== ts.ModuleKind.System && moduleKind < ts.ModuleKind.ES2015) {
|
|
81989
81534
|
if (node.exportClause) {
|
|
81990
81535
|
// export * as ns from "foo";
|
|
81991
81536
|
// For ES2015 modules, we emit it as a pair of `import * as a_1 ...; export { a_1 as ns }` and don't need the helper.
|
|
81992
81537
|
// We only use the helper here when in esModuleInterop
|
|
81993
|
-
if (
|
|
81538
|
+
if (compilerOptions.esModuleInterop) {
|
|
81994
81539
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
81995
81540
|
}
|
|
81996
81541
|
}
|
|
@@ -82073,9 +81618,9 @@ var ts;
|
|
|
82073
81618
|
}
|
|
82074
81619
|
}
|
|
82075
81620
|
else {
|
|
82076
|
-
if (
|
|
81621
|
+
if (compilerOptions.esModuleInterop &&
|
|
82077
81622
|
moduleKind !== ts.ModuleKind.System &&
|
|
82078
|
-
|
|
81623
|
+
moduleKind < ts.ModuleKind.ES2015 &&
|
|
82079
81624
|
ts.idText(node.propertyName || node.name) === "default") {
|
|
82080
81625
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
82081
81626
|
}
|
|
@@ -82134,7 +81679,7 @@ var ts;
|
|
|
82134
81679
|
grammarErrorOnNode(node.expression, ts.Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
82135
81680
|
}
|
|
82136
81681
|
if (node.isExportEquals && !(node.flags & 8388608 /* Ambient */)) {
|
|
82137
|
-
if (moduleKind >= ts.ModuleKind.ES2015
|
|
81682
|
+
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
82138
81683
|
// export assignment is not supported in es6 modules
|
|
82139
81684
|
grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
82140
81685
|
}
|
|
@@ -84671,11 +84216,6 @@ var ts;
|
|
|
84671
84216
|
if (!ts.isArrowFunction(node)) {
|
|
84672
84217
|
return false;
|
|
84673
84218
|
}
|
|
84674
|
-
if (node.typeParameters && !(ts.length(node.typeParameters) > 1 || node.typeParameters.hasTrailingComma || node.typeParameters[0].constraint)) {
|
|
84675
|
-
if (file && ts.fileExtensionIsOneOf(file.fileName, [".mts" /* Mts */, ".cts" /* Cts */])) {
|
|
84676
|
-
grammarErrorOnNode(node.typeParameters[0], ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint);
|
|
84677
|
-
}
|
|
84678
|
-
}
|
|
84679
84219
|
var equalsGreaterThanToken = node.equalsGreaterThanToken;
|
|
84680
84220
|
var startLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.pos).line;
|
|
84681
84221
|
var endLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.end).line;
|
|
@@ -85008,8 +84548,8 @@ var ts;
|
|
|
85008
84548
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
85009
84549
|
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module));
|
|
85010
84550
|
}
|
|
85011
|
-
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System
|
|
85012
|
-
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.
|
|
84551
|
+
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) || languageVersion < 4 /* ES2017 */) {
|
|
84552
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher));
|
|
85013
84553
|
}
|
|
85014
84554
|
}
|
|
85015
84555
|
}
|
|
@@ -85350,7 +84890,8 @@ var ts;
|
|
|
85350
84890
|
: ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
|
|
85351
84891
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
85352
84892
|
}
|
|
85353
|
-
|
|
84893
|
+
var moduleKind = ts.getEmitModuleKind(compilerOptions);
|
|
84894
|
+
if (moduleKind < ts.ModuleKind.ES2015 && moduleKind !== ts.ModuleKind.System &&
|
|
85354
84895
|
!(node.parent.parent.flags & 8388608 /* Ambient */) && ts.hasSyntacticModifier(node.parent.parent, 1 /* Export */)) {
|
|
85355
84896
|
checkESModuleMarker(node.name);
|
|
85356
84897
|
}
|
|
@@ -85685,7 +85226,7 @@ var ts;
|
|
|
85685
85226
|
}
|
|
85686
85227
|
function checkGrammarImportCallExpression(node) {
|
|
85687
85228
|
if (moduleKind === ts.ModuleKind.ES2015) {
|
|
85688
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
85229
|
+
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_or_umd);
|
|
85689
85230
|
}
|
|
85690
85231
|
if (node.typeArguments) {
|
|
85691
85232
|
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments);
|
|
@@ -90830,7 +90371,7 @@ var ts;
|
|
|
90830
90371
|
function transformSourceFile(node) {
|
|
90831
90372
|
var options = context.getCompilerOptions();
|
|
90832
90373
|
if (node.isDeclarationFile
|
|
90833
|
-
|| useDefineForClassFields &&
|
|
90374
|
+
|| useDefineForClassFields && options.target === 99 /* ESNext */) {
|
|
90834
90375
|
return node;
|
|
90835
90376
|
}
|
|
90836
90377
|
var visited = ts.visitEachChild(node, visitor, context);
|
|
@@ -94206,7 +93747,7 @@ var ts;
|
|
|
94206
93747
|
// When there are no attributes, React wants "null"
|
|
94207
93748
|
}
|
|
94208
93749
|
else {
|
|
94209
|
-
var target =
|
|
93750
|
+
var target = compilerOptions.target;
|
|
94210
93751
|
if (target && target >= 5 /* ES2018 */) {
|
|
94211
93752
|
objectProperties = factory.createObjectLiteralExpression(ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) {
|
|
94212
93753
|
return isSpread ? ts.map(attrs, transformJsxSpreadAttributeToSpreadAssignment) : ts.map(attrs, transformJsxAttributeToObjectLiteralElement);
|
|
@@ -101041,7 +100582,7 @@ var ts;
|
|
|
101041
100582
|
case 345 /* PartiallyEmittedExpression */:
|
|
101042
100583
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
101043
100584
|
case 206 /* CallExpression */:
|
|
101044
|
-
if (ts.isImportCall(node)
|
|
100585
|
+
if (ts.isImportCall(node)) {
|
|
101045
100586
|
return visitImportCallExpression(node);
|
|
101046
100587
|
}
|
|
101047
100588
|
break;
|
|
@@ -101264,7 +100805,7 @@ var ts;
|
|
|
101264
100805
|
}
|
|
101265
100806
|
}
|
|
101266
100807
|
var promise = factory.createNewExpression(factory.createIdentifier("Promise"), /*typeArguments*/ undefined, [func]);
|
|
101267
|
-
if (
|
|
100808
|
+
if (compilerOptions.esModuleInterop) {
|
|
101268
100809
|
return factory.createCallExpression(factory.createPropertyAccessExpression(promise, factory.createIdentifier("then")), /*typeArguments*/ undefined, [emitHelpers().createImportStarCallbackHelper()]);
|
|
101269
100810
|
}
|
|
101270
100811
|
return promise;
|
|
@@ -101277,7 +100818,7 @@ var ts;
|
|
|
101277
100818
|
// if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately
|
|
101278
100819
|
var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []);
|
|
101279
100820
|
var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
|
|
101280
|
-
if (
|
|
100821
|
+
if (compilerOptions.esModuleInterop) {
|
|
101281
100822
|
requireCall = emitHelpers().createImportStarHelper(requireCall);
|
|
101282
100823
|
}
|
|
101283
100824
|
var func;
|
|
@@ -101307,7 +100848,7 @@ var ts;
|
|
|
101307
100848
|
return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
|
|
101308
100849
|
}
|
|
101309
100850
|
function getHelperExpressionForExport(node, innerExpr) {
|
|
101310
|
-
if (!
|
|
100851
|
+
if (!compilerOptions.esModuleInterop || ts.getEmitFlags(node) & 67108864 /* NeverApplyImportHelper */) {
|
|
101311
100852
|
return innerExpr;
|
|
101312
100853
|
}
|
|
101313
100854
|
if (ts.getExportNeedsImportStarHelper(node)) {
|
|
@@ -101316,7 +100857,7 @@ var ts;
|
|
|
101316
100857
|
return innerExpr;
|
|
101317
100858
|
}
|
|
101318
100859
|
function getHelperExpressionForImport(node, innerExpr) {
|
|
101319
|
-
if (!
|
|
100860
|
+
if (!compilerOptions.esModuleInterop || ts.getEmitFlags(node) & 67108864 /* NeverApplyImportHelper */) {
|
|
101320
100861
|
return innerExpr;
|
|
101321
100862
|
}
|
|
101322
100863
|
if (ts.getImportNeedsImportStarHelper(node)) {
|
|
@@ -101470,7 +101011,7 @@ var ts;
|
|
|
101470
101011
|
statements.push(ts.setOriginalNode(ts.setTextRange(factory.createExpressionStatement(emitHelpers().createCreateBindingHelper(generatedName, factory.createStringLiteralFromNode(specifier.propertyName || specifier.name), specifier.propertyName ? factory.createStringLiteralFromNode(specifier.name) : undefined)), specifier), specifier));
|
|
101471
101012
|
}
|
|
101472
101013
|
else {
|
|
101473
|
-
var exportNeedsImportDefault = !!
|
|
101014
|
+
var exportNeedsImportDefault = !!compilerOptions.esModuleInterop &&
|
|
101474
101015
|
!(ts.getEmitFlags(node) & 67108864 /* NeverApplyImportHelper */) &&
|
|
101475
101016
|
ts.idText(specifier.propertyName || specifier.name) === "default";
|
|
101476
101017
|
var exportedValue = factory.createPropertyAccessExpression(exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName, specifier.propertyName || specifier.name);
|
|
@@ -103639,10 +103180,7 @@ var ts;
|
|
|
103639
103180
|
(function (ts) {
|
|
103640
103181
|
function transformECMAScriptModule(context) {
|
|
103641
103182
|
var factory = context.factory, emitHelpers = context.getEmitHelperFactory;
|
|
103642
|
-
var host = context.getEmitHost();
|
|
103643
|
-
var resolver = context.getEmitResolver();
|
|
103644
103183
|
var compilerOptions = context.getCompilerOptions();
|
|
103645
|
-
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
|
|
103646
103184
|
var previousOnEmitNode = context.onEmitNode;
|
|
103647
103185
|
var previousOnSubstituteNode = context.onSubstituteNode;
|
|
103648
103186
|
context.onEmitNode = onEmitNode;
|
|
@@ -103650,21 +103188,13 @@ var ts;
|
|
|
103650
103188
|
context.enableEmitNotification(300 /* SourceFile */);
|
|
103651
103189
|
context.enableSubstitution(79 /* Identifier */);
|
|
103652
103190
|
var helperNameSubstitutions;
|
|
103653
|
-
var currentSourceFile;
|
|
103654
|
-
var importRequireStatements;
|
|
103655
103191
|
return ts.chainBundle(context, transformSourceFile);
|
|
103656
103192
|
function transformSourceFile(node) {
|
|
103657
103193
|
if (node.isDeclarationFile) {
|
|
103658
103194
|
return node;
|
|
103659
103195
|
}
|
|
103660
103196
|
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
|
|
103661
|
-
currentSourceFile = node;
|
|
103662
|
-
importRequireStatements = undefined;
|
|
103663
103197
|
var result = updateExternalModule(node);
|
|
103664
|
-
currentSourceFile = undefined;
|
|
103665
|
-
if (importRequireStatements) {
|
|
103666
|
-
result = factory.updateSourceFile(result, ts.setTextRange(factory.createNodeArray(ts.insertStatementsAfterCustomPrologue(result.statements.slice(), importRequireStatements)), result.statements));
|
|
103667
|
-
}
|
|
103668
103198
|
if (!ts.isExternalModule(node) || ts.some(result.statements, ts.isExternalModuleIndicator)) {
|
|
103669
103199
|
return result;
|
|
103670
103200
|
}
|
|
@@ -103688,10 +103218,8 @@ var ts;
|
|
|
103688
103218
|
function visitor(node) {
|
|
103689
103219
|
switch (node.kind) {
|
|
103690
103220
|
case 263 /* ImportEqualsDeclaration */:
|
|
103691
|
-
//
|
|
103692
|
-
|
|
103693
|
-
// is available, just because the output is reasonable for a node-like runtime.
|
|
103694
|
-
return ts.getEmitScriptTarget(compilerOptions) >= ts.ModuleKind.ES2020 ? visitImportEqualsDeclaration(node) : undefined;
|
|
103221
|
+
// Elide `import=` as it is not legal with --module ES6
|
|
103222
|
+
return undefined;
|
|
103695
103223
|
case 269 /* ExportAssignment */:
|
|
103696
103224
|
return visitExportAssignment(node);
|
|
103697
103225
|
case 270 /* ExportDeclaration */:
|
|
@@ -103700,68 +103228,6 @@ var ts;
|
|
|
103700
103228
|
}
|
|
103701
103229
|
return node;
|
|
103702
103230
|
}
|
|
103703
|
-
/**
|
|
103704
|
-
* Creates a `require()` call to import an external module.
|
|
103705
|
-
*
|
|
103706
|
-
* @param importNode The declaration to import.
|
|
103707
|
-
*/
|
|
103708
|
-
function createRequireCall(importNode) {
|
|
103709
|
-
var moduleName = ts.getExternalModuleNameLiteral(factory, importNode, ts.Debug.checkDefined(currentSourceFile), host, resolver, compilerOptions);
|
|
103710
|
-
var args = [];
|
|
103711
|
-
if (moduleName) {
|
|
103712
|
-
args.push(moduleName);
|
|
103713
|
-
}
|
|
103714
|
-
if (!importRequireStatements) {
|
|
103715
|
-
var createRequireName = factory.createUniqueName("_createRequire", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
103716
|
-
var importStatement = factory.createImportDeclaration(
|
|
103717
|
-
/*decorators*/ undefined,
|
|
103718
|
-
/*modifiers*/ undefined, factory.createImportClause(
|
|
103719
|
-
/*isTypeOnly*/ false,
|
|
103720
|
-
/*name*/ undefined, factory.createNamedImports([
|
|
103721
|
-
factory.createImportSpecifier(factory.createIdentifier("createRequire"), createRequireName)
|
|
103722
|
-
])), factory.createStringLiteral("module"));
|
|
103723
|
-
var requireHelperName = factory.createUniqueName("__require", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
103724
|
-
var requireStatement = factory.createVariableStatement(
|
|
103725
|
-
/*modifiers*/ undefined, factory.createVariableDeclarationList([
|
|
103726
|
-
factory.createVariableDeclaration(requireHelperName,
|
|
103727
|
-
/*exclamationToken*/ undefined,
|
|
103728
|
-
/*type*/ undefined, factory.createCallExpression(factory.cloneNode(createRequireName), /*typeArguments*/ undefined, [
|
|
103729
|
-
factory.createPropertyAccessExpression(factory.createMetaProperty(100 /* ImportKeyword */, factory.createIdentifier("meta")), factory.createIdentifier("url"))
|
|
103730
|
-
]))
|
|
103731
|
-
],
|
|
103732
|
-
/*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */));
|
|
103733
|
-
importRequireStatements = [importStatement, requireStatement];
|
|
103734
|
-
}
|
|
103735
|
-
var name = importRequireStatements[1].declarationList.declarations[0].name;
|
|
103736
|
-
ts.Debug.assertNode(name, ts.isIdentifier);
|
|
103737
|
-
return factory.createCallExpression(factory.cloneNode(name), /*typeArguments*/ undefined, args);
|
|
103738
|
-
}
|
|
103739
|
-
/**
|
|
103740
|
-
* Visits an ImportEqualsDeclaration node.
|
|
103741
|
-
*
|
|
103742
|
-
* @param node The node to visit.
|
|
103743
|
-
*/
|
|
103744
|
-
function visitImportEqualsDeclaration(node) {
|
|
103745
|
-
ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer.");
|
|
103746
|
-
var statements;
|
|
103747
|
-
statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createVariableStatement(
|
|
103748
|
-
/*modifiers*/ undefined, factory.createVariableDeclarationList([
|
|
103749
|
-
factory.createVariableDeclaration(factory.cloneNode(node.name),
|
|
103750
|
-
/*exclamationToken*/ undefined,
|
|
103751
|
-
/*type*/ undefined, createRequireCall(node))
|
|
103752
|
-
],
|
|
103753
|
-
/*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */)), node), node));
|
|
103754
|
-
statements = appendExportsOfImportEqualsDeclaration(statements, node);
|
|
103755
|
-
return ts.singleOrMany(statements);
|
|
103756
|
-
}
|
|
103757
|
-
function appendExportsOfImportEqualsDeclaration(statements, node) {
|
|
103758
|
-
if (ts.hasSyntacticModifier(node, 1 /* Export */)) {
|
|
103759
|
-
statements = ts.append(statements, factory.createExportDeclaration(
|
|
103760
|
-
/*decorators*/ undefined,
|
|
103761
|
-
/*modifiers*/ undefined, node.isTypeOnly, factory.createNamedExports([factory.createExportSpecifier(/*propertyName*/ undefined, ts.idText(node.name))])));
|
|
103762
|
-
}
|
|
103763
|
-
return statements;
|
|
103764
|
-
}
|
|
103765
103231
|
function visitExportAssignment(node) {
|
|
103766
103232
|
// Elide `export=` as it is not legal with --module ES6
|
|
103767
103233
|
return node.isExportEquals ? undefined : node;
|
|
@@ -103839,78 +103305,6 @@ var ts;
|
|
|
103839
103305
|
}
|
|
103840
103306
|
ts.transformECMAScriptModule = transformECMAScriptModule;
|
|
103841
103307
|
})(ts || (ts = {}));
|
|
103842
|
-
/*@internal*/
|
|
103843
|
-
var ts;
|
|
103844
|
-
(function (ts) {
|
|
103845
|
-
function transformNodeModule(context) {
|
|
103846
|
-
var previousOnSubstituteNode = context.onSubstituteNode;
|
|
103847
|
-
var previousOnEmitNode = context.onEmitNode;
|
|
103848
|
-
var esmTransform = ts.transformECMAScriptModule(context);
|
|
103849
|
-
var esmOnSubstituteNode = context.onSubstituteNode;
|
|
103850
|
-
var esmOnEmitNode = context.onEmitNode;
|
|
103851
|
-
context.onSubstituteNode = previousOnSubstituteNode;
|
|
103852
|
-
context.onEmitNode = previousOnEmitNode;
|
|
103853
|
-
var cjsTransform = ts.transformModule(context);
|
|
103854
|
-
var cjsOnSubstituteNode = context.onSubstituteNode;
|
|
103855
|
-
var cjsOnEmitNode = context.onEmitNode;
|
|
103856
|
-
context.onSubstituteNode = onSubstituteNode;
|
|
103857
|
-
context.onEmitNode = onEmitNode;
|
|
103858
|
-
context.enableSubstitution(300 /* SourceFile */);
|
|
103859
|
-
context.enableEmitNotification(300 /* SourceFile */);
|
|
103860
|
-
var currentSourceFile;
|
|
103861
|
-
return transformSourceFileOrBundle;
|
|
103862
|
-
function onSubstituteNode(hint, node) {
|
|
103863
|
-
if (ts.isSourceFile(node)) {
|
|
103864
|
-
currentSourceFile = node;
|
|
103865
|
-
// Neither component transform wants substitution notifications for `SourceFile`s, and, in fact, relies on
|
|
103866
|
-
// the source file emit notification to setup scope variables for substitutions (so we _cannot_ call their substitute
|
|
103867
|
-
// functions on source files safely, as that context only gets setup in a later pipeline phase!)
|
|
103868
|
-
return previousOnSubstituteNode(hint, node);
|
|
103869
|
-
}
|
|
103870
|
-
else {
|
|
103871
|
-
if (!currentSourceFile) {
|
|
103872
|
-
return previousOnSubstituteNode(hint, node);
|
|
103873
|
-
}
|
|
103874
|
-
if (currentSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
103875
|
-
return esmOnSubstituteNode(hint, node);
|
|
103876
|
-
}
|
|
103877
|
-
return cjsOnSubstituteNode(hint, node);
|
|
103878
|
-
}
|
|
103879
|
-
}
|
|
103880
|
-
function onEmitNode(hint, node, emitCallback) {
|
|
103881
|
-
if (ts.isSourceFile(node)) {
|
|
103882
|
-
currentSourceFile = node;
|
|
103883
|
-
}
|
|
103884
|
-
if (!currentSourceFile) {
|
|
103885
|
-
return previousOnEmitNode(hint, node, emitCallback);
|
|
103886
|
-
}
|
|
103887
|
-
if (currentSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
103888
|
-
return esmOnEmitNode(hint, node, emitCallback);
|
|
103889
|
-
}
|
|
103890
|
-
return cjsOnEmitNode(hint, node, emitCallback);
|
|
103891
|
-
}
|
|
103892
|
-
function getModuleTransformForFile(file) {
|
|
103893
|
-
return file.impliedNodeFormat === ts.ModuleKind.ESNext ? esmTransform : cjsTransform;
|
|
103894
|
-
}
|
|
103895
|
-
function transformSourceFile(node) {
|
|
103896
|
-
if (node.isDeclarationFile) {
|
|
103897
|
-
return node;
|
|
103898
|
-
}
|
|
103899
|
-
currentSourceFile = node;
|
|
103900
|
-
var result = getModuleTransformForFile(node)(node);
|
|
103901
|
-
currentSourceFile = undefined;
|
|
103902
|
-
ts.Debug.assert(ts.isSourceFile(result));
|
|
103903
|
-
return result;
|
|
103904
|
-
}
|
|
103905
|
-
function transformSourceFileOrBundle(node) {
|
|
103906
|
-
return node.kind === 300 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node);
|
|
103907
|
-
}
|
|
103908
|
-
function transformBundle(node) {
|
|
103909
|
-
return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends);
|
|
103910
|
-
}
|
|
103911
|
-
}
|
|
103912
|
-
ts.transformNodeModule = transformNodeModule;
|
|
103913
|
-
})(ts || (ts = {}));
|
|
103914
103308
|
/* @internal */
|
|
103915
103309
|
var ts;
|
|
103916
103310
|
(function (ts) {
|
|
@@ -105728,9 +105122,6 @@ var ts;
|
|
|
105728
105122
|
return ts.transformECMAScriptModule;
|
|
105729
105123
|
case ts.ModuleKind.System:
|
|
105730
105124
|
return ts.transformSystemModule;
|
|
105731
|
-
case ts.ModuleKind.Node12:
|
|
105732
|
-
case ts.ModuleKind.NodeNext:
|
|
105733
|
-
return ts.transformNodeModule;
|
|
105734
105125
|
default:
|
|
105735
105126
|
return ts.transformModule;
|
|
105736
105127
|
}
|
|
@@ -106341,7 +105732,7 @@ var ts;
|
|
|
106341
105732
|
return getOutputPathsForBundle(options, forceDtsPaths);
|
|
106342
105733
|
}
|
|
106343
105734
|
else {
|
|
106344
|
-
var ownOutputFilePath = ts.getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile
|
|
105735
|
+
var ownOutputFilePath = ts.getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile, options));
|
|
106345
105736
|
var isJsonFile = ts.isJsonSourceFile(sourceFile);
|
|
106346
105737
|
// If json file emits to the same location skip writing it, if emitDeclarationOnly skip writing it
|
|
106347
105738
|
var isJsonEmittedToSameLocation = isJsonFile &&
|
|
@@ -106357,13 +105748,26 @@ var ts;
|
|
|
106357
105748
|
function getSourceMapFilePath(jsFilePath, options) {
|
|
106358
105749
|
return (options.sourceMap && !options.inlineSourceMap) ? jsFilePath + ".map" : undefined;
|
|
106359
105750
|
}
|
|
105751
|
+
// JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also.
|
|
105752
|
+
// So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve.
|
|
105753
|
+
// For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve
|
|
106360
105754
|
/* @internal */
|
|
106361
|
-
function getOutputExtension(
|
|
106362
|
-
|
|
106363
|
-
|
|
106364
|
-
|
|
106365
|
-
|
|
106366
|
-
|
|
105755
|
+
function getOutputExtension(sourceFile, options) {
|
|
105756
|
+
if (ts.isJsonSourceFile(sourceFile)) {
|
|
105757
|
+
return ".json" /* Json */;
|
|
105758
|
+
}
|
|
105759
|
+
if (options.jsx === 1 /* Preserve */) {
|
|
105760
|
+
if (ts.isSourceFileJS(sourceFile)) {
|
|
105761
|
+
if (ts.fileExtensionIs(sourceFile.fileName, ".jsx" /* Jsx */)) {
|
|
105762
|
+
return ".jsx" /* Jsx */;
|
|
105763
|
+
}
|
|
105764
|
+
}
|
|
105765
|
+
else if (sourceFile.languageVariant === 1 /* JSX */) {
|
|
105766
|
+
// TypeScript source file preserving JSX syntax
|
|
105767
|
+
return ".jsx" /* Jsx */;
|
|
105768
|
+
}
|
|
105769
|
+
}
|
|
105770
|
+
return ".js" /* Js */;
|
|
106367
105771
|
}
|
|
106368
105772
|
ts.getOutputExtension = getOutputExtension;
|
|
106369
105773
|
function getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, outputDir, getCommonSourceDirectory) {
|
|
@@ -106373,14 +105777,19 @@ var ts;
|
|
|
106373
105777
|
}
|
|
106374
105778
|
/* @internal */
|
|
106375
105779
|
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory) {
|
|
106376
|
-
|
|
105780
|
+
ts.Debug.assert(!ts.fileExtensionIs(inputFileName, ".d.ts" /* Dts */) && !ts.fileExtensionIs(inputFileName, ".json" /* Json */));
|
|
105781
|
+
return ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir, getCommonSourceDirectory), ".d.ts" /* Dts */);
|
|
106377
105782
|
}
|
|
106378
105783
|
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
|
106379
105784
|
function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory) {
|
|
106380
105785
|
if (configFile.options.emitDeclarationOnly)
|
|
106381
105786
|
return undefined;
|
|
106382
105787
|
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */);
|
|
106383
|
-
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory),
|
|
105788
|
+
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), isJsonFile ?
|
|
105789
|
+
".json" /* Json */ :
|
|
105790
|
+
configFile.options.jsx === 1 /* Preserve */ && (ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) || ts.fileExtensionIs(inputFileName, ".jsx" /* Jsx */)) ?
|
|
105791
|
+
".jsx" /* Jsx */ :
|
|
105792
|
+
".js" /* Js */);
|
|
106384
105793
|
return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ?
|
|
106385
105794
|
outputFileName :
|
|
106386
105795
|
undefined;
|
|
@@ -106451,7 +105860,7 @@ var ts;
|
|
|
106451
105860
|
/*@internal*/
|
|
106452
105861
|
function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
|
|
106453
105862
|
var options = _a.options, fileNames = _a.fileNames;
|
|
106454
|
-
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.
|
|
105863
|
+
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensions)) && !ts.fileExtensionIs(file, ".d.ts" /* Dts */); }); }, ts.getDirectoryPath(ts.normalizeSlashes(ts.Debug.checkDefined(options.configFilePath))), ts.createGetCanonicalFileName(!ignoreCase));
|
|
106455
105864
|
}
|
|
106456
105865
|
ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
|
|
106457
105866
|
/*@internal*/
|
|
@@ -111686,7 +111095,7 @@ var ts;
|
|
|
111686
111095
|
if (options.declarationDir)
|
|
111687
111096
|
return false;
|
|
111688
111097
|
}
|
|
111689
|
-
else if (!ts.fileExtensionIsOneOf(fileOrDirectoryPath, ts.
|
|
111098
|
+
else if (!ts.fileExtensionIsOneOf(fileOrDirectoryPath, ts.supportedJSExtensions)) {
|
|
111690
111099
|
return false;
|
|
111691
111100
|
}
|
|
111692
111101
|
// just check if sourceFile with the name exists
|
|
@@ -112299,82 +111708,6 @@ var ts;
|
|
|
112299
111708
|
}
|
|
112300
111709
|
ts.loadWithLocalCache = loadWithLocalCache;
|
|
112301
111710
|
/* @internal */
|
|
112302
|
-
/**
|
|
112303
|
-
* Are you sure you want to use this? If you have a bound and parent pointer'd sourcefile, as in the checker, getModeForUsageLocation is much more ergonomic
|
|
112304
|
-
*/
|
|
112305
|
-
function getModeForResolutionAtIndex(file, index) {
|
|
112306
|
-
if (file.impliedNodeFormat === undefined)
|
|
112307
|
-
return undefined;
|
|
112308
|
-
if (file.impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
112309
|
-
var usage_1 = getModuleNameStringLiteralAt(file, index);
|
|
112310
|
-
if (usage_1.parent) {
|
|
112311
|
-
// parent pointers are set - do the fast thing and just check if the parent is an import call expression
|
|
112312
|
-
return ts.isImportCall(ts.walkUpParenthesizedExpressions(usage_1.parent)) ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
112313
|
-
}
|
|
112314
|
-
// We can't rely on parent pointers being set - so instead we search for the usage in the top-level statements in the file,
|
|
112315
|
-
// since that's the only place (module) import declarations and module augmentations (or definitions) are allowed.
|
|
112316
|
-
// If the usage is anywhere else, by process of elimination, it must be an import call usage.
|
|
112317
|
-
if (ts.some(file.statements, function (s) {
|
|
112318
|
-
return (ts.isImportDeclaration(s) && s.moduleSpecifier === usage_1) ||
|
|
112319
|
-
(ts.isImportEqualsDeclaration(s) && ts.isExternalModuleReference(s.moduleReference) && ts.skipParentheses(s.moduleReference.expression) === usage_1) ||
|
|
112320
|
-
(ts.isModuleDeclaration(s) && s.name === usage_1) ||
|
|
112321
|
-
(ts.isExportDeclaration(s) && s.moduleSpecifier === usage_1);
|
|
112322
|
-
})) {
|
|
112323
|
-
return ts.ModuleKind.CommonJS;
|
|
112324
|
-
}
|
|
112325
|
-
return ts.ModuleKind.ESNext;
|
|
112326
|
-
}
|
|
112327
|
-
// in an esnext format file, import require statements desugar to `require` calls, so should follow cjs resolution rules
|
|
112328
|
-
var usage = getModuleNameStringLiteralAt(file, index);
|
|
112329
|
-
if (usage.parent) {
|
|
112330
|
-
// parent pointers are set - do the fast thing and just check if the parent is an import require statement
|
|
112331
|
-
return ts.isImportEqualsDeclaration(ts.walkUpParenthesizedExpressions(usage.parent).parent) ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
112332
|
-
}
|
|
112333
|
-
// parent pointers are unset - check to see if the usage is refered to in any of the top-level import require statements, as that's the only place they should be valid
|
|
112334
|
-
if (ts.some(file.statements, function (s) { return ts.isImportEqualsDeclaration(s) && ts.isExternalModuleReference(s.moduleReference) && ts.skipParentheses(s.moduleReference.expression) === usage; })) {
|
|
112335
|
-
return ts.ModuleKind.CommonJS;
|
|
112336
|
-
}
|
|
112337
|
-
return ts.ModuleKind.ESNext;
|
|
112338
|
-
}
|
|
112339
|
-
ts.getModeForResolutionAtIndex = getModeForResolutionAtIndex;
|
|
112340
|
-
/* @internal */
|
|
112341
|
-
function getModeForUsageLocation(file, usage) {
|
|
112342
|
-
if (file.impliedNodeFormat === undefined)
|
|
112343
|
-
return undefined;
|
|
112344
|
-
if (file.impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
112345
|
-
// in cjs files, import call expressions are esm format, otherwise everything is cjs
|
|
112346
|
-
return ts.isImportCall(ts.walkUpParenthesizedExpressions(usage.parent)) ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
112347
|
-
}
|
|
112348
|
-
// in esm files, import=require statements are cjs format, otherwise everything is esm
|
|
112349
|
-
return ts.isImportEqualsDeclaration(ts.walkUpParenthesizedExpressions(usage.parent).parent) ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
112350
|
-
}
|
|
112351
|
-
ts.getModeForUsageLocation = getModeForUsageLocation;
|
|
112352
|
-
/* @internal */
|
|
112353
|
-
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, loader) {
|
|
112354
|
-
if (names.length === 0) {
|
|
112355
|
-
return [];
|
|
112356
|
-
}
|
|
112357
|
-
var resolutions = [];
|
|
112358
|
-
var cache = new ts.Map();
|
|
112359
|
-
var i = 0;
|
|
112360
|
-
for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
|
|
112361
|
-
var name = names_3[_i];
|
|
112362
|
-
var result = void 0;
|
|
112363
|
-
var mode = getModeForResolutionAtIndex(containingFile, i);
|
|
112364
|
-
i++;
|
|
112365
|
-
var cacheKey = mode !== undefined ? mode + "|" + name : name;
|
|
112366
|
-
if (cache.has(cacheKey)) {
|
|
112367
|
-
result = cache.get(cacheKey);
|
|
112368
|
-
}
|
|
112369
|
-
else {
|
|
112370
|
-
cache.set(cacheKey, result = loader(name, mode, containingFileName, redirectedReference));
|
|
112371
|
-
}
|
|
112372
|
-
resolutions.push(result);
|
|
112373
|
-
}
|
|
112374
|
-
return resolutions;
|
|
112375
|
-
}
|
|
112376
|
-
ts.loadWithModeAwareCache = loadWithModeAwareCache;
|
|
112377
|
-
/* @internal */
|
|
112378
111711
|
function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
|
|
112379
111712
|
return forEachProjectReference(/*projectReferences*/ undefined, resolvedProjectReferences, function (resolvedRef, parent) { return resolvedRef && cb(resolvedRef, parent); });
|
|
112380
111713
|
}
|
|
@@ -112432,7 +111765,7 @@ var ts;
|
|
|
112432
111765
|
switch (kind) {
|
|
112433
111766
|
case ts.FileIncludeKind.Import:
|
|
112434
111767
|
var importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
112435
|
-
packageId = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text
|
|
111768
|
+
packageId = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text)) === null || _e === void 0 ? void 0 : _e.packageId;
|
|
112436
111769
|
if (importLiteral.pos === -1)
|
|
112437
111770
|
return { file: file, packageId: packageId, text: importLiteral.text };
|
|
112438
111771
|
pos = ts.skipTrivia(file.text, importLiteral.pos);
|
|
@@ -112443,7 +111776,7 @@ var ts;
|
|
|
112443
111776
|
break;
|
|
112444
111777
|
case ts.FileIncludeKind.TypeReferenceDirective:
|
|
112445
111778
|
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end);
|
|
112446
|
-
packageId = (_g = (_f = file.resolvedTypeReferenceDirectiveNames) === null || _f === void 0 ? void 0 : _f.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName)
|
|
111779
|
+
packageId = (_g = (_f = file.resolvedTypeReferenceDirectiveNames) === null || _f === void 0 ? void 0 : _f.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName))) === null || _g === void 0 ? void 0 : _g.packageId;
|
|
112447
111780
|
break;
|
|
112448
111781
|
case ts.FileIncludeKind.LibReferenceDirective:
|
|
112449
111782
|
(_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
|
|
@@ -112530,33 +111863,6 @@ var ts;
|
|
|
112530
111863
|
configFileParseResult.errors;
|
|
112531
111864
|
}
|
|
112532
111865
|
ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics;
|
|
112533
|
-
/**
|
|
112534
|
-
* A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
|
|
112535
|
-
* `options` parameter.
|
|
112536
|
-
*
|
|
112537
|
-
* @param fileName The normalized absolute path to check the format of (it need not exist on disk)
|
|
112538
|
-
* @param [packageJsonInfoCache] A cache for package file lookups - it's best to have a cache when this function is called often
|
|
112539
|
-
* @param host The ModuleResolutionHost which can perform the filesystem lookups for package json data
|
|
112540
|
-
* @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution`
|
|
112541
|
-
* @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format
|
|
112542
|
-
*/
|
|
112543
|
-
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
112544
|
-
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
112545
|
-
case ts.ModuleResolutionKind.Node12:
|
|
112546
|
-
case ts.ModuleResolutionKind.NodeNext:
|
|
112547
|
-
return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
|
|
112548
|
-
ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
|
|
112549
|
-
ts.fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() :
|
|
112550
|
-
undefined; // other extensions, like `json` or `tsbuildinfo`, are set as `undefined` here but they should never be fed through the transformer pipeline
|
|
112551
|
-
default:
|
|
112552
|
-
return undefined;
|
|
112553
|
-
}
|
|
112554
|
-
function lookupFromPackageJson() {
|
|
112555
|
-
var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
|
|
112556
|
-
return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
112557
|
-
}
|
|
112558
|
-
}
|
|
112559
|
-
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
112560
111866
|
/**
|
|
112561
111867
|
* Determine if source file needs to be re-created even if its text hasn't changed
|
|
112562
111868
|
*/
|
|
@@ -112577,7 +111883,7 @@ var ts;
|
|
|
112577
111883
|
};
|
|
112578
111884
|
}
|
|
112579
111885
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
112580
|
-
var _a, _b, _c
|
|
111886
|
+
var _a, _b, _c;
|
|
112581
111887
|
var createProgramOptions = ts.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; // TODO: GH#18217
|
|
112582
111888
|
var rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences;
|
|
112583
111889
|
var oldProgram = createProgramOptions.oldProgram;
|
|
@@ -112619,7 +111925,7 @@ var ts;
|
|
|
112619
111925
|
var programDiagnostics = ts.createDiagnosticCollection();
|
|
112620
111926
|
var currentDirectory = host.getCurrentDirectory();
|
|
112621
111927
|
var supportedExtensions = ts.getSupportedExtensions(options);
|
|
112622
|
-
var supportedExtensionsWithJsonIfResolveJsonModule = ts.
|
|
111928
|
+
var supportedExtensionsWithJsonIfResolveJsonModule = ts.getSuppoertedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
|
|
112623
111929
|
// Map storing if there is emit blocking diagnostics for given input
|
|
112624
111930
|
var hasEmitBlockingDiagnostics = new ts.Map();
|
|
112625
111931
|
var _compilerOptionsObjectLiteralSyntax;
|
|
@@ -112628,7 +111934,7 @@ var ts;
|
|
|
112628
111934
|
var actualResolveModuleNamesWorker;
|
|
112629
111935
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|
|
112630
111936
|
if (host.resolveModuleNames) {
|
|
112631
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile,
|
|
111937
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFile, reusedNames, redirectedReference, options).map(function (resolved) {
|
|
112632
111938
|
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
|
|
112633
111939
|
if (!resolved || resolved.extension !== undefined) {
|
|
112634
111940
|
return resolved;
|
|
@@ -112637,12 +111943,11 @@ var ts;
|
|
|
112637
111943
|
withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName);
|
|
112638
111944
|
return withExtension;
|
|
112639
111945
|
}); };
|
|
112640
|
-
moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
112641
111946
|
}
|
|
112642
111947
|
else {
|
|
112643
111948
|
moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
112644
|
-
var loader_1 = function (moduleName,
|
|
112645
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile,
|
|
111949
|
+
var loader_1 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache, redirectedReference).resolvedModule; }; // TODO: GH#18217
|
|
111950
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, _reusedNames, redirectedReference) { return loadWithLocalCache(ts.Debug.checkEachDefined(moduleNames), containingFile, redirectedReference, loader_1); };
|
|
112646
111951
|
}
|
|
112647
111952
|
var actualResolveTypeReferenceDirectiveNamesWorker;
|
|
112648
111953
|
if (host.resolveTypeReferenceDirectives) {
|
|
@@ -112678,9 +111983,9 @@ var ts;
|
|
|
112678
111983
|
var projectReferenceRedirects;
|
|
112679
111984
|
var mapFromFileToProjectReferenceRedirects;
|
|
112680
111985
|
var mapFromToProjectReferenceRedirectSource;
|
|
112681
|
-
var useSourceOfProjectReferenceRedirect = !!((
|
|
111986
|
+
var useSourceOfProjectReferenceRedirect = !!((_a = host.useSourceOfProjectReferenceRedirect) === null || _a === void 0 ? void 0 : _a.call(host)) &&
|
|
112682
111987
|
!options.disableSourceOfProjectReferenceRedirect;
|
|
112683
|
-
var
|
|
111988
|
+
var _d = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
112684
111989
|
compilerHost: host,
|
|
112685
111990
|
getSymlinkCache: getSymlinkCache,
|
|
112686
111991
|
useSourceOfProjectReferenceRedirect: useSourceOfProjectReferenceRedirect,
|
|
@@ -112688,7 +111993,7 @@ var ts;
|
|
|
112688
111993
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
112689
111994
|
getSourceOfProjectReferenceRedirect: getSourceOfProjectReferenceRedirect,
|
|
112690
111995
|
forEachResolvedProjectReference: forEachResolvedProjectReference
|
|
112691
|
-
}), onProgramCreateComplete =
|
|
111996
|
+
}), onProgramCreateComplete = _d.onProgramCreateComplete, fileExists = _d.fileExists, directoryExists = _d.directoryExists;
|
|
112692
111997
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
112693
111998
|
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
112694
111999
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -112747,7 +112052,7 @@ var ts;
|
|
|
112747
112052
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
112748
112053
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
112749
112054
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
112750
|
-
processTypeReferenceDirective(typeReferences[i], resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (
|
|
112055
|
+
processTypeReferenceDirective(typeReferences[i], resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_b = resolutions[i]) === null || _b === void 0 ? void 0 : _b.packageId });
|
|
112751
112056
|
}
|
|
112752
112057
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
112753
112058
|
}
|
|
@@ -112764,7 +112069,7 @@ var ts;
|
|
|
112764
112069
|
}
|
|
112765
112070
|
else {
|
|
112766
112071
|
ts.forEach(options.lib, function (libFileName, index) {
|
|
112767
|
-
processRootFile(
|
|
112072
|
+
processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.LibFile, index: index });
|
|
112768
112073
|
});
|
|
112769
112074
|
}
|
|
112770
112075
|
}
|
|
@@ -112865,7 +112170,7 @@ var ts;
|
|
|
112865
112170
|
fileExists: fileExists,
|
|
112866
112171
|
directoryExists: directoryExists,
|
|
112867
112172
|
getSymlinkCache: getSymlinkCache,
|
|
112868
|
-
realpath: (
|
|
112173
|
+
realpath: (_c = host.realpath) === null || _c === void 0 ? void 0 : _c.bind(host),
|
|
112869
112174
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
112870
112175
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
112871
112176
|
structureIsReused: structureIsReused,
|
|
@@ -112895,7 +112200,7 @@ var ts;
|
|
|
112895
112200
|
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
112896
112201
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "resolveModuleNamesWorker", { containingFileName: containingFileName });
|
|
112897
112202
|
ts.performance.mark("beforeResolveModule");
|
|
112898
|
-
var result = actualResolveModuleNamesWorker(moduleNames,
|
|
112203
|
+
var result = actualResolveModuleNamesWorker(moduleNames, containingFileName, reusedNames, redirectedReference);
|
|
112899
112204
|
ts.performance.mark("afterResolveModule");
|
|
112900
112205
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
112901
112206
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -112961,8 +112266,8 @@ var ts;
|
|
|
112961
112266
|
}
|
|
112962
112267
|
return ts.libs.length + 2;
|
|
112963
112268
|
}
|
|
112964
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile
|
|
112965
|
-
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache
|
|
112269
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
|
|
112270
|
+
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache);
|
|
112966
112271
|
}
|
|
112967
112272
|
function toPath(fileName) {
|
|
112968
112273
|
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
@@ -113004,11 +112309,9 @@ var ts;
|
|
|
113004
112309
|
// Since we assume the filesystem does not change during program creation,
|
|
113005
112310
|
// it is safe to reuse resolutions from the earlier call.
|
|
113006
112311
|
var result_14 = [];
|
|
113007
|
-
var i = 0;
|
|
113008
112312
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
113009
112313
|
var moduleName = moduleNames_1[_i];
|
|
113010
|
-
var resolvedModule = file.resolvedModules.get(moduleName
|
|
113011
|
-
i++;
|
|
112314
|
+
var resolvedModule = file.resolvedModules.get(moduleName);
|
|
113012
112315
|
result_14.push(resolvedModule);
|
|
113013
112316
|
}
|
|
113014
112317
|
return result_14;
|
|
@@ -113036,7 +112339,7 @@ var ts;
|
|
|
113036
112339
|
var moduleName = moduleNames[i];
|
|
113037
112340
|
// If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
|
|
113038
112341
|
if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
113039
|
-
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName
|
|
112342
|
+
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName);
|
|
113040
112343
|
if (oldResolvedModule) {
|
|
113041
112344
|
if (ts.isTraceEnabled(options, host)) {
|
|
113042
112345
|
ts.trace(host, oldResolvedModule.packageId ?
|
|
@@ -113060,7 +112363,7 @@ var ts;
|
|
|
113060
112363
|
}
|
|
113061
112364
|
}
|
|
113062
112365
|
else {
|
|
113063
|
-
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName
|
|
112366
|
+
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName);
|
|
113064
112367
|
}
|
|
113065
112368
|
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
113066
112369
|
(result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
@@ -113097,8 +112400,8 @@ var ts;
|
|
|
113097
112400
|
return result;
|
|
113098
112401
|
// If we change our policy of rechecking failed lookups on each program create,
|
|
113099
112402
|
// we should adjust the value returned here.
|
|
113100
|
-
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName
|
|
113101
|
-
var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName
|
|
112403
|
+
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
112404
|
+
var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName);
|
|
113102
112405
|
var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
113103
112406
|
if (resolutionToFile && resolvedFile) {
|
|
113104
112407
|
// In the old program, we resolved to an ambient module that was in the same
|
|
@@ -113181,8 +112484,8 @@ var ts;
|
|
|
113181
112484
|
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
|
|
113182
112485
|
var oldSourceFile = oldSourceFiles_2[_i];
|
|
113183
112486
|
var newSourceFile = host.getSourceFileByPath
|
|
113184
|
-
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath,
|
|
113185
|
-
: host.getSourceFile(oldSourceFile.fileName,
|
|
112487
|
+
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, options.target, /*onError*/ undefined, shouldCreateNewSourceFile)
|
|
112488
|
+
: host.getSourceFile(oldSourceFile.fileName, options.target, /*onError*/ undefined, shouldCreateNewSourceFile); // TODO: GH#18217
|
|
113186
112489
|
if (!newSourceFile) {
|
|
113187
112490
|
return 0 /* Not */;
|
|
113188
112491
|
}
|
|
@@ -113289,10 +112592,10 @@ var ts;
|
|
|
113289
112592
|
var moduleNames = getModuleNames(newSourceFile);
|
|
113290
112593
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
113291
112594
|
// ensure that module resolution results are still correct
|
|
113292
|
-
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules,
|
|
112595
|
+
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo);
|
|
113293
112596
|
if (resolutionsChanged) {
|
|
113294
112597
|
structureIsReused = 1 /* SafeModules */;
|
|
113295
|
-
newSourceFile.resolvedModules = ts.
|
|
112598
|
+
newSourceFile.resolvedModules = ts.zipToMap(moduleNames, resolutions);
|
|
113296
112599
|
}
|
|
113297
112600
|
else {
|
|
113298
112601
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
@@ -113301,10 +112604,10 @@ var ts;
|
|
|
113301
112604
|
var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (ref) { return ts.toFileNameLowerCase(ref.fileName); });
|
|
113302
112605
|
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
113303
112606
|
// ensure that types resolutions are still correct
|
|
113304
|
-
var typeReferenceEesolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames,
|
|
112607
|
+
var typeReferenceEesolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo);
|
|
113305
112608
|
if (typeReferenceEesolutionsChanged) {
|
|
113306
112609
|
structureIsReused = 1 /* SafeModules */;
|
|
113307
|
-
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.
|
|
112610
|
+
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToMap(typesReferenceDirectives, typeReferenceResolutions);
|
|
113308
112611
|
}
|
|
113309
112612
|
else {
|
|
113310
112613
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
@@ -113428,7 +112731,7 @@ var ts;
|
|
|
113428
112731
|
return equalityComparer(file.fileName, getDefaultLibraryFileName());
|
|
113429
112732
|
}
|
|
113430
112733
|
else {
|
|
113431
|
-
return ts.some(options.lib, function (libFileName) { return equalityComparer(file.fileName,
|
|
112734
|
+
return ts.some(options.lib, function (libFileName) { return equalityComparer(file.fileName, pathForLibFile(libFileName)); });
|
|
113432
112735
|
}
|
|
113433
112736
|
}
|
|
113434
112737
|
function getDiagnosticsProducingTypeChecker() {
|
|
@@ -114010,7 +113313,7 @@ var ts;
|
|
|
114010
113313
|
var libName = ts.toFileNameLowerCase(ref.fileName);
|
|
114011
113314
|
var libFileName = ts.libMap.get(libName);
|
|
114012
113315
|
if (libFileName) {
|
|
114013
|
-
return getSourceFile(
|
|
113316
|
+
return getSourceFile(pathForLibFile(libFileName));
|
|
114014
113317
|
}
|
|
114015
113318
|
}
|
|
114016
113319
|
/** This should have similar behavior to 'processSourceFile' without diagnostics or mutation. */
|
|
@@ -114020,13 +113323,13 @@ var ts;
|
|
|
114020
113323
|
function getSourceFileFromReferenceWorker(fileName, getSourceFile, fail, reason) {
|
|
114021
113324
|
if (ts.hasExtension(fileName)) {
|
|
114022
113325
|
var canonicalFileName_1 = host.getCanonicalFileName(fileName);
|
|
114023
|
-
if (!options.allowNonTsExtensions && !ts.forEach(
|
|
113326
|
+
if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensionsWithJsonIfResolveJsonModule, function (extension) { return ts.fileExtensionIs(canonicalFileName_1, extension); })) {
|
|
114024
113327
|
if (fail) {
|
|
114025
113328
|
if (ts.hasJSFileExtension(canonicalFileName_1)) {
|
|
114026
113329
|
fail(ts.Diagnostics.File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option, fileName);
|
|
114027
113330
|
}
|
|
114028
113331
|
else {
|
|
114029
|
-
fail(ts.Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1, fileName, "'" +
|
|
113332
|
+
fail(ts.Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1, fileName, "'" + supportedExtensions.join("', '") + "'");
|
|
114030
113333
|
}
|
|
114031
113334
|
}
|
|
114032
113335
|
return undefined;
|
|
@@ -114056,10 +113359,9 @@ var ts;
|
|
|
114056
113359
|
fail(ts.Diagnostics.File_0_not_found, fileName);
|
|
114057
113360
|
return undefined;
|
|
114058
113361
|
}
|
|
114059
|
-
|
|
114060
|
-
var sourceFileWithAddedExtension = ts.forEach(supportedExtensions[0], function (extension) { return getSourceFile(fileName + extension); });
|
|
113362
|
+
var sourceFileWithAddedExtension = ts.forEach(supportedExtensions, function (extension) { return getSourceFile(fileName + extension); });
|
|
114061
113363
|
if (fail && !sourceFileWithAddedExtension)
|
|
114062
|
-
fail(ts.Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1, fileName, "'" +
|
|
113364
|
+
fail(ts.Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1, fileName, "'" + supportedExtensions.join("', '") + "'");
|
|
114063
113365
|
return sourceFileWithAddedExtension;
|
|
114064
113366
|
}
|
|
114065
113367
|
}
|
|
@@ -114204,7 +113506,7 @@ var ts;
|
|
|
114204
113506
|
}
|
|
114205
113507
|
}
|
|
114206
113508
|
// We haven't looked for this file, do so now and cache result
|
|
114207
|
-
var file = host.getSourceFile(fileName,
|
|
113509
|
+
var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile);
|
|
114208
113510
|
if (packageId) {
|
|
114209
113511
|
var packageIdKey = ts.packageIdToString(packageId);
|
|
114210
113512
|
var fileFromPackageId = packageIdToSourceFile.get(packageIdKey);
|
|
@@ -114232,10 +113534,6 @@ var ts;
|
|
|
114232
113534
|
file.path = path;
|
|
114233
113535
|
file.resolvedPath = toPath(fileName);
|
|
114234
113536
|
file.originalFileName = originalFileName;
|
|
114235
|
-
// It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache
|
|
114236
|
-
// and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way
|
|
114237
|
-
// to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront.
|
|
114238
|
-
file.impliedNodeFormat = getImpliedNodeFormatForFile(file.resolvedPath, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
114239
113537
|
addFileIncludeReason(file, reason);
|
|
114240
113538
|
if (host.useCaseSensitiveFileNames()) {
|
|
114241
113539
|
var pathLowerCase = ts.toFileNameLowerCase(path);
|
|
@@ -114426,13 +113724,31 @@ var ts;
|
|
|
114426
113724
|
resolvedTypeReferenceDirectives.set(typeReferenceDirective, resolvedTypeReferenceDirective);
|
|
114427
113725
|
}
|
|
114428
113726
|
}
|
|
113727
|
+
function pathForLibFile(libFileName) {
|
|
113728
|
+
// Support resolving to lib.dom.d.ts -> @typescript/dom, and
|
|
113729
|
+
// lib.dom.iterable.d.ts -> @typescript/dom/iterable
|
|
113730
|
+
// lib.es2015.symbol.wellknown.d.ts -> @typescript/es2015/symbol-wellknown
|
|
113731
|
+
var components = libFileName.split(".");
|
|
113732
|
+
var path = components[1];
|
|
113733
|
+
var i = 2;
|
|
113734
|
+
while (components[i] && components[i] !== "d") {
|
|
113735
|
+
path += (i === 2 ? "/" : "-") + components[i];
|
|
113736
|
+
i++;
|
|
113737
|
+
}
|
|
113738
|
+
var resolveFrom = ts.combinePaths(currentDirectory, "__lib_node_modules_lookup_" + libFileName + "__.ts");
|
|
113739
|
+
var localOverrideModuleResult = ts.resolveModuleName("@typescript/" + path, resolveFrom, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host, moduleResolutionCache);
|
|
113740
|
+
if (localOverrideModuleResult === null || localOverrideModuleResult === void 0 ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
113741
|
+
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
113742
|
+
}
|
|
113743
|
+
return ts.combinePaths(defaultLibraryPath, libFileName);
|
|
113744
|
+
}
|
|
114429
113745
|
function processLibReferenceDirectives(file) {
|
|
114430
113746
|
ts.forEach(file.libReferenceDirectives, function (libReference, index) {
|
|
114431
113747
|
var libName = ts.toFileNameLowerCase(libReference.fileName);
|
|
114432
113748
|
var libFileName = ts.libMap.get(libName);
|
|
114433
113749
|
if (libFileName) {
|
|
114434
113750
|
// we ignore any 'no-default-lib' reference set on this file.
|
|
114435
|
-
processRootFile(
|
|
113751
|
+
processRootFile(pathForLibFile(libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ true, { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, });
|
|
114436
113752
|
}
|
|
114437
113753
|
else {
|
|
114438
113754
|
var unqualifiedLibName = ts.removeSuffix(ts.removePrefix(libName, "lib."), ".d.ts");
|
|
@@ -114461,7 +113777,7 @@ var ts;
|
|
|
114461
113777
|
var optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a = getRedirectReferenceForResolution(file)) === null || _a === void 0 ? void 0 : _a.commandLine.options : undefined) || options;
|
|
114462
113778
|
for (var index = 0; index < moduleNames.length; index++) {
|
|
114463
113779
|
var resolution = resolutions[index];
|
|
114464
|
-
ts.setResolvedModule(file, moduleNames[index], resolution
|
|
113780
|
+
ts.setResolvedModule(file, moduleNames[index], resolution);
|
|
114465
113781
|
if (!resolution) {
|
|
114466
113782
|
continue;
|
|
114467
113783
|
}
|
|
@@ -114684,7 +114000,7 @@ var ts;
|
|
|
114684
114000
|
if (options.noImplicitUseStrict && ts.getStrictOptionValue(options, "alwaysStrict")) {
|
|
114685
114001
|
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict");
|
|
114686
114002
|
}
|
|
114687
|
-
var languageVersion =
|
|
114003
|
+
var languageVersion = options.target || 0 /* ES3 */;
|
|
114688
114004
|
var firstNonAmbientExternalModuleSourceFile = ts.find(files, function (f) { return ts.isExternalModule(f) && !f.isDeclarationFile; });
|
|
114689
114005
|
if (options.isolatedModules) {
|
|
114690
114006
|
if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES2015 */) {
|
|
@@ -114945,7 +114261,7 @@ var ts;
|
|
|
114945
114261
|
message = ts.Diagnostics.File_is_library_specified_here;
|
|
114946
114262
|
break;
|
|
114947
114263
|
}
|
|
114948
|
-
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value ===
|
|
114264
|
+
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === options.target ? key : undefined; });
|
|
114949
114265
|
configFileNode = target ? getOptionsSyntaxByValue("target", target) : undefined;
|
|
114950
114266
|
message = ts.Diagnostics.File_is_default_library_for_target_specified_here;
|
|
114951
114267
|
break;
|
|
@@ -115113,7 +114429,7 @@ var ts;
|
|
|
115113
114429
|
if (options.outDir) {
|
|
115114
114430
|
return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
|
|
115115
114431
|
}
|
|
115116
|
-
if (ts.fileExtensionIsOneOf(filePath, ts.
|
|
114432
|
+
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensions) || ts.fileExtensionIs(filePath, ".d.ts" /* Dts */)) {
|
|
115117
114433
|
// Otherwise just check if sourceFile with the name exists
|
|
115118
114434
|
var filePathWithoutExtension = ts.removeFileExtension(filePath);
|
|
115119
114435
|
return !!getSourceFileByPath((filePathWithoutExtension + ".ts" /* Ts */)) ||
|
|
@@ -115645,7 +114961,7 @@ var ts;
|
|
|
115645
114961
|
}
|
|
115646
114962
|
}
|
|
115647
114963
|
}
|
|
115648
|
-
fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined
|
|
114964
|
+
fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined });
|
|
115649
114965
|
}
|
|
115650
114966
|
return {
|
|
115651
114967
|
fileInfos: fileInfos,
|
|
@@ -115739,7 +115055,7 @@ var ts;
|
|
|
115739
115055
|
/*forceDtsEmit*/ true);
|
|
115740
115056
|
var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
|
|
115741
115057
|
if (firstDts_1) {
|
|
115742
|
-
ts.Debug.assert(ts.
|
|
115058
|
+
ts.Debug.assert(ts.fileExtensionIs(firstDts_1.name, ".d.ts" /* Dts */), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
|
|
115743
115059
|
latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
|
|
115744
115060
|
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
|
115745
115061
|
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
|
@@ -116063,14 +115379,6 @@ var ts;
|
|
|
116063
115379
|
ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
|
|
116064
115380
|
state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
|
|
116065
115381
|
}
|
|
116066
|
-
if (useOldState) {
|
|
116067
|
-
// Any time the interpretation of a source file changes, mark it as changed
|
|
116068
|
-
ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
|
|
116069
|
-
if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
|
|
116070
|
-
state.changedFilesSet.add(sourceFilePath);
|
|
116071
|
-
}
|
|
116072
|
-
});
|
|
116073
|
-
}
|
|
116074
115382
|
state.buildInfoEmitPending = !!state.changedFilesSet.size;
|
|
116075
115383
|
return state;
|
|
116076
115384
|
}
|
|
@@ -116467,13 +115775,13 @@ var ts;
|
|
|
116467
115775
|
var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
|
|
116468
115776
|
return value.version === actualSignature ?
|
|
116469
115777
|
value.affectsGlobalScope ?
|
|
116470
|
-
{ version: value.version, signature: undefined, affectsGlobalScope: true
|
|
115778
|
+
{ version: value.version, signature: undefined, affectsGlobalScope: true } :
|
|
116471
115779
|
value.version :
|
|
116472
115780
|
actualSignature !== undefined ?
|
|
116473
115781
|
signature === undefined ?
|
|
116474
115782
|
value :
|
|
116475
|
-
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope
|
|
116476
|
-
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope
|
|
115783
|
+
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope } :
|
|
115784
|
+
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope };
|
|
116477
115785
|
});
|
|
116478
115786
|
var referencedMap;
|
|
116479
115787
|
if (state.referencedMap) {
|
|
@@ -116893,10 +116201,10 @@ var ts;
|
|
|
116893
116201
|
}
|
|
116894
116202
|
function toBuilderStateFileInfo(fileInfo) {
|
|
116895
116203
|
return ts.isString(fileInfo) ?
|
|
116896
|
-
{ version: fileInfo, signature: fileInfo, affectsGlobalScope: undefined
|
|
116204
|
+
{ version: fileInfo, signature: fileInfo, affectsGlobalScope: undefined } :
|
|
116897
116205
|
ts.isString(fileInfo.signature) ?
|
|
116898
116206
|
fileInfo :
|
|
116899
|
-
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope
|
|
116207
|
+
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope };
|
|
116900
116208
|
}
|
|
116901
116209
|
ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
|
|
116902
116210
|
function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
|
|
@@ -117234,14 +116542,14 @@ var ts;
|
|
|
117234
116542
|
}
|
|
117235
116543
|
function resolveNamesWithLocalCache(_a) {
|
|
117236
116544
|
var _b, _c, _d;
|
|
117237
|
-
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges
|
|
116545
|
+
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
|
|
117238
116546
|
var path = resolutionHost.toPath(containingFile);
|
|
117239
|
-
var resolutionsInFile = cache.get(path) || cache.set(path, ts.
|
|
116547
|
+
var resolutionsInFile = cache.get(path) || cache.set(path, new ts.Map()).get(path);
|
|
117240
116548
|
var dirPath = ts.getDirectoryPath(path);
|
|
117241
116549
|
var perDirectoryCache = perDirectoryCacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
117242
116550
|
var perDirectoryResolution = perDirectoryCache.get(dirPath);
|
|
117243
116551
|
if (!perDirectoryResolution) {
|
|
117244
|
-
perDirectoryResolution = ts.
|
|
116552
|
+
perDirectoryResolution = new ts.Map();
|
|
117245
116553
|
perDirectoryCache.set(dirPath, perDirectoryResolution);
|
|
117246
116554
|
}
|
|
117247
116555
|
var resolvedModules = [];
|
|
@@ -117253,20 +116561,17 @@ var ts;
|
|
|
117253
116561
|
var unmatchedRedirects = oldRedirect ?
|
|
117254
116562
|
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
|
|
117255
116563
|
!!redirectedReference;
|
|
117256
|
-
var seenNamesInFile = ts.
|
|
117257
|
-
var
|
|
117258
|
-
|
|
117259
|
-
var
|
|
117260
|
-
var mode = containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
117261
|
-
i++;
|
|
117262
|
-
var resolution = resolutionsInFile.get(name, mode);
|
|
116564
|
+
var seenNamesInFile = new ts.Map();
|
|
116565
|
+
for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
|
|
116566
|
+
var name = names_3[_i];
|
|
116567
|
+
var resolution = resolutionsInFile.get(name);
|
|
117263
116568
|
// Resolution is valid if it is present and not invalidated
|
|
117264
|
-
if (!seenNamesInFile.has(name
|
|
116569
|
+
if (!seenNamesInFile.has(name) &&
|
|
117265
116570
|
unmatchedRedirects || !resolution || resolution.isInvalidated ||
|
|
117266
116571
|
// If the name is unresolved import that was invalidated, recalculate
|
|
117267
116572
|
(hasInvalidatedNonRelativeUnresolvedImport && !ts.isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
117268
116573
|
var existingResolution = resolution;
|
|
117269
|
-
var resolutionInDirectory = perDirectoryResolution.get(name
|
|
116574
|
+
var resolutionInDirectory = perDirectoryResolution.get(name);
|
|
117270
116575
|
if (resolutionInDirectory) {
|
|
117271
116576
|
resolution = resolutionInDirectory;
|
|
117272
116577
|
var host = ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost;
|
|
@@ -117286,10 +116591,10 @@ var ts;
|
|
|
117286
116591
|
}
|
|
117287
116592
|
}
|
|
117288
116593
|
else {
|
|
117289
|
-
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference
|
|
117290
|
-
perDirectoryResolution.set(name,
|
|
116594
|
+
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference);
|
|
116595
|
+
perDirectoryResolution.set(name, resolution);
|
|
117291
116596
|
}
|
|
117292
|
-
resolutionsInFile.set(name,
|
|
116597
|
+
resolutionsInFile.set(name, resolution);
|
|
117293
116598
|
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
117294
116599
|
if (existingResolution) {
|
|
117295
116600
|
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
@@ -117302,7 +116607,7 @@ var ts;
|
|
|
117302
116607
|
}
|
|
117303
116608
|
else {
|
|
117304
116609
|
var host = ((_d = resolutionHost.getCompilerHost) === null || _d === void 0 ? void 0 : _d.call(resolutionHost)) || resolutionHost;
|
|
117305
|
-
if (ts.isTraceEnabled(compilerOptions, host) && !seenNamesInFile.has(name
|
|
116610
|
+
if (ts.isTraceEnabled(compilerOptions, host) && !seenNamesInFile.has(name)) {
|
|
117306
116611
|
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
117307
116612
|
ts.trace(host, loader === resolveModuleName ?
|
|
117308
116613
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
@@ -117318,14 +116623,14 @@ var ts;
|
|
|
117318
116623
|
}
|
|
117319
116624
|
}
|
|
117320
116625
|
ts.Debug.assert(resolution !== undefined && !resolution.isInvalidated);
|
|
117321
|
-
seenNamesInFile.set(name,
|
|
116626
|
+
seenNamesInFile.set(name, true);
|
|
117322
116627
|
resolvedModules.push(getResolutionWithResolvedFileName(resolution));
|
|
117323
116628
|
}
|
|
117324
116629
|
// Stop watching and remove the unused name
|
|
117325
|
-
resolutionsInFile.forEach(function (resolution, name
|
|
117326
|
-
if (!seenNamesInFile.has(name
|
|
116630
|
+
resolutionsInFile.forEach(function (resolution, name) {
|
|
116631
|
+
if (!seenNamesInFile.has(name) && !ts.contains(reusedNames, name)) {
|
|
117327
116632
|
stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
117328
|
-
resolutionsInFile.delete(name
|
|
116633
|
+
resolutionsInFile.delete(name);
|
|
117329
116634
|
}
|
|
117330
116635
|
});
|
|
117331
116636
|
return resolvedModules;
|
|
@@ -117359,7 +116664,7 @@ var ts;
|
|
|
117359
116664
|
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
|
|
117360
116665
|
});
|
|
117361
116666
|
}
|
|
117362
|
-
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference
|
|
116667
|
+
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
117363
116668
|
return resolveNamesWithLocalCache({
|
|
117364
116669
|
names: moduleNames,
|
|
117365
116670
|
containingFile: containingFile,
|
|
@@ -117371,14 +116676,11 @@ var ts;
|
|
|
117371
116676
|
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
|
|
117372
116677
|
reusedNames: reusedNames,
|
|
117373
116678
|
logChanges: logChangesWhenResolvingModule,
|
|
117374
|
-
containingSourceFile: containingSourceFile,
|
|
117375
116679
|
});
|
|
117376
116680
|
}
|
|
117377
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile
|
|
116681
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
|
|
117378
116682
|
var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile));
|
|
117379
|
-
|
|
117380
|
-
return undefined;
|
|
117381
|
-
return cache.get(moduleName, resolutionMode);
|
|
116683
|
+
return cache && cache.get(moduleName);
|
|
117382
116684
|
}
|
|
117383
116685
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
117384
116686
|
return ts.endsWith(dirPath, "/node_modules/@types");
|
|
@@ -118303,7 +117605,7 @@ var ts;
|
|
|
118303
117605
|
if (!host.fileExists)
|
|
118304
117606
|
return;
|
|
118305
117607
|
// We check all js, `node` and `json` extensions in addition to TS, since node module resolution would also choose those over the directory
|
|
118306
|
-
var extensions = ts.
|
|
117608
|
+
var extensions = ts.getSupportedExtensions({ allowJs: true }, [{ extension: "node", isMixedContent: false }, { extension: "json", isMixedContent: false, scriptKind: 6 /* JSON */ }]);
|
|
118307
117609
|
for (var _i = 0, extensions_3 = extensions; _i < extensions_3.length; _i++) {
|
|
118308
117610
|
var e = extensions_3[_i];
|
|
118309
117611
|
var fullPath = path + e;
|
|
@@ -118401,14 +117703,6 @@ var ts;
|
|
|
118401
117703
|
case ".jsx" /* Jsx */:
|
|
118402
117704
|
case ".json" /* Json */:
|
|
118403
117705
|
return ext;
|
|
118404
|
-
case ".d.mts" /* Dmts */:
|
|
118405
|
-
case ".mts" /* Mts */:
|
|
118406
|
-
case ".mjs" /* Mjs */:
|
|
118407
|
-
return ".mjs" /* Mjs */;
|
|
118408
|
-
case ".d.cts" /* Dcts */:
|
|
118409
|
-
case ".cts" /* Cts */:
|
|
118410
|
-
case ".cjs" /* Cjs */:
|
|
118411
|
-
return ".cjs" /* Cjs */;
|
|
118412
117706
|
default:
|
|
118413
117707
|
return undefined;
|
|
118414
117708
|
}
|
|
@@ -118683,7 +117977,7 @@ var ts;
|
|
|
118683
117977
|
case ts.FileIncludeKind.LibFile:
|
|
118684
117978
|
if (reason.index !== undefined)
|
|
118685
117979
|
return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Library_0_specified_in_compilerOptions, options.lib[reason.index]);
|
|
118686
|
-
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value ===
|
|
117980
|
+
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === options.target ? key : undefined; });
|
|
118687
117981
|
return ts.chainDiagnosticMessages(
|
|
118688
117982
|
/*details*/ undefined, target ?
|
|
118689
117983
|
ts.Diagnostics.Default_library_for_target_0 :
|
|
@@ -119106,7 +118400,7 @@ var ts;
|
|
|
119106
118400
|
}
|
|
119107
118401
|
return host.resolveModuleNames.apply(host, args);
|
|
119108
118402
|
}) :
|
|
119109
|
-
(function (moduleNames, containingFile, reusedNames, redirectedReference
|
|
118403
|
+
(function (moduleNames, containingFile, reusedNames, redirectedReference) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); });
|
|
119110
118404
|
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
|
|
119111
118405
|
(function () {
|
|
119112
118406
|
var args = [];
|
|
@@ -119834,11 +119128,10 @@ var ts;
|
|
|
119834
119128
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
119835
119129
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
119836
119130
|
if (!compilerHost.resolveModuleNames) {
|
|
119837
|
-
var loader_3 = function (moduleName,
|
|
119838
|
-
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference
|
|
119839
|
-
return ts.
|
|
119131
|
+
var loader_3 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule; };
|
|
119132
|
+
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference) {
|
|
119133
|
+
return ts.loadWithLocalCache(ts.Debug.checkEachDefined(moduleNames), containingFile, redirectedReference, loader_3);
|
|
119840
119134
|
};
|
|
119841
|
-
compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
|
|
119842
119135
|
}
|
|
119843
119136
|
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
119844
119137
|
var loader_4 = function (moduleName, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache).resolvedTypeReferenceDirective; };
|
|
@@ -121527,12 +120820,6 @@ var ts;
|
|
|
121527
120820
|
ScriptElementKindModifier["jsModifier"] = ".js";
|
|
121528
120821
|
ScriptElementKindModifier["jsxModifier"] = ".jsx";
|
|
121529
120822
|
ScriptElementKindModifier["jsonModifier"] = ".json";
|
|
121530
|
-
ScriptElementKindModifier["dmtsModifier"] = ".d.mts";
|
|
121531
|
-
ScriptElementKindModifier["mtsModifier"] = ".mts";
|
|
121532
|
-
ScriptElementKindModifier["mjsModifier"] = ".mjs";
|
|
121533
|
-
ScriptElementKindModifier["dctsModifier"] = ".d.cts";
|
|
121534
|
-
ScriptElementKindModifier["ctsModifier"] = ".cts";
|
|
121535
|
-
ScriptElementKindModifier["cjsModifier"] = ".cjs";
|
|
121536
120823
|
})(ScriptElementKindModifier = ts.ScriptElementKindModifier || (ts.ScriptElementKindModifier = {}));
|
|
121537
120824
|
var ClassificationTypeNames;
|
|
121538
120825
|
(function (ClassificationTypeNames) {
|
|
@@ -123322,7 +122609,7 @@ var ts;
|
|
|
123322
122609
|
}
|
|
123323
122610
|
ts.programContainsEs6Modules = programContainsEs6Modules;
|
|
123324
122611
|
function compilerOptionsIndicateEs6Modules(compilerOptions) {
|
|
123325
|
-
return !!compilerOptions.module ||
|
|
122612
|
+
return !!compilerOptions.module || compilerOptions.target >= 2 /* ES2015 */ || !!compilerOptions.noEmit;
|
|
123326
122613
|
}
|
|
123327
122614
|
ts.compilerOptionsIndicateEs6Modules = compilerOptionsIndicateEs6Modules;
|
|
123328
122615
|
function createModuleSpecifierResolutionHost(program, host) {
|
|
@@ -126297,12 +125584,6 @@ var ts;
|
|
|
126297
125584
|
case ".jsx" /* Jsx */: return ".jsx" /* jsxModifier */;
|
|
126298
125585
|
case ".ts" /* Ts */: return ".ts" /* tsModifier */;
|
|
126299
125586
|
case ".tsx" /* Tsx */: return ".tsx" /* tsxModifier */;
|
|
126300
|
-
case ".d.mts" /* Dmts */: return ".d.mts" /* dmtsModifier */;
|
|
126301
|
-
case ".mjs" /* Mjs */: return ".mjs" /* mjsModifier */;
|
|
126302
|
-
case ".mts" /* Mts */: return ".mts" /* mtsModifier */;
|
|
126303
|
-
case ".d.cts" /* Dcts */: return ".d.cts" /* dctsModifier */;
|
|
126304
|
-
case ".cjs" /* Cjs */: return ".cjs" /* cjsModifier */;
|
|
126305
|
-
case ".cts" /* Cts */: return ".cts" /* ctsModifier */;
|
|
126306
125587
|
case ".tsbuildinfo" /* TsBuildInfo */: return ts.Debug.fail("Extension " + ".tsbuildinfo" /* TsBuildInfo */ + " is unsupported.");
|
|
126307
125588
|
case undefined: return "" /* none */;
|
|
126308
125589
|
default:
|
|
@@ -126497,7 +125778,7 @@ var ts;
|
|
|
126497
125778
|
}
|
|
126498
125779
|
function getExtensionOptions(compilerOptions, includeExtensionsOption) {
|
|
126499
125780
|
if (includeExtensionsOption === void 0) { includeExtensionsOption = 0 /* Exclude */; }
|
|
126500
|
-
return { extensions:
|
|
125781
|
+
return { extensions: getSupportedExtensionsForModuleResolution(compilerOptions), includeExtensionsOption: includeExtensionsOption };
|
|
126501
125782
|
}
|
|
126502
125783
|
function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, preferences) {
|
|
126503
125784
|
var includeExtensions = preferences.importModuleSpecifierEnding === "js" ? 2 /* ModuleSpecifierCompletion */ : 0 /* Exclude */;
|
|
@@ -126511,8 +125792,8 @@ var ts;
|
|
|
126511
125792
|
}
|
|
126512
125793
|
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
126513
125794
|
var extensions = ts.getSupportedExtensions(compilerOptions);
|
|
126514
|
-
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ?
|
|
126515
|
-
|
|
125795
|
+
return compilerOptions.resolveJsonModule && ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ?
|
|
125796
|
+
extensions.concat(".json" /* Json */) :
|
|
126516
125797
|
extensions;
|
|
126517
125798
|
}
|
|
126518
125799
|
/**
|
|
@@ -127190,15 +126471,15 @@ var ts;
|
|
|
127190
126471
|
var entries = [];
|
|
127191
126472
|
if (isUncheckedFile(sourceFile, compilerOptions)) {
|
|
127192
126473
|
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
127193
|
-
/* contextToken */ undefined, location, sourceFile, typeChecker,
|
|
127194
|
-
getJSCompletionEntries(sourceFile, location.pos, uniqueNames,
|
|
126474
|
+
/* contextToken */ undefined, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
|
|
126475
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target, entries); // TODO: GH#18217
|
|
127195
126476
|
}
|
|
127196
126477
|
else {
|
|
127197
126478
|
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
127198
126479
|
return undefined;
|
|
127199
126480
|
}
|
|
127200
126481
|
getCompletionEntriesFromSymbols(symbols, entries,
|
|
127201
|
-
/* contextToken */ undefined, location, sourceFile, typeChecker,
|
|
126482
|
+
/* contextToken */ undefined, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
|
|
127202
126483
|
}
|
|
127203
126484
|
if (keywordFilters !== 0 /* None */) {
|
|
127204
126485
|
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
@@ -127369,6 +126650,32 @@ var ts;
|
|
|
127369
126650
|
data = originToCompletionEntryData(origin);
|
|
127370
126651
|
hasAction = !importCompletionNode;
|
|
127371
126652
|
}
|
|
126653
|
+
var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location); // TODO: GH#18217
|
|
126654
|
+
if (kind === "JSX attribute" /* jsxAttribute */ && preferences.jsxSnippetCompletion && preferences.jsxSnippetCompletion !== "none") {
|
|
126655
|
+
var useBraces_1 = preferences.jsxSnippetCompletion === "braces";
|
|
126656
|
+
var type = typeChecker.getTypeOfSymbolAtLocation(symbol, location);
|
|
126657
|
+
// If is boolean like or undefined, don't return a snippet we want just to return the completion.
|
|
126658
|
+
if (preferences.jsxSnippetCompletion === "auto"
|
|
126659
|
+
&& !(type.flags & 528 /* BooleanLike */)
|
|
126660
|
+
&& !(type.flags & 1048576 /* Union */ && ts.every(type.types, function (type) { return !!(type.flags & (528 /* BooleanLike */ | 32768 /* Undefined */)); }))) {
|
|
126661
|
+
if (type.flags & 402653316 /* StringLike */ || (type.flags & 1048576 /* Union */ && ts.every(type.types, function (type) { return !!(type.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)); }))) {
|
|
126662
|
+
// If is string like or undefined use quotes
|
|
126663
|
+
insertText = name + "=" + ts.quote(sourceFile, preferences, "$1");
|
|
126664
|
+
isSnippet = true;
|
|
126665
|
+
}
|
|
126666
|
+
else {
|
|
126667
|
+
// Use braces for everything else
|
|
126668
|
+
useBraces_1 = true;
|
|
126669
|
+
}
|
|
126670
|
+
}
|
|
126671
|
+
if (useBraces_1) {
|
|
126672
|
+
insertText = name + "={$1}";
|
|
126673
|
+
isSnippet = true;
|
|
126674
|
+
}
|
|
126675
|
+
if (isSnippet) {
|
|
126676
|
+
replacementSpan = ts.createTextSpanFromNode(location, sourceFile);
|
|
126677
|
+
}
|
|
126678
|
+
}
|
|
127372
126679
|
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
|
|
127373
126680
|
// 'getSymbolKind' which is permissible given that it is backwards compatible; but
|
|
127374
126681
|
// really we should consider passing the meaning for the node so that we don't report
|
|
@@ -127378,7 +126685,7 @@ var ts;
|
|
|
127378
126685
|
// entries (like JavaScript identifier entries).
|
|
127379
126686
|
return {
|
|
127380
126687
|
name: name,
|
|
127381
|
-
kind:
|
|
126688
|
+
kind: kind,
|
|
127382
126689
|
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(typeChecker, symbol),
|
|
127383
126690
|
sortText: sortText,
|
|
127384
126691
|
source: getSourceFromOrigin(origin),
|
|
@@ -127582,7 +126889,7 @@ var ts;
|
|
|
127582
126889
|
// completion entry.
|
|
127583
126890
|
return ts.firstDefined(symbols, function (symbol, index) {
|
|
127584
126891
|
var origin = symbolToOriginInfoMap[index];
|
|
127585
|
-
var info = getCompletionEntryDisplayNameForSymbol(symbol,
|
|
126892
|
+
var info = getCompletionEntryDisplayNameForSymbol(symbol, compilerOptions.target, origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
127586
126893
|
return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source
|
|
127587
126894
|
? { type: "symbol", symbol: symbol, location: location, origin: origin, previousToken: previousToken, isJsxInitializer: isJsxInitializer, isTypeOnlyLocation: isTypeOnlyLocation }
|
|
127588
126895
|
: undefined;
|
|
@@ -127659,7 +126966,7 @@ var ts;
|
|
|
127659
126966
|
var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
|
|
127660
126967
|
var moduleSymbol = origin.moduleSymbol;
|
|
127661
126968
|
var exportedSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
|
|
127662
|
-
var _b = ts.codefix.getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol,
|
|
126969
|
+
var _b = ts.codefix.getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, compilerOptions.target), host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _b.moduleSpecifier, codeAction = _b.codeAction;
|
|
127663
126970
|
ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
|
|
127664
126971
|
return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
|
|
127665
126972
|
}
|
|
@@ -130212,7 +129519,7 @@ var ts;
|
|
|
130212
129519
|
}
|
|
130213
129520
|
function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) {
|
|
130214
129521
|
scriptKind = ts.ensureScriptKind(fileName, scriptKind);
|
|
130215
|
-
var scriptTarget = scriptKind === 6 /* JSON */ ? 100 /* JSON */ :
|
|
129522
|
+
var scriptTarget = scriptKind === 6 /* JSON */ ? 100 /* JSON */ : compilationSettings.target || 1 /* ES5 */;
|
|
130216
129523
|
var bucket = ts.getOrUpdate(buckets, key, function () { return new ts.Map(); });
|
|
130217
129524
|
var bucketEntry = bucket.get(path);
|
|
130218
129525
|
var entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
@@ -131483,7 +130790,7 @@ var ts;
|
|
|
131483
130790
|
if (!options.implementations && ts.isStringLiteralLike(node)) {
|
|
131484
130791
|
if (ts.isModuleSpecifierLike(node)) {
|
|
131485
130792
|
var fileIncludeReasons = program.getFileIncludeReasons();
|
|
131486
|
-
var referencedFileName = (_b = (_a = node.getSourceFile().resolvedModules) === null || _a === void 0 ? void 0 : _a.get(node.text
|
|
130793
|
+
var referencedFileName = (_b = (_a = node.getSourceFile().resolvedModules) === null || _a === void 0 ? void 0 : _a.get(node.text)) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
|
|
131487
130794
|
var referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : undefined;
|
|
131488
130795
|
if (referencedFile) {
|
|
131489
130796
|
return [{ definition: { type: 4 /* String */, node: node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || ts.emptyArray }];
|
|
@@ -133641,10 +132948,9 @@ var ts;
|
|
|
133641
132948
|
return newFileName === undefined ? { newFileName: oldFileName, updated: false } : { newFileName: newFileName, updated: true };
|
|
133642
132949
|
}
|
|
133643
132950
|
else {
|
|
133644
|
-
var mode = ts.getModeForResolutionAtIndex({ statements: importingSourceFile.statements, imports: [importLiteral], moduleAugmentations: [], impliedNodeFormat: importingSourceFile.impliedNodeFormat }, 0);
|
|
133645
132951
|
var resolved = host.resolveModuleNames
|
|
133646
|
-
? host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName
|
|
133647
|
-
: program.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName
|
|
132952
|
+
? host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName)
|
|
132953
|
+
: program.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName);
|
|
133648
132954
|
return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
|
|
133649
132955
|
}
|
|
133650
132956
|
}
|
|
@@ -133869,10 +133175,10 @@ var ts;
|
|
|
133869
133175
|
var file = program.getLibFileFromReference(libReferenceDirective);
|
|
133870
133176
|
return file && { reference: libReferenceDirective, fileName: file.fileName, file: file, unverified: false };
|
|
133871
133177
|
}
|
|
133872
|
-
if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size
|
|
133178
|
+
if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size) {
|
|
133873
133179
|
var node = ts.getTokenAtPosition(sourceFile, position);
|
|
133874
|
-
if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text
|
|
133875
|
-
var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text
|
|
133180
|
+
if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text)) {
|
|
133181
|
+
var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text)) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
|
|
133876
133182
|
var fileName = verifiedFileName || ts.resolvePath(ts.getDirectoryPath(sourceFile.fileName), node.text);
|
|
133877
133183
|
return {
|
|
133878
133184
|
file: program.getSourceFile(fileName),
|
|
@@ -138580,7 +137886,7 @@ var ts;
|
|
|
138580
137886
|
var name = importNameForConvertToDefaultImport(importNode);
|
|
138581
137887
|
if (!name)
|
|
138582
137888
|
continue;
|
|
138583
|
-
var module_1 = ts.getResolvedModule(sourceFile, moduleSpecifier.text
|
|
137889
|
+
var module_1 = ts.getResolvedModule(sourceFile, moduleSpecifier.text);
|
|
138584
137890
|
var resolvedFile = module_1 && program.getSourceFile(module_1.resolvedFileName);
|
|
138585
137891
|
if (resolvedFile && resolvedFile.externalModuleIndicator && ts.isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
|
|
138586
137892
|
diags.push(ts.createDiagnosticForNode(name, ts.Diagnostics.Import_may_be_converted_to_a_default_import));
|
|
@@ -139480,7 +138786,7 @@ var ts;
|
|
|
139480
138786
|
options.allowNonTsExtensions = true;
|
|
139481
138787
|
// if jsx is specified then treat file as .tsx
|
|
139482
138788
|
var inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts");
|
|
139483
|
-
var sourceFile = ts.createSourceFile(inputFileName, input,
|
|
138789
|
+
var sourceFile = ts.createSourceFile(inputFileName, input, options.target); // TODO: GH#18217
|
|
139484
138790
|
if (transpileOptions.moduleName) {
|
|
139485
138791
|
sourceFile.moduleName = transpileOptions.moduleName;
|
|
139486
138792
|
}
|
|
@@ -145052,7 +144358,7 @@ var ts;
|
|
|
145052
144358
|
return propName;
|
|
145053
144359
|
}
|
|
145054
144360
|
if (ts.isStringLiteralLike(propName)) {
|
|
145055
|
-
return ts.isIdentifierText(propName.text,
|
|
144361
|
+
return ts.isIdentifierText(propName.text, compilerOptions.target) ? ts.factory.createIdentifier(propName.text)
|
|
145056
144362
|
: ts.isNoSubstitutionTemplateLiteral(propName) ? ts.factory.createStringLiteral(propName.text, quotePreference === 0 /* Single */)
|
|
145057
144363
|
: propName;
|
|
145058
144364
|
}
|
|
@@ -145800,7 +145106,7 @@ var ts;
|
|
|
145800
145106
|
getCodeActions: function (context) {
|
|
145801
145107
|
var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences;
|
|
145802
145108
|
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) {
|
|
145803
|
-
var moduleExportsChangedToDefault = convertFileToEs6Module(sourceFile, program.getTypeChecker(), changes,
|
|
145109
|
+
var moduleExportsChangedToDefault = convertFileToEs6Module(sourceFile, program.getTypeChecker(), changes, program.getCompilerOptions().target, ts.getQuotePreference(sourceFile, preferences));
|
|
145804
145110
|
if (moduleExportsChangedToDefault) {
|
|
145805
145111
|
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
|
|
145806
145112
|
var importingFile = _a[_i];
|
|
@@ -145815,7 +145121,7 @@ var ts;
|
|
|
145815
145121
|
function fixImportOfModuleExports(importingFile, exportingFile, changes, quotePreference) {
|
|
145816
145122
|
for (var _i = 0, _a = importingFile.imports; _i < _a.length; _i++) {
|
|
145817
145123
|
var moduleSpecifier = _a[_i];
|
|
145818
|
-
var imported = ts.getResolvedModule(importingFile, moduleSpecifier.text
|
|
145124
|
+
var imported = ts.getResolvedModule(importingFile, moduleSpecifier.text);
|
|
145819
145125
|
if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
|
|
145820
145126
|
continue;
|
|
145821
145127
|
}
|
|
@@ -146766,7 +146072,7 @@ var ts;
|
|
|
146766
146072
|
return;
|
|
146767
146073
|
}
|
|
146768
146074
|
var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
|
|
146769
|
-
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol,
|
|
146075
|
+
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
|
|
146770
146076
|
result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson });
|
|
146771
146077
|
}
|
|
146772
146078
|
for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
|
|
@@ -147061,9 +146367,6 @@ var ts;
|
|
|
147061
146367
|
case ts.ModuleKind.None:
|
|
147062
146368
|
// Fall back to the `import * as ns` style import.
|
|
147063
146369
|
return 2 /* Namespace */;
|
|
147064
|
-
case ts.ModuleKind.Node12:
|
|
147065
|
-
case ts.ModuleKind.NodeNext:
|
|
147066
|
-
return importingFile.impliedNodeFormat === ts.ModuleKind.ESNext ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
147067
146370
|
default:
|
|
147068
146371
|
return ts.Debug.assertNever(moduleKind, "Unexpected moduleKind " + moduleKind);
|
|
147069
146372
|
}
|
|
@@ -147118,7 +146421,7 @@ var ts;
|
|
|
147118
146421
|
cancellationToken.throwIfCancellationRequested();
|
|
147119
146422
|
var compilerOptions = program.getCompilerOptions();
|
|
147120
146423
|
var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
|
|
147121
|
-
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol,
|
|
146424
|
+
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
|
|
147122
146425
|
addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program, isFromPackageJson);
|
|
147123
146426
|
}
|
|
147124
146427
|
// check exports with the same name
|
|
@@ -147625,6 +146928,7 @@ var ts;
|
|
|
147625
146928
|
ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code,
|
|
147626
146929
|
ts.Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2.code,
|
|
147627
146930
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1.code,
|
|
146931
|
+
ts.Diagnostics.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.code,
|
|
147628
146932
|
// for JSX class components
|
|
147629
146933
|
ts.Diagnostics.No_overload_matches_this_call.code,
|
|
147630
146934
|
// for JSX FC
|
|
@@ -147638,14 +146942,14 @@ var ts;
|
|
|
147638
146942
|
if (!info)
|
|
147639
146943
|
return undefined;
|
|
147640
146944
|
var node = info.node, suggestedSymbol = info.suggestedSymbol;
|
|
147641
|
-
var target =
|
|
146945
|
+
var target = context.host.getCompilationSettings().target;
|
|
147642
146946
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, node, suggestedSymbol, target); });
|
|
147643
146947
|
return [codefix.createCodeFixAction("spelling", changes, [ts.Diagnostics.Change_spelling_to_0, ts.symbolName(suggestedSymbol)], fixId, ts.Diagnostics.Fix_all_detected_spelling_errors)];
|
|
147644
146948
|
},
|
|
147645
146949
|
fixIds: [fixId],
|
|
147646
146950
|
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
147647
146951
|
var info = getInfo(diag.file, diag.start, context, diag.code);
|
|
147648
|
-
var target =
|
|
146952
|
+
var target = context.host.getCompilationSettings().target;
|
|
147649
146953
|
if (info)
|
|
147650
146954
|
doChange(changes, context.sourceFile, info.node, info.suggestedSymbol, target);
|
|
147651
146955
|
}); },
|
|
@@ -147738,7 +147042,7 @@ var ts;
|
|
|
147738
147042
|
function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) {
|
|
147739
147043
|
if (!importDeclaration || !ts.isStringLiteralLike(importDeclaration.moduleSpecifier))
|
|
147740
147044
|
return undefined;
|
|
147741
|
-
var resolvedModule = ts.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text
|
|
147045
|
+
var resolvedModule = ts.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text);
|
|
147742
147046
|
if (!resolvedModule)
|
|
147743
147047
|
return undefined;
|
|
147744
147048
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -148785,8 +148089,8 @@ var ts;
|
|
|
148785
148089
|
(function (codefix) {
|
|
148786
148090
|
codefix.registerCodeFix({
|
|
148787
148091
|
errorCodes: [
|
|
148788
|
-
ts.Diagnostics.
|
|
148789
|
-
ts.Diagnostics.
|
|
148092
|
+
ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
148093
|
+
ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
148790
148094
|
],
|
|
148791
148095
|
getCodeActions: function (context) {
|
|
148792
148096
|
var compilerOptions = context.program.getCompilerOptions();
|
|
@@ -161397,6 +160701,7 @@ var ts;
|
|
|
161397
160701
|
ts.WatchType.MissingSourceMapFile = "Missing source map file";
|
|
161398
160702
|
ts.WatchType.NoopConfigFileForInferredRoot = "Noop Config file for the inferred project root";
|
|
161399
160703
|
ts.WatchType.MissingGeneratedFile = "Missing generated file";
|
|
160704
|
+
ts.WatchType.PackageJsonFile = "package.json file for import suggestions";
|
|
161400
160705
|
})(ts || (ts = {}));
|
|
161401
160706
|
/* eslint-disable @typescript-eslint/no-unnecessary-qualifier */
|
|
161402
160707
|
/**
|
|
@@ -162664,11 +161969,11 @@ var ts;
|
|
|
162664
161969
|
var path = this.toPath(file);
|
|
162665
161970
|
return !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file);
|
|
162666
161971
|
};
|
|
162667
|
-
Project.prototype.resolveModuleNames = function (moduleNames, containingFile, reusedNames, redirectedReference
|
|
162668
|
-
return this.resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference
|
|
161972
|
+
Project.prototype.resolveModuleNames = function (moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
161973
|
+
return this.resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference);
|
|
162669
161974
|
};
|
|
162670
|
-
Project.prototype.getResolvedModuleWithFailedLookupLocationsFromCache = function (moduleName, containingFile
|
|
162671
|
-
return this.resolutionCache.getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile
|
|
161975
|
+
Project.prototype.getResolvedModuleWithFailedLookupLocationsFromCache = function (moduleName, containingFile) {
|
|
161976
|
+
return this.resolutionCache.getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile);
|
|
162672
161977
|
};
|
|
162673
161978
|
Project.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile, redirectedReference) {
|
|
162674
161979
|
return this.resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference);
|
|
@@ -167688,7 +166993,7 @@ var ts;
|
|
|
167688
166993
|
watchers.get(path).close();
|
|
167689
166994
|
watchers.delete(path);
|
|
167690
166995
|
}
|
|
167691
|
-
}, ts.PollingInterval.Low, this.hostConfiguration.watchOptions, ts.WatchType.
|
|
166996
|
+
}, ts.PollingInterval.Low, this.hostConfiguration.watchOptions, ts.WatchType.PackageJsonFile));
|
|
167692
166997
|
}
|
|
167693
166998
|
};
|
|
167694
166999
|
/*@internal*/
|