typescript 4.5.0-dev.20210923 → 4.5.0-dev.20210927
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cs/diagnosticMessages.generated.json +2 -1
- package/lib/es/diagnosticMessages.generated.json +2 -1
- package/lib/fr/diagnosticMessages.generated.json +2 -1
- package/lib/it/diagnosticMessages.generated.json +2 -1
- package/lib/ja/diagnosticMessages.generated.json +2 -1
- package/lib/ko/diagnosticMessages.generated.json +2 -1
- package/lib/lib.es2021.d.ts +1 -0
- package/lib/lib.es2021.intl.d.ts +9 -0
- package/lib/pl/diagnosticMessages.generated.json +2 -1
- package/lib/pt-br/diagnosticMessages.generated.json +2 -1
- package/lib/ru/diagnosticMessages.generated.json +2 -1
- package/lib/tr/diagnosticMessages.generated.json +2 -1
- package/lib/tsc.js +1278 -386
- package/lib/tsserver.js +1487 -477
- package/lib/tsserverlibrary.d.ts +66 -15
- package/lib/tsserverlibrary.js +1487 -477
- package/lib/typescript.d.ts +64 -13
- package/lib/typescript.js +1482 -471
- package/lib/typescriptServices.d.ts +64 -13
- package/lib/typescriptServices.js +1482 -471
- package/lib/typingsInstaller.js +1413 -428
- package/lib/zh-cn/diagnosticMessages.generated.json +2 -1
- package/lib/zh-tw/diagnosticMessages.generated.json +2 -1
- package/package.json +1 -1
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-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20210927";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -4734,6 +4734,7 @@ var ts;
|
|
|
4734
4734
|
CheckFlags[CheckFlags["HasNeverType"] = 131072] = "HasNeverType";
|
|
4735
4735
|
CheckFlags[CheckFlags["Mapped"] = 262144] = "Mapped";
|
|
4736
4736
|
CheckFlags[CheckFlags["StripOptional"] = 524288] = "StripOptional";
|
|
4737
|
+
CheckFlags[CheckFlags["Unresolved"] = 1048576] = "Unresolved";
|
|
4737
4738
|
CheckFlags[CheckFlags["Synthetic"] = 6] = "Synthetic";
|
|
4738
4739
|
CheckFlags[CheckFlags["Discriminant"] = 192] = "Discriminant";
|
|
4739
4740
|
CheckFlags[CheckFlags["Partial"] = 48] = "Partial";
|
|
@@ -4865,7 +4866,7 @@ var ts;
|
|
|
4865
4866
|
TypeFlags[TypeFlags["IncludesMask"] = 205258751] = "IncludesMask";
|
|
4866
4867
|
// The following flags are used for different purposes during union and intersection type construction
|
|
4867
4868
|
/* @internal */
|
|
4868
|
-
TypeFlags[TypeFlags["
|
|
4869
|
+
TypeFlags[TypeFlags["IncludesMissingType"] = 262144] = "IncludesMissingType";
|
|
4869
4870
|
/* @internal */
|
|
4870
4871
|
TypeFlags[TypeFlags["IncludesNonWideningType"] = 4194304] = "IncludesNonWideningType";
|
|
4871
4872
|
/* @internal */
|
|
@@ -5111,6 +5112,12 @@ var ts;
|
|
|
5111
5112
|
(function (ModuleResolutionKind) {
|
|
5112
5113
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5113
5114
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5115
|
+
// Starting with node12, node's module resolver has significant departures from tranditional cjs resolution
|
|
5116
|
+
// to better support ecmascript modules and their use within node - more features are still being added, so
|
|
5117
|
+
// we can expect it to change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12`
|
|
5118
|
+
// version-anchored resolution target
|
|
5119
|
+
ModuleResolutionKind[ModuleResolutionKind["Node12"] = 3] = "Node12";
|
|
5120
|
+
ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
|
|
5114
5121
|
})(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
|
|
5115
5122
|
var WatchFileKind;
|
|
5116
5123
|
(function (WatchFileKind) {
|
|
@@ -5148,6 +5155,9 @@ var ts;
|
|
|
5148
5155
|
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
|
|
5149
5156
|
ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
|
|
5150
5157
|
ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
|
|
5158
|
+
// Node12+ is an amalgam of commonjs (albeit updated) and es2020+, and represents a distinct module system from es2020/esnext
|
|
5159
|
+
ModuleKind[ModuleKind["Node12"] = 100] = "Node12";
|
|
5160
|
+
ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
|
|
5151
5161
|
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
|
|
5152
5162
|
var JsxEmit;
|
|
5153
5163
|
(function (JsxEmit) {
|
|
@@ -5347,6 +5357,12 @@ var ts;
|
|
|
5347
5357
|
Extension["Jsx"] = ".jsx";
|
|
5348
5358
|
Extension["Json"] = ".json";
|
|
5349
5359
|
Extension["TsBuildInfo"] = ".tsbuildinfo";
|
|
5360
|
+
Extension["Mjs"] = ".mjs";
|
|
5361
|
+
Extension["Mts"] = ".mts";
|
|
5362
|
+
Extension["Dmts"] = ".d.mts";
|
|
5363
|
+
Extension["Cjs"] = ".cjs";
|
|
5364
|
+
Extension["Cts"] = ".cts";
|
|
5365
|
+
Extension["Dcts"] = ".d.cts";
|
|
5350
5366
|
})(Extension = ts.Extension || (ts.Extension = {}));
|
|
5351
5367
|
/* @internal */
|
|
5352
5368
|
var TransformFlags;
|
|
@@ -5493,9 +5509,10 @@ var ts;
|
|
|
5493
5509
|
ExternalEmitHelpers[ExternalEmitHelpers["MakeTemplateObject"] = 262144] = "MakeTemplateObject";
|
|
5494
5510
|
ExternalEmitHelpers[ExternalEmitHelpers["ClassPrivateFieldGet"] = 524288] = "ClassPrivateFieldGet";
|
|
5495
5511
|
ExternalEmitHelpers[ExternalEmitHelpers["ClassPrivateFieldSet"] = 1048576] = "ClassPrivateFieldSet";
|
|
5496
|
-
ExternalEmitHelpers[ExternalEmitHelpers["
|
|
5512
|
+
ExternalEmitHelpers[ExternalEmitHelpers["ClassPrivateFieldIn"] = 2097152] = "ClassPrivateFieldIn";
|
|
5513
|
+
ExternalEmitHelpers[ExternalEmitHelpers["CreateBinding"] = 4194304] = "CreateBinding";
|
|
5497
5514
|
ExternalEmitHelpers[ExternalEmitHelpers["FirstEmitHelper"] = 1] = "FirstEmitHelper";
|
|
5498
|
-
ExternalEmitHelpers[ExternalEmitHelpers["LastEmitHelper"] =
|
|
5515
|
+
ExternalEmitHelpers[ExternalEmitHelpers["LastEmitHelper"] = 4194304] = "LastEmitHelper";
|
|
5499
5516
|
// Helpers included by ES2015 for..of
|
|
5500
5517
|
ExternalEmitHelpers[ExternalEmitHelpers["ForOfIncludes"] = 256] = "ForOfIncludes";
|
|
5501
5518
|
// Helpers included by ES2017 for..await..of
|
|
@@ -8054,7 +8071,7 @@ var ts;
|
|
|
8054
8071
|
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."),
|
|
8055
8072
|
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."),
|
|
8056
8073
|
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."),
|
|
8057
|
-
|
|
8074
|
+
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_umd_node12_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'."),
|
|
8058
8075
|
Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext'."),
|
|
8059
8076
|
Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
|
|
8060
8077
|
Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."),
|
|
@@ -8072,7 +8089,7 @@ var ts;
|
|
|
8072
8089
|
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."),
|
|
8073
8090
|
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}')'?"),
|
|
8074
8091
|
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
8075
|
-
|
|
8092
|
+
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12_or_nodenext: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'."),
|
|
8076
8093
|
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
8077
8094
|
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."),
|
|
8078
8095
|
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."),
|
|
@@ -8103,7 +8120,7 @@ var ts;
|
|
|
8103
8120
|
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."),
|
|
8104
8121
|
_0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
8105
8122
|
_0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
8106
|
-
|
|
8123
|
+
Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, ts.DiagnosticCategory.Error, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
8107
8124
|
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'."),
|
|
8108
8125
|
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'."),
|
|
8109
8126
|
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 `}`?"),
|
|
@@ -8155,7 +8172,7 @@ var ts;
|
|
|
8155
8172
|
File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
8156
8173
|
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:"),
|
|
8157
8174
|
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."),
|
|
8158
|
-
|
|
8175
|
+
Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, ts.DiagnosticCategory.Error, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
8159
8176
|
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."),
|
|
8160
8177
|
Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
8161
8178
|
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}'?"),
|
|
@@ -8172,6 +8189,9 @@ var ts;
|
|
|
8172
8189
|
_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."),
|
|
8173
8190
|
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."),
|
|
8174
8191
|
Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments: diag(1450, ts.DiagnosticCategory.Message, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional assertion as arguments"),
|
|
8192
|
+
Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression: diag(1451, ts.DiagnosticCategory.Error, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),
|
|
8193
|
+
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."),
|
|
8194
|
+
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."),
|
|
8175
8195
|
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."),
|
|
8176
8196
|
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."),
|
|
8177
8197
|
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),
|
|
@@ -8236,7 +8256,7 @@ var ts;
|
|
|
8236
8256
|
The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
|
|
8237
8257
|
The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
|
|
8238
8258
|
The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),
|
|
8239
|
-
|
|
8259
|
+
The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."),
|
|
8240
8260
|
The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."),
|
|
8241
8261
|
The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
8242
8262
|
The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
|
|
@@ -9041,6 +9061,13 @@ var ts;
|
|
|
9041
9061
|
Output_Formatting: diag(6256, ts.DiagnosticCategory.Message, "Output_Formatting_6256", "Output Formatting"),
|
|
9042
9062
|
Completeness: diag(6257, ts.DiagnosticCategory.Message, "Completeness_6257", "Completeness"),
|
|
9043
9063
|
_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"),
|
|
9064
|
+
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."),
|
|
9065
|
+
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}'."),
|
|
9066
|
+
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."),
|
|
9067
|
+
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."),
|
|
9068
|
+
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."),
|
|
9069
|
+
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}'"),
|
|
9070
|
+
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}'."),
|
|
9044
9071
|
Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"),
|
|
9045
9072
|
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."),
|
|
9046
9073
|
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}'."),
|
|
@@ -9300,6 +9327,8 @@ var ts;
|
|
|
9300
9327
|
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."),
|
|
9301
9328
|
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."),
|
|
9302
9329
|
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}';`"),
|
|
9330
|
+
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."),
|
|
9331
|
+
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."),
|
|
9303
9332
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9304
9333
|
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."),
|
|
9305
9334
|
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."),
|
|
@@ -11906,7 +11935,7 @@ var ts;
|
|
|
11906
11935
|
}
|
|
11907
11936
|
ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics;
|
|
11908
11937
|
function getDefaultLibFileName(options) {
|
|
11909
|
-
switch (options
|
|
11938
|
+
switch (ts.getEmitScriptTarget(options)) {
|
|
11910
11939
|
case 99 /* ESNext */:
|
|
11911
11940
|
return "lib.esnext.full.d.ts";
|
|
11912
11941
|
case 8 /* ES2021 */:
|
|
@@ -13327,6 +13356,7 @@ var ts;
|
|
|
13327
13356
|
case 225 /* ClassExpression */:
|
|
13328
13357
|
case 212 /* FunctionExpression */:
|
|
13329
13358
|
case 79 /* Identifier */:
|
|
13359
|
+
case 80 /* PrivateIdentifier */: // technically this is only an Expression if it's in a `#field in expr` BinaryExpression
|
|
13330
13360
|
case 13 /* RegularExpressionLiteral */:
|
|
13331
13361
|
case 8 /* NumericLiteral */:
|
|
13332
13362
|
case 9 /* BigIntLiteral */:
|
|
@@ -13969,22 +13999,22 @@ var ts;
|
|
|
13969
13999
|
return node.end - node.pos;
|
|
13970
14000
|
}
|
|
13971
14001
|
ts.getFullWidth = getFullWidth;
|
|
13972
|
-
function getResolvedModule(sourceFile, moduleNameText) {
|
|
13973
|
-
return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText);
|
|
14002
|
+
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
14003
|
+
return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText, mode);
|
|
13974
14004
|
}
|
|
13975
14005
|
ts.getResolvedModule = getResolvedModule;
|
|
13976
|
-
function setResolvedModule(sourceFile, moduleNameText, resolvedModule) {
|
|
14006
|
+
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
13977
14007
|
if (!sourceFile.resolvedModules) {
|
|
13978
|
-
sourceFile.resolvedModules =
|
|
14008
|
+
sourceFile.resolvedModules = ts.createModeAwareCache();
|
|
13979
14009
|
}
|
|
13980
|
-
sourceFile.resolvedModules.set(moduleNameText, resolvedModule);
|
|
14010
|
+
sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
|
|
13981
14011
|
}
|
|
13982
14012
|
ts.setResolvedModule = setResolvedModule;
|
|
13983
14013
|
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
|
|
13984
14014
|
if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
13985
|
-
sourceFile.resolvedTypeReferenceDirectiveNames =
|
|
14015
|
+
sourceFile.resolvedTypeReferenceDirectiveNames = ts.createModeAwareCache();
|
|
13986
14016
|
}
|
|
13987
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, resolvedTypeReferenceDirective);
|
|
14017
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, /*mode*/ undefined, resolvedTypeReferenceDirective);
|
|
13988
14018
|
}
|
|
13989
14019
|
ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
|
|
13990
14020
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
@@ -14016,11 +14046,11 @@ var ts;
|
|
|
14016
14046
|
&& oldResolution.originalPath === newResolution.originalPath;
|
|
14017
14047
|
}
|
|
14018
14048
|
ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
|
|
14019
|
-
function hasChangesInResolutions(names, newResolutions, oldResolutions, comparer) {
|
|
14049
|
+
function hasChangesInResolutions(names, newResolutions, oldResolutions, oldSourceFile, comparer) {
|
|
14020
14050
|
ts.Debug.assert(names.length === newResolutions.length);
|
|
14021
14051
|
for (var i = 0; i < names.length; i++) {
|
|
14022
14052
|
var newResolution = newResolutions[i];
|
|
14023
|
-
var oldResolution = oldResolutions && oldResolutions.get(names[i]);
|
|
14053
|
+
var oldResolution = oldResolutions && oldResolutions.get(names[i], oldSourceFile && ts.getModeForResolutionAtIndex(oldSourceFile, i));
|
|
14024
14054
|
var changed = oldResolution
|
|
14025
14055
|
? !newResolution || !comparer(oldResolution, newResolution)
|
|
14026
14056
|
: newResolution;
|
|
@@ -14555,8 +14585,11 @@ var ts;
|
|
|
14555
14585
|
return (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return !isExternalModuleAugmentation(d) && !(ts.isModuleDeclaration(d) && isGlobalScopeAugmentation(d)); });
|
|
14556
14586
|
}
|
|
14557
14587
|
ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
|
|
14588
|
+
function isCommonJSContainingModuleKind(kind) {
|
|
14589
|
+
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node12 || kind === ts.ModuleKind.NodeNext;
|
|
14590
|
+
}
|
|
14558
14591
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
14559
|
-
return ts.isExternalModule(node) || compilerOptions.isolatedModules || ((getEmitModuleKind(compilerOptions)
|
|
14592
|
+
return ts.isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator);
|
|
14560
14593
|
}
|
|
14561
14594
|
ts.isEffectiveExternalModule = isEffectiveExternalModule;
|
|
14562
14595
|
/**
|
|
@@ -15674,6 +15707,8 @@ var ts;
|
|
|
15674
15707
|
node = node.parent;
|
|
15675
15708
|
}
|
|
15676
15709
|
return node.parent.kind === 180 /* TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node);
|
|
15710
|
+
case 80 /* PrivateIdentifier */:
|
|
15711
|
+
return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101 /* InKeyword */;
|
|
15677
15712
|
case 79 /* Identifier */:
|
|
15678
15713
|
if (node.parent.kind === 180 /* TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) {
|
|
15679
15714
|
return true;
|
|
@@ -17340,6 +17375,7 @@ var ts;
|
|
|
17340
17375
|
case 108 /* ThisKeyword */:
|
|
17341
17376
|
case 106 /* SuperKeyword */:
|
|
17342
17377
|
case 79 /* Identifier */:
|
|
17378
|
+
case 80 /* PrivateIdentifier */:
|
|
17343
17379
|
case 104 /* NullKeyword */:
|
|
17344
17380
|
case 110 /* TrueKeyword */:
|
|
17345
17381
|
case 95 /* FalseKeyword */:
|
|
@@ -17846,9 +17882,17 @@ var ts;
|
|
|
17846
17882
|
var path = outputDir
|
|
17847
17883
|
? getSourceFilePathInNewDirWorker(fileName, outputDir, currentDirectory, commonSourceDirectory, getCanonicalFileName)
|
|
17848
17884
|
: fileName;
|
|
17849
|
-
|
|
17885
|
+
var declarationExtension = getDeclarationEmitExtensionForPath(path);
|
|
17886
|
+
return removeFileExtension(path) + declarationExtension;
|
|
17850
17887
|
}
|
|
17851
17888
|
ts.getDeclarationEmitOutputFilePathWorker = getDeclarationEmitOutputFilePathWorker;
|
|
17889
|
+
function getDeclarationEmitExtensionForPath(path) {
|
|
17890
|
+
return ts.fileExtensionIsOneOf(path, [".mjs" /* Mjs */, ".mts" /* Mts */]) ? ".d.mts" /* Dmts */ :
|
|
17891
|
+
ts.fileExtensionIsOneOf(path, [".cjs" /* Cjs */, ".cts" /* Cts */]) ? ".d.cts" /* Dcts */ :
|
|
17892
|
+
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
|
|
17893
|
+
".d.ts" /* Dts */;
|
|
17894
|
+
}
|
|
17895
|
+
ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
|
|
17852
17896
|
function outFile(options) {
|
|
17853
17897
|
return options.outFile || options.out;
|
|
17854
17898
|
}
|
|
@@ -18588,7 +18632,7 @@ var ts;
|
|
|
18588
18632
|
}
|
|
18589
18633
|
/** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */
|
|
18590
18634
|
function tryExtractTSExtension(fileName) {
|
|
18591
|
-
return ts.find(
|
|
18635
|
+
return ts.find(supportedTSExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
18592
18636
|
}
|
|
18593
18637
|
ts.tryExtractTSExtension = tryExtractTSExtension;
|
|
18594
18638
|
/**
|
|
@@ -19540,7 +19584,10 @@ var ts;
|
|
|
19540
19584
|
}
|
|
19541
19585
|
ts.getLanguageVariant = getLanguageVariant;
|
|
19542
19586
|
function getEmitScriptTarget(compilerOptions) {
|
|
19543
|
-
return compilerOptions.target ||
|
|
19587
|
+
return compilerOptions.target ||
|
|
19588
|
+
(compilerOptions.module === ts.ModuleKind.Node12 && 7 /* ES2020 */) ||
|
|
19589
|
+
(compilerOptions.module === ts.ModuleKind.NodeNext && 99 /* ESNext */) ||
|
|
19590
|
+
0 /* ES3 */;
|
|
19544
19591
|
}
|
|
19545
19592
|
ts.getEmitScriptTarget = getEmitScriptTarget;
|
|
19546
19593
|
function getEmitModuleKind(compilerOptions) {
|
|
@@ -19552,7 +19599,20 @@ var ts;
|
|
|
19552
19599
|
function getEmitModuleResolutionKind(compilerOptions) {
|
|
19553
19600
|
var moduleResolution = compilerOptions.moduleResolution;
|
|
19554
19601
|
if (moduleResolution === undefined) {
|
|
19555
|
-
|
|
19602
|
+
switch (getEmitModuleKind(compilerOptions)) {
|
|
19603
|
+
case ts.ModuleKind.CommonJS:
|
|
19604
|
+
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
19605
|
+
break;
|
|
19606
|
+
case ts.ModuleKind.Node12:
|
|
19607
|
+
moduleResolution = ts.ModuleResolutionKind.Node12;
|
|
19608
|
+
break;
|
|
19609
|
+
case ts.ModuleKind.NodeNext:
|
|
19610
|
+
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
19611
|
+
break;
|
|
19612
|
+
default:
|
|
19613
|
+
moduleResolution = ts.ModuleResolutionKind.Classic;
|
|
19614
|
+
break;
|
|
19615
|
+
}
|
|
19556
19616
|
}
|
|
19557
19617
|
return moduleResolution;
|
|
19558
19618
|
}
|
|
@@ -19582,11 +19642,23 @@ var ts;
|
|
|
19582
19642
|
return !!(getEmitDeclarations(options) && options.declarationMap);
|
|
19583
19643
|
}
|
|
19584
19644
|
ts.getAreDeclarationMapsEnabled = getAreDeclarationMapsEnabled;
|
|
19645
|
+
function getESModuleInterop(compilerOptions) {
|
|
19646
|
+
if (compilerOptions.esModuleInterop !== undefined) {
|
|
19647
|
+
return compilerOptions.esModuleInterop;
|
|
19648
|
+
}
|
|
19649
|
+
switch (getEmitModuleKind(compilerOptions)) {
|
|
19650
|
+
case ts.ModuleKind.Node12:
|
|
19651
|
+
case ts.ModuleKind.NodeNext:
|
|
19652
|
+
return true;
|
|
19653
|
+
}
|
|
19654
|
+
return undefined;
|
|
19655
|
+
}
|
|
19656
|
+
ts.getESModuleInterop = getESModuleInterop;
|
|
19585
19657
|
function getAllowSyntheticDefaultImports(compilerOptions) {
|
|
19586
19658
|
var moduleKind = getEmitModuleKind(compilerOptions);
|
|
19587
19659
|
return compilerOptions.allowSyntheticDefaultImports !== undefined
|
|
19588
19660
|
? compilerOptions.allowSyntheticDefaultImports
|
|
19589
|
-
: compilerOptions
|
|
19661
|
+
: getESModuleInterop(compilerOptions) ||
|
|
19590
19662
|
moduleKind === ts.ModuleKind.System;
|
|
19591
19663
|
}
|
|
19592
19664
|
ts.getAllowSyntheticDefaultImports = getAllowSyntheticDefaultImports;
|
|
@@ -19611,7 +19683,7 @@ var ts;
|
|
|
19611
19683
|
}
|
|
19612
19684
|
ts.getAllowJSCompilerOption = getAllowJSCompilerOption;
|
|
19613
19685
|
function getUseDefineForClassFields(compilerOptions) {
|
|
19614
|
-
return compilerOptions.useDefineForClassFields === undefined ? compilerOptions
|
|
19686
|
+
return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ : compilerOptions.useDefineForClassFields;
|
|
19615
19687
|
}
|
|
19616
19688
|
ts.getUseDefineForClassFields = getUseDefineForClassFields;
|
|
19617
19689
|
function compilerOptionsAffectSemanticDiagnostics(newOptions, oldOptions) {
|
|
@@ -20051,51 +20123,54 @@ var ts;
|
|
|
20051
20123
|
}
|
|
20052
20124
|
ts.getScriptKindFromFileName = getScriptKindFromFileName;
|
|
20053
20125
|
/**
|
|
20054
|
-
*
|
|
20126
|
+
* Groups of supported extensions in order of file resolution precedence. (eg, TS > TSX > DTS and seperately, CTS > DCTS)
|
|
20055
20127
|
*/
|
|
20056
|
-
ts.supportedTSExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */];
|
|
20057
|
-
ts.
|
|
20128
|
+
ts.supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
|
|
20129
|
+
ts.supportedTSExtensionsFlat = ts.flatten(ts.supportedTSExtensions);
|
|
20130
|
+
var supportedTSExtensionsWithJson = __spreadArray(__spreadArray([], ts.supportedTSExtensions, true), [[".json" /* Json */]], false);
|
|
20058
20131
|
/** Must have ".d.ts" first because if ".ts" goes first, that will be detected as the extension instead of ".d.ts". */
|
|
20059
|
-
|
|
20060
|
-
ts.supportedJSExtensions = [".js" /* Js */, ".jsx" /* Jsx */];
|
|
20061
|
-
ts.
|
|
20062
|
-
var allSupportedExtensions =
|
|
20063
|
-
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray(
|
|
20132
|
+
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".cts" /* Cts */, ".mts" /* Mts */];
|
|
20133
|
+
ts.supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
|
|
20134
|
+
ts.supportedJSExtensionsFlat = ts.flatten(ts.supportedJSExtensions);
|
|
20135
|
+
var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
20136
|
+
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[".json" /* Json */]], false);
|
|
20064
20137
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
20065
20138
|
var needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
20066
20139
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
20067
20140
|
return needJsExtensions ? allSupportedExtensions : ts.supportedTSExtensions;
|
|
20068
20141
|
}
|
|
20069
|
-
var
|
|
20070
|
-
|
|
20142
|
+
var builtins = needJsExtensions ? allSupportedExtensions : ts.supportedTSExtensions;
|
|
20143
|
+
var flatBuiltins = ts.flatten(builtins);
|
|
20144
|
+
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);
|
|
20145
|
+
return extensions;
|
|
20071
20146
|
}
|
|
20072
20147
|
ts.getSupportedExtensions = getSupportedExtensions;
|
|
20073
|
-
function
|
|
20148
|
+
function getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions) {
|
|
20074
20149
|
if (!options || !options.resolveJsonModule)
|
|
20075
20150
|
return supportedExtensions;
|
|
20076
20151
|
if (supportedExtensions === allSupportedExtensions)
|
|
20077
20152
|
return allSupportedExtensionsWithJson;
|
|
20078
20153
|
if (supportedExtensions === ts.supportedTSExtensions)
|
|
20079
|
-
return
|
|
20080
|
-
return __spreadArray(__spreadArray([], supportedExtensions, true), [".json" /* Json */], false);
|
|
20154
|
+
return supportedTSExtensionsWithJson;
|
|
20155
|
+
return __spreadArray(__spreadArray([], supportedExtensions, true), [[".json" /* Json */]], false);
|
|
20081
20156
|
}
|
|
20082
|
-
ts.
|
|
20157
|
+
ts.getSupportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule;
|
|
20083
20158
|
function isJSLike(scriptKind) {
|
|
20084
20159
|
return scriptKind === 1 /* JS */ || scriptKind === 2 /* JSX */;
|
|
20085
20160
|
}
|
|
20086
20161
|
function hasJSFileExtension(fileName) {
|
|
20087
|
-
return ts.some(ts.
|
|
20162
|
+
return ts.some(ts.supportedJSExtensionsFlat, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
20088
20163
|
}
|
|
20089
20164
|
ts.hasJSFileExtension = hasJSFileExtension;
|
|
20090
20165
|
function hasTSFileExtension(fileName) {
|
|
20091
|
-
return ts.some(ts.
|
|
20166
|
+
return ts.some(ts.supportedTSExtensionsFlat, function (extension) { return ts.fileExtensionIs(fileName, extension); });
|
|
20092
20167
|
}
|
|
20093
20168
|
ts.hasTSFileExtension = hasTSFileExtension;
|
|
20094
20169
|
function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) {
|
|
20095
20170
|
if (!fileName)
|
|
20096
20171
|
return false;
|
|
20097
20172
|
var supportedExtensions = getSupportedExtensions(compilerOptions, extraFileExtensions);
|
|
20098
|
-
for (var _i = 0, _a =
|
|
20173
|
+
for (var _i = 0, _a = ts.flatten(getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, supportedExtensions)); _i < _a.length; _i++) {
|
|
20099
20174
|
var extension = _a[_i];
|
|
20100
20175
|
if (ts.fileExtensionIs(fileName, extension)) {
|
|
20101
20176
|
return true;
|
|
@@ -20112,57 +20187,7 @@ var ts;
|
|
|
20112
20187
|
return ts.compareValues(numberOfDirectorySeparators(path1), numberOfDirectorySeparators(path2));
|
|
20113
20188
|
}
|
|
20114
20189
|
ts.compareNumberOfDirectorySeparators = compareNumberOfDirectorySeparators;
|
|
20115
|
-
|
|
20116
|
-
* Extension boundaries by priority. Lower numbers indicate higher priorities, and are
|
|
20117
|
-
* aligned to the offset of the highest priority extension in the
|
|
20118
|
-
* allSupportedExtensions array.
|
|
20119
|
-
*/
|
|
20120
|
-
var ExtensionPriority;
|
|
20121
|
-
(function (ExtensionPriority) {
|
|
20122
|
-
ExtensionPriority[ExtensionPriority["TypeScriptFiles"] = 0] = "TypeScriptFiles";
|
|
20123
|
-
ExtensionPriority[ExtensionPriority["DeclarationAndJavaScriptFiles"] = 2] = "DeclarationAndJavaScriptFiles";
|
|
20124
|
-
ExtensionPriority[ExtensionPriority["Highest"] = 0] = "Highest";
|
|
20125
|
-
ExtensionPriority[ExtensionPriority["Lowest"] = 2] = "Lowest";
|
|
20126
|
-
})(ExtensionPriority = ts.ExtensionPriority || (ts.ExtensionPriority = {}));
|
|
20127
|
-
function getExtensionPriority(path, supportedExtensions) {
|
|
20128
|
-
for (var i = supportedExtensions.length - 1; i >= 0; i--) {
|
|
20129
|
-
if (ts.fileExtensionIs(path, supportedExtensions[i])) {
|
|
20130
|
-
return adjustExtensionPriority(i, supportedExtensions);
|
|
20131
|
-
}
|
|
20132
|
-
}
|
|
20133
|
-
// If its not in the list of supported extensions, this is likely a
|
|
20134
|
-
// TypeScript file with a non-ts extension
|
|
20135
|
-
return 0 /* Highest */;
|
|
20136
|
-
}
|
|
20137
|
-
ts.getExtensionPriority = getExtensionPriority;
|
|
20138
|
-
/**
|
|
20139
|
-
* Adjusts an extension priority to be the highest priority within the same range.
|
|
20140
|
-
*/
|
|
20141
|
-
function adjustExtensionPriority(extensionPriority, supportedExtensions) {
|
|
20142
|
-
if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) {
|
|
20143
|
-
return 0 /* TypeScriptFiles */;
|
|
20144
|
-
}
|
|
20145
|
-
else if (extensionPriority < supportedExtensions.length) {
|
|
20146
|
-
return 2 /* DeclarationAndJavaScriptFiles */;
|
|
20147
|
-
}
|
|
20148
|
-
else {
|
|
20149
|
-
return supportedExtensions.length;
|
|
20150
|
-
}
|
|
20151
|
-
}
|
|
20152
|
-
ts.adjustExtensionPriority = adjustExtensionPriority;
|
|
20153
|
-
/**
|
|
20154
|
-
* Gets the next lowest extension priority for a given priority.
|
|
20155
|
-
*/
|
|
20156
|
-
function getNextLowestExtensionPriority(extensionPriority, supportedExtensions) {
|
|
20157
|
-
if (extensionPriority < 2 /* DeclarationAndJavaScriptFiles */) {
|
|
20158
|
-
return 2 /* DeclarationAndJavaScriptFiles */;
|
|
20159
|
-
}
|
|
20160
|
-
else {
|
|
20161
|
-
return supportedExtensions.length;
|
|
20162
|
-
}
|
|
20163
|
-
}
|
|
20164
|
-
ts.getNextLowestExtensionPriority = getNextLowestExtensionPriority;
|
|
20165
|
-
var extensionsToRemove = [".d.ts" /* Dts */, ".ts" /* Ts */, ".js" /* Js */, ".tsx" /* Tsx */, ".jsx" /* Jsx */, ".json" /* Json */];
|
|
20190
|
+
var extensionsToRemove = [".d.ts" /* Dts */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".mjs" /* Mjs */, ".mts" /* Mts */, ".cjs" /* Cjs */, ".cts" /* Cts */, ".ts" /* Ts */, ".js" /* Js */, ".tsx" /* Tsx */, ".jsx" /* Jsx */, ".json" /* Json */];
|
|
20166
20191
|
function removeFileExtension(path) {
|
|
20167
20192
|
for (var _i = 0, extensionsToRemove_1 = extensionsToRemove; _i < extensionsToRemove_1.length; _i++) {
|
|
20168
20193
|
var ext = extensionsToRemove_1[_i];
|
|
@@ -20215,7 +20240,7 @@ var ts;
|
|
|
20215
20240
|
ts.positionIsSynthesized = positionIsSynthesized;
|
|
20216
20241
|
/** True if an extension is one of the supported TypeScript extensions. */
|
|
20217
20242
|
function extensionIsTS(ext) {
|
|
20218
|
-
return ext === ".ts" /* Ts */ || ext === ".tsx" /* Tsx */ || ext === ".d.ts" /* Dts */;
|
|
20243
|
+
return ext === ".ts" /* Ts */ || ext === ".tsx" /* Tsx */ || ext === ".d.ts" /* Dts */ || ext === ".cts" /* Cts */ || ext === ".mts" /* Mts */ || ext === ".d.mts" /* Dmts */ || ext === ".d.cts" /* Dcts */;
|
|
20219
20244
|
}
|
|
20220
20245
|
ts.extensionIsTS = extensionIsTS;
|
|
20221
20246
|
function resolutionExtensionIsTSOrJson(ext) {
|
|
@@ -25376,6 +25401,7 @@ var ts;
|
|
|
25376
25401
|
node.transformFlags =
|
|
25377
25402
|
propagateChildrenFlags(node.statements) |
|
|
25378
25403
|
propagateChildFlags(node.endOfFileToken);
|
|
25404
|
+
node.impliedNodeFormat = source.impliedNodeFormat;
|
|
25379
25405
|
return node;
|
|
25380
25406
|
}
|
|
25381
25407
|
// @api
|
|
@@ -26949,6 +26975,7 @@ var ts;
|
|
|
26949
26975
|
// Class Fields Helpers
|
|
26950
26976
|
createClassPrivateFieldGetHelper: createClassPrivateFieldGetHelper,
|
|
26951
26977
|
createClassPrivateFieldSetHelper: createClassPrivateFieldSetHelper,
|
|
26978
|
+
createClassPrivateFieldInHelper: createClassPrivateFieldInHelper
|
|
26952
26979
|
};
|
|
26953
26980
|
/**
|
|
26954
26981
|
* Gets an identifier for the name of an *unscoped* emit helper.
|
|
@@ -26989,7 +27016,7 @@ var ts;
|
|
|
26989
27016
|
}
|
|
26990
27017
|
// ES2018 Helpers
|
|
26991
27018
|
function createAssignHelper(attributesSegments) {
|
|
26992
|
-
if (context.getCompilerOptions()
|
|
27019
|
+
if (ts.getEmitScriptTarget(context.getCompilerOptions()) >= 2 /* ES2015 */) {
|
|
26993
27020
|
return factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "assign"),
|
|
26994
27021
|
/*typeArguments*/ undefined, attributesSegments);
|
|
26995
27022
|
}
|
|
@@ -27159,6 +27186,10 @@ var ts;
|
|
|
27159
27186
|
}
|
|
27160
27187
|
return factory.createCallExpression(getUnscopedHelperName("__classPrivateFieldSet"), /*typeArguments*/ undefined, args);
|
|
27161
27188
|
}
|
|
27189
|
+
function createClassPrivateFieldInHelper(state, receiver) {
|
|
27190
|
+
context.requestEmitHelper(ts.classPrivateFieldInHelper);
|
|
27191
|
+
return factory.createCallExpression(getUnscopedHelperName("__classPrivateFieldIn"), /* typeArguments*/ undefined, [state, receiver]);
|
|
27192
|
+
}
|
|
27162
27193
|
}
|
|
27163
27194
|
ts.createEmitHelperFactory = createEmitHelperFactory;
|
|
27164
27195
|
/* @internal */
|
|
@@ -27516,6 +27547,24 @@ var ts;
|
|
|
27516
27547
|
scoped: false,
|
|
27517
27548
|
text: "\n var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n };"
|
|
27518
27549
|
};
|
|
27550
|
+
/**
|
|
27551
|
+
* Parameters:
|
|
27552
|
+
* @param state — One of the following:
|
|
27553
|
+
* - A WeakMap when the member is a private instance field.
|
|
27554
|
+
* - A WeakSet when the member is a private instance method or accessor.
|
|
27555
|
+
* - A function value that should be the undecorated class constructor when the member is a private static field, method, or accessor.
|
|
27556
|
+
* @param receiver — The object being checked if it has the private member.
|
|
27557
|
+
*
|
|
27558
|
+
* Usage:
|
|
27559
|
+
* This helper is used to transform `#field in expression` to
|
|
27560
|
+
* `__classPrivateFieldIn(<weakMap/weakSet/constructor>, expression)`
|
|
27561
|
+
*/
|
|
27562
|
+
ts.classPrivateFieldInHelper = {
|
|
27563
|
+
name: "typescript:classPrivateFieldIn",
|
|
27564
|
+
importName: "__classPrivateFieldIn",
|
|
27565
|
+
scoped: false,
|
|
27566
|
+
text: "\n var __classPrivateFieldIn = (this && this.__classPrivateFieldIn) || function(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n };"
|
|
27567
|
+
};
|
|
27519
27568
|
var allUnscopedEmitHelpers;
|
|
27520
27569
|
function getAllUnscopedEmitHelpers() {
|
|
27521
27570
|
return allUnscopedEmitHelpers || (allUnscopedEmitHelpers = ts.arrayToMap([
|
|
@@ -27540,6 +27589,7 @@ var ts;
|
|
|
27540
27589
|
ts.exportStarHelper,
|
|
27541
27590
|
ts.classPrivateFieldGetHelper,
|
|
27542
27591
|
ts.classPrivateFieldSetHelper,
|
|
27592
|
+
ts.classPrivateFieldInHelper,
|
|
27543
27593
|
ts.createBindingHelper,
|
|
27544
27594
|
ts.setModuleDefaultHelper
|
|
27545
27595
|
], function (helper) { return helper.name; }));
|
|
@@ -28859,7 +28909,7 @@ var ts;
|
|
|
28859
28909
|
if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
28860
28910
|
var namedBindings = void 0;
|
|
28861
28911
|
var moduleKind = ts.getEmitModuleKind(compilerOptions);
|
|
28862
|
-
if (moduleKind >= ts.ModuleKind.ES2015 && moduleKind <= ts.ModuleKind.ESNext) {
|
|
28912
|
+
if ((moduleKind >= ts.ModuleKind.ES2015 && moduleKind <= ts.ModuleKind.ESNext) || sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
28863
28913
|
// use named imports
|
|
28864
28914
|
var helpers = ts.getEmitHelpers(sourceFile);
|
|
28865
28915
|
if (helpers) {
|
|
@@ -28911,9 +28961,9 @@ var ts;
|
|
|
28911
28961
|
return externalHelpersModuleName;
|
|
28912
28962
|
}
|
|
28913
28963
|
var moduleKind = ts.getEmitModuleKind(compilerOptions);
|
|
28914
|
-
var create = (hasExportStarsToExportValues || (compilerOptions
|
|
28964
|
+
var create = (hasExportStarsToExportValues || (ts.getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault))
|
|
28915
28965
|
&& moduleKind !== ts.ModuleKind.System
|
|
28916
|
-
&& moduleKind < ts.ModuleKind.ES2015;
|
|
28966
|
+
&& (moduleKind < ts.ModuleKind.ES2015 || node.impliedNodeFormat === ts.ModuleKind.CommonJS);
|
|
28917
28967
|
if (!create) {
|
|
28918
28968
|
var helpers = ts.getEmitHelpers(node);
|
|
28919
28969
|
if (helpers) {
|
|
@@ -34465,6 +34515,8 @@ var ts;
|
|
|
34465
34515
|
break;
|
|
34466
34516
|
case 15 /* TemplateHead */:
|
|
34467
34517
|
return parseTemplateExpression(/* isTaggedTemplate */ false);
|
|
34518
|
+
case 80 /* PrivateIdentifier */:
|
|
34519
|
+
return parsePrivateIdentifier();
|
|
34468
34520
|
}
|
|
34469
34521
|
return parseIdentifier(ts.Diagnostics.Expression_expected);
|
|
34470
34522
|
}
|
|
@@ -37166,6 +37218,7 @@ var ts;
|
|
|
37166
37218
|
// are already correct.
|
|
37167
37219
|
var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true, sourceFile.scriptKind);
|
|
37168
37220
|
result.commentDirectives = getNewCommentDirectives(sourceFile.commentDirectives, result.commentDirectives, changeRange.span.start, ts.textSpanEnd(changeRange.span), delta, oldText, newText, aggressiveChecks);
|
|
37221
|
+
result.impliedNodeFormat = sourceFile.impliedNodeFormat;
|
|
37169
37222
|
return result;
|
|
37170
37223
|
}
|
|
37171
37224
|
IncrementalParser.updateSourceFile = updateSourceFile;
|
|
@@ -37615,7 +37668,7 @@ var ts;
|
|
|
37615
37668
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
37616
37669
|
/** @internal */
|
|
37617
37670
|
function isDeclarationFileName(fileName) {
|
|
37618
|
-
return ts.
|
|
37671
|
+
return ts.fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */]);
|
|
37619
37672
|
}
|
|
37620
37673
|
ts.isDeclarationFileName = isDeclarationFileName;
|
|
37621
37674
|
/*@internal*/
|
|
@@ -38228,7 +38281,9 @@ var ts;
|
|
|
38228
38281
|
es6: ts.ModuleKind.ES2015,
|
|
38229
38282
|
es2015: ts.ModuleKind.ES2015,
|
|
38230
38283
|
es2020: ts.ModuleKind.ES2020,
|
|
38231
|
-
esnext: ts.ModuleKind.ESNext
|
|
38284
|
+
esnext: ts.ModuleKind.ESNext,
|
|
38285
|
+
node12: ts.ModuleKind.Node12,
|
|
38286
|
+
nodenext: ts.ModuleKind.NodeNext,
|
|
38232
38287
|
})),
|
|
38233
38288
|
affectsModuleResolution: true,
|
|
38234
38289
|
affectsEmit: true,
|
|
@@ -39133,7 +39188,7 @@ var ts;
|
|
|
39133
39188
|
/* @internal */
|
|
39134
39189
|
ts.defaultInitCompilerOptions = {
|
|
39135
39190
|
module: ts.ModuleKind.CommonJS,
|
|
39136
|
-
target:
|
|
39191
|
+
target: 3 /* ES2016 */,
|
|
39137
39192
|
strict: true,
|
|
39138
39193
|
esModuleInterop: true,
|
|
39139
39194
|
forceConsistentCasingInFileNames: true,
|
|
@@ -40654,7 +40709,7 @@ var ts;
|
|
|
40654
40709
|
// Rather than re-query this for each file and filespec, we query the supported extensions
|
|
40655
40710
|
// once and store it on the expansion context.
|
|
40656
40711
|
var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions);
|
|
40657
|
-
var supportedExtensionsWithJsonIfResolveJsonModule = ts.
|
|
40712
|
+
var supportedExtensionsWithJsonIfResolveJsonModule = ts.getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
|
|
40658
40713
|
// Literal files are always included verbatim. An "include" or "exclude" specification cannot
|
|
40659
40714
|
// remove a literal file.
|
|
40660
40715
|
if (validatedFilesSpec) {
|
|
@@ -40702,7 +40757,7 @@ var ts;
|
|
|
40702
40757
|
wildcardFileMap.set(key, file);
|
|
40703
40758
|
}
|
|
40704
40759
|
};
|
|
40705
|
-
for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensionsWithJsonIfResolveJsonModule, validatedExcludeSpecs, validatedIncludeSpecs, /*depth*/ undefined); _a < _b.length; _a++) {
|
|
40760
|
+
for (var _a = 0, _b = host.readDirectory(basePath, ts.flatten(supportedExtensionsWithJsonIfResolveJsonModule), validatedExcludeSpecs, validatedIncludeSpecs, /*depth*/ undefined); _a < _b.length; _a++) {
|
|
40706
40761
|
var file = _b[_a];
|
|
40707
40762
|
_loop_6(file);
|
|
40708
40763
|
}
|
|
@@ -40865,16 +40920,25 @@ var ts;
|
|
|
40865
40920
|
* extension priority.
|
|
40866
40921
|
*
|
|
40867
40922
|
* @param file The path to the file.
|
|
40868
|
-
* @param extensionPriority The priority of the extension.
|
|
40869
|
-
* @param context The expansion context.
|
|
40870
40923
|
*/
|
|
40871
40924
|
function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) {
|
|
40872
|
-
var
|
|
40873
|
-
|
|
40874
|
-
|
|
40875
|
-
|
|
40876
|
-
|
|
40925
|
+
var extensionGroup = ts.forEach(extensions, function (group) { return ts.fileExtensionIsOneOf(file, group) ? group : undefined; });
|
|
40926
|
+
if (!extensionGroup) {
|
|
40927
|
+
return false;
|
|
40928
|
+
}
|
|
40929
|
+
for (var _i = 0, extensionGroup_1 = extensionGroup; _i < extensionGroup_1.length; _i++) {
|
|
40930
|
+
var ext = extensionGroup_1[_i];
|
|
40931
|
+
if (ts.fileExtensionIs(file, ext)) {
|
|
40932
|
+
return false;
|
|
40933
|
+
}
|
|
40934
|
+
var higherPriorityPath = keyMapper(ts.changeExtension(file, ext));
|
|
40877
40935
|
if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) {
|
|
40936
|
+
if (ext === ".d.ts" /* Dts */ && (ts.fileExtensionIs(file, ".js" /* Js */) || ts.fileExtensionIs(file, ".jsx" /* Jsx */))) {
|
|
40937
|
+
// LEGACY BEHAVIOR: An off-by-one bug somewhere in the extension priority system for wildcard module loading allowed declaration
|
|
40938
|
+
// files to be loaded alongside their js(x) counterparts. We regard this as generally undesirable, but retain the behavior to
|
|
40939
|
+
// prevent breakage.
|
|
40940
|
+
continue;
|
|
40941
|
+
}
|
|
40878
40942
|
return true;
|
|
40879
40943
|
}
|
|
40880
40944
|
}
|
|
@@ -40885,15 +40949,18 @@ var ts;
|
|
|
40885
40949
|
* already been included.
|
|
40886
40950
|
*
|
|
40887
40951
|
* @param file The path to the file.
|
|
40888
|
-
* @param extensionPriority The priority of the extension.
|
|
40889
|
-
* @param context The expansion context.
|
|
40890
40952
|
*/
|
|
40891
40953
|
function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) {
|
|
40892
|
-
var
|
|
40893
|
-
|
|
40894
|
-
|
|
40895
|
-
|
|
40896
|
-
|
|
40954
|
+
var extensionGroup = ts.forEach(extensions, function (group) { return ts.fileExtensionIsOneOf(file, group) ? group : undefined; });
|
|
40955
|
+
if (!extensionGroup) {
|
|
40956
|
+
return;
|
|
40957
|
+
}
|
|
40958
|
+
for (var i = extensionGroup.length - 1; i >= 0; i--) {
|
|
40959
|
+
var ext = extensionGroup[i];
|
|
40960
|
+
if (ts.fileExtensionIs(file, ext)) {
|
|
40961
|
+
return;
|
|
40962
|
+
}
|
|
40963
|
+
var lowerPriorityPath = keyMapper(ts.changeExtension(file, ext));
|
|
40897
40964
|
wildcardFiles.delete(lowerPriorityPath);
|
|
40898
40965
|
}
|
|
40899
40966
|
}
|
|
@@ -41153,7 +41220,7 @@ var ts;
|
|
|
41153
41220
|
}
|
|
41154
41221
|
var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
|
|
41155
41222
|
var perFolderCache = containingDirectory ? cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference) : undefined;
|
|
41156
|
-
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName);
|
|
41223
|
+
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName, /*mode*/ undefined);
|
|
41157
41224
|
if (result) {
|
|
41158
41225
|
if (traceEnabled) {
|
|
41159
41226
|
trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -41187,7 +41254,7 @@ var ts;
|
|
|
41187
41254
|
}
|
|
41188
41255
|
}
|
|
41189
41256
|
var failedLookupLocations = [];
|
|
41190
|
-
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache };
|
|
41257
|
+
var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.AllFeatures, conditions: ["node", "require", "types"] };
|
|
41191
41258
|
var resolved = primaryLookup();
|
|
41192
41259
|
var primary = true;
|
|
41193
41260
|
if (!resolved) {
|
|
@@ -41207,7 +41274,7 @@ var ts;
|
|
|
41207
41274
|
};
|
|
41208
41275
|
}
|
|
41209
41276
|
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
|
|
41210
|
-
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, result);
|
|
41277
|
+
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, /*mode*/ undefined, result);
|
|
41211
41278
|
if (traceEnabled)
|
|
41212
41279
|
traceResult(result);
|
|
41213
41280
|
return result;
|
|
@@ -41420,9 +41487,56 @@ var ts;
|
|
|
41420
41487
|
}
|
|
41421
41488
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
41422
41489
|
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
41423
|
-
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function () { return
|
|
41490
|
+
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function () { return createModeAwareCache(); });
|
|
41424
41491
|
}
|
|
41425
41492
|
}
|
|
41493
|
+
/* @internal */
|
|
41494
|
+
function createModeAwareCache() {
|
|
41495
|
+
var underlying = new ts.Map();
|
|
41496
|
+
var memoizedReverseKeys = new ts.Map();
|
|
41497
|
+
var cache = {
|
|
41498
|
+
get: function (specifier, mode) {
|
|
41499
|
+
return underlying.get(getUnderlyingCacheKey(specifier, mode));
|
|
41500
|
+
},
|
|
41501
|
+
set: function (specifier, mode, value) {
|
|
41502
|
+
underlying.set(getUnderlyingCacheKey(specifier, mode), value);
|
|
41503
|
+
return cache;
|
|
41504
|
+
},
|
|
41505
|
+
delete: function (specifier, mode) {
|
|
41506
|
+
underlying.delete(getUnderlyingCacheKey(specifier, mode));
|
|
41507
|
+
return cache;
|
|
41508
|
+
},
|
|
41509
|
+
has: function (specifier, mode) {
|
|
41510
|
+
return underlying.has(getUnderlyingCacheKey(specifier, mode));
|
|
41511
|
+
},
|
|
41512
|
+
forEach: function (cb) {
|
|
41513
|
+
return underlying.forEach(function (elem, key) {
|
|
41514
|
+
var _a = memoizedReverseKeys.get(key), specifier = _a[0], mode = _a[1];
|
|
41515
|
+
return cb(elem, specifier, mode);
|
|
41516
|
+
});
|
|
41517
|
+
},
|
|
41518
|
+
size: function () {
|
|
41519
|
+
return underlying.size;
|
|
41520
|
+
}
|
|
41521
|
+
};
|
|
41522
|
+
return cache;
|
|
41523
|
+
function getUnderlyingCacheKey(specifier, mode) {
|
|
41524
|
+
var result = mode === undefined ? specifier : mode + "|" + specifier;
|
|
41525
|
+
memoizedReverseKeys.set(result, [specifier, mode]);
|
|
41526
|
+
return result;
|
|
41527
|
+
}
|
|
41528
|
+
}
|
|
41529
|
+
ts.createModeAwareCache = createModeAwareCache;
|
|
41530
|
+
/* @internal */
|
|
41531
|
+
function zipToModeAwareCache(file, keys, values) {
|
|
41532
|
+
ts.Debug.assert(keys.length === values.length);
|
|
41533
|
+
var map = createModeAwareCache();
|
|
41534
|
+
for (var i = 0; i < keys.length; ++i) {
|
|
41535
|
+
map.set(keys[i], ts.getModeForResolutionAtIndex(file, i), values[i]);
|
|
41536
|
+
}
|
|
41537
|
+
return map;
|
|
41538
|
+
}
|
|
41539
|
+
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
41426
41540
|
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
41427
41541
|
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
41428
41542
|
moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
|
|
@@ -41436,9 +41550,9 @@ var ts;
|
|
|
41436
41550
|
function update(options) {
|
|
41437
41551
|
updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap);
|
|
41438
41552
|
}
|
|
41439
|
-
function getOrCreateCacheForModuleName(nonRelativeModuleName, redirectedReference) {
|
|
41553
|
+
function getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference) {
|
|
41440
41554
|
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
41441
|
-
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, nonRelativeModuleName, createPerModuleNameCache);
|
|
41555
|
+
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, mode === undefined ? nonRelativeModuleName : mode + "|" + nonRelativeModuleName, createPerModuleNameCache);
|
|
41442
41556
|
}
|
|
41443
41557
|
function createPerModuleNameCache() {
|
|
41444
41558
|
var directoryPathMap = new ts.Map();
|
|
@@ -41517,13 +41631,15 @@ var ts;
|
|
|
41517
41631
|
}
|
|
41518
41632
|
}
|
|
41519
41633
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
41520
|
-
function resolveModuleNameFromCache(moduleName, containingFile, cache) {
|
|
41634
|
+
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
41521
41635
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
41522
41636
|
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory);
|
|
41523
|
-
|
|
41637
|
+
if (!perFolderCache)
|
|
41638
|
+
return undefined;
|
|
41639
|
+
return perFolderCache.get(moduleName, mode);
|
|
41524
41640
|
}
|
|
41525
41641
|
ts.resolveModuleNameFromCache = resolveModuleNameFromCache;
|
|
41526
|
-
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
41642
|
+
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
41527
41643
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
41528
41644
|
if (redirectedReference) {
|
|
41529
41645
|
compilerOptions = redirectedReference.commandLine.options;
|
|
@@ -41536,7 +41652,7 @@ var ts;
|
|
|
41536
41652
|
}
|
|
41537
41653
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
41538
41654
|
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference);
|
|
41539
|
-
var result = perFolderCache && perFolderCache.get(moduleName);
|
|
41655
|
+
var result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
|
|
41540
41656
|
if (result) {
|
|
41541
41657
|
if (traceEnabled) {
|
|
41542
41658
|
trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -41545,7 +41661,20 @@ var ts;
|
|
|
41545
41661
|
else {
|
|
41546
41662
|
var moduleResolution = compilerOptions.moduleResolution;
|
|
41547
41663
|
if (moduleResolution === undefined) {
|
|
41548
|
-
|
|
41664
|
+
switch (ts.getEmitModuleKind(compilerOptions)) {
|
|
41665
|
+
case ts.ModuleKind.CommonJS:
|
|
41666
|
+
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
41667
|
+
break;
|
|
41668
|
+
case ts.ModuleKind.Node12:
|
|
41669
|
+
moduleResolution = ts.ModuleResolutionKind.Node12;
|
|
41670
|
+
break;
|
|
41671
|
+
case ts.ModuleKind.NodeNext:
|
|
41672
|
+
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
41673
|
+
break;
|
|
41674
|
+
default:
|
|
41675
|
+
moduleResolution = ts.ModuleResolutionKind.Classic;
|
|
41676
|
+
break;
|
|
41677
|
+
}
|
|
41549
41678
|
if (traceEnabled) {
|
|
41550
41679
|
trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]);
|
|
41551
41680
|
}
|
|
@@ -41557,6 +41686,12 @@ var ts;
|
|
|
41557
41686
|
}
|
|
41558
41687
|
ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
|
|
41559
41688
|
switch (moduleResolution) {
|
|
41689
|
+
case ts.ModuleResolutionKind.Node12:
|
|
41690
|
+
result = node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
41691
|
+
break;
|
|
41692
|
+
case ts.ModuleResolutionKind.NodeNext:
|
|
41693
|
+
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
41694
|
+
break;
|
|
41560
41695
|
case ts.ModuleResolutionKind.NodeJs:
|
|
41561
41696
|
result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference);
|
|
41562
41697
|
break;
|
|
@@ -41570,10 +41705,10 @@ var ts;
|
|
|
41570
41705
|
ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
|
|
41571
41706
|
ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
41572
41707
|
if (perFolderCache) {
|
|
41573
|
-
perFolderCache.set(moduleName, result);
|
|
41708
|
+
perFolderCache.set(moduleName, resolutionMode, result);
|
|
41574
41709
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
41575
41710
|
// put result in per-module name cache
|
|
41576
|
-
cache.getOrCreateCacheForModuleName(moduleName, redirectedReference).set(containingDirectory, result);
|
|
41711
|
+
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
41577
41712
|
}
|
|
41578
41713
|
}
|
|
41579
41714
|
}
|
|
@@ -41780,22 +41915,60 @@ var ts;
|
|
|
41780
41915
|
return tryResolveJSModuleWorker(moduleName, initialDir, host).resolvedModule;
|
|
41781
41916
|
}
|
|
41782
41917
|
ts.tryResolveJSModule = tryResolveJSModule;
|
|
41918
|
+
/* @internal */
|
|
41919
|
+
var NodeResolutionFeatures;
|
|
41920
|
+
(function (NodeResolutionFeatures) {
|
|
41921
|
+
NodeResolutionFeatures[NodeResolutionFeatures["None"] = 0] = "None";
|
|
41922
|
+
// resolving `#local` names in your own package.json
|
|
41923
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Imports"] = 2] = "Imports";
|
|
41924
|
+
// resolving `your-own-name` from your own package.json
|
|
41925
|
+
NodeResolutionFeatures[NodeResolutionFeatures["SelfName"] = 4] = "SelfName";
|
|
41926
|
+
// respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
|
|
41927
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
41928
|
+
// allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
|
|
41929
|
+
// not currently backported to node 12 - https://github.com/nodejs/Release/issues/690
|
|
41930
|
+
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
41931
|
+
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
41932
|
+
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
41933
|
+
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
41934
|
+
function node12ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
41935
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Imports | NodeResolutionFeatures.SelfName | NodeResolutionFeatures.Exports, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
41936
|
+
}
|
|
41937
|
+
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
41938
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.AllFeatures, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
41939
|
+
}
|
|
41940
|
+
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
41941
|
+
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
41942
|
+
// es module file or cjs-like input file, use a variant of the legacy cjs resolver that supports the selected modern features
|
|
41943
|
+
var esmMode = resolutionMode === ts.ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0;
|
|
41944
|
+
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions, redirectedReference);
|
|
41945
|
+
}
|
|
41783
41946
|
var jsOnlyExtensions = [Extensions.JavaScript];
|
|
41784
41947
|
var tsExtensions = [Extensions.TypeScript, Extensions.JavaScript];
|
|
41785
41948
|
var tsPlusJsonExtensions = __spreadArray(__spreadArray([], tsExtensions, true), [Extensions.Json], false);
|
|
41786
41949
|
var tsconfigExtensions = [Extensions.TSConfig];
|
|
41787
41950
|
function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
41788
|
-
return nodeModuleNameResolverWorker(moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
41951
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
41789
41952
|
}
|
|
41790
41953
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
41791
|
-
return nodeModuleNameResolverWorker(moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
|
|
41954
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, lookupConfig ? tsconfigExtensions : (compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions), redirectedReference);
|
|
41792
41955
|
}
|
|
41793
41956
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
41794
|
-
function nodeModuleNameResolverWorker(moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
41957
|
+
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
41795
41958
|
var _a, _b;
|
|
41796
41959
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
41797
41960
|
var failedLookupLocations = [];
|
|
41798
|
-
|
|
41961
|
+
// conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
|
|
41962
|
+
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
41963
|
+
var state = {
|
|
41964
|
+
compilerOptions: compilerOptions,
|
|
41965
|
+
host: host,
|
|
41966
|
+
traceEnabled: traceEnabled,
|
|
41967
|
+
failedLookupLocations: failedLookupLocations,
|
|
41968
|
+
packageJsonInfoCache: cache,
|
|
41969
|
+
features: features,
|
|
41970
|
+
conditions: features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"]
|
|
41971
|
+
};
|
|
41799
41972
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
41800
41973
|
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);
|
|
41801
41974
|
function tryResolve(extensions) {
|
|
@@ -41805,10 +41978,19 @@ var ts;
|
|
|
41805
41978
|
return toSearchResult({ resolved: resolved, isExternalLibraryImport: pathContainsNodeModules(resolved.path) });
|
|
41806
41979
|
}
|
|
41807
41980
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
41808
|
-
|
|
41809
|
-
|
|
41981
|
+
var resolved_1;
|
|
41982
|
+
if (features & NodeResolutionFeatures.Imports && ts.startsWith(moduleName, "#")) {
|
|
41983
|
+
resolved_1 = loadModuleFromImports(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
41984
|
+
}
|
|
41985
|
+
if (!resolved_1 && features & NodeResolutionFeatures.SelfName) {
|
|
41986
|
+
resolved_1 = loadModuleFromSelfNameReference(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
41987
|
+
}
|
|
41988
|
+
if (!resolved_1) {
|
|
41989
|
+
if (traceEnabled) {
|
|
41990
|
+
trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]);
|
|
41991
|
+
}
|
|
41992
|
+
resolved_1 = loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
41810
41993
|
}
|
|
41811
|
-
var resolved_1 = loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
41812
41994
|
if (!resolved_1)
|
|
41813
41995
|
return undefined;
|
|
41814
41996
|
var resolvedValue = resolved_1.value;
|
|
@@ -41917,26 +42099,40 @@ var ts;
|
|
|
41917
42099
|
function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
|
|
41918
42100
|
if (extensions === Extensions.Json || extensions === Extensions.TSConfig) {
|
|
41919
42101
|
var extensionLess = ts.tryRemoveExtension(candidate, ".json" /* Json */);
|
|
41920
|
-
|
|
42102
|
+
var extension = extensionLess ? candidate.substring(extensionLess.length) : "";
|
|
42103
|
+
return (extensionLess === undefined && extensions === Extensions.Json) ? undefined : tryAddingExtensions(extensionLess || candidate, extensions, extension, onlyRecordFailures, state);
|
|
41921
42104
|
}
|
|
41922
|
-
//
|
|
41923
|
-
|
|
41924
|
-
|
|
41925
|
-
|
|
42105
|
+
// esm mode resolutions don't include automatic extension lookup (without additional flags, at least)
|
|
42106
|
+
if (!(state.features & NodeResolutionFeatures.EsmMode)) {
|
|
42107
|
+
// First, try adding an extension. An import of "foo" could be matched by a file "foo.ts", or "foo.js" by "foo.js.ts"
|
|
42108
|
+
var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, "", onlyRecordFailures, state);
|
|
42109
|
+
if (resolvedByAddingExtension) {
|
|
42110
|
+
return resolvedByAddingExtension;
|
|
42111
|
+
}
|
|
41926
42112
|
}
|
|
42113
|
+
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
42114
|
+
}
|
|
42115
|
+
function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
|
|
41927
42116
|
// If that didn't work, try stripping a ".js" or ".jsx" extension and replacing it with a TypeScript one;
|
|
41928
42117
|
// e.g. "./foo.js" can be matched by "./foo.ts" or "./foo.d.ts"
|
|
41929
|
-
if (ts.hasJSFileExtension(candidate)) {
|
|
42118
|
+
if (ts.hasJSFileExtension(candidate) || (ts.fileExtensionIs(candidate, ".json" /* Json */) && state.compilerOptions.resolveJsonModule)) {
|
|
41930
42119
|
var extensionless = ts.removeFileExtension(candidate);
|
|
42120
|
+
var extension = candidate.substring(extensionless.length);
|
|
41931
42121
|
if (state.traceEnabled) {
|
|
41932
|
-
var extension = candidate.substring(extensionless.length);
|
|
41933
42122
|
trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension);
|
|
41934
42123
|
}
|
|
41935
|
-
return tryAddingExtensions(extensionless, extensions, onlyRecordFailures, state);
|
|
42124
|
+
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
42125
|
+
}
|
|
42126
|
+
}
|
|
42127
|
+
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
42128
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */])) {
|
|
42129
|
+
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
42130
|
+
return result !== undefined ? { path: candidate, ext: ts.forEach([".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */], function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
|
|
41936
42131
|
}
|
|
42132
|
+
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
41937
42133
|
}
|
|
41938
42134
|
/** Try to return an existing file that adds one of the `extensions` to `candidate`. */
|
|
41939
|
-
function tryAddingExtensions(candidate, extensions, onlyRecordFailures, state) {
|
|
42135
|
+
function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecordFailures, state) {
|
|
41940
42136
|
if (!onlyRecordFailures) {
|
|
41941
42137
|
// check if containing folder exists - if it doesn't then just record failures for all supported extensions without disk probing
|
|
41942
42138
|
var directory = ts.getDirectoryPath(candidate);
|
|
@@ -41946,11 +42142,51 @@ var ts;
|
|
|
41946
42142
|
}
|
|
41947
42143
|
switch (extensions) {
|
|
41948
42144
|
case Extensions.DtsOnly:
|
|
41949
|
-
|
|
42145
|
+
switch (originalExtension) {
|
|
42146
|
+
case ".mjs" /* Mjs */:
|
|
42147
|
+
case ".mts" /* Mts */:
|
|
42148
|
+
case ".d.mts" /* Dmts */:
|
|
42149
|
+
return tryExtension(".d.mts" /* Dmts */);
|
|
42150
|
+
case ".cjs" /* Cjs */:
|
|
42151
|
+
case ".cts" /* Cts */:
|
|
42152
|
+
case ".d.cts" /* Dcts */:
|
|
42153
|
+
return tryExtension(".d.cts" /* Dcts */);
|
|
42154
|
+
case ".json" /* Json */:
|
|
42155
|
+
candidate += ".json" /* Json */;
|
|
42156
|
+
return tryExtension(".d.ts" /* Dts */);
|
|
42157
|
+
default: return tryExtension(".d.ts" /* Dts */);
|
|
42158
|
+
}
|
|
41950
42159
|
case Extensions.TypeScript:
|
|
41951
|
-
|
|
42160
|
+
switch (originalExtension) {
|
|
42161
|
+
case ".mjs" /* Mjs */:
|
|
42162
|
+
case ".mts" /* Mts */:
|
|
42163
|
+
case ".d.mts" /* Dmts */:
|
|
42164
|
+
return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
|
|
42165
|
+
case ".cjs" /* Cjs */:
|
|
42166
|
+
case ".cts" /* Cts */:
|
|
42167
|
+
case ".d.cts" /* Dcts */:
|
|
42168
|
+
return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
|
|
42169
|
+
case ".json" /* Json */:
|
|
42170
|
+
candidate += ".json" /* Json */;
|
|
42171
|
+
return tryExtension(".d.ts" /* Dts */);
|
|
42172
|
+
default:
|
|
42173
|
+
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
42174
|
+
}
|
|
41952
42175
|
case Extensions.JavaScript:
|
|
41953
|
-
|
|
42176
|
+
switch (originalExtension) {
|
|
42177
|
+
case ".mjs" /* Mjs */:
|
|
42178
|
+
case ".mts" /* Mts */:
|
|
42179
|
+
case ".d.mts" /* Dmts */:
|
|
42180
|
+
return tryExtension(".mjs" /* Mjs */);
|
|
42181
|
+
case ".cjs" /* Cjs */:
|
|
42182
|
+
case ".cts" /* Cts */:
|
|
42183
|
+
case ".d.cts" /* Dcts */:
|
|
42184
|
+
return tryExtension(".cjs" /* Cjs */);
|
|
42185
|
+
case ".json" /* Json */:
|
|
42186
|
+
return tryExtension(".json" /* Json */);
|
|
42187
|
+
default:
|
|
42188
|
+
return tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */);
|
|
42189
|
+
}
|
|
41954
42190
|
case Extensions.TSConfig:
|
|
41955
42191
|
case Extensions.Json:
|
|
41956
42192
|
return tryExtension(".json" /* Json */);
|
|
@@ -41985,6 +42221,33 @@ var ts;
|
|
|
41985
42221
|
var versionPaths = packageInfo && packageInfo.versionPaths;
|
|
41986
42222
|
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
|
|
41987
42223
|
}
|
|
42224
|
+
/**
|
|
42225
|
+
* A function for locating the package.json scope for a given path
|
|
42226
|
+
*/
|
|
42227
|
+
/*@internal*/
|
|
42228
|
+
function getPackageScopeForPath(fileName, packageJsonInfoCache, host, options) {
|
|
42229
|
+
var state = {
|
|
42230
|
+
host: host,
|
|
42231
|
+
compilerOptions: options,
|
|
42232
|
+
traceEnabled: isTraceEnabled(options, host),
|
|
42233
|
+
failedLookupLocations: [],
|
|
42234
|
+
packageJsonInfoCache: packageJsonInfoCache,
|
|
42235
|
+
features: 0,
|
|
42236
|
+
conditions: [],
|
|
42237
|
+
};
|
|
42238
|
+
var parts = ts.getPathComponents(fileName);
|
|
42239
|
+
parts.pop();
|
|
42240
|
+
while (parts.length > 0) {
|
|
42241
|
+
var pkg = getPackageJsonInfo(ts.getPathFromPathComponents(parts), /*onlyRecordFailures*/ false, state);
|
|
42242
|
+
if (pkg) {
|
|
42243
|
+
return pkg;
|
|
42244
|
+
}
|
|
42245
|
+
parts.pop();
|
|
42246
|
+
}
|
|
42247
|
+
return undefined;
|
|
42248
|
+
}
|
|
42249
|
+
ts.getPackageScopeForPath = getPackageScopeForPath;
|
|
42250
|
+
/*@internal*/
|
|
41988
42251
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
41989
42252
|
var _a, _b, _c;
|
|
41990
42253
|
var host = state.host, traceEnabled = state.traceEnabled;
|
|
@@ -42027,6 +42290,7 @@ var ts;
|
|
|
42027
42290
|
state.failedLookupLocations.push(packageJsonPath);
|
|
42028
42291
|
}
|
|
42029
42292
|
}
|
|
42293
|
+
ts.getPackageJsonInfo = getPackageJsonInfo;
|
|
42030
42294
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
42031
42295
|
var packageFile;
|
|
42032
42296
|
if (jsonContent) {
|
|
@@ -42082,7 +42346,10 @@ var ts;
|
|
|
42082
42346
|
var packageFileResult = packageFile && removeIgnoredPackageId(loader(extensions, packageFile, onlyRecordFailuresForPackageFile, state));
|
|
42083
42347
|
if (packageFileResult)
|
|
42084
42348
|
return packageFileResult;
|
|
42085
|
-
|
|
42349
|
+
// esm mode resolutions don't do package `index` lookups
|
|
42350
|
+
if (!(state.features & NodeResolutionFeatures.EsmMode)) {
|
|
42351
|
+
return loadModuleFromFile(extensions, indexPath, onlyRecordFailuresForIndex, state);
|
|
42352
|
+
}
|
|
42086
42353
|
}
|
|
42087
42354
|
/** Resolve from an arbitrarily specified file. Return `undefined` if it has an unsupported extension. */
|
|
42088
42355
|
function resolvedIfExtensionMatches(extensions, path) {
|
|
@@ -42112,6 +42379,226 @@ var ts;
|
|
|
42112
42379
|
return idx === -1 ? { packageName: moduleName, rest: "" } : { packageName: moduleName.slice(0, idx), rest: moduleName.slice(idx + 1) };
|
|
42113
42380
|
}
|
|
42114
42381
|
ts.parsePackageName = parsePackageName;
|
|
42382
|
+
function allKeysStartWithDot(obj) {
|
|
42383
|
+
return ts.every(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
|
|
42384
|
+
}
|
|
42385
|
+
function noKeyStartsWithDot(obj) {
|
|
42386
|
+
return !ts.some(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
|
|
42387
|
+
}
|
|
42388
|
+
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
42389
|
+
var _a, _b;
|
|
42390
|
+
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
42391
|
+
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));
|
|
42392
|
+
var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
|
|
42393
|
+
if (!scope || !scope.packageJsonContent.exports) {
|
|
42394
|
+
return undefined;
|
|
42395
|
+
}
|
|
42396
|
+
var parts = ts.getPathComponents(moduleName); // unrooted paths should have `""` as their 0th entry
|
|
42397
|
+
if (scope.packageJsonContent.name !== parts[1]) {
|
|
42398
|
+
return undefined;
|
|
42399
|
+
}
|
|
42400
|
+
var trailingParts = parts.slice(2);
|
|
42401
|
+
return loadModuleFromExports(scope, extensions, !ts.length(trailingParts) ? "." : "." + ts.directorySeparator + trailingParts.join(ts.directorySeparator), state, cache, redirectedReference);
|
|
42402
|
+
}
|
|
42403
|
+
function loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference) {
|
|
42404
|
+
if (!scope.packageJsonContent.exports) {
|
|
42405
|
+
return undefined;
|
|
42406
|
+
}
|
|
42407
|
+
if (subpath === ".") {
|
|
42408
|
+
var mainExport = void 0;
|
|
42409
|
+
if (typeof scope.packageJsonContent.exports === "string" || Array.isArray(scope.packageJsonContent.exports) || (typeof scope.packageJsonContent.exports === "object" && noKeyStartsWithDot(scope.packageJsonContent.exports))) {
|
|
42410
|
+
mainExport = scope.packageJsonContent.exports;
|
|
42411
|
+
}
|
|
42412
|
+
else if (ts.hasProperty(scope.packageJsonContent.exports, ".")) {
|
|
42413
|
+
mainExport = scope.packageJsonContent.exports["."];
|
|
42414
|
+
}
|
|
42415
|
+
if (mainExport) {
|
|
42416
|
+
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false);
|
|
42417
|
+
return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false);
|
|
42418
|
+
}
|
|
42419
|
+
}
|
|
42420
|
+
else if (allKeysStartWithDot(scope.packageJsonContent.exports)) {
|
|
42421
|
+
if (typeof scope.packageJsonContent.exports !== "object") {
|
|
42422
|
+
if (state.traceEnabled) {
|
|
42423
|
+
trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory);
|
|
42424
|
+
}
|
|
42425
|
+
return toSearchResult(/*value*/ undefined);
|
|
42426
|
+
}
|
|
42427
|
+
var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, subpath, scope.packageJsonContent.exports, scope, /*isImports*/ false);
|
|
42428
|
+
if (result) {
|
|
42429
|
+
return result;
|
|
42430
|
+
}
|
|
42431
|
+
}
|
|
42432
|
+
if (state.traceEnabled) {
|
|
42433
|
+
trace(state.host, ts.Diagnostics.Export_specifier_0_does_not_exist_in_package_json_scope_at_path_1, subpath, scope.packageDirectory);
|
|
42434
|
+
}
|
|
42435
|
+
return toSearchResult(/*value*/ undefined);
|
|
42436
|
+
}
|
|
42437
|
+
function loadModuleFromImports(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
42438
|
+
var _a, _b;
|
|
42439
|
+
if (moduleName === "#" || ts.startsWith(moduleName, "#/")) {
|
|
42440
|
+
if (state.traceEnabled) {
|
|
42441
|
+
trace(state.host, ts.Diagnostics.Invalid_import_specifier_0_has_no_possible_resolutions, moduleName);
|
|
42442
|
+
}
|
|
42443
|
+
return toSearchResult(/*value*/ undefined);
|
|
42444
|
+
}
|
|
42445
|
+
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
42446
|
+
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));
|
|
42447
|
+
var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
|
|
42448
|
+
if (!scope) {
|
|
42449
|
+
if (state.traceEnabled) {
|
|
42450
|
+
trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
|
|
42451
|
+
}
|
|
42452
|
+
return toSearchResult(/*value*/ undefined);
|
|
42453
|
+
}
|
|
42454
|
+
if (!scope.packageJsonContent.imports) {
|
|
42455
|
+
if (state.traceEnabled) {
|
|
42456
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_no_imports_defined, scope.packageDirectory);
|
|
42457
|
+
}
|
|
42458
|
+
return toSearchResult(/*value*/ undefined);
|
|
42459
|
+
}
|
|
42460
|
+
var result = loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, scope.packageJsonContent.imports, scope, /*isImports*/ true);
|
|
42461
|
+
if (result) {
|
|
42462
|
+
return result;
|
|
42463
|
+
}
|
|
42464
|
+
if (state.traceEnabled) {
|
|
42465
|
+
trace(state.host, ts.Diagnostics.Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1, moduleName, scope.packageDirectory);
|
|
42466
|
+
}
|
|
42467
|
+
return toSearchResult(/*value*/ undefined);
|
|
42468
|
+
}
|
|
42469
|
+
function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
|
|
42470
|
+
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
42471
|
+
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
42472
|
+
var target = lookupTable[moduleName];
|
|
42473
|
+
return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
|
|
42474
|
+
}
|
|
42475
|
+
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; });
|
|
42476
|
+
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
42477
|
+
var potentialTarget = expandingKeys_1[_i];
|
|
42478
|
+
if (state.features & NodeResolutionFeatures.ExportsPatternTrailers && matchesPatternWithTrailer(potentialTarget, moduleName)) {
|
|
42479
|
+
var target = lookupTable[potentialTarget];
|
|
42480
|
+
var starPos = potentialTarget.indexOf("*");
|
|
42481
|
+
var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos));
|
|
42482
|
+
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
|
|
42483
|
+
}
|
|
42484
|
+
else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) {
|
|
42485
|
+
var target = lookupTable[potentialTarget];
|
|
42486
|
+
var subpath = moduleName.substring(potentialTarget.length - 1);
|
|
42487
|
+
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
|
|
42488
|
+
}
|
|
42489
|
+
else if (ts.startsWith(moduleName, potentialTarget)) {
|
|
42490
|
+
var target = lookupTable[potentialTarget];
|
|
42491
|
+
var subpath = moduleName.substring(potentialTarget.length);
|
|
42492
|
+
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false);
|
|
42493
|
+
}
|
|
42494
|
+
}
|
|
42495
|
+
function matchesPatternWithTrailer(target, name) {
|
|
42496
|
+
if (ts.endsWith(target, "*"))
|
|
42497
|
+
return false; // handled by next case in loop
|
|
42498
|
+
var starPos = target.indexOf("*");
|
|
42499
|
+
if (starPos === -1)
|
|
42500
|
+
return false; // handled by last case in loop
|
|
42501
|
+
return ts.startsWith(name, target.substring(0, starPos)) && ts.endsWith(name, target.substring(starPos + 1));
|
|
42502
|
+
}
|
|
42503
|
+
}
|
|
42504
|
+
/**
|
|
42505
|
+
* Gets the self-recursive function specialized to retrieving the targeted import/export element for the given resolution configuration
|
|
42506
|
+
*/
|
|
42507
|
+
function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
|
42508
|
+
return loadModuleFromTargetImportOrExport;
|
|
42509
|
+
function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
|
|
42510
|
+
var _a, _b;
|
|
42511
|
+
if (typeof target === "string") {
|
|
42512
|
+
if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
|
|
42513
|
+
if (state.traceEnabled) {
|
|
42514
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42515
|
+
}
|
|
42516
|
+
return toSearchResult(/*value*/ undefined);
|
|
42517
|
+
}
|
|
42518
|
+
if (!ts.startsWith(target, "./")) {
|
|
42519
|
+
if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) {
|
|
42520
|
+
var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath;
|
|
42521
|
+
var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference);
|
|
42522
|
+
return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined);
|
|
42523
|
+
}
|
|
42524
|
+
if (state.traceEnabled) {
|
|
42525
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42526
|
+
}
|
|
42527
|
+
return toSearchResult(/*value*/ undefined);
|
|
42528
|
+
}
|
|
42529
|
+
var parts = ts.pathIsRelative(target) ? ts.getPathComponents(target).slice(1) : ts.getPathComponents(target);
|
|
42530
|
+
var partsAfterFirst = parts.slice(1);
|
|
42531
|
+
if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) {
|
|
42532
|
+
if (state.traceEnabled) {
|
|
42533
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42534
|
+
}
|
|
42535
|
+
return toSearchResult(/*value*/ undefined);
|
|
42536
|
+
}
|
|
42537
|
+
var resolvedTarget = ts.combinePaths(scope.packageDirectory, target);
|
|
42538
|
+
// TODO: Assert that `resolvedTarget` is actually within the package directory? That's what the spec says.... but I'm not sure we need
|
|
42539
|
+
// to be in the business of validating everyone's import and export map correctness.
|
|
42540
|
+
var subpathParts = ts.getPathComponents(subpath);
|
|
42541
|
+
if (subpathParts.indexOf("..") >= 0 || subpathParts.indexOf(".") >= 0 || subpathParts.indexOf("node_modules") >= 0) {
|
|
42542
|
+
if (state.traceEnabled) {
|
|
42543
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42544
|
+
}
|
|
42545
|
+
return toSearchResult(/*value*/ undefined);
|
|
42546
|
+
}
|
|
42547
|
+
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));
|
|
42548
|
+
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, finalPath, /*onlyRecordFailures*/ false, state)));
|
|
42549
|
+
}
|
|
42550
|
+
else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
|
|
42551
|
+
if (!Array.isArray(target)) {
|
|
42552
|
+
for (var _i = 0, _c = ts.getOwnKeys(target); _i < _c.length; _i++) {
|
|
42553
|
+
var key = _c[_i];
|
|
42554
|
+
if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
|
|
42555
|
+
var subTarget = target[key];
|
|
42556
|
+
var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
|
|
42557
|
+
if (result) {
|
|
42558
|
+
return result;
|
|
42559
|
+
}
|
|
42560
|
+
}
|
|
42561
|
+
}
|
|
42562
|
+
return undefined;
|
|
42563
|
+
}
|
|
42564
|
+
else {
|
|
42565
|
+
if (!ts.length(target)) {
|
|
42566
|
+
if (state.traceEnabled) {
|
|
42567
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42568
|
+
}
|
|
42569
|
+
return toSearchResult(/*value*/ undefined);
|
|
42570
|
+
}
|
|
42571
|
+
for (var _d = 0, target_1 = target; _d < target_1.length; _d++) {
|
|
42572
|
+
var elem = target_1[_d];
|
|
42573
|
+
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
42574
|
+
if (result) {
|
|
42575
|
+
return result;
|
|
42576
|
+
}
|
|
42577
|
+
}
|
|
42578
|
+
}
|
|
42579
|
+
}
|
|
42580
|
+
else if (target === null) { // eslint-disable-line no-null/no-null
|
|
42581
|
+
if (state.traceEnabled) {
|
|
42582
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_explicitly_maps_specifier_1_to_null, scope.packageDirectory, moduleName);
|
|
42583
|
+
}
|
|
42584
|
+
return toSearchResult(/*value*/ undefined);
|
|
42585
|
+
}
|
|
42586
|
+
if (state.traceEnabled) {
|
|
42587
|
+
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
42588
|
+
}
|
|
42589
|
+
return toSearchResult(/*value*/ undefined);
|
|
42590
|
+
}
|
|
42591
|
+
function isApplicableVersionedTypesKey(conditions, key) {
|
|
42592
|
+
if (conditions.indexOf("types") === -1)
|
|
42593
|
+
return false; // only apply versioned types conditions if the types condition is applied
|
|
42594
|
+
if (!ts.startsWith(key, "types@"))
|
|
42595
|
+
return false;
|
|
42596
|
+
var range = ts.VersionRange.tryParse(key.substring("types@".length));
|
|
42597
|
+
if (!range)
|
|
42598
|
+
return false;
|
|
42599
|
+
return range.test(ts.version);
|
|
42600
|
+
}
|
|
42601
|
+
}
|
|
42115
42602
|
function loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
42116
42603
|
return loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, /*typesScopeOnly*/ false, cache, redirectedReference);
|
|
42117
42604
|
}
|
|
@@ -42120,24 +42607,24 @@ var ts;
|
|
|
42120
42607
|
return loadModuleFromNearestNodeModulesDirectoryWorker(Extensions.DtsOnly, moduleName, directory, state, /*typesScopeOnly*/ true, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
42121
42608
|
}
|
|
42122
42609
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
42123
|
-
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, redirectedReference);
|
|
42610
|
+
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, state.features === 0 ? undefined : state.features & NodeResolutionFeatures.EsmMode ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS, redirectedReference);
|
|
42124
42611
|
return ts.forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {
|
|
42125
42612
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
42126
42613
|
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state);
|
|
42127
42614
|
if (resolutionFromCache) {
|
|
42128
42615
|
return resolutionFromCache;
|
|
42129
42616
|
}
|
|
42130
|
-
return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, ancestorDirectory, state, typesScopeOnly));
|
|
42617
|
+
return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, ancestorDirectory, state, typesScopeOnly, cache, redirectedReference));
|
|
42131
42618
|
}
|
|
42132
42619
|
});
|
|
42133
42620
|
}
|
|
42134
|
-
function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly) {
|
|
42621
|
+
function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
42135
42622
|
var nodeModulesFolder = ts.combinePaths(directory, "node_modules");
|
|
42136
42623
|
var nodeModulesFolderExists = ts.directoryProbablyExists(nodeModulesFolder, state.host);
|
|
42137
42624
|
if (!nodeModulesFolderExists && state.traceEnabled) {
|
|
42138
42625
|
trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder);
|
|
42139
42626
|
}
|
|
42140
|
-
var packageResult = typesScopeOnly ? undefined : loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state);
|
|
42627
|
+
var packageResult = typesScopeOnly ? undefined : loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state, cache, redirectedReference);
|
|
42141
42628
|
if (packageResult) {
|
|
42142
42629
|
return packageResult;
|
|
42143
42630
|
}
|
|
@@ -42150,27 +42637,35 @@ var ts;
|
|
|
42150
42637
|
}
|
|
42151
42638
|
nodeModulesAtTypesExists = false;
|
|
42152
42639
|
}
|
|
42153
|
-
return loadModuleFromSpecificNodeModulesDirectory(Extensions.DtsOnly, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, state);
|
|
42640
|
+
return loadModuleFromSpecificNodeModulesDirectory(Extensions.DtsOnly, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, state, cache, redirectedReference);
|
|
42154
42641
|
}
|
|
42155
42642
|
}
|
|
42156
|
-
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state) {
|
|
42643
|
+
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
42157
42644
|
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
|
|
42158
42645
|
// First look for a nested package.json, as in `node_modules/foo/bar/package.json`.
|
|
42159
42646
|
var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
|
|
42160
|
-
if (
|
|
42161
|
-
|
|
42162
|
-
if (
|
|
42163
|
-
|
|
42647
|
+
// But only if we're not respecting export maps (if we are, we might redirect around this location)
|
|
42648
|
+
if (!(state.features & NodeResolutionFeatures.Exports)) {
|
|
42649
|
+
if (packageInfo) {
|
|
42650
|
+
var fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
|
|
42651
|
+
if (fromFile) {
|
|
42652
|
+
return noPackageId(fromFile);
|
|
42653
|
+
}
|
|
42654
|
+
var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
|
|
42655
|
+
return withPackageId(packageInfo, fromDirectory);
|
|
42164
42656
|
}
|
|
42165
|
-
var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
|
|
42166
|
-
return withPackageId(packageInfo, fromDirectory);
|
|
42167
42657
|
}
|
|
42658
|
+
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
|
|
42168
42659
|
var loader = function (extensions, candidate, onlyRecordFailures, state) {
|
|
42660
|
+
var _a;
|
|
42661
|
+
// package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them)
|
|
42662
|
+
if (packageInfo && packageInfo.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
|
|
42663
|
+
return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
|
|
42664
|
+
}
|
|
42169
42665
|
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
|
|
42170
42666
|
loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
|
|
42171
42667
|
return withPackageId(packageInfo, pathAndExtension);
|
|
42172
42668
|
};
|
|
42173
|
-
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
|
|
42174
42669
|
if (rest !== "") { // If "rest" is empty, we just did this search above.
|
|
42175
42670
|
var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
|
|
42176
42671
|
// 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.
|
|
@@ -42272,7 +42767,7 @@ var ts;
|
|
|
42272
42767
|
function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
42273
42768
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
42274
42769
|
var failedLookupLocations = [];
|
|
42275
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache };
|
|
42770
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [] };
|
|
42276
42771
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
42277
42772
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
42278
42773
|
// No originalPath because classic resolution doesn't resolve realPath
|
|
@@ -42283,7 +42778,7 @@ var ts;
|
|
|
42283
42778
|
return { value: resolvedUsingSettings };
|
|
42284
42779
|
}
|
|
42285
42780
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
42286
|
-
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, redirectedReference);
|
|
42781
|
+
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, /*mode*/ undefined, redirectedReference);
|
|
42287
42782
|
// Climb up parent directories looking for a module.
|
|
42288
42783
|
var resolved_3 = ts.forEachAncestorDirectory(containingDirectory, function (directory) {
|
|
42289
42784
|
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache_1, moduleName, directory, state);
|
|
@@ -42319,8 +42814,8 @@ var ts;
|
|
|
42319
42814
|
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);
|
|
42320
42815
|
}
|
|
42321
42816
|
var failedLookupLocations = [];
|
|
42322
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache };
|
|
42323
|
-
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false);
|
|
42817
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache, features: NodeResolutionFeatures.None, conditions: [] };
|
|
42818
|
+
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
42324
42819
|
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, state.resultFromCache);
|
|
42325
42820
|
}
|
|
42326
42821
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
@@ -44501,7 +44996,7 @@ var ts;
|
|
|
44501
44996
|
}
|
|
44502
44997
|
function checkStrictModeLabeledStatement(node) {
|
|
44503
44998
|
// Grammar checking for labeledStatement
|
|
44504
|
-
if (inStrictMode && options
|
|
44999
|
+
if (inStrictMode && ts.getEmitScriptTarget(options) >= 2 /* ES2015 */) {
|
|
44505
45000
|
if (ts.isDeclarationStatement(node.statement) || ts.isVariableStatement(node.statement)) {
|
|
44506
45001
|
errorOnFirstToken(node.label, ts.Diagnostics.A_label_is_not_allowed_here);
|
|
44507
45002
|
}
|
|
@@ -46017,7 +46512,7 @@ var ts;
|
|
|
46017
46512
|
host.getSourceFiles().forEach(function (sf) {
|
|
46018
46513
|
if (!sf.resolvedModules)
|
|
46019
46514
|
return;
|
|
46020
|
-
|
|
46515
|
+
sf.resolvedModules.forEach(function (r) {
|
|
46021
46516
|
if (r && r.packageId)
|
|
46022
46517
|
map.set(r.packageId.name, r.extension === ".d.ts" /* Dts */ || !!map.get(r.packageId.name));
|
|
46023
46518
|
});
|
|
@@ -46435,10 +46930,13 @@ var ts;
|
|
|
46435
46930
|
var undefinedProperties = new ts.Map();
|
|
46436
46931
|
var unknownSymbol = createSymbol(4 /* Property */, "unknown");
|
|
46437
46932
|
var resolvingSymbol = createSymbol(0, "__resolving__" /* Resolving */);
|
|
46933
|
+
var unresolvedSymbols = new ts.Map();
|
|
46934
|
+
var errorTypes = new ts.Map();
|
|
46438
46935
|
var anyType = createIntrinsicType(1 /* Any */, "any");
|
|
46439
46936
|
var autoType = createIntrinsicType(1 /* Any */, "any");
|
|
46440
46937
|
var wildcardType = createIntrinsicType(1 /* Any */, "any");
|
|
46441
46938
|
var errorType = createIntrinsicType(1 /* Any */, "error");
|
|
46939
|
+
var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
|
|
46442
46940
|
var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 131072 /* ContainsWideningType */);
|
|
46443
46941
|
var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
|
|
46444
46942
|
var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
@@ -47160,7 +47658,7 @@ var ts;
|
|
|
47160
47658
|
}
|
|
47161
47659
|
else if (ts.isParameterPropertyDeclaration(declaration, declaration.parent)) {
|
|
47162
47660
|
// foo = this.bar is illegal in esnext+useDefineForClassFields when bar is a parameter property
|
|
47163
|
-
return !(compilerOptions
|
|
47661
|
+
return !(ts.getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ && useDefineForClassFields
|
|
47164
47662
|
&& ts.getContainingClass(declaration) === ts.getContainingClass(usage)
|
|
47165
47663
|
&& isUsedInFunctionOrInstanceProperty(usage, declaration));
|
|
47166
47664
|
}
|
|
@@ -47188,7 +47686,7 @@ var ts;
|
|
|
47188
47686
|
return true;
|
|
47189
47687
|
}
|
|
47190
47688
|
if (isUsedInFunctionOrInstanceProperty(usage, declaration)) {
|
|
47191
|
-
if (compilerOptions
|
|
47689
|
+
if (ts.getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ && useDefineForClassFields
|
|
47192
47690
|
&& ts.getContainingClass(declaration)
|
|
47193
47691
|
&& (ts.isPropertyDeclaration(declaration) || ts.isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
47194
47692
|
return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage, /*stopAtAnyPropertyDeclaration*/ true);
|
|
@@ -47366,7 +47864,7 @@ var ts;
|
|
|
47366
47864
|
return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSymbol, issueSuggestions);
|
|
47367
47865
|
}
|
|
47368
47866
|
function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, lookup, issueSuggestions) {
|
|
47369
|
-
var _a;
|
|
47867
|
+
var _a, _b, _c;
|
|
47370
47868
|
var originalLocation = location; // needed for did-you-mean error reporting, which gathers candidates starting from the original location
|
|
47371
47869
|
var result;
|
|
47372
47870
|
var lastLocation;
|
|
@@ -47436,7 +47934,7 @@ var ts;
|
|
|
47436
47934
|
isInExternalModule = true;
|
|
47437
47935
|
// falls through
|
|
47438
47936
|
case 260 /* ModuleDeclaration */:
|
|
47439
|
-
var moduleExports = getSymbolOfNode(location).exports || emptySymbols;
|
|
47937
|
+
var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols;
|
|
47440
47938
|
if (location.kind === 303 /* SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 8388608 /* Ambient */ && !ts.isGlobalScopeAugmentation(location))) {
|
|
47441
47939
|
// It's an external module. First see if the module has an export default and if the local
|
|
47442
47940
|
// name of that export default matches.
|
|
@@ -47467,7 +47965,7 @@ var ts;
|
|
|
47467
47965
|
}
|
|
47468
47966
|
// ES6 exports are also visible locally (except for 'default'), but commonjs exports are not (except typedefs)
|
|
47469
47967
|
if (name !== "default" /* Default */ && (result = lookup(moduleExports, name, meaning & 2623475 /* ModuleMember */))) {
|
|
47470
|
-
if (ts.isSourceFile(location) && location.commonJsModuleIndicator && !((
|
|
47968
|
+
if (ts.isSourceFile(location) && location.commonJsModuleIndicator && !((_b = result.declarations) === null || _b === void 0 ? void 0 : _b.some(ts.isJSDocTypeAlias))) {
|
|
47471
47969
|
result = undefined;
|
|
47472
47970
|
}
|
|
47473
47971
|
else {
|
|
@@ -47476,7 +47974,7 @@ var ts;
|
|
|
47476
47974
|
}
|
|
47477
47975
|
break;
|
|
47478
47976
|
case 259 /* EnumDeclaration */:
|
|
47479
|
-
if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) {
|
|
47977
|
+
if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) {
|
|
47480
47978
|
break loop;
|
|
47481
47979
|
}
|
|
47482
47980
|
break;
|
|
@@ -47559,7 +48057,7 @@ var ts;
|
|
|
47559
48057
|
case 213 /* ArrowFunction */:
|
|
47560
48058
|
// when targeting ES6 or higher there is no 'arguments' in an arrow function
|
|
47561
48059
|
// for lower compile targets the resolved symbol is used to emit an error
|
|
47562
|
-
if (compilerOptions
|
|
48060
|
+
if (ts.getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) {
|
|
47563
48061
|
break;
|
|
47564
48062
|
}
|
|
47565
48063
|
// falls through
|
|
@@ -47727,7 +48225,7 @@ var ts;
|
|
|
47727
48225
|
}
|
|
47728
48226
|
// Perform extra checks only if error reporting was requested
|
|
47729
48227
|
if (nameNotFoundMessage) {
|
|
47730
|
-
if (propertyWithInvalidInitializer && !(compilerOptions
|
|
48228
|
+
if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ && useDefineForClassFields)) {
|
|
47731
48229
|
// We have a match, but the reference occurred within a property initializer and the identifier also binds
|
|
47732
48230
|
// to a local variable in the constructor where the code will be emitted. Note that this is actually allowed
|
|
47733
48231
|
// with ESNext+useDefineForClassFields because the scope semantics are different.
|
|
@@ -48305,7 +48803,7 @@ var ts;
|
|
|
48305
48803
|
if (!ts.isIdentifier(name)) {
|
|
48306
48804
|
return undefined;
|
|
48307
48805
|
}
|
|
48308
|
-
var suppressInteropError = name.escapedText === "default" /* Default */ && !!(compilerOptions.allowSyntheticDefaultImports || compilerOptions
|
|
48806
|
+
var suppressInteropError = name.escapedText === "default" /* Default */ && !!(compilerOptions.allowSyntheticDefaultImports || ts.getESModuleInterop(compilerOptions));
|
|
48309
48807
|
var targetSymbol = resolveESModuleSymbol(moduleSymbol, moduleSpecifier, /*dontResolveAlias*/ false, suppressInteropError);
|
|
48310
48808
|
if (targetSymbol) {
|
|
48311
48809
|
if (name.escapedText) {
|
|
@@ -48383,18 +48881,18 @@ var ts;
|
|
|
48383
48881
|
}
|
|
48384
48882
|
function reportInvalidImportEqualsExportMember(node, name, declarationName, moduleName) {
|
|
48385
48883
|
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
48386
|
-
var message = compilerOptions
|
|
48884
|
+
var message = ts.getESModuleInterop(compilerOptions) ? ts.Diagnostics._0_can_only_be_imported_by_using_a_default_import :
|
|
48387
48885
|
ts.Diagnostics._0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
48388
48886
|
error(name, message, declarationName);
|
|
48389
48887
|
}
|
|
48390
48888
|
else {
|
|
48391
48889
|
if (ts.isInJSFile(node)) {
|
|
48392
|
-
var message = compilerOptions
|
|
48890
|
+
var message = ts.getESModuleInterop(compilerOptions) ? ts.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import :
|
|
48393
48891
|
ts.Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import;
|
|
48394
48892
|
error(name, message, declarationName);
|
|
48395
48893
|
}
|
|
48396
48894
|
else {
|
|
48397
|
-
var message = compilerOptions
|
|
48895
|
+
var message = ts.getESModuleInterop(compilerOptions) ? ts.Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import :
|
|
48398
48896
|
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;
|
|
48399
48897
|
error(name, message, declarationName, declarationName, moduleName);
|
|
48400
48898
|
}
|
|
@@ -48835,6 +49333,7 @@ var ts;
|
|
|
48835
49333
|
: undefined;
|
|
48836
49334
|
}
|
|
48837
49335
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
|
|
49336
|
+
var _a, _b, _c, _d, _e, _f;
|
|
48838
49337
|
if (isForAugmentation === void 0) { isForAugmentation = false; }
|
|
48839
49338
|
if (ts.startsWith(moduleReference, "@types/")) {
|
|
48840
49339
|
var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
@@ -48846,7 +49345,15 @@ var ts;
|
|
|
48846
49345
|
return ambientModule;
|
|
48847
49346
|
}
|
|
48848
49347
|
var currentSourceFile = ts.getSourceFileOfNode(location);
|
|
48849
|
-
var
|
|
49348
|
+
var contextSpecifier = ts.isStringLiteralLike(location)
|
|
49349
|
+
? location
|
|
49350
|
+
: ((_a = ts.findAncestor(location, ts.isImportCall)) === null || _a === void 0 ? void 0 : _a.arguments[0]) ||
|
|
49351
|
+
((_b = ts.findAncestor(location, ts.isImportDeclaration)) === null || _b === void 0 ? void 0 : _b.moduleSpecifier) ||
|
|
49352
|
+
((_c = ts.findAncestor(location, ts.isExternalModuleImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.moduleReference.expression) ||
|
|
49353
|
+
((_d = ts.findAncestor(location, ts.isExportDeclaration)) === null || _d === void 0 ? void 0 : _d.moduleSpecifier) ||
|
|
49354
|
+
((_e = (ts.isModuleDeclaration(location) ? location : location.parent && ts.isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : undefined)) === null || _e === void 0 ? void 0 : _e.name) ||
|
|
49355
|
+
((_f = (ts.isLiteralImportTypeNode(location) ? location : undefined)) === null || _f === void 0 ? void 0 : _f.argument.literal);
|
|
49356
|
+
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : undefined); // TODO: GH#18217
|
|
48850
49357
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
48851
49358
|
var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
48852
49359
|
if (sourceFile) {
|
|
@@ -48854,6 +49361,12 @@ var ts;
|
|
|
48854
49361
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
48855
49362
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
48856
49363
|
}
|
|
49364
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
49365
|
+
var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
|
|
49366
|
+
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
49367
|
+
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);
|
|
49368
|
+
}
|
|
49369
|
+
}
|
|
48857
49370
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
48858
49371
|
return getMergedSymbol(sourceFile.symbol);
|
|
48859
49372
|
}
|
|
@@ -48911,15 +49424,14 @@ var ts;
|
|
|
48911
49424
|
* Direct users to import source with .js extension if outputting an ES module.
|
|
48912
49425
|
* @see https://github.com/microsoft/TypeScript/issues/42151
|
|
48913
49426
|
*/
|
|
48914
|
-
|
|
48915
|
-
|
|
48916
|
-
replacedImportSource += ".js";
|
|
49427
|
+
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
49428
|
+
replacedImportSource += tsExtension === ".mts" /* Mts */ ? ".mjs" : tsExtension === ".cts" /* Cts */ ? ".cjs" : ".js";
|
|
48917
49429
|
}
|
|
48918
49430
|
error(errorNode, diag, tsExtension, replacedImportSource);
|
|
48919
49431
|
}
|
|
48920
49432
|
else if (!compilerOptions.resolveJsonModule &&
|
|
48921
49433
|
ts.fileExtensionIs(moduleReference, ".json" /* Json */) &&
|
|
48922
|
-
ts.getEmitModuleResolutionKind(compilerOptions)
|
|
49434
|
+
ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic &&
|
|
48923
49435
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
48924
49436
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
48925
49437
|
}
|
|
@@ -48992,7 +49504,7 @@ var ts;
|
|
|
48992
49504
|
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);
|
|
48993
49505
|
return symbol;
|
|
48994
49506
|
}
|
|
48995
|
-
if (compilerOptions
|
|
49507
|
+
if (ts.getESModuleInterop(compilerOptions)) {
|
|
48996
49508
|
var referenceParent = referencingLocation.parent;
|
|
48997
49509
|
if ((ts.isImportDeclaration(referenceParent) && ts.getNamespaceDeclarationNode(referenceParent)) ||
|
|
48998
49510
|
ts.isImportCall(referenceParent)) {
|
|
@@ -49877,7 +50389,9 @@ var ts;
|
|
|
49877
50389
|
var typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0), writer);
|
|
49878
50390
|
if (typeNode === undefined)
|
|
49879
50391
|
return ts.Debug.fail("should always get typenode");
|
|
49880
|
-
|
|
50392
|
+
// The unresolved type gets a synthesized comment on `any` to hint to users that it's not a plain `any`.
|
|
50393
|
+
// Otherwise, we always strip comments out.
|
|
50394
|
+
var options = { removeComments: type !== unresolvedType };
|
|
49881
50395
|
var printer = ts.createPrinter(options);
|
|
49882
50396
|
var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration);
|
|
49883
50397
|
printer.writeNode(4 /* Unspecified */, typeNode, /*sourceFile*/ sourceFile, writer);
|
|
@@ -49957,6 +50471,7 @@ var ts;
|
|
|
49957
50471
|
isSourceOfProjectReferenceRedirect: function (fileName) { return host.isSourceOfProjectReferenceRedirect(fileName); },
|
|
49958
50472
|
fileExists: function (fileName) { return host.fileExists(fileName); },
|
|
49959
50473
|
getFileIncludeReasons: function () { return host.getFileIncludeReasons(); },
|
|
50474
|
+
readFile: host.readFile ? (function (fileName) { return host.readFile(fileName); }) : undefined,
|
|
49960
50475
|
} : undefined },
|
|
49961
50476
|
encounteredError: false,
|
|
49962
50477
|
reportedDiagnostic: false,
|
|
@@ -50022,6 +50537,12 @@ var ts;
|
|
|
50022
50537
|
type = getReducedType(type);
|
|
50023
50538
|
}
|
|
50024
50539
|
if (type.flags & 1 /* Any */) {
|
|
50540
|
+
if (type.aliasSymbol) {
|
|
50541
|
+
return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context));
|
|
50542
|
+
}
|
|
50543
|
+
if (type === unresolvedType) {
|
|
50544
|
+
return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "unresolved");
|
|
50545
|
+
}
|
|
50025
50546
|
context.approximateLength += 3;
|
|
50026
50547
|
return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 /* IntrinsicKeyword */ : 130 /* AnyKeyword */);
|
|
50027
50548
|
}
|
|
@@ -51110,6 +51631,10 @@ var ts;
|
|
|
51110
51631
|
}
|
|
51111
51632
|
return specifier;
|
|
51112
51633
|
}
|
|
51634
|
+
function symbolToEntityNameNode(symbol) {
|
|
51635
|
+
var identifier = ts.factory.createIdentifier(ts.unescapeLeadingUnderscores(symbol.escapedName));
|
|
51636
|
+
return symbol.parent ? ts.factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier;
|
|
51637
|
+
}
|
|
51113
51638
|
function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) {
|
|
51114
51639
|
var chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */)); // If we're using aliases outside the current scope, dont bother with the module
|
|
51115
51640
|
var isTypeOf = meaning === 111551 /* Value */;
|
|
@@ -51118,7 +51643,7 @@ var ts;
|
|
|
51118
51643
|
var nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined;
|
|
51119
51644
|
var typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain, 0, context);
|
|
51120
51645
|
var specifier = getSpecifierForModuleSymbol(chain[0], context);
|
|
51121
|
-
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions)
|
|
51646
|
+
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
|
|
51122
51647
|
// If ultimately we can only name the symbol with a reference that dives into a `node_modules` folder, we should error
|
|
51123
51648
|
// since declaration files with these kinds of references are liable to fail when published :(
|
|
51124
51649
|
context.encounteredError = true;
|
|
@@ -51341,7 +51866,7 @@ var ts;
|
|
|
51341
51866
|
if (nameType) {
|
|
51342
51867
|
if (nameType.flags & 384 /* StringOrNumberLiteral */) {
|
|
51343
51868
|
var name = "" + nameType.value;
|
|
51344
|
-
if (!ts.isIdentifierText(name, compilerOptions
|
|
51869
|
+
if (!ts.isIdentifierText(name, ts.getEmitScriptTarget(compilerOptions)) && !isNumericLiteralName(name)) {
|
|
51345
51870
|
return ts.factory.createStringLiteral(name, !!singleQuote);
|
|
51346
51871
|
}
|
|
51347
51872
|
if (isNumericLiteralName(name) && ts.startsWith(name, "-")) {
|
|
@@ -51355,7 +51880,7 @@ var ts;
|
|
|
51355
51880
|
}
|
|
51356
51881
|
}
|
|
51357
51882
|
function createPropertyNameNodeForIdentifierOrLiteral(name, stringNamed, singleQuote) {
|
|
51358
|
-
return ts.isIdentifierText(name, compilerOptions
|
|
51883
|
+
return ts.isIdentifierText(name, ts.getEmitScriptTarget(compilerOptions)) ? ts.factory.createIdentifier(name) :
|
|
51359
51884
|
!stringNamed && isNumericLiteralName(name) && +name >= 0 ? ts.factory.createNumericLiteral(+name) :
|
|
51360
51885
|
ts.factory.createStringLiteral(name, !!singleQuote);
|
|
51361
51886
|
}
|
|
@@ -51396,7 +51921,7 @@ var ts;
|
|
|
51396
51921
|
* so a `unique symbol` is returned when appropriate for the input symbol, rather than `typeof sym`
|
|
51397
51922
|
*/
|
|
51398
51923
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
51399
|
-
if (type
|
|
51924
|
+
if (!isErrorType(type) && enclosingDeclaration) {
|
|
51400
51925
|
var declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
|
|
51401
51926
|
if (declWithExistingAnnotation && !ts.isFunctionLikeDeclaration(declWithExistingAnnotation) && !ts.isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
51402
51927
|
// try to reuse the existing annotation
|
|
@@ -51419,7 +51944,7 @@ var ts;
|
|
|
51419
51944
|
return result;
|
|
51420
51945
|
}
|
|
51421
51946
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
51422
|
-
if (type
|
|
51947
|
+
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
51423
51948
|
var annotation = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
|
|
51424
51949
|
if (!!ts.findAncestor(annotation, function (n) { return n === context.enclosingDeclaration; }) && annotation) {
|
|
51425
51950
|
var annotated = getTypeFromTypeNode(annotation);
|
|
@@ -51526,7 +52051,7 @@ var ts;
|
|
|
51526
52051
|
/*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* AnyKeyword */));
|
|
51527
52052
|
}
|
|
51528
52053
|
}
|
|
51529
|
-
if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(
|
|
52054
|
+
if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* Type */, /*ignoreErrors*/ true))) {
|
|
51530
52055
|
return ts.setOriginalNode(typeToTypeNodeHelper(getTypeFromTypeNode(node), context), node);
|
|
51531
52056
|
}
|
|
51532
52057
|
if (ts.isLiteralImportTypeNode(node)) {
|
|
@@ -52289,6 +52814,27 @@ var ts;
|
|
|
52289
52814
|
/*decorators*/ undefined,
|
|
52290
52815
|
/*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);
|
|
52291
52816
|
}
|
|
52817
|
+
function getSomeTargetNameFromDeclarations(declarations) {
|
|
52818
|
+
return ts.firstDefined(declarations, function (d) {
|
|
52819
|
+
if (ts.isImportSpecifier(d) || ts.isExportSpecifier(d)) {
|
|
52820
|
+
return ts.idText(d.propertyName || d.name);
|
|
52821
|
+
}
|
|
52822
|
+
if (ts.isBinaryExpression(d) || ts.isExportAssignment(d)) {
|
|
52823
|
+
var expression = ts.isExportAssignment(d) ? d.expression : d.right;
|
|
52824
|
+
if (ts.isPropertyAccessExpression(expression)) {
|
|
52825
|
+
return ts.idText(expression.name);
|
|
52826
|
+
}
|
|
52827
|
+
}
|
|
52828
|
+
if (isAliasSymbolDeclaration(d)) {
|
|
52829
|
+
// This is... heuristic, at best. But it's probably better than always printing the name of the shorthand ambient module.
|
|
52830
|
+
var name = ts.getNameOfDeclaration(d);
|
|
52831
|
+
if (name && ts.isIdentifier(name)) {
|
|
52832
|
+
return ts.idText(name);
|
|
52833
|
+
}
|
|
52834
|
+
}
|
|
52835
|
+
return undefined;
|
|
52836
|
+
});
|
|
52837
|
+
}
|
|
52292
52838
|
function serializeAsAlias(symbol, localName, modifierFlags) {
|
|
52293
52839
|
var _a, _b, _c, _d, _e;
|
|
52294
52840
|
// synthesize an alias, eg `export { symbolName as Name }`
|
|
@@ -52301,8 +52847,10 @@ var ts;
|
|
|
52301
52847
|
if (!target) {
|
|
52302
52848
|
return;
|
|
52303
52849
|
}
|
|
52304
|
-
|
|
52305
|
-
|
|
52850
|
+
// If `target` refers to a shorthand module symbol, the name we're trying to pull out isn;t recoverable from the target symbol
|
|
52851
|
+
// In such a scenario, we must fall back to looking for an alias declaration on `symbol` and pulling the target name from that
|
|
52852
|
+
var verbatimTargetName = ts.isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || ts.unescapeLeadingUnderscores(target.escapedName);
|
|
52853
|
+
if (verbatimTargetName === "export=" /* ExportEquals */ && (ts.getESModuleInterop(compilerOptions) || compilerOptions.allowSyntheticDefaultImports)) {
|
|
52306
52854
|
// target refers to an `export=` symbol that was hoisted into a synthetic default - rename here to match
|
|
52307
52855
|
verbatimTargetName = "default" /* Default */;
|
|
52308
52856
|
}
|
|
@@ -52849,7 +53397,7 @@ var ts;
|
|
|
52849
53397
|
if (nameType) {
|
|
52850
53398
|
if (nameType.flags & 384 /* StringOrNumberLiteral */) {
|
|
52851
53399
|
var name = "" + nameType.value;
|
|
52852
|
-
if (!ts.isIdentifierText(name, compilerOptions
|
|
53400
|
+
if (!ts.isIdentifierText(name, ts.getEmitScriptTarget(compilerOptions)) && !isNumericLiteralName(name)) {
|
|
52853
53401
|
return "\"" + ts.escapeString(name, 34 /* doubleQuote */) + "\"";
|
|
52854
53402
|
}
|
|
52855
53403
|
if (isNumericLiteralName(name) && ts.startsWith(name, "-")) {
|
|
@@ -53154,6 +53702,11 @@ var ts;
|
|
|
53154
53702
|
function isTypeAny(type) {
|
|
53155
53703
|
return type && (type.flags & 1 /* Any */) !== 0;
|
|
53156
53704
|
}
|
|
53705
|
+
function isErrorType(type) {
|
|
53706
|
+
// The only 'any' types that have alias symbols are those manufactured by getTypeFromTypeAliasReference for
|
|
53707
|
+
// a reference to an unresolved symbol. We want those to behave like the errorType.
|
|
53708
|
+
return type === errorType || !!(type.flags & 1 /* Any */ && type.aliasSymbol);
|
|
53709
|
+
}
|
|
53157
53710
|
// Return the type of a binding element parent. We check SymbolLinks first to see if a type has been
|
|
53158
53711
|
// assigned by contextual typing.
|
|
53159
53712
|
function getTypeForBindingElementParent(node) {
|
|
@@ -53671,7 +54224,7 @@ var ts;
|
|
|
53671
54224
|
if (!declaredType) {
|
|
53672
54225
|
return type;
|
|
53673
54226
|
}
|
|
53674
|
-
else if (declaredType
|
|
54227
|
+
else if (!isErrorType(declaredType) && !isErrorType(type) && !isTypeIdenticalTo(declaredType, type)) {
|
|
53675
54228
|
errorNextVariableOrPropertyDeclarationMustHaveSameType(/*firstDeclaration*/ undefined, declaredType, declaration, type);
|
|
53676
54229
|
}
|
|
53677
54230
|
}
|
|
@@ -54565,7 +55118,7 @@ var ts;
|
|
|
54565
55118
|
for (var _b = 0, implementsTypeNodes_1 = implementsTypeNodes; _b < implementsTypeNodes_1.length; _b++) {
|
|
54566
55119
|
var node = implementsTypeNodes_1[_b];
|
|
54567
55120
|
var implementsType = getTypeFromTypeNode(node);
|
|
54568
|
-
if (implementsType
|
|
55121
|
+
if (!isErrorType(implementsType)) {
|
|
54569
55122
|
if (resolvedImplementsTypes === ts.emptyArray) {
|
|
54570
55123
|
resolvedImplementsTypes = [implementsType];
|
|
54571
55124
|
}
|
|
@@ -54645,7 +55198,7 @@ var ts;
|
|
|
54645
55198
|
}
|
|
54646
55199
|
baseType = getReturnTypeOfSignature(constructors[0]);
|
|
54647
55200
|
}
|
|
54648
|
-
if (baseType
|
|
55201
|
+
if (isErrorType(baseType)) {
|
|
54649
55202
|
return type.resolvedBaseTypes = ts.emptyArray;
|
|
54650
55203
|
}
|
|
54651
55204
|
var reducedBaseType = getReducedType(baseType);
|
|
@@ -54701,7 +55254,7 @@ var ts;
|
|
|
54701
55254
|
for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {
|
|
54702
55255
|
var node = _c[_b];
|
|
54703
55256
|
var baseType = getReducedType(getTypeFromTypeNode(node));
|
|
54704
|
-
if (baseType
|
|
55257
|
+
if (!isErrorType(baseType)) {
|
|
54705
55258
|
if (isValidBaseType(baseType)) {
|
|
54706
55259
|
if (type !== baseType && !hasBaseType(baseType, type)) {
|
|
54707
55260
|
if (type.resolvedBaseTypes === ts.emptyArray) {
|
|
@@ -56543,7 +57096,7 @@ var ts;
|
|
|
56543
57096
|
for (var _i = 0, _c = containingType.types; _i < _c.length; _i++) {
|
|
56544
57097
|
var current = _c[_i];
|
|
56545
57098
|
var type = getApparentType(current);
|
|
56546
|
-
if (!(type
|
|
57099
|
+
if (!(isErrorType(type) || type.flags & 131072 /* Never */)) {
|
|
56547
57100
|
var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment);
|
|
56548
57101
|
var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
|
|
56549
57102
|
if (prop) {
|
|
@@ -57493,7 +58046,7 @@ var ts;
|
|
|
57493
58046
|
}
|
|
57494
58047
|
else {
|
|
57495
58048
|
var type = getTypeFromTypeNode(constraintDeclaration);
|
|
57496
|
-
if (type.flags & 1 /* Any */ && type
|
|
58049
|
+
if (type.flags & 1 /* Any */ && !isErrorType(type)) { // Allow errorType to propegate to keep downstream errors suppressed
|
|
57497
58050
|
// use keyofConstraintType as the base constraint for mapped type key constraints (unknown isn;t assignable to that, but `any` was),
|
|
57498
58051
|
// use unknown otherwise
|
|
57499
58052
|
type = constraintDeclaration.parent.parent.kind === 194 /* MappedType */ ? keyofConstraintType : unknownType;
|
|
@@ -57665,6 +58218,18 @@ var ts;
|
|
|
57665
58218
|
* declared type. Instantiations are cached using the type identities of the type arguments as the key.
|
|
57666
58219
|
*/
|
|
57667
58220
|
function getTypeFromTypeAliasReference(node, symbol) {
|
|
58221
|
+
if (ts.getCheckFlags(symbol) & 1048576 /* Unresolved */) {
|
|
58222
|
+
var typeArguments = typeArgumentsFromTypeReferenceNode(node);
|
|
58223
|
+
var id = getAliasId(symbol, typeArguments);
|
|
58224
|
+
var errorType_1 = errorTypes.get(id);
|
|
58225
|
+
if (!errorType_1) {
|
|
58226
|
+
errorType_1 = createIntrinsicType(1 /* Any */, "error");
|
|
58227
|
+
errorType_1.aliasSymbol = symbol;
|
|
58228
|
+
errorType_1.aliasTypeArguments = typeArguments;
|
|
58229
|
+
errorTypes.set(id, errorType_1);
|
|
58230
|
+
}
|
|
58231
|
+
return errorType_1;
|
|
58232
|
+
}
|
|
57668
58233
|
var type = getDeclaredTypeOfSymbol(symbol);
|
|
57669
58234
|
var typeParameters = getSymbolLinks(symbol).typeParameters;
|
|
57670
58235
|
if (typeParameters) {
|
|
@@ -57706,11 +58271,37 @@ var ts;
|
|
|
57706
58271
|
}
|
|
57707
58272
|
return undefined;
|
|
57708
58273
|
}
|
|
57709
|
-
function
|
|
57710
|
-
|
|
58274
|
+
function getSymbolPath(symbol) {
|
|
58275
|
+
return symbol.parent ? getSymbolPath(symbol.parent) + "." + symbol.escapedName : symbol.escapedName;
|
|
58276
|
+
}
|
|
58277
|
+
function getUnresolvedSymbolForEntityName(name) {
|
|
58278
|
+
var identifier = name.kind === 160 /* QualifiedName */ ? name.right :
|
|
58279
|
+
name.kind === 205 /* PropertyAccessExpression */ ? name.name :
|
|
58280
|
+
name;
|
|
58281
|
+
var text = identifier.escapedText;
|
|
58282
|
+
if (text) {
|
|
58283
|
+
var parentSymbol = name.kind === 160 /* QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) :
|
|
58284
|
+
name.kind === 205 /* PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) :
|
|
58285
|
+
undefined;
|
|
58286
|
+
var path = parentSymbol ? getSymbolPath(parentSymbol) + "." + text : text;
|
|
58287
|
+
var result = unresolvedSymbols.get(path);
|
|
58288
|
+
if (!result) {
|
|
58289
|
+
unresolvedSymbols.set(path, result = createSymbol(524288 /* TypeAlias */, text, 1048576 /* Unresolved */));
|
|
58290
|
+
result.parent = parentSymbol;
|
|
58291
|
+
result.declaredType = unresolvedType;
|
|
58292
|
+
}
|
|
58293
|
+
return result;
|
|
58294
|
+
}
|
|
58295
|
+
return unknownSymbol;
|
|
58296
|
+
}
|
|
58297
|
+
function resolveTypeReferenceName(typeReference, meaning, ignoreErrors) {
|
|
58298
|
+
var name = getTypeReferenceName(typeReference);
|
|
58299
|
+
if (!name) {
|
|
57711
58300
|
return unknownSymbol;
|
|
57712
58301
|
}
|
|
57713
|
-
|
|
58302
|
+
var symbol = resolveEntityName(name, meaning, ignoreErrors);
|
|
58303
|
+
return symbol && symbol !== unknownSymbol ? symbol :
|
|
58304
|
+
ignoreErrors ? unknownSymbol : getUnresolvedSymbolForEntityName(name);
|
|
57714
58305
|
}
|
|
57715
58306
|
function getTypeReferenceType(node, symbol) {
|
|
57716
58307
|
if (symbol === unknownSymbol) {
|
|
@@ -57735,7 +58326,7 @@ var ts;
|
|
|
57735
58326
|
}
|
|
57736
58327
|
else {
|
|
57737
58328
|
// Resolve the type reference as a Type for the purpose of reporting errors.
|
|
57738
|
-
resolveTypeReferenceName(
|
|
58329
|
+
resolveTypeReferenceName(node, 788968 /* Type */);
|
|
57739
58330
|
return getTypeOfSymbol(symbol);
|
|
57740
58331
|
}
|
|
57741
58332
|
}
|
|
@@ -57879,18 +58470,18 @@ var ts;
|
|
|
57879
58470
|
if (isJSDocTypeReference(node)) {
|
|
57880
58471
|
type = getIntendedTypeFromJSDocTypeReference(node);
|
|
57881
58472
|
if (!type) {
|
|
57882
|
-
symbol = resolveTypeReferenceName(
|
|
58473
|
+
symbol = resolveTypeReferenceName(node, meaning, /*ignoreErrors*/ true);
|
|
57883
58474
|
if (symbol === unknownSymbol) {
|
|
57884
|
-
symbol = resolveTypeReferenceName(
|
|
58475
|
+
symbol = resolveTypeReferenceName(node, meaning | 111551 /* Value */);
|
|
57885
58476
|
}
|
|
57886
58477
|
else {
|
|
57887
|
-
resolveTypeReferenceName(
|
|
58478
|
+
resolveTypeReferenceName(node, meaning); // Resolve again to mark errors, if any
|
|
57888
58479
|
}
|
|
57889
58480
|
type = getTypeReferenceType(node, symbol);
|
|
57890
58481
|
}
|
|
57891
58482
|
}
|
|
57892
58483
|
if (!type) {
|
|
57893
|
-
symbol = resolveTypeReferenceName(
|
|
58484
|
+
symbol = resolveTypeReferenceName(node, meaning);
|
|
57894
58485
|
type = getTypeReferenceType(node, symbol);
|
|
57895
58486
|
}
|
|
57896
58487
|
// Cache both the resolved symbol and the resolved type. The resolved symbol is needed when we check the
|
|
@@ -58151,7 +58742,7 @@ var ts;
|
|
|
58151
58742
|
function mayResolveTypeAlias(node) {
|
|
58152
58743
|
switch (node.kind) {
|
|
58153
58744
|
case 177 /* TypeReference */:
|
|
58154
|
-
return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node
|
|
58745
|
+
return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* Type */).flags & 524288 /* TypeAlias */);
|
|
58155
58746
|
case 180 /* TypeQuery */:
|
|
58156
58747
|
return true;
|
|
58157
58748
|
case 192 /* TypeOperator */:
|
|
@@ -58426,8 +59017,6 @@ var ts;
|
|
|
58426
59017
|
// We ignore 'never' types in unions
|
|
58427
59018
|
if (!(flags & 131072 /* Never */)) {
|
|
58428
59019
|
includes |= flags & 205258751 /* IncludesMask */;
|
|
58429
|
-
if (flags & 469499904 /* StructuredOrInstantiable */)
|
|
58430
|
-
includes |= 262144 /* IncludesStructuredOrInstantiable */;
|
|
58431
59020
|
if (type === wildcardType)
|
|
58432
59021
|
includes |= 8388608 /* IncludesWildcard */;
|
|
58433
59022
|
if (!strictNullChecks && flags & 98304 /* Nullable */) {
|
|
@@ -58733,13 +59322,19 @@ var ts;
|
|
|
58733
59322
|
if (type === wildcardType)
|
|
58734
59323
|
includes |= 8388608 /* IncludesWildcard */;
|
|
58735
59324
|
}
|
|
58736
|
-
else if (
|
|
58737
|
-
if (
|
|
58738
|
-
|
|
58739
|
-
|
|
58740
|
-
|
|
59325
|
+
else if (strictNullChecks || !(flags & 98304 /* Nullable */)) {
|
|
59326
|
+
if (exactOptionalPropertyTypes && type === missingType) {
|
|
59327
|
+
includes |= 262144 /* IncludesMissingType */;
|
|
59328
|
+
type = undefinedType;
|
|
59329
|
+
}
|
|
59330
|
+
if (!typeSet.has(type.id.toString())) {
|
|
59331
|
+
if (type.flags & 109440 /* Unit */ && includes & 109440 /* Unit */) {
|
|
59332
|
+
// We have seen two distinct unit types which means we should reduce to an
|
|
59333
|
+
// empty intersection. Adding TypeFlags.NonPrimitive causes that to happen.
|
|
59334
|
+
includes |= 67108864 /* NonPrimitive */;
|
|
59335
|
+
}
|
|
59336
|
+
typeSet.set(type.id.toString(), type);
|
|
58741
59337
|
}
|
|
58742
|
-
typeSet.set(type.id.toString(), type);
|
|
58743
59338
|
}
|
|
58744
59339
|
includes |= flags & 205258751 /* IncludesMask */;
|
|
58745
59340
|
}
|
|
@@ -58812,14 +59407,13 @@ var ts;
|
|
|
58812
59407
|
}
|
|
58813
59408
|
return false;
|
|
58814
59409
|
}
|
|
58815
|
-
function
|
|
58816
|
-
|
|
58817
|
-
|
|
58818
|
-
|
|
58819
|
-
|
|
58820
|
-
return
|
|
59410
|
+
function eachIsUnionContaining(types, flag) {
|
|
59411
|
+
return ts.every(types, function (t) { return !!(t.flags & 1048576 /* Union */) && ts.some(t.types, function (tt) { return !!(tt.flags & flag); }); });
|
|
59412
|
+
}
|
|
59413
|
+
function removeFromEach(types, flag) {
|
|
59414
|
+
for (var i = 0; i < types.length; i++) {
|
|
59415
|
+
types[i] = filterType(types[i], function (t) { return !(t.flags & flag); });
|
|
58821
59416
|
}
|
|
58822
|
-
return false;
|
|
58823
59417
|
}
|
|
58824
59418
|
// If the given list of types contains more than one union of primitive types, replace the
|
|
58825
59419
|
// first with a union containing an intersection of those primitive types, then remove the
|
|
@@ -58928,6 +59522,9 @@ var ts;
|
|
|
58928
59522
|
if (includes & 16777216 /* IncludesEmptyObject */ && includes & 524288 /* Object */) {
|
|
58929
59523
|
ts.orderedRemoveItemAt(typeSet, ts.findIndex(typeSet, isEmptyAnonymousObjectType));
|
|
58930
59524
|
}
|
|
59525
|
+
if (includes & 262144 /* IncludesMissingType */) {
|
|
59526
|
+
typeSet[typeSet.indexOf(undefinedType)] = missingType;
|
|
59527
|
+
}
|
|
58931
59528
|
if (typeSet.length === 0) {
|
|
58932
59529
|
return unknownType;
|
|
58933
59530
|
}
|
|
@@ -58944,10 +59541,13 @@ var ts;
|
|
|
58944
59541
|
// reduced we'll never reduce again, so this occurs at most once.
|
|
58945
59542
|
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
58946
59543
|
}
|
|
58947
|
-
else if (
|
|
58948
|
-
|
|
59544
|
+
else if (eachIsUnionContaining(typeSet, 32768 /* Undefined */)) {
|
|
59545
|
+
var undefinedOrMissingType = exactOptionalPropertyTypes && ts.some(typeSet, function (t) { return containsType(t.types, missingType); }) ? missingType : undefinedType;
|
|
59546
|
+
removeFromEach(typeSet, 32768 /* Undefined */);
|
|
59547
|
+
result = getUnionType([getIntersectionType(typeSet), undefinedOrMissingType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
58949
59548
|
}
|
|
58950
|
-
else if (
|
|
59549
|
+
else if (eachIsUnionContaining(typeSet, 65536 /* Null */)) {
|
|
59550
|
+
removeFromEach(typeSet, 65536 /* Null */);
|
|
58951
59551
|
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
58952
59552
|
}
|
|
58953
59553
|
else {
|
|
@@ -60680,7 +61280,7 @@ var ts;
|
|
|
60680
61280
|
var mappedTypeVariable = instantiateType(typeVariable, mapper);
|
|
60681
61281
|
if (typeVariable !== mappedTypeVariable) {
|
|
60682
61282
|
return mapTypeWithAlias(getReducedType(mappedTypeVariable), function (t) {
|
|
60683
|
-
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && t
|
|
61283
|
+
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
60684
61284
|
if (!type.declaration.nameType) {
|
|
60685
61285
|
if (isArrayType(t)) {
|
|
60686
61286
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
@@ -60722,7 +61322,7 @@ var ts;
|
|
|
60722
61322
|
}
|
|
60723
61323
|
function instantiateMappedArrayType(arrayType, mappedType, mapper) {
|
|
60724
61324
|
var elementType = instantiateMappedTypeTemplate(mappedType, numberType, /*isOptional*/ true, mapper);
|
|
60725
|
-
return elementType
|
|
61325
|
+
return isErrorType(elementType) ? errorType :
|
|
60726
61326
|
createArrayType(elementType, getModifiedReadonlyState(isReadonlyArrayType(arrayType), getMappedTypeModifiers(mappedType)));
|
|
60727
61327
|
}
|
|
60728
61328
|
function instantiateMappedTupleType(tupleType, mappedType, mapper) {
|
|
@@ -61940,7 +62540,7 @@ var ts;
|
|
|
61940
62540
|
path = "" + str;
|
|
61941
62541
|
}
|
|
61942
62542
|
// Otherwise write a dotted name if possible
|
|
61943
|
-
else if (ts.isIdentifierText(str, compilerOptions
|
|
62543
|
+
else if (ts.isIdentifierText(str, ts.getEmitScriptTarget(compilerOptions))) {
|
|
61944
62544
|
path = path + "." + str;
|
|
61945
62545
|
}
|
|
61946
62546
|
// Failing that, check if the name is already a computed name
|
|
@@ -62304,7 +62904,7 @@ var ts;
|
|
|
62304
62904
|
var targetTypes = target.types;
|
|
62305
62905
|
var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode);
|
|
62306
62906
|
var intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode);
|
|
62307
|
-
if (intrinsicAttributes
|
|
62907
|
+
if (!isErrorType(intrinsicAttributes) && !isErrorType(intrinsicClassAttributes) &&
|
|
62308
62908
|
(ts.contains(targetTypes, intrinsicAttributes) || ts.contains(targetTypes, intrinsicClassAttributes))) {
|
|
62309
62909
|
// do not report top error
|
|
62310
62910
|
return result;
|
|
@@ -67819,6 +68419,9 @@ var ts;
|
|
|
67819
68419
|
case 102 /* InstanceOfKeyword */:
|
|
67820
68420
|
return narrowTypeByInstanceof(type, expr, assumeTrue);
|
|
67821
68421
|
case 101 /* InKeyword */:
|
|
68422
|
+
if (ts.isPrivateIdentifier(expr.left)) {
|
|
68423
|
+
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
68424
|
+
}
|
|
67822
68425
|
var target = getReferenceCandidate(expr.right);
|
|
67823
68426
|
var leftType = getTypeOfNode(expr.left);
|
|
67824
68427
|
if (leftType.flags & 128 /* StringLiteral */) {
|
|
@@ -67848,6 +68451,22 @@ var ts;
|
|
|
67848
68451
|
}
|
|
67849
68452
|
return type;
|
|
67850
68453
|
}
|
|
68454
|
+
function narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue) {
|
|
68455
|
+
var target = getReferenceCandidate(expr.right);
|
|
68456
|
+
if (!isMatchingReference(reference, target)) {
|
|
68457
|
+
return type;
|
|
68458
|
+
}
|
|
68459
|
+
ts.Debug.assertNode(expr.left, ts.isPrivateIdentifier);
|
|
68460
|
+
var symbol = getSymbolForPrivateIdentifierExpression(expr.left);
|
|
68461
|
+
if (symbol === undefined) {
|
|
68462
|
+
return type;
|
|
68463
|
+
}
|
|
68464
|
+
var classSymbol = symbol.parent;
|
|
68465
|
+
var targetType = ts.hasStaticModifier(ts.Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration"))
|
|
68466
|
+
? getTypeOfSymbol(classSymbol)
|
|
68467
|
+
: getDeclaredTypeOfSymbol(classSymbol);
|
|
68468
|
+
return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
|
|
68469
|
+
}
|
|
67851
68470
|
function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) {
|
|
67852
68471
|
// We are in a branch of obj?.foo === value (or any one of the other equality operators). We narrow obj as follows:
|
|
67853
68472
|
// When operator is === and type of value excludes undefined, null and undefined is removed from type of obj in true branch.
|
|
@@ -69281,8 +69900,7 @@ var ts;
|
|
|
69281
69900
|
if (result) {
|
|
69282
69901
|
return result;
|
|
69283
69902
|
}
|
|
69284
|
-
if (!(contextFlags & 8 /* SkipBindingPatterns */) && ts.isBindingPattern(declaration.name)) {
|
|
69285
|
-
// This is less a contextual type and more an implied shape - in some cases, this may be undesirable
|
|
69903
|
+
if (!(contextFlags & 8 /* SkipBindingPatterns */) && ts.isBindingPattern(declaration.name)) { // This is less a contextual type and more an implied shape - in some cases, this may be undesirable
|
|
69286
69904
|
return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true, /*reportErrors*/ false);
|
|
69287
69905
|
}
|
|
69288
69906
|
}
|
|
@@ -69863,7 +70481,7 @@ var ts;
|
|
|
69863
70481
|
var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType);
|
|
69864
70482
|
propsType = getJsxManagedAttributesFromLocatedAttributes(context, getJsxNamespaceAt(context), propsType);
|
|
69865
70483
|
var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
|
|
69866
|
-
if (intrinsicAttribs
|
|
70484
|
+
if (!isErrorType(intrinsicAttribs)) {
|
|
69867
70485
|
propsType = intersectTypes(intrinsicAttribs, propsType);
|
|
69868
70486
|
}
|
|
69869
70487
|
return propsType;
|
|
@@ -69956,7 +70574,7 @@ var ts;
|
|
|
69956
70574
|
// Normal case -- add in IntrinsicClassElements<T> and IntrinsicElements
|
|
69957
70575
|
var apparentAttributesType = attributesType;
|
|
69958
70576
|
var intrinsicClassAttribs = getJsxType(JsxNames.IntrinsicClassAttributes, context);
|
|
69959
|
-
if (intrinsicClassAttribs
|
|
70577
|
+
if (!isErrorType(intrinsicClassAttribs)) {
|
|
69960
70578
|
var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
|
|
69961
70579
|
var hostClassType = getReturnTypeOfSignature(sig);
|
|
69962
70580
|
apparentAttributesType = intersectTypes(typeParams
|
|
@@ -69964,7 +70582,7 @@ var ts;
|
|
|
69964
70582
|
: intrinsicClassAttribs, apparentAttributesType);
|
|
69965
70583
|
}
|
|
69966
70584
|
var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
|
|
69967
|
-
if (intrinsicAttribs
|
|
70585
|
+
if (!isErrorType(intrinsicAttribs)) {
|
|
69968
70586
|
apparentAttributesType = intersectTypes(intrinsicAttribs, apparentAttributesType);
|
|
69969
70587
|
}
|
|
69970
70588
|
return apparentAttributesType;
|
|
@@ -70432,7 +71050,7 @@ var ts;
|
|
|
70432
71050
|
checkSpreadPropOverrides(mergedType, allPropertiesTable, memberDecl);
|
|
70433
71051
|
}
|
|
70434
71052
|
offset = propertiesArray.length;
|
|
70435
|
-
if (spread
|
|
71053
|
+
if (isErrorType(spread)) {
|
|
70436
71054
|
continue;
|
|
70437
71055
|
}
|
|
70438
71056
|
spread = getSpreadType(spread, mergedType, node.symbol, objectFlags, inConstContext);
|
|
@@ -70489,7 +71107,7 @@ var ts;
|
|
|
70489
71107
|
}
|
|
70490
71108
|
}
|
|
70491
71109
|
}
|
|
70492
|
-
if (spread
|
|
71110
|
+
if (isErrorType(spread)) {
|
|
70493
71111
|
return errorType;
|
|
70494
71112
|
}
|
|
70495
71113
|
if (spread !== emptyObjectType) {
|
|
@@ -70756,7 +71374,7 @@ var ts;
|
|
|
70756
71374
|
var links = getNodeLinks(node);
|
|
70757
71375
|
if (!links.resolvedSymbol) {
|
|
70758
71376
|
var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements, node);
|
|
70759
|
-
if (intrinsicElementsType
|
|
71377
|
+
if (!isErrorType(intrinsicElementsType)) {
|
|
70760
71378
|
// Property case
|
|
70761
71379
|
if (!ts.isIdentifier(node.tagName))
|
|
70762
71380
|
return ts.Debug.fail();
|
|
@@ -70919,7 +71537,7 @@ var ts;
|
|
|
70919
71537
|
// var CustomTag: "h1" = "h1";
|
|
70920
71538
|
// <CustomTag> Hello World </CustomTag>
|
|
70921
71539
|
var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements, location);
|
|
70922
|
-
if (intrinsicElementsType
|
|
71540
|
+
if (!isErrorType(intrinsicElementsType)) {
|
|
70923
71541
|
var stringLiteralTypeName = type.value;
|
|
70924
71542
|
var intrinsicProp = getPropertyOfType(intrinsicElementsType, ts.escapeLeadingUnderscores(stringLiteralTypeName));
|
|
70925
71543
|
if (intrinsicProp) {
|
|
@@ -70987,7 +71605,7 @@ var ts;
|
|
|
70987
71605
|
}
|
|
70988
71606
|
function getJsxElementClassTypeAt(location) {
|
|
70989
71607
|
var type = getJsxType(JsxNames.ElementClass, location);
|
|
70990
|
-
if (type
|
|
71608
|
+
if (isErrorType(type))
|
|
70991
71609
|
return undefined;
|
|
70992
71610
|
return type;
|
|
70993
71611
|
}
|
|
@@ -71293,7 +71911,7 @@ var ts;
|
|
|
71293
71911
|
}
|
|
71294
71912
|
function checkNonNullNonVoidType(type, node) {
|
|
71295
71913
|
var nonNullType = checkNonNullType(type, node);
|
|
71296
|
-
if (nonNullType
|
|
71914
|
+
if (nonNullType.flags & 16384 /* Void */) {
|
|
71297
71915
|
error(node, ts.Diagnostics.Object_is_possibly_undefined);
|
|
71298
71916
|
}
|
|
71299
71917
|
return nonNullType;
|
|
@@ -71328,6 +71946,36 @@ var ts;
|
|
|
71328
71946
|
}
|
|
71329
71947
|
}
|
|
71330
71948
|
}
|
|
71949
|
+
function checkGrammarPrivateIdentifierExpression(privId) {
|
|
71950
|
+
if (!ts.getContainingClass(privId)) {
|
|
71951
|
+
return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
71952
|
+
}
|
|
71953
|
+
if (!ts.isExpressionNode(privId)) {
|
|
71954
|
+
return grammarErrorOnNode(privId, ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression);
|
|
71955
|
+
}
|
|
71956
|
+
if (!getSymbolForPrivateIdentifierExpression(privId)) {
|
|
71957
|
+
return grammarErrorOnNode(privId, ts.Diagnostics.Cannot_find_name_0, ts.idText(privId));
|
|
71958
|
+
}
|
|
71959
|
+
return false;
|
|
71960
|
+
}
|
|
71961
|
+
function checkPrivateIdentifierExpression(privId) {
|
|
71962
|
+
checkGrammarPrivateIdentifierExpression(privId);
|
|
71963
|
+
var symbol = getSymbolForPrivateIdentifierExpression(privId);
|
|
71964
|
+
if (symbol) {
|
|
71965
|
+
markPropertyAsReferenced(symbol, /* nodeForCheckWriteOnly: */ undefined, /* isThisAccess: */ false);
|
|
71966
|
+
}
|
|
71967
|
+
return anyType;
|
|
71968
|
+
}
|
|
71969
|
+
function getSymbolForPrivateIdentifierExpression(privId) {
|
|
71970
|
+
if (!ts.isExpressionNode(privId)) {
|
|
71971
|
+
return undefined;
|
|
71972
|
+
}
|
|
71973
|
+
var links = getNodeLinks(privId);
|
|
71974
|
+
if (links.resolvedSymbol === undefined) {
|
|
71975
|
+
links.resolvedSymbol = lookupSymbolForPrivateIdentifierDeclaration(privId.escapedText, privId);
|
|
71976
|
+
}
|
|
71977
|
+
return links.resolvedSymbol;
|
|
71978
|
+
}
|
|
71331
71979
|
function getPrivateIdentifierPropertyOfType(leftType, lexicallyScopedIdentifier) {
|
|
71332
71980
|
return getPropertyOfType(leftType, lexicallyScopedIdentifier.escapedName);
|
|
71333
71981
|
}
|
|
@@ -71391,7 +72039,7 @@ var ts;
|
|
|
71391
72039
|
if (assignmentKind && lexicallyScopedSymbol && lexicallyScopedSymbol.valueDeclaration && ts.isMethodDeclaration(lexicallyScopedSymbol.valueDeclaration)) {
|
|
71392
72040
|
grammarErrorOnNode(right, ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable, ts.idText(right));
|
|
71393
72041
|
}
|
|
71394
|
-
if ((lexicallyScopedSymbol === null || lexicallyScopedSymbol === void 0 ? void 0 : lexicallyScopedSymbol.valueDeclaration) && (compilerOptions
|
|
72042
|
+
if ((lexicallyScopedSymbol === null || lexicallyScopedSymbol === void 0 ? void 0 : lexicallyScopedSymbol.valueDeclaration) && (ts.getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ && !useDefineForClassFields)) {
|
|
71395
72043
|
var lexicalClass_1 = ts.getContainingClass(lexicallyScopedSymbol.valueDeclaration);
|
|
71396
72044
|
var parentStaticFieldInitializer = ts.findAncestor(node, function (n) {
|
|
71397
72045
|
if (n === lexicalClass_1)
|
|
@@ -71410,7 +72058,7 @@ var ts;
|
|
|
71410
72058
|
}
|
|
71411
72059
|
if (isAnyLike) {
|
|
71412
72060
|
if (lexicallyScopedSymbol) {
|
|
71413
|
-
return apparentType;
|
|
72061
|
+
return isErrorType(apparentType) ? errorType : apparentType;
|
|
71414
72062
|
}
|
|
71415
72063
|
if (!ts.getContainingClass(right)) {
|
|
71416
72064
|
grammarErrorOnNode(right, ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies);
|
|
@@ -71434,7 +72082,8 @@ var ts;
|
|
|
71434
72082
|
if (ts.isIdentifier(left) && parentSymbol) {
|
|
71435
72083
|
markAliasReferenced(parentSymbol, node);
|
|
71436
72084
|
}
|
|
71437
|
-
return apparentType;
|
|
72085
|
+
return isErrorType(apparentType) ? errorType : apparentType;
|
|
72086
|
+
;
|
|
71438
72087
|
}
|
|
71439
72088
|
prop = getPropertyOfType(apparentType, right.escapedText);
|
|
71440
72089
|
}
|
|
@@ -71893,7 +72542,7 @@ var ts;
|
|
|
71893
72542
|
}
|
|
71894
72543
|
function isValidPropertyAccessWithType(node, isSuper, propertyName, type) {
|
|
71895
72544
|
// Short-circuiting for improved performance.
|
|
71896
|
-
if (
|
|
72545
|
+
if (isTypeAny(type)) {
|
|
71897
72546
|
return true;
|
|
71898
72547
|
}
|
|
71899
72548
|
var prop = getPropertyOfType(type, propertyName);
|
|
@@ -71911,7 +72560,7 @@ var ts;
|
|
|
71911
72560
|
*/
|
|
71912
72561
|
function isPropertyAccessible(node, isSuper, isWrite, containingType, property) {
|
|
71913
72562
|
// Short-circuiting for improved performance.
|
|
71914
|
-
if (
|
|
72563
|
+
if (isTypeAny(containingType)) {
|
|
71915
72564
|
return true;
|
|
71916
72565
|
}
|
|
71917
72566
|
// A #private property access in an optional chain is an error dealt with by the parser.
|
|
@@ -71982,7 +72631,7 @@ var ts;
|
|
|
71982
72631
|
var objectType = ts.getAssignmentTargetKind(node) !== 0 /* None */ || isMethodAccessForCall(node) ? getWidenedType(exprType) : exprType;
|
|
71983
72632
|
var indexExpression = node.argumentExpression;
|
|
71984
72633
|
var indexType = checkExpression(indexExpression);
|
|
71985
|
-
if (objectType
|
|
72634
|
+
if (isErrorType(objectType) || objectType === silentNeverType) {
|
|
71986
72635
|
return objectType;
|
|
71987
72636
|
}
|
|
71988
72637
|
if (isConstEnumObjectType(objectType) && !ts.isStringLiteralLike(indexExpression)) {
|
|
@@ -72227,7 +72876,7 @@ var ts;
|
|
|
72227
72876
|
// 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the
|
|
72228
72877
|
// return type of 'wrap'.
|
|
72229
72878
|
if (node.kind !== 164 /* Decorator */) {
|
|
72230
|
-
var contextualType = getContextualType(node, 8 /* SkipBindingPatterns */);
|
|
72879
|
+
var contextualType = getContextualType(node, ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }) ? 8 /* SkipBindingPatterns */ : 0 /* None */);
|
|
72231
72880
|
if (contextualType) {
|
|
72232
72881
|
// We clone the inference context to avoid disturbing a resolution in progress for an
|
|
72233
72882
|
// outer call expression. Effectively we just want a snapshot of whatever has been
|
|
@@ -73176,7 +73825,7 @@ var ts;
|
|
|
73176
73825
|
}
|
|
73177
73826
|
return anySignature;
|
|
73178
73827
|
}
|
|
73179
|
-
if (superType
|
|
73828
|
+
if (!isErrorType(superType)) {
|
|
73180
73829
|
// In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated
|
|
73181
73830
|
// with the type arguments specified in the extends clause.
|
|
73182
73831
|
var baseTypeNode = ts.getEffectiveBaseTypeNode(ts.getContainingClass(node));
|
|
@@ -73204,7 +73853,7 @@ var ts;
|
|
|
73204
73853
|
return silentNeverSignature;
|
|
73205
73854
|
}
|
|
73206
73855
|
var apparentType = getApparentType(funcType);
|
|
73207
|
-
if (apparentType
|
|
73856
|
+
if (isErrorType(apparentType)) {
|
|
73208
73857
|
// Another error has already been reported
|
|
73209
73858
|
return resolveErrorCall(node);
|
|
73210
73859
|
}
|
|
@@ -73220,7 +73869,7 @@ var ts;
|
|
|
73220
73869
|
if (isUntypedFunctionCall(funcType, apparentType, callSignatures.length, numConstructSignatures)) {
|
|
73221
73870
|
// The unknownType indicates that an error already occurred (and was reported). No
|
|
73222
73871
|
// need to report another error in this case.
|
|
73223
|
-
if (funcType
|
|
73872
|
+
if (!isErrorType(funcType) && node.typeArguments) {
|
|
73224
73873
|
error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments);
|
|
73225
73874
|
}
|
|
73226
73875
|
return resolveUntypedCall(node);
|
|
@@ -73297,7 +73946,7 @@ var ts;
|
|
|
73297
73946
|
// signatures for overload resolution. The result type of the function call becomes
|
|
73298
73947
|
// the result type of the operation.
|
|
73299
73948
|
expressionType = getApparentType(expressionType);
|
|
73300
|
-
if (expressionType
|
|
73949
|
+
if (isErrorType(expressionType)) {
|
|
73301
73950
|
// Another error has already been reported
|
|
73302
73951
|
return resolveErrorCall(node);
|
|
73303
73952
|
}
|
|
@@ -73512,7 +74161,7 @@ var ts;
|
|
|
73512
74161
|
function resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode) {
|
|
73513
74162
|
var tagType = checkExpression(node.tag);
|
|
73514
74163
|
var apparentType = getApparentType(tagType);
|
|
73515
|
-
if (apparentType
|
|
74164
|
+
if (isErrorType(apparentType)) {
|
|
73516
74165
|
// Another error has already been reported
|
|
73517
74166
|
return resolveErrorCall(node);
|
|
73518
74167
|
}
|
|
@@ -73558,7 +74207,7 @@ var ts;
|
|
|
73558
74207
|
function resolveDecorator(node, candidatesOutArray, checkMode) {
|
|
73559
74208
|
var funcType = checkExpression(node.expression);
|
|
73560
74209
|
var apparentType = getApparentType(funcType);
|
|
73561
|
-
if (apparentType
|
|
74210
|
+
if (isErrorType(apparentType)) {
|
|
73562
74211
|
return resolveErrorCall(node);
|
|
73563
74212
|
}
|
|
73564
74213
|
var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */);
|
|
@@ -73613,7 +74262,7 @@ var ts;
|
|
|
73613
74262
|
}
|
|
73614
74263
|
var exprTypes = checkExpression(node.tagName);
|
|
73615
74264
|
var apparentType = getApparentType(exprTypes);
|
|
73616
|
-
if (apparentType
|
|
74265
|
+
if (isErrorType(apparentType)) {
|
|
73617
74266
|
return resolveErrorCall(node);
|
|
73618
74267
|
}
|
|
73619
74268
|
var signatures = getUninstantiatedJsxSignaturesOfType(exprTypes, node);
|
|
@@ -73936,7 +74585,7 @@ var ts;
|
|
|
73936
74585
|
}
|
|
73937
74586
|
function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol) {
|
|
73938
74587
|
var _a;
|
|
73939
|
-
if (allowSyntheticDefaultImports && type && type
|
|
74588
|
+
if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
|
|
73940
74589
|
var synthType = type;
|
|
73941
74590
|
if (!synthType.syntheticType) {
|
|
73942
74591
|
var file = (_a = originalSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
|
|
@@ -73999,6 +74648,12 @@ var ts;
|
|
|
73999
74648
|
return getReturnTypeOfSignature(signature);
|
|
74000
74649
|
}
|
|
74001
74650
|
function checkAssertion(node) {
|
|
74651
|
+
if (node.kind === 210 /* TypeAssertionExpression */) {
|
|
74652
|
+
var file = ts.getSourceFileOfNode(node);
|
|
74653
|
+
if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Cts */, ".mts" /* Mts */])) {
|
|
74654
|
+
grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
|
|
74655
|
+
}
|
|
74656
|
+
}
|
|
74002
74657
|
return checkAssertionWorker(node, node.type, node.expression);
|
|
74003
74658
|
}
|
|
74004
74659
|
function isValidConstAssertionArgument(node) {
|
|
@@ -74042,7 +74697,7 @@ var ts;
|
|
|
74042
74697
|
checkSourceElement(type);
|
|
74043
74698
|
exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(exprType));
|
|
74044
74699
|
var targetType = getTypeFromTypeNode(type);
|
|
74045
|
-
if (produceDiagnostics && targetType
|
|
74700
|
+
if (produceDiagnostics && !isErrorType(targetType)) {
|
|
74046
74701
|
var widenedType = getWidenedType(exprType);
|
|
74047
74702
|
if (!isTypeComparableTo(targetType, widenedType)) {
|
|
74048
74703
|
checkTypeComparableTo(exprType, targetType, errNode, ts.Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first);
|
|
@@ -74075,7 +74730,7 @@ var ts;
|
|
|
74075
74730
|
return getGlobalImportMetaExpressionType();
|
|
74076
74731
|
case 103 /* NewKeyword */:
|
|
74077
74732
|
var type = checkNewTargetMetaProperty(node);
|
|
74078
|
-
return type
|
|
74733
|
+
return isErrorType(type) ? errorType : createNewTargetExpressionType(type);
|
|
74079
74734
|
default:
|
|
74080
74735
|
ts.Debug.assertNever(node.keywordToken);
|
|
74081
74736
|
}
|
|
@@ -74097,7 +74752,14 @@ var ts;
|
|
|
74097
74752
|
}
|
|
74098
74753
|
function checkImportMetaProperty(node) {
|
|
74099
74754
|
if (moduleKind !== ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) {
|
|
74100
|
-
|
|
74755
|
+
if (moduleKind === ts.ModuleKind.Node12 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
74756
|
+
if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
74757
|
+
error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
74758
|
+
}
|
|
74759
|
+
}
|
|
74760
|
+
else {
|
|
74761
|
+
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12_or_nodenext);
|
|
74762
|
+
}
|
|
74101
74763
|
}
|
|
74102
74764
|
var file = ts.getSourceFileOfNode(node);
|
|
74103
74765
|
ts.Debug.assert(!!(file.flags & 2097152 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -75041,9 +75703,9 @@ var ts;
|
|
|
75041
75703
|
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);
|
|
75042
75704
|
diagnostics.add(diagnostic);
|
|
75043
75705
|
}
|
|
75044
|
-
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) || languageVersion < 4 /* ES2017 */) {
|
|
75706
|
+
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4 /* ES2017 */) {
|
|
75045
75707
|
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
75046
|
-
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.
|
|
75708
|
+
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher);
|
|
75047
75709
|
diagnostics.add(diagnostic);
|
|
75048
75710
|
}
|
|
75049
75711
|
}
|
|
@@ -75068,7 +75730,7 @@ var ts;
|
|
|
75068
75730
|
}
|
|
75069
75731
|
var operandType = checkExpression(node.expression);
|
|
75070
75732
|
var awaitedType = checkAwaitedType(operandType, /*withAlias*/ true, node, ts.Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
|
|
75071
|
-
if (awaitedType === operandType && awaitedType
|
|
75733
|
+
if (awaitedType === operandType && !isErrorType(awaitedType) && !(operandType.flags & 3 /* AnyOrUnknown */)) {
|
|
75072
75734
|
addErrorOrSuggestion(/*isError*/ false, ts.createDiagnosticForNode(node, ts.Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
|
|
75073
75735
|
}
|
|
75074
75736
|
return awaitedType;
|
|
@@ -75217,11 +75879,29 @@ var ts;
|
|
|
75217
75879
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
75218
75880
|
return silentNeverType;
|
|
75219
75881
|
}
|
|
75220
|
-
|
|
75882
|
+
if (ts.isPrivateIdentifier(left)) {
|
|
75883
|
+
if (languageVersion < 99 /* ESNext */) {
|
|
75884
|
+
checkExternalEmitHelpers(left, 2097152 /* ClassPrivateFieldIn */);
|
|
75885
|
+
}
|
|
75886
|
+
// Unlike in 'checkPrivateIdentifierExpression' we now have access to the RHS type
|
|
75887
|
+
// which provides us with the opportunity to emit more detailed errors
|
|
75888
|
+
if (!getNodeLinks(left).resolvedSymbol && ts.getContainingClass(left)) {
|
|
75889
|
+
var isUncheckedJS = isUncheckedJSSuggestion(left, rightType.symbol, /*excludeClasses*/ true);
|
|
75890
|
+
reportNonexistentProperty(left, rightType, isUncheckedJS);
|
|
75891
|
+
}
|
|
75892
|
+
}
|
|
75893
|
+
else {
|
|
75894
|
+
leftType = checkNonNullType(leftType, left);
|
|
75895
|
+
// TypeScript 1.0 spec (April 2014): 4.15.5
|
|
75896
|
+
// Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
|
|
75897
|
+
if (!(allTypesAssignableToKind(leftType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */) ||
|
|
75898
|
+
isTypeAssignableToKind(leftType, 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */ | 262144 /* TypeParameter */))) {
|
|
75899
|
+
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
|
|
75900
|
+
}
|
|
75901
|
+
}
|
|
75221
75902
|
rightType = checkNonNullType(rightType, right);
|
|
75222
75903
|
// TypeScript 1.0 spec (April 2014): 4.15.5
|
|
75223
|
-
// The in operator requires the
|
|
75224
|
-
// and the right operand to be
|
|
75904
|
+
// The in operator requires the right operand to be
|
|
75225
75905
|
//
|
|
75226
75906
|
// 1. assignable to the non-primitive type,
|
|
75227
75907
|
// 2. an unconstrained type parameter,
|
|
@@ -75239,10 +75919,6 @@ var ts;
|
|
|
75239
75919
|
// unless *all* instantiations would result in an error.
|
|
75240
75920
|
//
|
|
75241
75921
|
// The result is always of the Boolean primitive type.
|
|
75242
|
-
if (!(allTypesAssignableToKind(leftType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */) ||
|
|
75243
|
-
isTypeAssignableToKind(leftType, 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */ | 262144 /* TypeParameter */))) {
|
|
75244
|
-
error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol);
|
|
75245
|
-
}
|
|
75246
75922
|
var rightTypeConstraint = getConstraintOfType(rightType);
|
|
75247
75923
|
if (!allTypesAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */) ||
|
|
75248
75924
|
rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */) ||
|
|
@@ -75709,7 +76385,7 @@ var ts;
|
|
|
75709
76385
|
else if (isTypeAny(leftType) || isTypeAny(rightType)) {
|
|
75710
76386
|
// Otherwise, the result is of type Any.
|
|
75711
76387
|
// NOTE: unknown type here denotes error type. Old compiler treated this case as any type so do we.
|
|
75712
|
-
resultType = leftType
|
|
76388
|
+
resultType = isErrorType(leftType) || isErrorType(rightType) ? errorType : anyType;
|
|
75713
76389
|
}
|
|
75714
76390
|
// Symbols are not allowed at all in arithmetic expressions
|
|
75715
76391
|
if (resultType && !checkForDisallowedESSymbolOperand(operator)) {
|
|
@@ -76488,6 +77164,8 @@ var ts;
|
|
|
76488
77164
|
switch (kind) {
|
|
76489
77165
|
case 79 /* Identifier */:
|
|
76490
77166
|
return checkIdentifier(node, checkMode);
|
|
77167
|
+
case 80 /* PrivateIdentifier */:
|
|
77168
|
+
return checkPrivateIdentifierExpression(node);
|
|
76491
77169
|
case 108 /* ThisKeyword */:
|
|
76492
77170
|
return checkThisExpression(node);
|
|
76493
77171
|
case 106 /* SuperKeyword */:
|
|
@@ -77081,7 +77759,7 @@ var ts;
|
|
|
77081
77759
|
// - The containing class is a derived class.
|
|
77082
77760
|
// - The constructor declares parameter properties
|
|
77083
77761
|
// or the containing class declares instance member variables with initializers.
|
|
77084
|
-
var superCallShouldBeFirst = (compilerOptions
|
|
77762
|
+
var superCallShouldBeFirst = (ts.getEmitScriptTarget(compilerOptions) !== 99 /* ESNext */ || !useDefineForClassFields) &&
|
|
77085
77763
|
(ts.some(node.parent.members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) ||
|
|
77086
77764
|
ts.some(node.parameters, function (p) { return ts.hasSyntacticModifier(p, 16476 /* ParameterPropertyModifier */); }));
|
|
77087
77765
|
// Skip past any prologue directives to find the first statement
|
|
@@ -77187,7 +77865,7 @@ var ts;
|
|
|
77187
77865
|
}
|
|
77188
77866
|
function getTypeParametersForTypeReference(node) {
|
|
77189
77867
|
var type = getTypeFromTypeReference(node);
|
|
77190
|
-
if (type
|
|
77868
|
+
if (!isErrorType(type)) {
|
|
77191
77869
|
var symbol = getNodeLinks(node).resolvedSymbol;
|
|
77192
77870
|
if (symbol) {
|
|
77193
77871
|
return symbol.flags & 524288 /* TypeAlias */ && getSymbolLinks(symbol).typeParameters ||
|
|
@@ -77203,7 +77881,7 @@ var ts;
|
|
|
77203
77881
|
}
|
|
77204
77882
|
ts.forEach(node.typeArguments, checkSourceElement);
|
|
77205
77883
|
var type = getTypeFromTypeReference(node);
|
|
77206
|
-
if (type
|
|
77884
|
+
if (!isErrorType(type)) {
|
|
77207
77885
|
if (node.typeArguments && produceDiagnostics) {
|
|
77208
77886
|
var typeParameters = getTypeParametersForTypeReference(node);
|
|
77209
77887
|
if (typeParameters) {
|
|
@@ -78029,7 +78707,7 @@ var ts;
|
|
|
78029
78707
|
//
|
|
78030
78708
|
var returnType = getTypeFromTypeNode(returnTypeNode);
|
|
78031
78709
|
if (languageVersion >= 2 /* ES2015 */) {
|
|
78032
|
-
if (returnType
|
|
78710
|
+
if (isErrorType(returnType)) {
|
|
78033
78711
|
return;
|
|
78034
78712
|
}
|
|
78035
78713
|
var globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true);
|
|
@@ -78043,7 +78721,7 @@ var ts;
|
|
|
78043
78721
|
else {
|
|
78044
78722
|
// Always mark the type node as referenced if it points to a value
|
|
78045
78723
|
markTypeNodeAsReferenced(returnTypeNode);
|
|
78046
|
-
if (returnType
|
|
78724
|
+
if (isErrorType(returnType)) {
|
|
78047
78725
|
return;
|
|
78048
78726
|
}
|
|
78049
78727
|
var promiseConstructorName = ts.getEntityNameFromTypeNode(returnTypeNode);
|
|
@@ -78053,7 +78731,7 @@ var ts;
|
|
|
78053
78731
|
}
|
|
78054
78732
|
var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 111551 /* Value */, /*ignoreErrors*/ true);
|
|
78055
78733
|
var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
|
|
78056
|
-
if (promiseConstructorType
|
|
78734
|
+
if (isErrorType(promiseConstructorType)) {
|
|
78057
78735
|
if (promiseConstructorName.kind === 79 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
|
|
78058
78736
|
error(returnTypeNode, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
|
|
78059
78737
|
}
|
|
@@ -78825,7 +79503,7 @@ var ts;
|
|
|
78825
79503
|
}
|
|
78826
79504
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
78827
79505
|
// No need to check for require or exports for ES6 modules and later
|
|
78828
|
-
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
79506
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node12 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
78829
79507
|
return;
|
|
78830
79508
|
}
|
|
78831
79509
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -79105,7 +79783,7 @@ var ts;
|
|
|
79105
79783
|
// Node is a secondary declaration, check that type is identical to primary declaration and check that
|
|
79106
79784
|
// initializer is consistent with type associated with the node
|
|
79107
79785
|
var declarationType = convertAutoToAny(getWidenedTypeForVariableLikeDeclaration(node));
|
|
79108
|
-
if (type
|
|
79786
|
+
if (!isErrorType(type) && !isErrorType(declarationType) &&
|
|
79109
79787
|
!isTypeIdenticalTo(type, declarationType) &&
|
|
79110
79788
|
!(symbol.flags & 67108864 /* Assignment */)) {
|
|
79111
79789
|
errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType);
|
|
@@ -80386,8 +81064,8 @@ var ts;
|
|
|
80386
81064
|
* The name cannot be used as 'Object' of user defined types with special target.
|
|
80387
81065
|
*/
|
|
80388
81066
|
function checkClassNameCollisionWithObject(name) {
|
|
80389
|
-
if (languageVersion
|
|
80390
|
-
&& moduleKind < ts.ModuleKind.ES2015) {
|
|
81067
|
+
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object"
|
|
81068
|
+
&& (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(name).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
80391
81069
|
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
|
|
80392
81070
|
}
|
|
80393
81071
|
}
|
|
@@ -80603,7 +81281,7 @@ var ts;
|
|
|
80603
81281
|
checkTypeReferenceNode(typeRefNode);
|
|
80604
81282
|
if (produceDiagnostics) {
|
|
80605
81283
|
var t = getReducedType(getTypeFromTypeNode(typeRefNode));
|
|
80606
|
-
if (t
|
|
81284
|
+
if (!isErrorType(t)) {
|
|
80607
81285
|
if (isValidBaseType(t)) {
|
|
80608
81286
|
var genericDiag = t.symbol && t.symbol.flags & 32 /* Class */ ?
|
|
80609
81287
|
ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass :
|
|
@@ -81557,8 +82235,8 @@ var ts;
|
|
|
81557
82235
|
checkAliasSymbol(node);
|
|
81558
82236
|
if (node.kind === 269 /* ImportSpecifier */ &&
|
|
81559
82237
|
ts.idText(node.propertyName || node.name) === "default" &&
|
|
81560
|
-
compilerOptions
|
|
81561
|
-
moduleKind !== ts.ModuleKind.System && moduleKind < ts.ModuleKind.ES2015) {
|
|
82238
|
+
ts.getESModuleInterop(compilerOptions) &&
|
|
82239
|
+
moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
81562
82240
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
81563
82241
|
}
|
|
81564
82242
|
}
|
|
@@ -81590,7 +82268,7 @@ var ts;
|
|
|
81590
82268
|
if (importClause.namedBindings) {
|
|
81591
82269
|
if (importClause.namedBindings.kind === 267 /* NamespaceImport */) {
|
|
81592
82270
|
checkImportBinding(importClause.namedBindings);
|
|
81593
|
-
if (moduleKind !== ts.ModuleKind.System && moduleKind < ts.ModuleKind.ES2015 && compilerOptions
|
|
82271
|
+
if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) {
|
|
81594
82272
|
// import * as ns from "foo";
|
|
81595
82273
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
81596
82274
|
}
|
|
@@ -81636,7 +82314,7 @@ var ts;
|
|
|
81636
82314
|
}
|
|
81637
82315
|
}
|
|
81638
82316
|
else {
|
|
81639
|
-
if (moduleKind >= ts.ModuleKind.ES2015 && !node.isTypeOnly && !(node.flags & 8388608 /* Ambient */)) {
|
|
82317
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & 8388608 /* Ambient */)) {
|
|
81640
82318
|
// Import equals declaration is deprecated in es6 or above
|
|
81641
82319
|
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);
|
|
81642
82320
|
}
|
|
@@ -81652,7 +82330,7 @@ var ts;
|
|
|
81652
82330
|
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);
|
|
81653
82331
|
}
|
|
81654
82332
|
if (node.moduleSpecifier && node.exportClause && ts.isNamedExports(node.exportClause) && ts.length(node.exportClause.elements) && languageVersion === 0 /* ES3 */) {
|
|
81655
|
-
checkExternalEmitHelpers(node,
|
|
82333
|
+
checkExternalEmitHelpers(node, 4194304 /* CreateBinding */);
|
|
81656
82334
|
}
|
|
81657
82335
|
checkGrammarExportDeclaration(node);
|
|
81658
82336
|
if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) {
|
|
@@ -81677,12 +82355,12 @@ var ts;
|
|
|
81677
82355
|
else if (node.exportClause) {
|
|
81678
82356
|
checkAliasSymbol(node.exportClause);
|
|
81679
82357
|
}
|
|
81680
|
-
if (moduleKind !== ts.ModuleKind.System && moduleKind < ts.ModuleKind.ES2015) {
|
|
82358
|
+
if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
81681
82359
|
if (node.exportClause) {
|
|
81682
82360
|
// export * as ns from "foo";
|
|
81683
82361
|
// 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.
|
|
81684
82362
|
// We only use the helper here when in esModuleInterop
|
|
81685
|
-
if (compilerOptions
|
|
82363
|
+
if (ts.getESModuleInterop(compilerOptions)) {
|
|
81686
82364
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
81687
82365
|
}
|
|
81688
82366
|
}
|
|
@@ -81766,9 +82444,9 @@ var ts;
|
|
|
81766
82444
|
}
|
|
81767
82445
|
}
|
|
81768
82446
|
else {
|
|
81769
|
-
if (compilerOptions
|
|
82447
|
+
if (ts.getESModuleInterop(compilerOptions) &&
|
|
81770
82448
|
moduleKind !== ts.ModuleKind.System &&
|
|
81771
|
-
moduleKind < ts.ModuleKind.ES2015 &&
|
|
82449
|
+
(moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) &&
|
|
81772
82450
|
ts.idText(node.propertyName || node.name) === "default") {
|
|
81773
82451
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
81774
82452
|
}
|
|
@@ -81827,7 +82505,7 @@ var ts;
|
|
|
81827
82505
|
grammarErrorOnNode(node.expression, ts.Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
81828
82506
|
}
|
|
81829
82507
|
if (node.isExportEquals && !(node.flags & 8388608 /* Ambient */)) {
|
|
81830
|
-
if (moduleKind >= ts.ModuleKind.ES2015) {
|
|
82508
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.CommonJS) {
|
|
81831
82509
|
// export assignment is not supported in es6 modules
|
|
81832
82510
|
grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
81833
82511
|
}
|
|
@@ -82621,6 +83299,9 @@ var ts;
|
|
|
82621
83299
|
}
|
|
82622
83300
|
return result;
|
|
82623
83301
|
}
|
|
83302
|
+
else if (ts.isPrivateIdentifier(name)) {
|
|
83303
|
+
return getSymbolForPrivateIdentifierExpression(name);
|
|
83304
|
+
}
|
|
82624
83305
|
else if (name.kind === 205 /* PropertyAccessExpression */ || name.kind === 160 /* QualifiedName */) {
|
|
82625
83306
|
var links = getNodeLinks(name);
|
|
82626
83307
|
if (links.resolvedSymbol) {
|
|
@@ -82643,7 +83324,8 @@ var ts;
|
|
|
82643
83324
|
}
|
|
82644
83325
|
else if (isTypeReferenceIdentifier(name)) {
|
|
82645
83326
|
var meaning = name.parent.kind === 177 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */;
|
|
82646
|
-
|
|
83327
|
+
var symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
|
|
83328
|
+
return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name);
|
|
82647
83329
|
}
|
|
82648
83330
|
if (name.parent.kind === 176 /* TypePredicate */) {
|
|
82649
83331
|
return resolveEntityName(name, /*meaning*/ 1 /* FunctionScopedVariable */);
|
|
@@ -82870,7 +83552,7 @@ var ts;
|
|
|
82870
83552
|
var symbol = getSymbolAtLocation(node);
|
|
82871
83553
|
if (symbol) {
|
|
82872
83554
|
var declaredType = getDeclaredTypeOfSymbol(symbol);
|
|
82873
|
-
return declaredType
|
|
83555
|
+
return !isErrorType(declaredType) ? declaredType : getTypeOfSymbol(symbol);
|
|
82874
83556
|
}
|
|
82875
83557
|
}
|
|
82876
83558
|
if (ts.isMetaProperty(node.parent) && node.parent.keywordToken === node.kind) {
|
|
@@ -83368,7 +84050,7 @@ var ts;
|
|
|
83368
84050
|
return isTypeOnly ? ts.TypeReferenceSerializationKind.ObjectType : ts.TypeReferenceSerializationKind.Unknown;
|
|
83369
84051
|
}
|
|
83370
84052
|
var type = getDeclaredTypeOfSymbol(typeSymbol);
|
|
83371
|
-
if (type
|
|
84053
|
+
if (isErrorType(type)) {
|
|
83372
84054
|
return isTypeOnly ? ts.TypeReferenceSerializationKind.ObjectType : ts.TypeReferenceSerializationKind.Unknown;
|
|
83373
84055
|
}
|
|
83374
84056
|
else if (type.flags & 3 /* AnyOrUnknown */) {
|
|
@@ -83880,7 +84562,7 @@ var ts;
|
|
|
83880
84562
|
var helpersModule = resolveHelpersModule(sourceFile, location);
|
|
83881
84563
|
if (helpersModule !== unknownSymbol) {
|
|
83882
84564
|
var uncheckedHelpers = helpers & ~requestedExternalEmitHelpers;
|
|
83883
|
-
for (var helper = 1 /* FirstEmitHelper */; helper <=
|
|
84565
|
+
for (var helper = 1 /* FirstEmitHelper */; helper <= 4194304 /* LastEmitHelper */; helper <<= 1) {
|
|
83884
84566
|
if (uncheckedHelpers & helper) {
|
|
83885
84567
|
var name = getHelperName(helper);
|
|
83886
84568
|
var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 111551 /* Value */);
|
|
@@ -83932,7 +84614,8 @@ var ts;
|
|
|
83932
84614
|
case 262144 /* MakeTemplateObject */: return "__makeTemplateObject";
|
|
83933
84615
|
case 524288 /* ClassPrivateFieldGet */: return "__classPrivateFieldGet";
|
|
83934
84616
|
case 1048576 /* ClassPrivateFieldSet */: return "__classPrivateFieldSet";
|
|
83935
|
-
case 2097152 /*
|
|
84617
|
+
case 2097152 /* ClassPrivateFieldIn */: return "__classPrivateFieldIn";
|
|
84618
|
+
case 4194304 /* CreateBinding */: return "__createBinding";
|
|
83936
84619
|
default: return ts.Debug.fail("Unrecognized helper");
|
|
83937
84620
|
}
|
|
83938
84621
|
}
|
|
@@ -84364,6 +85047,11 @@ var ts;
|
|
|
84364
85047
|
if (!ts.isArrowFunction(node)) {
|
|
84365
85048
|
return false;
|
|
84366
85049
|
}
|
|
85050
|
+
if (node.typeParameters && !(ts.length(node.typeParameters) > 1 || node.typeParameters.hasTrailingComma || node.typeParameters[0].constraint)) {
|
|
85051
|
+
if (file && ts.fileExtensionIsOneOf(file.fileName, [".mts" /* Mts */, ".cts" /* Cts */])) {
|
|
85052
|
+
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);
|
|
85053
|
+
}
|
|
85054
|
+
}
|
|
84367
85055
|
var equalsGreaterThanToken = node.equalsGreaterThanToken;
|
|
84368
85056
|
var startLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.pos).line;
|
|
84369
85057
|
var endLine = ts.getLineAndCharacterOfPosition(file, equalsGreaterThanToken.end).line;
|
|
@@ -84696,8 +85384,8 @@ var ts;
|
|
|
84696
85384
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
84697
85385
|
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));
|
|
84698
85386
|
}
|
|
84699
|
-
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) || languageVersion < 4 /* ES2017 */) {
|
|
84700
|
-
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.
|
|
85387
|
+
if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(forInOrOfStatement).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4 /* ES2017 */) {
|
|
85388
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));
|
|
84701
85389
|
}
|
|
84702
85390
|
}
|
|
84703
85391
|
}
|
|
@@ -85038,8 +85726,7 @@ var ts;
|
|
|
85038
85726
|
: ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
|
|
85039
85727
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
85040
85728
|
}
|
|
85041
|
-
|
|
85042
|
-
if (moduleKind < ts.ModuleKind.ES2015 && moduleKind !== ts.ModuleKind.System &&
|
|
85729
|
+
if ((moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && moduleKind !== ts.ModuleKind.System &&
|
|
85043
85730
|
!(node.parent.parent.flags & 8388608 /* Ambient */) && ts.hasSyntacticModifier(node.parent.parent, 1 /* Export */)) {
|
|
85044
85731
|
checkESModuleMarker(node.name);
|
|
85045
85732
|
}
|
|
@@ -85374,7 +86061,7 @@ var ts;
|
|
|
85374
86061
|
}
|
|
85375
86062
|
function checkGrammarImportCallExpression(node) {
|
|
85376
86063
|
if (moduleKind === ts.ModuleKind.ES2015) {
|
|
85377
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
86064
|
+
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_umd_node12_or_nodenext);
|
|
85378
86065
|
}
|
|
85379
86066
|
if (node.typeArguments) {
|
|
85380
86067
|
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments);
|
|
@@ -90534,7 +91221,7 @@ var ts;
|
|
|
90534
91221
|
function transformSourceFile(node) {
|
|
90535
91222
|
var options = context.getCompilerOptions();
|
|
90536
91223
|
if (node.isDeclarationFile
|
|
90537
|
-
|| useDefineForClassFields && options
|
|
91224
|
+
|| useDefineForClassFields && ts.getEmitScriptTarget(options) === 99 /* ESNext */) {
|
|
90538
91225
|
return node;
|
|
90539
91226
|
}
|
|
90540
91227
|
var visited = ts.visitEachChild(node, visitor, context);
|
|
@@ -90622,14 +91309,37 @@ var ts;
|
|
|
90622
91309
|
}
|
|
90623
91310
|
/**
|
|
90624
91311
|
* If we visit a private name, this means it is an undeclared private name.
|
|
90625
|
-
* Replace it with an empty identifier to indicate a problem with the code
|
|
91312
|
+
* Replace it with an empty identifier to indicate a problem with the code,
|
|
91313
|
+
* unless we are in a statement position - otherwise this will not trigger
|
|
91314
|
+
* a SyntaxError.
|
|
90626
91315
|
*/
|
|
90627
91316
|
function visitPrivateIdentifier(node) {
|
|
90628
91317
|
if (!shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
90629
91318
|
return node;
|
|
90630
91319
|
}
|
|
91320
|
+
if (ts.isStatement(node.parent)) {
|
|
91321
|
+
return node;
|
|
91322
|
+
}
|
|
90631
91323
|
return ts.setOriginalNode(factory.createIdentifier(""), node);
|
|
90632
91324
|
}
|
|
91325
|
+
/**
|
|
91326
|
+
* Visits `#id in expr`
|
|
91327
|
+
*/
|
|
91328
|
+
function visitPrivateIdentifierInInExpression(node) {
|
|
91329
|
+
if (!shouldTransformPrivateElementsOrClassStaticBlocks) {
|
|
91330
|
+
return node;
|
|
91331
|
+
}
|
|
91332
|
+
var privId = node.left;
|
|
91333
|
+
ts.Debug.assertNode(privId, ts.isPrivateIdentifier);
|
|
91334
|
+
ts.Debug.assert(node.operatorToken.kind === 101 /* InKeyword */);
|
|
91335
|
+
var info = accessPrivateIdentifier(privId);
|
|
91336
|
+
if (info) {
|
|
91337
|
+
var receiver = ts.visitNode(node.right, visitor, ts.isExpression);
|
|
91338
|
+
return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node);
|
|
91339
|
+
}
|
|
91340
|
+
// Private name has not been declared. Subsequent transformers will handle this error
|
|
91341
|
+
return ts.visitEachChild(node, visitor, context);
|
|
91342
|
+
}
|
|
90633
91343
|
/**
|
|
90634
91344
|
* Visits the members of a class that has fields.
|
|
90635
91345
|
*
|
|
@@ -91016,6 +91726,9 @@ var ts;
|
|
|
91016
91726
|
}
|
|
91017
91727
|
}
|
|
91018
91728
|
}
|
|
91729
|
+
if (node.operatorToken.kind === 101 /* InKeyword */ && ts.isPrivateIdentifier(node.left)) {
|
|
91730
|
+
return visitPrivateIdentifierInInExpression(node);
|
|
91731
|
+
}
|
|
91019
91732
|
return ts.visitEachChild(node, visitor, context);
|
|
91020
91733
|
}
|
|
91021
91734
|
function createPrivateIdentifierAssignment(info, receiver, right, operator) {
|
|
@@ -93910,7 +94623,7 @@ var ts;
|
|
|
93910
94623
|
// When there are no attributes, React wants "null"
|
|
93911
94624
|
}
|
|
93912
94625
|
else {
|
|
93913
|
-
var target = compilerOptions
|
|
94626
|
+
var target = ts.getEmitScriptTarget(compilerOptions);
|
|
93914
94627
|
if (target && target >= 5 /* ES2018 */) {
|
|
93915
94628
|
objectProperties = factory.createObjectLiteralExpression(ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) {
|
|
93916
94629
|
return isSpread ? ts.map(attrs, transformJsxSpreadAttributeToSpreadAssignment) : ts.map(attrs, transformJsxAttributeToObjectLiteralElement);
|
|
@@ -94109,7 +94822,8 @@ var ts;
|
|
|
94109
94822
|
}
|
|
94110
94823
|
}
|
|
94111
94824
|
function visitJsxExpression(node) {
|
|
94112
|
-
|
|
94825
|
+
var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
|
|
94826
|
+
return node.dotDotDotToken ? factory.createSpreadElement(expression) : expression;
|
|
94113
94827
|
}
|
|
94114
94828
|
}
|
|
94115
94829
|
ts.transformJsx = transformJsx;
|
|
@@ -100745,7 +101459,7 @@ var ts;
|
|
|
100745
101459
|
case 348 /* PartiallyEmittedExpression */:
|
|
100746
101460
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
100747
101461
|
case 207 /* CallExpression */:
|
|
100748
|
-
if (ts.isImportCall(node)) {
|
|
101462
|
+
if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) {
|
|
100749
101463
|
return visitImportCallExpression(node);
|
|
100750
101464
|
}
|
|
100751
101465
|
break;
|
|
@@ -100968,7 +101682,7 @@ var ts;
|
|
|
100968
101682
|
}
|
|
100969
101683
|
}
|
|
100970
101684
|
var promise = factory.createNewExpression(factory.createIdentifier("Promise"), /*typeArguments*/ undefined, [func]);
|
|
100971
|
-
if (compilerOptions
|
|
101685
|
+
if (ts.getESModuleInterop(compilerOptions)) {
|
|
100972
101686
|
return factory.createCallExpression(factory.createPropertyAccessExpression(promise, factory.createIdentifier("then")), /*typeArguments*/ undefined, [emitHelpers().createImportStarCallbackHelper()]);
|
|
100973
101687
|
}
|
|
100974
101688
|
return promise;
|
|
@@ -100981,7 +101695,7 @@ var ts;
|
|
|
100981
101695
|
// if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately
|
|
100982
101696
|
var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []);
|
|
100983
101697
|
var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []);
|
|
100984
|
-
if (compilerOptions
|
|
101698
|
+
if (ts.getESModuleInterop(compilerOptions)) {
|
|
100985
101699
|
requireCall = emitHelpers().createImportStarHelper(requireCall);
|
|
100986
101700
|
}
|
|
100987
101701
|
var func;
|
|
@@ -101011,7 +101725,7 @@ var ts;
|
|
|
101011
101725
|
return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
|
|
101012
101726
|
}
|
|
101013
101727
|
function getHelperExpressionForExport(node, innerExpr) {
|
|
101014
|
-
if (!compilerOptions
|
|
101728
|
+
if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* NeverApplyImportHelper */) {
|
|
101015
101729
|
return innerExpr;
|
|
101016
101730
|
}
|
|
101017
101731
|
if (ts.getExportNeedsImportStarHelper(node)) {
|
|
@@ -101020,7 +101734,7 @@ var ts;
|
|
|
101020
101734
|
return innerExpr;
|
|
101021
101735
|
}
|
|
101022
101736
|
function getHelperExpressionForImport(node, innerExpr) {
|
|
101023
|
-
if (!compilerOptions
|
|
101737
|
+
if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* NeverApplyImportHelper */) {
|
|
101024
101738
|
return innerExpr;
|
|
101025
101739
|
}
|
|
101026
101740
|
if (ts.getImportNeedsImportStarHelper(node)) {
|
|
@@ -101174,7 +101888,7 @@ var ts;
|
|
|
101174
101888
|
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));
|
|
101175
101889
|
}
|
|
101176
101890
|
else {
|
|
101177
|
-
var exportNeedsImportDefault = !!compilerOptions
|
|
101891
|
+
var exportNeedsImportDefault = !!ts.getESModuleInterop(compilerOptions) &&
|
|
101178
101892
|
!(ts.getEmitFlags(node) & 67108864 /* NeverApplyImportHelper */) &&
|
|
101179
101893
|
ts.idText(specifier.propertyName || specifier.name) === "default";
|
|
101180
101894
|
var exportedValue = factory.createPropertyAccessExpression(exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName, specifier.propertyName || specifier.name);
|
|
@@ -103343,7 +104057,10 @@ var ts;
|
|
|
103343
104057
|
(function (ts) {
|
|
103344
104058
|
function transformECMAScriptModule(context) {
|
|
103345
104059
|
var factory = context.factory, emitHelpers = context.getEmitHelperFactory;
|
|
104060
|
+
var host = context.getEmitHost();
|
|
104061
|
+
var resolver = context.getEmitResolver();
|
|
103346
104062
|
var compilerOptions = context.getCompilerOptions();
|
|
104063
|
+
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
|
|
103347
104064
|
var previousOnEmitNode = context.onEmitNode;
|
|
103348
104065
|
var previousOnSubstituteNode = context.onSubstituteNode;
|
|
103349
104066
|
context.onEmitNode = onEmitNode;
|
|
@@ -103351,13 +104068,21 @@ var ts;
|
|
|
103351
104068
|
context.enableEmitNotification(303 /* SourceFile */);
|
|
103352
104069
|
context.enableSubstitution(79 /* Identifier */);
|
|
103353
104070
|
var helperNameSubstitutions;
|
|
104071
|
+
var currentSourceFile;
|
|
104072
|
+
var importRequireStatements;
|
|
103354
104073
|
return ts.chainBundle(context, transformSourceFile);
|
|
103355
104074
|
function transformSourceFile(node) {
|
|
103356
104075
|
if (node.isDeclarationFile) {
|
|
103357
104076
|
return node;
|
|
103358
104077
|
}
|
|
103359
104078
|
if (ts.isExternalModule(node) || compilerOptions.isolatedModules) {
|
|
104079
|
+
currentSourceFile = node;
|
|
104080
|
+
importRequireStatements = undefined;
|
|
103360
104081
|
var result = updateExternalModule(node);
|
|
104082
|
+
currentSourceFile = undefined;
|
|
104083
|
+
if (importRequireStatements) {
|
|
104084
|
+
result = factory.updateSourceFile(result, ts.setTextRange(factory.createNodeArray(ts.insertStatementsAfterCustomPrologue(result.statements.slice(), importRequireStatements)), result.statements));
|
|
104085
|
+
}
|
|
103361
104086
|
if (!ts.isExternalModule(node) || ts.some(result.statements, ts.isExternalModuleIndicator)) {
|
|
103362
104087
|
return result;
|
|
103363
104088
|
}
|
|
@@ -103381,8 +104106,10 @@ var ts;
|
|
|
103381
104106
|
function visitor(node) {
|
|
103382
104107
|
switch (node.kind) {
|
|
103383
104108
|
case 264 /* ImportEqualsDeclaration */:
|
|
103384
|
-
//
|
|
103385
|
-
|
|
104109
|
+
// Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call
|
|
104110
|
+
// To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url`
|
|
104111
|
+
// is available, just because the output is reasonable for a node-like runtime.
|
|
104112
|
+
return ts.getEmitScriptTarget(compilerOptions) >= ts.ModuleKind.ES2020 ? visitImportEqualsDeclaration(node) : undefined;
|
|
103386
104113
|
case 270 /* ExportAssignment */:
|
|
103387
104114
|
return visitExportAssignment(node);
|
|
103388
104115
|
case 271 /* ExportDeclaration */:
|
|
@@ -103391,6 +104118,68 @@ var ts;
|
|
|
103391
104118
|
}
|
|
103392
104119
|
return node;
|
|
103393
104120
|
}
|
|
104121
|
+
/**
|
|
104122
|
+
* Creates a `require()` call to import an external module.
|
|
104123
|
+
*
|
|
104124
|
+
* @param importNode The declaration to import.
|
|
104125
|
+
*/
|
|
104126
|
+
function createRequireCall(importNode) {
|
|
104127
|
+
var moduleName = ts.getExternalModuleNameLiteral(factory, importNode, ts.Debug.checkDefined(currentSourceFile), host, resolver, compilerOptions);
|
|
104128
|
+
var args = [];
|
|
104129
|
+
if (moduleName) {
|
|
104130
|
+
args.push(moduleName);
|
|
104131
|
+
}
|
|
104132
|
+
if (!importRequireStatements) {
|
|
104133
|
+
var createRequireName = factory.createUniqueName("_createRequire", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
104134
|
+
var importStatement = factory.createImportDeclaration(
|
|
104135
|
+
/*decorators*/ undefined,
|
|
104136
|
+
/*modifiers*/ undefined, factory.createImportClause(
|
|
104137
|
+
/*isTypeOnly*/ false,
|
|
104138
|
+
/*name*/ undefined, factory.createNamedImports([
|
|
104139
|
+
factory.createImportSpecifier(factory.createIdentifier("createRequire"), createRequireName)
|
|
104140
|
+
])), factory.createStringLiteral("module"));
|
|
104141
|
+
var requireHelperName = factory.createUniqueName("__require", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
104142
|
+
var requireStatement = factory.createVariableStatement(
|
|
104143
|
+
/*modifiers*/ undefined, factory.createVariableDeclarationList([
|
|
104144
|
+
factory.createVariableDeclaration(requireHelperName,
|
|
104145
|
+
/*exclamationToken*/ undefined,
|
|
104146
|
+
/*type*/ undefined, factory.createCallExpression(factory.cloneNode(createRequireName), /*typeArguments*/ undefined, [
|
|
104147
|
+
factory.createPropertyAccessExpression(factory.createMetaProperty(100 /* ImportKeyword */, factory.createIdentifier("meta")), factory.createIdentifier("url"))
|
|
104148
|
+
]))
|
|
104149
|
+
],
|
|
104150
|
+
/*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */));
|
|
104151
|
+
importRequireStatements = [importStatement, requireStatement];
|
|
104152
|
+
}
|
|
104153
|
+
var name = importRequireStatements[1].declarationList.declarations[0].name;
|
|
104154
|
+
ts.Debug.assertNode(name, ts.isIdentifier);
|
|
104155
|
+
return factory.createCallExpression(factory.cloneNode(name), /*typeArguments*/ undefined, args);
|
|
104156
|
+
}
|
|
104157
|
+
/**
|
|
104158
|
+
* Visits an ImportEqualsDeclaration node.
|
|
104159
|
+
*
|
|
104160
|
+
* @param node The node to visit.
|
|
104161
|
+
*/
|
|
104162
|
+
function visitImportEqualsDeclaration(node) {
|
|
104163
|
+
ts.Debug.assert(ts.isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer.");
|
|
104164
|
+
var statements;
|
|
104165
|
+
statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(factory.createVariableStatement(
|
|
104166
|
+
/*modifiers*/ undefined, factory.createVariableDeclarationList([
|
|
104167
|
+
factory.createVariableDeclaration(factory.cloneNode(node.name),
|
|
104168
|
+
/*exclamationToken*/ undefined,
|
|
104169
|
+
/*type*/ undefined, createRequireCall(node))
|
|
104170
|
+
],
|
|
104171
|
+
/*flags*/ languageVersion >= 2 /* ES2015 */ ? 2 /* Const */ : 0 /* None */)), node), node));
|
|
104172
|
+
statements = appendExportsOfImportEqualsDeclaration(statements, node);
|
|
104173
|
+
return ts.singleOrMany(statements);
|
|
104174
|
+
}
|
|
104175
|
+
function appendExportsOfImportEqualsDeclaration(statements, node) {
|
|
104176
|
+
if (ts.hasSyntacticModifier(node, 1 /* Export */)) {
|
|
104177
|
+
statements = ts.append(statements, factory.createExportDeclaration(
|
|
104178
|
+
/*decorators*/ undefined,
|
|
104179
|
+
/*modifiers*/ undefined, node.isTypeOnly, factory.createNamedExports([factory.createExportSpecifier(/*propertyName*/ undefined, ts.idText(node.name))])));
|
|
104180
|
+
}
|
|
104181
|
+
return statements;
|
|
104182
|
+
}
|
|
103394
104183
|
function visitExportAssignment(node) {
|
|
103395
104184
|
// Elide `export=` as it is not legal with --module ES6
|
|
103396
104185
|
return node.isExportEquals ? undefined : node;
|
|
@@ -103468,6 +104257,78 @@ var ts;
|
|
|
103468
104257
|
}
|
|
103469
104258
|
ts.transformECMAScriptModule = transformECMAScriptModule;
|
|
103470
104259
|
})(ts || (ts = {}));
|
|
104260
|
+
/*@internal*/
|
|
104261
|
+
var ts;
|
|
104262
|
+
(function (ts) {
|
|
104263
|
+
function transformNodeModule(context) {
|
|
104264
|
+
var previousOnSubstituteNode = context.onSubstituteNode;
|
|
104265
|
+
var previousOnEmitNode = context.onEmitNode;
|
|
104266
|
+
var esmTransform = ts.transformECMAScriptModule(context);
|
|
104267
|
+
var esmOnSubstituteNode = context.onSubstituteNode;
|
|
104268
|
+
var esmOnEmitNode = context.onEmitNode;
|
|
104269
|
+
context.onSubstituteNode = previousOnSubstituteNode;
|
|
104270
|
+
context.onEmitNode = previousOnEmitNode;
|
|
104271
|
+
var cjsTransform = ts.transformModule(context);
|
|
104272
|
+
var cjsOnSubstituteNode = context.onSubstituteNode;
|
|
104273
|
+
var cjsOnEmitNode = context.onEmitNode;
|
|
104274
|
+
context.onSubstituteNode = onSubstituteNode;
|
|
104275
|
+
context.onEmitNode = onEmitNode;
|
|
104276
|
+
context.enableSubstitution(303 /* SourceFile */);
|
|
104277
|
+
context.enableEmitNotification(303 /* SourceFile */);
|
|
104278
|
+
var currentSourceFile;
|
|
104279
|
+
return transformSourceFileOrBundle;
|
|
104280
|
+
function onSubstituteNode(hint, node) {
|
|
104281
|
+
if (ts.isSourceFile(node)) {
|
|
104282
|
+
currentSourceFile = node;
|
|
104283
|
+
// Neither component transform wants substitution notifications for `SourceFile`s, and, in fact, relies on
|
|
104284
|
+
// the source file emit notification to setup scope variables for substitutions (so we _cannot_ call their substitute
|
|
104285
|
+
// functions on source files safely, as that context only gets setup in a later pipeline phase!)
|
|
104286
|
+
return previousOnSubstituteNode(hint, node);
|
|
104287
|
+
}
|
|
104288
|
+
else {
|
|
104289
|
+
if (!currentSourceFile) {
|
|
104290
|
+
return previousOnSubstituteNode(hint, node);
|
|
104291
|
+
}
|
|
104292
|
+
if (currentSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
104293
|
+
return esmOnSubstituteNode(hint, node);
|
|
104294
|
+
}
|
|
104295
|
+
return cjsOnSubstituteNode(hint, node);
|
|
104296
|
+
}
|
|
104297
|
+
}
|
|
104298
|
+
function onEmitNode(hint, node, emitCallback) {
|
|
104299
|
+
if (ts.isSourceFile(node)) {
|
|
104300
|
+
currentSourceFile = node;
|
|
104301
|
+
}
|
|
104302
|
+
if (!currentSourceFile) {
|
|
104303
|
+
return previousOnEmitNode(hint, node, emitCallback);
|
|
104304
|
+
}
|
|
104305
|
+
if (currentSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext) {
|
|
104306
|
+
return esmOnEmitNode(hint, node, emitCallback);
|
|
104307
|
+
}
|
|
104308
|
+
return cjsOnEmitNode(hint, node, emitCallback);
|
|
104309
|
+
}
|
|
104310
|
+
function getModuleTransformForFile(file) {
|
|
104311
|
+
return file.impliedNodeFormat === ts.ModuleKind.ESNext ? esmTransform : cjsTransform;
|
|
104312
|
+
}
|
|
104313
|
+
function transformSourceFile(node) {
|
|
104314
|
+
if (node.isDeclarationFile) {
|
|
104315
|
+
return node;
|
|
104316
|
+
}
|
|
104317
|
+
currentSourceFile = node;
|
|
104318
|
+
var result = getModuleTransformForFile(node)(node);
|
|
104319
|
+
currentSourceFile = undefined;
|
|
104320
|
+
ts.Debug.assert(ts.isSourceFile(result));
|
|
104321
|
+
return result;
|
|
104322
|
+
}
|
|
104323
|
+
function transformSourceFileOrBundle(node) {
|
|
104324
|
+
return node.kind === 303 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node);
|
|
104325
|
+
}
|
|
104326
|
+
function transformBundle(node) {
|
|
104327
|
+
return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends);
|
|
104328
|
+
}
|
|
104329
|
+
}
|
|
104330
|
+
ts.transformNodeModule = transformNodeModule;
|
|
104331
|
+
})(ts || (ts = {}));
|
|
103471
104332
|
/* @internal */
|
|
103472
104333
|
var ts;
|
|
103473
104334
|
(function (ts) {
|
|
@@ -105289,6 +106150,9 @@ var ts;
|
|
|
105289
106150
|
return ts.transformECMAScriptModule;
|
|
105290
106151
|
case ts.ModuleKind.System:
|
|
105291
106152
|
return ts.transformSystemModule;
|
|
106153
|
+
case ts.ModuleKind.Node12:
|
|
106154
|
+
case ts.ModuleKind.NodeNext:
|
|
106155
|
+
return ts.transformNodeModule;
|
|
105292
106156
|
default:
|
|
105293
106157
|
return ts.transformModule;
|
|
105294
106158
|
}
|
|
@@ -105899,7 +106763,7 @@ var ts;
|
|
|
105899
106763
|
return getOutputPathsForBundle(options, forceDtsPaths);
|
|
105900
106764
|
}
|
|
105901
106765
|
else {
|
|
105902
|
-
var ownOutputFilePath = ts.getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile, options));
|
|
106766
|
+
var ownOutputFilePath = ts.getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile.fileName, options));
|
|
105903
106767
|
var isJsonFile = ts.isJsonSourceFile(sourceFile);
|
|
105904
106768
|
// If json file emits to the same location skip writing it, if emitDeclarationOnly skip writing it
|
|
105905
106769
|
var isJsonEmittedToSameLocation = isJsonFile &&
|
|
@@ -105915,26 +106779,13 @@ var ts;
|
|
|
105915
106779
|
function getSourceMapFilePath(jsFilePath, options) {
|
|
105916
106780
|
return (options.sourceMap && !options.inlineSourceMap) ? jsFilePath + ".map" : undefined;
|
|
105917
106781
|
}
|
|
105918
|
-
// JavaScript files are always LanguageVariant.JSX, as JSX syntax is allowed in .js files also.
|
|
105919
|
-
// So for JavaScript files, '.jsx' is only emitted if the input was '.jsx', and JsxEmit.Preserve.
|
|
105920
|
-
// For TypeScript, the only time to emit with a '.jsx' extension, is on JSX input, and JsxEmit.Preserve
|
|
105921
106782
|
/* @internal */
|
|
105922
|
-
function getOutputExtension(
|
|
105923
|
-
|
|
105924
|
-
|
|
105925
|
-
|
|
105926
|
-
|
|
105927
|
-
|
|
105928
|
-
if (ts.fileExtensionIs(sourceFile.fileName, ".jsx" /* Jsx */)) {
|
|
105929
|
-
return ".jsx" /* Jsx */;
|
|
105930
|
-
}
|
|
105931
|
-
}
|
|
105932
|
-
else if (sourceFile.languageVariant === 1 /* JSX */) {
|
|
105933
|
-
// TypeScript source file preserving JSX syntax
|
|
105934
|
-
return ".jsx" /* Jsx */;
|
|
105935
|
-
}
|
|
105936
|
-
}
|
|
105937
|
-
return ".js" /* Js */;
|
|
106783
|
+
function getOutputExtension(fileName, options) {
|
|
106784
|
+
return ts.fileExtensionIs(fileName, ".json" /* Json */) ? ".json" /* Json */ :
|
|
106785
|
+
options.jsx === 1 /* Preserve */ && ts.fileExtensionIsOneOf(fileName, [".jsx" /* Jsx */, ".tsx" /* Tsx */]) ? ".jsx" /* Jsx */ :
|
|
106786
|
+
ts.fileExtensionIsOneOf(fileName, [".mts" /* Mts */, ".mjs" /* Mjs */]) ? ".mjs" /* Mjs */ :
|
|
106787
|
+
ts.fileExtensionIsOneOf(fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]) ? ".cjs" /* Cjs */ :
|
|
106788
|
+
".js" /* Js */;
|
|
105938
106789
|
}
|
|
105939
106790
|
ts.getOutputExtension = getOutputExtension;
|
|
105940
106791
|
function getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, outputDir, getCommonSourceDirectory) {
|
|
@@ -105944,19 +106795,14 @@ var ts;
|
|
|
105944
106795
|
}
|
|
105945
106796
|
/* @internal */
|
|
105946
106797
|
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory) {
|
|
105947
|
-
ts.
|
|
105948
|
-
return ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir, getCommonSourceDirectory), ".d.ts" /* Dts */);
|
|
106798
|
+
return ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir, getCommonSourceDirectory), ts.getDeclarationEmitExtensionForPath(inputFileName));
|
|
105949
106799
|
}
|
|
105950
106800
|
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
|
105951
106801
|
function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory) {
|
|
105952
106802
|
if (configFile.options.emitDeclarationOnly)
|
|
105953
106803
|
return undefined;
|
|
105954
106804
|
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */);
|
|
105955
|
-
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory),
|
|
105956
|
-
".json" /* Json */ :
|
|
105957
|
-
configFile.options.jsx === 1 /* Preserve */ && (ts.fileExtensionIs(inputFileName, ".tsx" /* Tsx */) || ts.fileExtensionIs(inputFileName, ".jsx" /* Jsx */)) ?
|
|
105958
|
-
".jsx" /* Jsx */ :
|
|
105959
|
-
".js" /* Js */);
|
|
106805
|
+
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory), getOutputExtension(inputFileName, configFile.options));
|
|
105960
106806
|
return !isJsonFile || ts.comparePaths(inputFileName, outputFileName, ts.Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ?
|
|
105961
106807
|
outputFileName :
|
|
105962
106808
|
undefined;
|
|
@@ -106027,7 +106873,7 @@ var ts;
|
|
|
106027
106873
|
/*@internal*/
|
|
106028
106874
|
function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
|
|
106029
106875
|
var options = _a.options, fileNames = _a.fileNames;
|
|
106030
|
-
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.
|
|
106876
|
+
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.fileExtensionIs(file, ".d.ts" /* Dts */); }); }, ts.getDirectoryPath(ts.normalizeSlashes(ts.Debug.checkDefined(options.configFilePath))), ts.createGetCanonicalFileName(!ignoreCase));
|
|
106031
106877
|
}
|
|
106032
106878
|
ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
|
|
106033
106879
|
/*@internal*/
|
|
@@ -107304,6 +108150,8 @@ var ts;
|
|
|
107304
108150
|
// Identifiers
|
|
107305
108151
|
case 79 /* Identifier */:
|
|
107306
108152
|
return emitIdentifier(node);
|
|
108153
|
+
case 80 /* PrivateIdentifier */:
|
|
108154
|
+
return emitPrivateIdentifier(node);
|
|
107307
108155
|
// Expressions
|
|
107308
108156
|
case 203 /* ArrayLiteralExpression */:
|
|
107309
108157
|
return emitArrayLiteralExpression(node);
|
|
@@ -111290,7 +112138,7 @@ var ts;
|
|
|
111290
112138
|
if (options.declarationDir)
|
|
111291
112139
|
return false;
|
|
111292
112140
|
}
|
|
111293
|
-
else if (!ts.fileExtensionIsOneOf(fileOrDirectoryPath, ts.
|
|
112141
|
+
else if (!ts.fileExtensionIsOneOf(fileOrDirectoryPath, ts.supportedJSExtensionsFlat)) {
|
|
111294
112142
|
return false;
|
|
111295
112143
|
}
|
|
111296
112144
|
// just check if sourceFile with the name exists
|
|
@@ -111902,6 +112750,56 @@ var ts;
|
|
|
111902
112750
|
return resolutions;
|
|
111903
112751
|
}
|
|
111904
112752
|
ts.loadWithLocalCache = loadWithLocalCache;
|
|
112753
|
+
;
|
|
112754
|
+
/* @internal */
|
|
112755
|
+
function getModeForResolutionAtIndex(file, index) {
|
|
112756
|
+
if (file.impliedNodeFormat === undefined)
|
|
112757
|
+
return undefined;
|
|
112758
|
+
// we ensure all elements of file.imports and file.moduleAugmentations have the relevant parent pointers set during program setup,
|
|
112759
|
+
// so it's safe to use them even pre-bind
|
|
112760
|
+
return getModeForUsageLocation(file, getModuleNameStringLiteralAt(file, index));
|
|
112761
|
+
}
|
|
112762
|
+
ts.getModeForResolutionAtIndex = getModeForResolutionAtIndex;
|
|
112763
|
+
/* @internal */
|
|
112764
|
+
function getModeForUsageLocation(file, usage) {
|
|
112765
|
+
var _a;
|
|
112766
|
+
if (file.impliedNodeFormat === undefined)
|
|
112767
|
+
return undefined;
|
|
112768
|
+
if (file.impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
112769
|
+
// in cjs files, import call expressions are esm format, otherwise everything is cjs
|
|
112770
|
+
return ts.isImportCall(ts.walkUpParenthesizedExpressions(usage.parent)) ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
112771
|
+
}
|
|
112772
|
+
// in esm files, import=require statements are cjs format, otherwise everything is esm
|
|
112773
|
+
// imports are only parent'd up to their containing declaration/expression, so access farther parents with care
|
|
112774
|
+
var exprParentParent = (_a = ts.walkUpParenthesizedExpressions(usage.parent)) === null || _a === void 0 ? void 0 : _a.parent;
|
|
112775
|
+
return exprParentParent && ts.isImportEqualsDeclaration(exprParentParent) ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
112776
|
+
}
|
|
112777
|
+
ts.getModeForUsageLocation = getModeForUsageLocation;
|
|
112778
|
+
/* @internal */
|
|
112779
|
+
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, loader) {
|
|
112780
|
+
if (names.length === 0) {
|
|
112781
|
+
return [];
|
|
112782
|
+
}
|
|
112783
|
+
var resolutions = [];
|
|
112784
|
+
var cache = new ts.Map();
|
|
112785
|
+
var i = 0;
|
|
112786
|
+
for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
|
|
112787
|
+
var name = names_3[_i];
|
|
112788
|
+
var result = void 0;
|
|
112789
|
+
var mode = getModeForResolutionAtIndex(containingFile, i);
|
|
112790
|
+
i++;
|
|
112791
|
+
var cacheKey = mode !== undefined ? mode + "|" + name : name;
|
|
112792
|
+
if (cache.has(cacheKey)) {
|
|
112793
|
+
result = cache.get(cacheKey);
|
|
112794
|
+
}
|
|
112795
|
+
else {
|
|
112796
|
+
cache.set(cacheKey, result = loader(name, mode, containingFileName, redirectedReference));
|
|
112797
|
+
}
|
|
112798
|
+
resolutions.push(result);
|
|
112799
|
+
}
|
|
112800
|
+
return resolutions;
|
|
112801
|
+
}
|
|
112802
|
+
ts.loadWithModeAwareCache = loadWithModeAwareCache;
|
|
111905
112803
|
/* @internal */
|
|
111906
112804
|
function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
|
|
111907
112805
|
return forEachProjectReference(/*projectReferences*/ undefined, resolvedProjectReferences, function (resolvedRef, parent) { return resolvedRef && cb(resolvedRef, parent); });
|
|
@@ -111960,7 +112858,7 @@ var ts;
|
|
|
111960
112858
|
switch (kind) {
|
|
111961
112859
|
case ts.FileIncludeKind.Import:
|
|
111962
112860
|
var importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
111963
|
-
packageId = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text)) === null || _e === void 0 ? void 0 : _e.packageId;
|
|
112861
|
+
packageId = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) === null || _e === void 0 ? void 0 : _e.packageId;
|
|
111964
112862
|
if (importLiteral.pos === -1)
|
|
111965
112863
|
return { file: file, packageId: packageId, text: importLiteral.text };
|
|
111966
112864
|
pos = ts.skipTrivia(file.text, importLiteral.pos);
|
|
@@ -111971,7 +112869,7 @@ var ts;
|
|
|
111971
112869
|
break;
|
|
111972
112870
|
case ts.FileIncludeKind.TypeReferenceDirective:
|
|
111973
112871
|
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end);
|
|
111974
|
-
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;
|
|
112872
|
+
packageId = (_g = (_f = file.resolvedTypeReferenceDirectiveNames) === null || _f === void 0 ? void 0 : _f.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), getModeForResolutionAtIndex(file, index))) === null || _g === void 0 ? void 0 : _g.packageId;
|
|
111975
112873
|
break;
|
|
111976
112874
|
case ts.FileIncludeKind.LibReferenceDirective:
|
|
111977
112875
|
(_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
|
|
@@ -112058,6 +112956,33 @@ var ts;
|
|
|
112058
112956
|
configFileParseResult.errors;
|
|
112059
112957
|
}
|
|
112060
112958
|
ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics;
|
|
112959
|
+
/**
|
|
112960
|
+
* A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
|
|
112961
|
+
* `options` parameter.
|
|
112962
|
+
*
|
|
112963
|
+
* @param fileName The normalized absolute path to check the format of (it need not exist on disk)
|
|
112964
|
+
* @param [packageJsonInfoCache] A cache for package file lookups - it's best to have a cache when this function is called often
|
|
112965
|
+
* @param host The ModuleResolutionHost which can perform the filesystem lookups for package json data
|
|
112966
|
+
* @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution`
|
|
112967
|
+
* @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format
|
|
112968
|
+
*/
|
|
112969
|
+
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
112970
|
+
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
112971
|
+
case ts.ModuleResolutionKind.Node12:
|
|
112972
|
+
case ts.ModuleResolutionKind.NodeNext:
|
|
112973
|
+
return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
|
|
112974
|
+
ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
|
|
112975
|
+
ts.fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() :
|
|
112976
|
+
undefined; // other extensions, like `json` or `tsbuildinfo`, are set as `undefined` here but they should never be fed through the transformer pipeline
|
|
112977
|
+
default:
|
|
112978
|
+
return undefined;
|
|
112979
|
+
}
|
|
112980
|
+
function lookupFromPackageJson() {
|
|
112981
|
+
var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
|
|
112982
|
+
return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
112983
|
+
}
|
|
112984
|
+
}
|
|
112985
|
+
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
112061
112986
|
/**
|
|
112062
112987
|
* Determine if source file needs to be re-created even if its text hasn't changed
|
|
112063
112988
|
*/
|
|
@@ -112078,7 +113003,7 @@ var ts;
|
|
|
112078
113003
|
};
|
|
112079
113004
|
}
|
|
112080
113005
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
112081
|
-
var _a, _b, _c;
|
|
113006
|
+
var _a, _b, _c, _d;
|
|
112082
113007
|
var createProgramOptions = ts.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; // TODO: GH#18217
|
|
112083
113008
|
var rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences;
|
|
112084
113009
|
var oldProgram = createProgramOptions.oldProgram;
|
|
@@ -112120,7 +113045,7 @@ var ts;
|
|
|
112120
113045
|
var programDiagnostics = ts.createDiagnosticCollection();
|
|
112121
113046
|
var currentDirectory = host.getCurrentDirectory();
|
|
112122
113047
|
var supportedExtensions = ts.getSupportedExtensions(options);
|
|
112123
|
-
var supportedExtensionsWithJsonIfResolveJsonModule = ts.
|
|
113048
|
+
var supportedExtensionsWithJsonIfResolveJsonModule = ts.getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
|
|
112124
113049
|
// Map storing if there is emit blocking diagnostics for given input
|
|
112125
113050
|
var hasEmitBlockingDiagnostics = new ts.Map();
|
|
112126
113051
|
var _compilerOptionsObjectLiteralSyntax;
|
|
@@ -112129,7 +113054,7 @@ var ts;
|
|
|
112129
113054
|
var actualResolveModuleNamesWorker;
|
|
112130
113055
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|
|
112131
113056
|
if (host.resolveModuleNames) {
|
|
112132
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames),
|
|
113057
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) {
|
|
112133
113058
|
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
|
|
112134
113059
|
if (!resolved || resolved.extension !== undefined) {
|
|
112135
113060
|
return resolved;
|
|
@@ -112138,11 +113063,12 @@ var ts;
|
|
|
112138
113063
|
withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName);
|
|
112139
113064
|
return withExtension;
|
|
112140
113065
|
}); };
|
|
113066
|
+
moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
112141
113067
|
}
|
|
112142
113068
|
else {
|
|
112143
113069
|
moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
112144
|
-
var loader_1 = function (moduleName,
|
|
112145
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, _reusedNames, redirectedReference) { return
|
|
113070
|
+
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; }; // TODO: GH#18217
|
|
113071
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, _reusedNames, redirectedReference) { return loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), containingFile, containingFileName, redirectedReference, loader_1); };
|
|
112146
113072
|
}
|
|
112147
113073
|
var actualResolveTypeReferenceDirectiveNamesWorker;
|
|
112148
113074
|
if (host.resolveTypeReferenceDirectives) {
|
|
@@ -112178,9 +113104,9 @@ var ts;
|
|
|
112178
113104
|
var projectReferenceRedirects;
|
|
112179
113105
|
var mapFromFileToProjectReferenceRedirects;
|
|
112180
113106
|
var mapFromToProjectReferenceRedirectSource;
|
|
112181
|
-
var useSourceOfProjectReferenceRedirect = !!((
|
|
113107
|
+
var useSourceOfProjectReferenceRedirect = !!((_b = host.useSourceOfProjectReferenceRedirect) === null || _b === void 0 ? void 0 : _b.call(host)) &&
|
|
112182
113108
|
!options.disableSourceOfProjectReferenceRedirect;
|
|
112183
|
-
var
|
|
113109
|
+
var _e = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
112184
113110
|
compilerHost: host,
|
|
112185
113111
|
getSymlinkCache: getSymlinkCache,
|
|
112186
113112
|
useSourceOfProjectReferenceRedirect: useSourceOfProjectReferenceRedirect,
|
|
@@ -112188,7 +113114,8 @@ var ts;
|
|
|
112188
113114
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
112189
113115
|
getSourceOfProjectReferenceRedirect: getSourceOfProjectReferenceRedirect,
|
|
112190
113116
|
forEachResolvedProjectReference: forEachResolvedProjectReference
|
|
112191
|
-
}), onProgramCreateComplete =
|
|
113117
|
+
}), onProgramCreateComplete = _e.onProgramCreateComplete, fileExists = _e.fileExists, directoryExists = _e.directoryExists;
|
|
113118
|
+
var readFile = host.readFile.bind(host);
|
|
112192
113119
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
112193
113120
|
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
112194
113121
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -112247,7 +113174,7 @@ var ts;
|
|
|
112247
113174
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
112248
113175
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
112249
113176
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
112250
|
-
processTypeReferenceDirective(typeReferences[i], resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (
|
|
113177
|
+
processTypeReferenceDirective(typeReferences[i], resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_c = resolutions[i]) === null || _c === void 0 ? void 0 : _c.packageId });
|
|
112251
113178
|
}
|
|
112252
113179
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
112253
113180
|
}
|
|
@@ -112363,9 +113290,10 @@ var ts;
|
|
|
112363
113290
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
112364
113291
|
emitBuildInfo: emitBuildInfo,
|
|
112365
113292
|
fileExists: fileExists,
|
|
113293
|
+
readFile: readFile,
|
|
112366
113294
|
directoryExists: directoryExists,
|
|
112367
113295
|
getSymlinkCache: getSymlinkCache,
|
|
112368
|
-
realpath: (
|
|
113296
|
+
realpath: (_d = host.realpath) === null || _d === void 0 ? void 0 : _d.bind(host),
|
|
112369
113297
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
112370
113298
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
112371
113299
|
structureIsReused: structureIsReused,
|
|
@@ -112395,7 +113323,7 @@ var ts;
|
|
|
112395
113323
|
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
112396
113324
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "resolveModuleNamesWorker", { containingFileName: containingFileName });
|
|
112397
113325
|
ts.performance.mark("beforeResolveModule");
|
|
112398
|
-
var result = actualResolveModuleNamesWorker(moduleNames, containingFileName, reusedNames, redirectedReference);
|
|
113326
|
+
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName, reusedNames, redirectedReference);
|
|
112399
113327
|
ts.performance.mark("afterResolveModule");
|
|
112400
113328
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
112401
113329
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -112416,7 +113344,7 @@ var ts;
|
|
|
112416
113344
|
}
|
|
112417
113345
|
function getRedirectReferenceForResolution(file) {
|
|
112418
113346
|
var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName);
|
|
112419
|
-
if (redirect || !ts.
|
|
113347
|
+
if (redirect || !ts.fileExtensionIsOneOf(file.originalFileName, [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */]))
|
|
112420
113348
|
return redirect;
|
|
112421
113349
|
// The originalFileName could not be actual source file name if file found was d.ts from referecned project
|
|
112422
113350
|
// So in this case try to look up if this is output from referenced project, if it is use the redirected project in that case
|
|
@@ -112461,8 +113389,8 @@ var ts;
|
|
|
112461
113389
|
}
|
|
112462
113390
|
return ts.libs.length + 2;
|
|
112463
113391
|
}
|
|
112464
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
|
|
112465
|
-
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache);
|
|
113392
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
|
|
113393
|
+
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
|
|
112466
113394
|
}
|
|
112467
113395
|
function toPath(fileName) {
|
|
112468
113396
|
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
@@ -112504,9 +113432,11 @@ var ts;
|
|
|
112504
113432
|
// Since we assume the filesystem does not change during program creation,
|
|
112505
113433
|
// it is safe to reuse resolutions from the earlier call.
|
|
112506
113434
|
var result_14 = [];
|
|
113435
|
+
var i = 0;
|
|
112507
113436
|
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
|
|
112508
113437
|
var moduleName = moduleNames_1[_i];
|
|
112509
|
-
var resolvedModule = file.resolvedModules.get(moduleName);
|
|
113438
|
+
var resolvedModule = file.resolvedModules.get(moduleName, getModeForResolutionAtIndex(file, i));
|
|
113439
|
+
i++;
|
|
112510
113440
|
result_14.push(resolvedModule);
|
|
112511
113441
|
}
|
|
112512
113442
|
return result_14;
|
|
@@ -112534,7 +113464,7 @@ var ts;
|
|
|
112534
113464
|
var moduleName = moduleNames[i];
|
|
112535
113465
|
// If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
|
|
112536
113466
|
if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
112537
|
-
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName);
|
|
113467
|
+
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i));
|
|
112538
113468
|
if (oldResolvedModule) {
|
|
112539
113469
|
if (ts.isTraceEnabled(options, host)) {
|
|
112540
113470
|
ts.trace(host, oldResolvedModule.packageId ?
|
|
@@ -112558,7 +113488,7 @@ var ts;
|
|
|
112558
113488
|
}
|
|
112559
113489
|
}
|
|
112560
113490
|
else {
|
|
112561
|
-
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName);
|
|
113491
|
+
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, i);
|
|
112562
113492
|
}
|
|
112563
113493
|
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
112564
113494
|
(result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
@@ -112595,8 +113525,10 @@ var ts;
|
|
|
112595
113525
|
return result;
|
|
112596
113526
|
// If we change our policy of rechecking failed lookups on each program create,
|
|
112597
113527
|
// we should adjust the value returned here.
|
|
112598
|
-
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
112599
|
-
|
|
113528
|
+
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, index) {
|
|
113529
|
+
if (index >= ts.length(oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.imports) + ts.length(oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.moduleAugmentations))
|
|
113530
|
+
return false; // mode index out of bounds, don't reuse resolution
|
|
113531
|
+
var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName, oldSourceFile && getModeForResolutionAtIndex(oldSourceFile, index));
|
|
112600
113532
|
var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
112601
113533
|
if (resolutionToFile && resolvedFile) {
|
|
112602
113534
|
// In the old program, we resolved to an ambient module that was in the same
|
|
@@ -112679,8 +113611,8 @@ var ts;
|
|
|
112679
113611
|
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
|
|
112680
113612
|
var oldSourceFile = oldSourceFiles_2[_i];
|
|
112681
113613
|
var newSourceFile = host.getSourceFileByPath
|
|
112682
|
-
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, options
|
|
112683
|
-
: host.getSourceFile(oldSourceFile.fileName, options
|
|
113614
|
+
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, ts.getEmitScriptTarget(options), /*onError*/ undefined, shouldCreateNewSourceFile)
|
|
113615
|
+
: host.getSourceFile(oldSourceFile.fileName, ts.getEmitScriptTarget(options), /*onError*/ undefined, shouldCreateNewSourceFile); // TODO: GH#18217
|
|
112684
113616
|
if (!newSourceFile) {
|
|
112685
113617
|
return 0 /* Not */;
|
|
112686
113618
|
}
|
|
@@ -112787,10 +113719,10 @@ var ts;
|
|
|
112787
113719
|
var moduleNames = getModuleNames(newSourceFile);
|
|
112788
113720
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
112789
113721
|
// ensure that module resolution results are still correct
|
|
112790
|
-
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, ts.moduleResolutionIsEqualTo);
|
|
113722
|
+
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, oldSourceFile, ts.moduleResolutionIsEqualTo);
|
|
112791
113723
|
if (resolutionsChanged) {
|
|
112792
113724
|
structureIsReused = 1 /* SafeModules */;
|
|
112793
|
-
newSourceFile.resolvedModules = ts.
|
|
113725
|
+
newSourceFile.resolvedModules = ts.zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
|
|
112794
113726
|
}
|
|
112795
113727
|
else {
|
|
112796
113728
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
@@ -112799,10 +113731,10 @@ var ts;
|
|
|
112799
113731
|
var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (ref) { return ts.toFileNameLowerCase(ref.fileName); });
|
|
112800
113732
|
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
112801
113733
|
// ensure that types resolutions are still correct
|
|
112802
|
-
var typeReferenceEesolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, ts.typeDirectiveIsEqualTo);
|
|
113734
|
+
var typeReferenceEesolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
112803
113735
|
if (typeReferenceEesolutionsChanged) {
|
|
112804
113736
|
structureIsReused = 1 /* SafeModules */;
|
|
112805
|
-
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.
|
|
113737
|
+
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
112806
113738
|
}
|
|
112807
113739
|
else {
|
|
112808
113740
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
@@ -113433,6 +114365,7 @@ var ts;
|
|
|
113433
114365
|
// An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference other external modules
|
|
113434
114366
|
// only through top - level external module names. Relative external module names are not permitted.
|
|
113435
114367
|
if (moduleNameExpr && ts.isStringLiteral(moduleNameExpr) && moduleNameExpr.text && (!inAmbientModule || !ts.isExternalModuleNameRelative(moduleNameExpr.text))) {
|
|
114368
|
+
ts.setParentRecursive(node, /*incremental*/ false); // we need parent data on imports before the program is fully bound, so we ensure it's set here
|
|
113436
114369
|
imports = ts.append(imports, moduleNameExpr);
|
|
113437
114370
|
if (!usesUriStyleNodeCoreModules && currentNodeModulesDepth === 0 && !file.isDeclarationFile) {
|
|
113438
114371
|
usesUriStyleNodeCoreModules = ts.startsWith(moduleNameExpr.text, "node:");
|
|
@@ -113441,6 +114374,7 @@ var ts;
|
|
|
113441
114374
|
}
|
|
113442
114375
|
else if (ts.isModuleDeclaration(node)) {
|
|
113443
114376
|
if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasSyntacticModifier(node, 2 /* Ambient */) || file.isDeclarationFile)) {
|
|
114377
|
+
node.name.parent = node;
|
|
113444
114378
|
var nameText = ts.getTextOfIdentifierOrLiteral(node.name);
|
|
113445
114379
|
// Ambient module declarations can be interpreted as augmentations for some existing external modules.
|
|
113446
114380
|
// This will happen in two cases:
|
|
@@ -113476,13 +114410,16 @@ var ts;
|
|
|
113476
114410
|
while (r.exec(file.text) !== null) { // eslint-disable-line no-null/no-null
|
|
113477
114411
|
var node = getNodeAtPosition(file, r.lastIndex);
|
|
113478
114412
|
if (isJavaScriptFile && ts.isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true)) {
|
|
114413
|
+
ts.setParentRecursive(node, /*incremental*/ false); // we need parent data on imports before the program is fully bound, so we ensure it's set here
|
|
113479
114414
|
imports = ts.append(imports, node.arguments[0]);
|
|
113480
114415
|
}
|
|
113481
114416
|
// we have to check the argument list has length of at least 1. We will still have to process these even though we have parsing error.
|
|
113482
114417
|
else if (ts.isImportCall(node) && node.arguments.length >= 1 && ts.isStringLiteralLike(node.arguments[0])) {
|
|
114418
|
+
ts.setParentRecursive(node, /*incremental*/ false); // we need parent data on imports before the program is fully bound, so we ensure it's set here
|
|
113483
114419
|
imports = ts.append(imports, node.arguments[0]);
|
|
113484
114420
|
}
|
|
113485
114421
|
else if (ts.isLiteralImportTypeNode(node)) {
|
|
114422
|
+
ts.setParentRecursive(node, /*incremental*/ false); // we need parent data on imports before the program is fully bound, so we ensure it's set here
|
|
113486
114423
|
imports = ts.append(imports, node.argument.literal);
|
|
113487
114424
|
}
|
|
113488
114425
|
}
|
|
@@ -113518,13 +114455,13 @@ var ts;
|
|
|
113518
114455
|
function getSourceFileFromReferenceWorker(fileName, getSourceFile, fail, reason) {
|
|
113519
114456
|
if (ts.hasExtension(fileName)) {
|
|
113520
114457
|
var canonicalFileName_1 = host.getCanonicalFileName(fileName);
|
|
113521
|
-
if (!options.allowNonTsExtensions && !ts.forEach(supportedExtensionsWithJsonIfResolveJsonModule, function (extension) { return ts.fileExtensionIs(canonicalFileName_1, extension); })) {
|
|
114458
|
+
if (!options.allowNonTsExtensions && !ts.forEach(ts.flatten(supportedExtensionsWithJsonIfResolveJsonModule), function (extension) { return ts.fileExtensionIs(canonicalFileName_1, extension); })) {
|
|
113522
114459
|
if (fail) {
|
|
113523
114460
|
if (ts.hasJSFileExtension(canonicalFileName_1)) {
|
|
113524
114461
|
fail(ts.Diagnostics.File_0_is_a_JavaScript_file_Did_you_mean_to_enable_the_allowJs_option, fileName);
|
|
113525
114462
|
}
|
|
113526
114463
|
else {
|
|
113527
|
-
fail(ts.Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1, fileName, "'" + supportedExtensions.join("', '") + "'");
|
|
114464
|
+
fail(ts.Diagnostics.File_0_has_an_unsupported_extension_The_only_supported_extensions_are_1, fileName, "'" + ts.flatten(supportedExtensions).join("', '") + "'");
|
|
113528
114465
|
}
|
|
113529
114466
|
}
|
|
113530
114467
|
return undefined;
|
|
@@ -113554,9 +114491,10 @@ var ts;
|
|
|
113554
114491
|
fail(ts.Diagnostics.File_0_not_found, fileName);
|
|
113555
114492
|
return undefined;
|
|
113556
114493
|
}
|
|
113557
|
-
|
|
114494
|
+
// Only try adding extensions from the first supported group (which should be .ts/.tsx/.d.ts)
|
|
114495
|
+
var sourceFileWithAddedExtension = ts.forEach(supportedExtensions[0], function (extension) { return getSourceFile(fileName + extension); });
|
|
113558
114496
|
if (fail && !sourceFileWithAddedExtension)
|
|
113559
|
-
fail(ts.Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1, fileName, "'" + supportedExtensions.join("', '") + "'");
|
|
114497
|
+
fail(ts.Diagnostics.Could_not_resolve_the_path_0_with_the_extensions_Colon_1, fileName, "'" + ts.flatten(supportedExtensions).join("', '") + "'");
|
|
113560
114498
|
return sourceFileWithAddedExtension;
|
|
113561
114499
|
}
|
|
113562
114500
|
}
|
|
@@ -113701,7 +114639,7 @@ var ts;
|
|
|
113701
114639
|
}
|
|
113702
114640
|
}
|
|
113703
114641
|
// We haven't looked for this file, do so now and cache result
|
|
113704
|
-
var file = host.getSourceFile(fileName, options
|
|
114642
|
+
var file = host.getSourceFile(fileName, ts.getEmitScriptTarget(options), function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile);
|
|
113705
114643
|
if (packageId) {
|
|
113706
114644
|
var packageIdKey = ts.packageIdToString(packageId);
|
|
113707
114645
|
var fileFromPackageId = packageIdToSourceFile.get(packageIdKey);
|
|
@@ -113729,6 +114667,10 @@ var ts;
|
|
|
113729
114667
|
file.path = path;
|
|
113730
114668
|
file.resolvedPath = toPath(fileName);
|
|
113731
114669
|
file.originalFileName = originalFileName;
|
|
114670
|
+
// 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
|
|
114671
|
+
// 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
|
|
114672
|
+
// 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.
|
|
114673
|
+
file.impliedNodeFormat = getImpliedNodeFormatForFile(file.resolvedPath, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
113732
114674
|
addFileIncludeReason(file, reason);
|
|
113733
114675
|
if (host.useCaseSensitiveFileNames()) {
|
|
113734
114676
|
var pathLowerCase = ts.toFileNameLowerCase(path);
|
|
@@ -113920,9 +114862,9 @@ var ts;
|
|
|
113920
114862
|
}
|
|
113921
114863
|
}
|
|
113922
114864
|
function pathForLibFile(libFileName) {
|
|
113923
|
-
// Support resolving to lib.dom.d.ts -> @typescript/dom, and
|
|
113924
|
-
// lib.dom.iterable.d.ts -> @typescript/dom/iterable
|
|
113925
|
-
// lib.es2015.symbol.wellknown.d.ts -> @typescript/es2015/symbol-wellknown
|
|
114865
|
+
// Support resolving to lib.dom.d.ts -> @typescript/lib-dom, and
|
|
114866
|
+
// lib.dom.iterable.d.ts -> @typescript/lib-dom/iterable
|
|
114867
|
+
// lib.es2015.symbol.wellknown.d.ts -> @typescript/lib-es2015/symbol-wellknown
|
|
113926
114868
|
var components = libFileName.split(".");
|
|
113927
114869
|
var path = components[1];
|
|
113928
114870
|
var i = 2;
|
|
@@ -113931,7 +114873,7 @@ var ts;
|
|
|
113931
114873
|
i++;
|
|
113932
114874
|
}
|
|
113933
114875
|
var resolveFrom = ts.combinePaths(currentDirectory, "__lib_node_modules_lookup_" + libFileName + "__.ts");
|
|
113934
|
-
var localOverrideModuleResult = ts.resolveModuleName("@typescript/" + path, resolveFrom, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host, moduleResolutionCache);
|
|
114876
|
+
var localOverrideModuleResult = ts.resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, host, moduleResolutionCache);
|
|
113935
114877
|
if (localOverrideModuleResult === null || localOverrideModuleResult === void 0 ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
113936
114878
|
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
113937
114879
|
}
|
|
@@ -113972,7 +114914,7 @@ var ts;
|
|
|
113972
114914
|
var optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a = getRedirectReferenceForResolution(file)) === null || _a === void 0 ? void 0 : _a.commandLine.options : undefined) || options;
|
|
113973
114915
|
for (var index = 0; index < moduleNames.length; index++) {
|
|
113974
114916
|
var resolution = resolutions[index];
|
|
113975
|
-
ts.setResolvedModule(file, moduleNames[index], resolution);
|
|
114917
|
+
ts.setResolvedModule(file, moduleNames[index], resolution, getModeForResolutionAtIndex(file, index));
|
|
113976
114918
|
if (!resolution) {
|
|
113977
114919
|
continue;
|
|
113978
114920
|
}
|
|
@@ -114195,7 +115137,7 @@ var ts;
|
|
|
114195
115137
|
if (options.noImplicitUseStrict && ts.getStrictOptionValue(options, "alwaysStrict")) {
|
|
114196
115138
|
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict");
|
|
114197
115139
|
}
|
|
114198
|
-
var languageVersion = options
|
|
115140
|
+
var languageVersion = ts.getEmitScriptTarget(options);
|
|
114199
115141
|
var firstNonAmbientExternalModuleSourceFile = ts.find(files, function (f) { return ts.isExternalModule(f) && !f.isDeclarationFile; });
|
|
114200
115142
|
if (options.isolatedModules) {
|
|
114201
115143
|
if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES2015 */) {
|
|
@@ -114456,7 +115398,7 @@ var ts;
|
|
|
114456
115398
|
message = ts.Diagnostics.File_is_library_specified_here;
|
|
114457
115399
|
break;
|
|
114458
115400
|
}
|
|
114459
|
-
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === options
|
|
115401
|
+
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === ts.getEmitScriptTarget(options) ? key : undefined; });
|
|
114460
115402
|
configFileNode = target ? getOptionsSyntaxByValue("target", target) : undefined;
|
|
114461
115403
|
message = ts.Diagnostics.File_is_default_library_for_target_specified_here;
|
|
114462
115404
|
break;
|
|
@@ -114624,7 +115566,7 @@ var ts;
|
|
|
114624
115566
|
if (options.outDir) {
|
|
114625
115567
|
return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
|
|
114626
115568
|
}
|
|
114627
|
-
if (ts.fileExtensionIsOneOf(filePath, ts.
|
|
115569
|
+
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.fileExtensionIs(filePath, ".d.ts" /* Dts */)) {
|
|
114628
115570
|
// Otherwise just check if sourceFile with the name exists
|
|
114629
115571
|
var filePathWithoutExtension = ts.removeFileExtension(filePath);
|
|
114630
115572
|
return !!getSourceFileByPath((filePathWithoutExtension + ".ts" /* Ts */)) ||
|
|
@@ -115156,7 +116098,7 @@ var ts;
|
|
|
115156
116098
|
}
|
|
115157
116099
|
}
|
|
115158
116100
|
}
|
|
115159
|
-
fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined });
|
|
116101
|
+
fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
|
|
115160
116102
|
}
|
|
115161
116103
|
return {
|
|
115162
116104
|
fileInfos: fileInfos,
|
|
@@ -115250,7 +116192,7 @@ var ts;
|
|
|
115250
116192
|
/*forceDtsEmit*/ true);
|
|
115251
116193
|
var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
|
|
115252
116194
|
if (firstDts_1) {
|
|
115253
|
-
ts.Debug.assert(ts.
|
|
116195
|
+
ts.Debug.assert(ts.fileExtensionIsOneOf(firstDts_1.name, [".d.ts" /* Dts */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */]), "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; })); });
|
|
115254
116196
|
latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
|
|
115255
116197
|
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
|
115256
116198
|
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
|
@@ -115574,6 +116516,14 @@ var ts;
|
|
|
115574
116516
|
ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
|
|
115575
116517
|
state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
|
|
115576
116518
|
}
|
|
116519
|
+
if (useOldState) {
|
|
116520
|
+
// Any time the interpretation of a source file changes, mark it as changed
|
|
116521
|
+
ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
|
|
116522
|
+
if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
|
|
116523
|
+
state.changedFilesSet.add(sourceFilePath);
|
|
116524
|
+
}
|
|
116525
|
+
});
|
|
116526
|
+
}
|
|
115577
116527
|
state.buildInfoEmitPending = !!state.changedFilesSet.size;
|
|
115578
116528
|
return state;
|
|
115579
116529
|
}
|
|
@@ -115970,13 +116920,13 @@ var ts;
|
|
|
115970
116920
|
var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
|
|
115971
116921
|
return value.version === actualSignature ?
|
|
115972
116922
|
value.affectsGlobalScope ?
|
|
115973
|
-
{ version: value.version, signature: undefined, affectsGlobalScope: true } :
|
|
116923
|
+
{ version: value.version, signature: undefined, affectsGlobalScope: true, impliedFormat: value.impliedFormat } :
|
|
115974
116924
|
value.version :
|
|
115975
116925
|
actualSignature !== undefined ?
|
|
115976
116926
|
signature === undefined ?
|
|
115977
116927
|
value :
|
|
115978
|
-
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope } :
|
|
115979
|
-
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope };
|
|
116928
|
+
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
116929
|
+
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
|
|
115980
116930
|
});
|
|
115981
116931
|
var referencedMap;
|
|
115982
116932
|
if (state.referencedMap) {
|
|
@@ -116396,10 +117346,10 @@ var ts;
|
|
|
116396
117346
|
}
|
|
116397
117347
|
function toBuilderStateFileInfo(fileInfo) {
|
|
116398
117348
|
return ts.isString(fileInfo) ?
|
|
116399
|
-
{ version: fileInfo, signature: fileInfo, affectsGlobalScope: undefined } :
|
|
117349
|
+
{ version: fileInfo, signature: fileInfo, affectsGlobalScope: undefined, impliedFormat: undefined } :
|
|
116400
117350
|
ts.isString(fileInfo.signature) ?
|
|
116401
117351
|
fileInfo :
|
|
116402
|
-
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope };
|
|
117352
|
+
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
|
|
116403
117353
|
}
|
|
116404
117354
|
ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
|
|
116405
117355
|
function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
|
|
@@ -116737,14 +117687,14 @@ var ts;
|
|
|
116737
117687
|
}
|
|
116738
117688
|
function resolveNamesWithLocalCache(_a) {
|
|
116739
117689
|
var _b, _c, _d;
|
|
116740
|
-
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;
|
|
117690
|
+
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges, containingSourceFile = _a.containingSourceFile;
|
|
116741
117691
|
var path = resolutionHost.toPath(containingFile);
|
|
116742
|
-
var resolutionsInFile = cache.get(path) || cache.set(path,
|
|
117692
|
+
var resolutionsInFile = cache.get(path) || cache.set(path, ts.createModeAwareCache()).get(path);
|
|
116743
117693
|
var dirPath = ts.getDirectoryPath(path);
|
|
116744
117694
|
var perDirectoryCache = perDirectoryCacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
116745
117695
|
var perDirectoryResolution = perDirectoryCache.get(dirPath);
|
|
116746
117696
|
if (!perDirectoryResolution) {
|
|
116747
|
-
perDirectoryResolution =
|
|
117697
|
+
perDirectoryResolution = ts.createModeAwareCache();
|
|
116748
117698
|
perDirectoryCache.set(dirPath, perDirectoryResolution);
|
|
116749
117699
|
}
|
|
116750
117700
|
var resolvedModules = [];
|
|
@@ -116756,17 +117706,20 @@ var ts;
|
|
|
116756
117706
|
var unmatchedRedirects = oldRedirect ?
|
|
116757
117707
|
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
|
|
116758
117708
|
!!redirectedReference;
|
|
116759
|
-
var seenNamesInFile =
|
|
116760
|
-
|
|
116761
|
-
|
|
116762
|
-
var
|
|
117709
|
+
var seenNamesInFile = ts.createModeAwareCache();
|
|
117710
|
+
var i = 0;
|
|
117711
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
117712
|
+
var name = names_4[_i];
|
|
117713
|
+
var mode = containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
117714
|
+
i++;
|
|
117715
|
+
var resolution = resolutionsInFile.get(name, mode);
|
|
116763
117716
|
// Resolution is valid if it is present and not invalidated
|
|
116764
|
-
if (!seenNamesInFile.has(name) &&
|
|
117717
|
+
if (!seenNamesInFile.has(name, mode) &&
|
|
116765
117718
|
unmatchedRedirects || !resolution || resolution.isInvalidated ||
|
|
116766
117719
|
// If the name is unresolved import that was invalidated, recalculate
|
|
116767
117720
|
(hasInvalidatedNonRelativeUnresolvedImport && !ts.isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
116768
117721
|
var existingResolution = resolution;
|
|
116769
|
-
var resolutionInDirectory = perDirectoryResolution.get(name);
|
|
117722
|
+
var resolutionInDirectory = perDirectoryResolution.get(name, mode);
|
|
116770
117723
|
if (resolutionInDirectory) {
|
|
116771
117724
|
resolution = resolutionInDirectory;
|
|
116772
117725
|
var host = ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost;
|
|
@@ -116786,10 +117739,10 @@ var ts;
|
|
|
116786
117739
|
}
|
|
116787
117740
|
}
|
|
116788
117741
|
else {
|
|
116789
|
-
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference);
|
|
116790
|
-
perDirectoryResolution.set(name, resolution);
|
|
117742
|
+
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile);
|
|
117743
|
+
perDirectoryResolution.set(name, mode, resolution);
|
|
116791
117744
|
}
|
|
116792
|
-
resolutionsInFile.set(name, resolution);
|
|
117745
|
+
resolutionsInFile.set(name, mode, resolution);
|
|
116793
117746
|
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
116794
117747
|
if (existingResolution) {
|
|
116795
117748
|
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
@@ -116802,7 +117755,7 @@ var ts;
|
|
|
116802
117755
|
}
|
|
116803
117756
|
else {
|
|
116804
117757
|
var host = ((_d = resolutionHost.getCompilerHost) === null || _d === void 0 ? void 0 : _d.call(resolutionHost)) || resolutionHost;
|
|
116805
|
-
if (ts.isTraceEnabled(compilerOptions, host) && !seenNamesInFile.has(name)) {
|
|
117758
|
+
if (ts.isTraceEnabled(compilerOptions, host) && !seenNamesInFile.has(name, mode)) {
|
|
116806
117759
|
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
116807
117760
|
ts.trace(host, loader === resolveModuleName ?
|
|
116808
117761
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
@@ -116818,14 +117771,14 @@ var ts;
|
|
|
116818
117771
|
}
|
|
116819
117772
|
}
|
|
116820
117773
|
ts.Debug.assert(resolution !== undefined && !resolution.isInvalidated);
|
|
116821
|
-
seenNamesInFile.set(name, true);
|
|
117774
|
+
seenNamesInFile.set(name, mode, true);
|
|
116822
117775
|
resolvedModules.push(getResolutionWithResolvedFileName(resolution));
|
|
116823
117776
|
}
|
|
116824
117777
|
// Stop watching and remove the unused name
|
|
116825
|
-
resolutionsInFile.forEach(function (resolution, name) {
|
|
116826
|
-
if (!seenNamesInFile.has(name) && !ts.contains(reusedNames, name)) {
|
|
117778
|
+
resolutionsInFile.forEach(function (resolution, name, mode) {
|
|
117779
|
+
if (!seenNamesInFile.has(name, mode) && !ts.contains(reusedNames, name)) {
|
|
116827
117780
|
stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
116828
|
-
resolutionsInFile.delete(name);
|
|
117781
|
+
resolutionsInFile.delete(name, mode);
|
|
116829
117782
|
}
|
|
116830
117783
|
});
|
|
116831
117784
|
return resolvedModules;
|
|
@@ -116859,7 +117812,7 @@ var ts;
|
|
|
116859
117812
|
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
|
|
116860
117813
|
});
|
|
116861
117814
|
}
|
|
116862
|
-
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
117815
|
+
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile) {
|
|
116863
117816
|
return resolveNamesWithLocalCache({
|
|
116864
117817
|
names: moduleNames,
|
|
116865
117818
|
containingFile: containingFile,
|
|
@@ -116871,11 +117824,14 @@ var ts;
|
|
|
116871
117824
|
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
|
|
116872
117825
|
reusedNames: reusedNames,
|
|
116873
117826
|
logChanges: logChangesWhenResolvingModule,
|
|
117827
|
+
containingSourceFile: containingSourceFile,
|
|
116874
117828
|
});
|
|
116875
117829
|
}
|
|
116876
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
|
|
117830
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode) {
|
|
116877
117831
|
var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile));
|
|
116878
|
-
|
|
117832
|
+
if (!cache)
|
|
117833
|
+
return undefined;
|
|
117834
|
+
return cache.get(moduleName, resolutionMode);
|
|
116879
117835
|
}
|
|
116880
117836
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
116881
117837
|
return ts.endsWith(dirPath, "/node_modules/@types");
|
|
@@ -117274,7 +118230,7 @@ var ts;
|
|
|
117274
118230
|
Ending[Ending["Index"] = 1] = "Index";
|
|
117275
118231
|
Ending[Ending["JsExtension"] = 2] = "JsExtension";
|
|
117276
118232
|
})(Ending || (Ending = {}));
|
|
117277
|
-
function getPreferences(_a, compilerOptions, importingSourceFile) {
|
|
118233
|
+
function getPreferences(host, _a, compilerOptions, importingSourceFile) {
|
|
117278
118234
|
var importModuleSpecifierPreference = _a.importModuleSpecifierPreference, importModuleSpecifierEnding = _a.importModuleSpecifierEnding;
|
|
117279
118235
|
return {
|
|
117280
118236
|
relativePreference: importModuleSpecifierPreference === "relative" ? 0 /* Relative */ :
|
|
@@ -117288,21 +118244,39 @@ var ts;
|
|
|
117288
118244
|
case "minimal": return 0 /* Minimal */;
|
|
117289
118245
|
case "index": return 1 /* Index */;
|
|
117290
118246
|
case "js": return 2 /* JsExtension */;
|
|
117291
|
-
default: return usesJsExtensionOnImports(importingSourceFile) ? 2 /* JsExtension */
|
|
118247
|
+
default: return usesJsExtensionOnImports(importingSourceFile) || isFormatRequiringExtensions(compilerOptions, importingSourceFile.path, host) ? 2 /* JsExtension */
|
|
117292
118248
|
: ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 /* Index */ : 0 /* Minimal */;
|
|
117293
118249
|
}
|
|
117294
118250
|
}
|
|
117295
118251
|
}
|
|
117296
|
-
function getPreferencesForUpdate(compilerOptions, oldImportSpecifier) {
|
|
118252
|
+
function getPreferencesForUpdate(compilerOptions, oldImportSpecifier, importingSourceFileName, host) {
|
|
117297
118253
|
return {
|
|
117298
118254
|
relativePreference: ts.isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */,
|
|
117299
|
-
ending: ts.hasJSFileExtension(oldImportSpecifier) ?
|
|
118255
|
+
ending: ts.hasJSFileExtension(oldImportSpecifier) || isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) ?
|
|
117300
118256
|
2 /* JsExtension */ :
|
|
117301
118257
|
ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs || ts.endsWith(oldImportSpecifier, "index") ? 1 /* Index */ : 0 /* Minimal */,
|
|
117302
118258
|
};
|
|
117303
118259
|
}
|
|
118260
|
+
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
118261
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12
|
|
118262
|
+
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118263
|
+
return false;
|
|
118264
|
+
}
|
|
118265
|
+
return ts.getImpliedNodeFormatForFile(importingSourceFileName, /*packageJsonInfoCache*/ undefined, getModuleResolutionHost(host), compilerOptions) !== ts.ModuleKind.CommonJS;
|
|
118266
|
+
}
|
|
118267
|
+
function getModuleResolutionHost(host) {
|
|
118268
|
+
var _a;
|
|
118269
|
+
return {
|
|
118270
|
+
fileExists: host.fileExists,
|
|
118271
|
+
readFile: ts.Debug.checkDefined(host.readFile),
|
|
118272
|
+
directoryExists: host.directoryExists,
|
|
118273
|
+
getCurrentDirectory: host.getCurrentDirectory,
|
|
118274
|
+
realpath: host.realpath,
|
|
118275
|
+
useCaseSensitiveFileNames: (_a = host.useCaseSensitiveFileNames) === null || _a === void 0 ? void 0 : _a.call(host),
|
|
118276
|
+
};
|
|
118277
|
+
}
|
|
117304
118278
|
function updateModuleSpecifier(compilerOptions, importingSourceFileName, toFileName, host, oldImportSpecifier) {
|
|
117305
|
-
var res = getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, getPreferencesForUpdate(compilerOptions, oldImportSpecifier), {});
|
|
118279
|
+
var res = getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, getPreferencesForUpdate(compilerOptions, oldImportSpecifier, importingSourceFileName, host), {});
|
|
117306
118280
|
if (res === oldImportSpecifier)
|
|
117307
118281
|
return undefined;
|
|
117308
118282
|
return res;
|
|
@@ -117310,7 +118284,7 @@ var ts;
|
|
|
117310
118284
|
moduleSpecifiers_1.updateModuleSpecifier = updateModuleSpecifier;
|
|
117311
118285
|
// Note: importingSourceFile is just for usesJsExtensionOnImports
|
|
117312
118286
|
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host) {
|
|
117313
|
-
return getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, getPreferences({}, compilerOptions, importingSourceFile), {});
|
|
118287
|
+
return getModuleSpecifierWorker(compilerOptions, importingSourceFileName, toFileName, host, getPreferences(host, {}, compilerOptions, importingSourceFile), {});
|
|
117314
118288
|
}
|
|
117315
118289
|
moduleSpecifiers_1.getModuleSpecifier = getModuleSpecifier;
|
|
117316
118290
|
function getNodeModulesPackageName(compilerOptions, importingSourceFileName, nodeModulesFileName, host, preferences) {
|
|
@@ -117364,7 +118338,7 @@ var ts;
|
|
|
117364
118338
|
moduleSpecifiers_1.getModuleSpecifiersWithCacheInfo = getModuleSpecifiersWithCacheInfo;
|
|
117365
118339
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences) {
|
|
117366
118340
|
var info = getInfo(importingSourceFile.path, host);
|
|
117367
|
-
var preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
118341
|
+
var preferences = getPreferences(host, userPreferences, compilerOptions, importingSourceFile);
|
|
117368
118342
|
var existingSpecifier = ts.forEach(modulePaths, function (modulePath) { return ts.forEach(host.getFileIncludeReasons().get(ts.toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)), function (reason) {
|
|
117369
118343
|
if (reason.kind !== ts.FileIncludeKind.Import || reason.file !== importingSourceFile.path)
|
|
117370
118344
|
return undefined;
|
|
@@ -117800,7 +118774,7 @@ var ts;
|
|
|
117800
118774
|
if (!host.fileExists)
|
|
117801
118775
|
return;
|
|
117802
118776
|
// We check all js, `node` and `json` extensions in addition to TS, since node module resolution would also choose those over the directory
|
|
117803
|
-
var extensions = ts.getSupportedExtensions({ allowJs: true }, [{ extension: "node", isMixedContent: false }, { extension: "json", isMixedContent: false, scriptKind: 6 /* JSON */ }]);
|
|
118777
|
+
var extensions = ts.flatten(ts.getSupportedExtensions({ allowJs: true }, [{ extension: "node", isMixedContent: false }, { extension: "json", isMixedContent: false, scriptKind: 6 /* JSON */ }]));
|
|
117804
118778
|
for (var _i = 0, extensions_3 = extensions; _i < extensions_3.length; _i++) {
|
|
117805
118779
|
var e = extensions_3[_i];
|
|
117806
118780
|
var fullPath = path + e;
|
|
@@ -117868,9 +118842,11 @@ var ts;
|
|
|
117868
118842
|
});
|
|
117869
118843
|
}
|
|
117870
118844
|
function removeExtensionAndIndexPostFix(fileName, ending, options) {
|
|
117871
|
-
if (ts.
|
|
118845
|
+
if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
|
|
117872
118846
|
return fileName;
|
|
117873
118847
|
var noExtension = ts.removeFileExtension(fileName);
|
|
118848
|
+
if (ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */]))
|
|
118849
|
+
return noExtension + getJSExtensionForFile(fileName, options);
|
|
117874
118850
|
switch (ending) {
|
|
117875
118851
|
case 0 /* Minimal */:
|
|
117876
118852
|
return ts.removeSuffix(noExtension, "/index");
|
|
@@ -117898,6 +118874,14 @@ var ts;
|
|
|
117898
118874
|
case ".jsx" /* Jsx */:
|
|
117899
118875
|
case ".json" /* Json */:
|
|
117900
118876
|
return ext;
|
|
118877
|
+
case ".d.mts" /* Dmts */:
|
|
118878
|
+
case ".mts" /* Mts */:
|
|
118879
|
+
case ".mjs" /* Mjs */:
|
|
118880
|
+
return ".mjs" /* Mjs */;
|
|
118881
|
+
case ".d.cts" /* Dcts */:
|
|
118882
|
+
case ".cts" /* Cts */:
|
|
118883
|
+
case ".cjs" /* Cjs */:
|
|
118884
|
+
return ".cjs" /* Cjs */;
|
|
117901
118885
|
default:
|
|
117902
118886
|
return undefined;
|
|
117903
118887
|
}
|
|
@@ -118172,7 +119156,7 @@ var ts;
|
|
|
118172
119156
|
case ts.FileIncludeKind.LibFile:
|
|
118173
119157
|
if (reason.index !== undefined)
|
|
118174
119158
|
return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Library_0_specified_in_compilerOptions, options.lib[reason.index]);
|
|
118175
|
-
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === options
|
|
119159
|
+
var target = ts.forEachEntry(ts.targetOptionDeclaration.type, function (value, key) { return value === ts.getEmitScriptTarget(options) ? key : undefined; });
|
|
118176
119160
|
return ts.chainDiagnosticMessages(
|
|
118177
119161
|
/*details*/ undefined, target ?
|
|
118178
119162
|
ts.Diagnostics.Default_library_for_target_0 :
|
|
@@ -118595,7 +119579,7 @@ var ts;
|
|
|
118595
119579
|
}
|
|
118596
119580
|
return host.resolveModuleNames.apply(host, args);
|
|
118597
119581
|
}) :
|
|
118598
|
-
(function (moduleNames, containingFile, reusedNames, redirectedReference) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference); });
|
|
119582
|
+
(function (moduleNames, containingFile, reusedNames, redirectedReference, _options, sourceFile) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, sourceFile); });
|
|
118599
119583
|
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
|
|
118600
119584
|
(function () {
|
|
118601
119585
|
var args = [];
|
|
@@ -119323,10 +120307,11 @@ var ts;
|
|
|
119323
120307
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
119324
120308
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
119325
120309
|
if (!compilerHost.resolveModuleNames) {
|
|
119326
|
-
var loader_3 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule; };
|
|
119327
|
-
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference) {
|
|
119328
|
-
return ts.
|
|
120310
|
+
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; };
|
|
120311
|
+
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile) {
|
|
120312
|
+
return ts.loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference, loader_3);
|
|
119329
120313
|
};
|
|
120314
|
+
compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
|
|
119330
120315
|
}
|
|
119331
120316
|
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
119332
120317
|
var loader_4 = function (moduleName, containingFile, redirectedReference) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache).resolvedTypeReferenceDirective; };
|
|
@@ -121015,6 +122000,12 @@ var ts;
|
|
|
121015
122000
|
ScriptElementKindModifier["jsModifier"] = ".js";
|
|
121016
122001
|
ScriptElementKindModifier["jsxModifier"] = ".jsx";
|
|
121017
122002
|
ScriptElementKindModifier["jsonModifier"] = ".json";
|
|
122003
|
+
ScriptElementKindModifier["dmtsModifier"] = ".d.mts";
|
|
122004
|
+
ScriptElementKindModifier["mtsModifier"] = ".mts";
|
|
122005
|
+
ScriptElementKindModifier["mjsModifier"] = ".mjs";
|
|
122006
|
+
ScriptElementKindModifier["dctsModifier"] = ".d.cts";
|
|
122007
|
+
ScriptElementKindModifier["ctsModifier"] = ".cts";
|
|
122008
|
+
ScriptElementKindModifier["cjsModifier"] = ".cjs";
|
|
121018
122009
|
})(ScriptElementKindModifier = ts.ScriptElementKindModifier || (ts.ScriptElementKindModifier = {}));
|
|
121019
122010
|
var ClassificationTypeNames;
|
|
121020
122011
|
(function (ClassificationTypeNames) {
|
|
@@ -122804,7 +123795,7 @@ var ts;
|
|
|
122804
123795
|
}
|
|
122805
123796
|
ts.programContainsEs6Modules = programContainsEs6Modules;
|
|
122806
123797
|
function compilerOptionsIndicateEs6Modules(compilerOptions) {
|
|
122807
|
-
return !!compilerOptions.module || compilerOptions
|
|
123798
|
+
return !!compilerOptions.module || ts.getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */ || !!compilerOptions.noEmit;
|
|
122808
123799
|
}
|
|
122809
123800
|
ts.compilerOptionsIndicateEs6Modules = compilerOptionsIndicateEs6Modules;
|
|
122810
123801
|
function createModuleSpecifierResolutionHost(program, host) {
|
|
@@ -125780,6 +126771,12 @@ var ts;
|
|
|
125780
126771
|
case ".jsx" /* Jsx */: return ".jsx" /* jsxModifier */;
|
|
125781
126772
|
case ".ts" /* Ts */: return ".ts" /* tsModifier */;
|
|
125782
126773
|
case ".tsx" /* Tsx */: return ".tsx" /* tsxModifier */;
|
|
126774
|
+
case ".d.mts" /* Dmts */: return ".d.mts" /* dmtsModifier */;
|
|
126775
|
+
case ".mjs" /* Mjs */: return ".mjs" /* mjsModifier */;
|
|
126776
|
+
case ".mts" /* Mts */: return ".mts" /* mtsModifier */;
|
|
126777
|
+
case ".d.cts" /* Dcts */: return ".d.cts" /* dctsModifier */;
|
|
126778
|
+
case ".cjs" /* Cjs */: return ".cjs" /* cjsModifier */;
|
|
126779
|
+
case ".cts" /* Cts */: return ".cts" /* ctsModifier */;
|
|
125783
126780
|
case ".tsbuildinfo" /* TsBuildInfo */: return ts.Debug.fail("Extension " + ".tsbuildinfo" /* TsBuildInfo */ + " is unsupported.");
|
|
125784
126781
|
case undefined: return "" /* none */;
|
|
125785
126782
|
default:
|
|
@@ -125969,15 +126966,18 @@ var ts;
|
|
|
125969
126966
|
var scriptPath = sourceFile.path;
|
|
125970
126967
|
var scriptDirectory = ts.getDirectoryPath(scriptPath);
|
|
125971
126968
|
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && (ts.isRootedDiskPath(literalValue) || ts.isUrl(literalValue))
|
|
125972
|
-
? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath,
|
|
126969
|
+
? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, getIncludeExtensionOption())
|
|
125973
126970
|
: getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, compilerOptions, host, typeChecker);
|
|
126971
|
+
function getIncludeExtensionOption() {
|
|
126972
|
+
var mode = ts.isStringLiteralLike(node) ? ts.getModeForUsageLocation(sourceFile, node) : undefined;
|
|
126973
|
+
return preferences.importModuleSpecifierEnding === "js" || mode === ts.ModuleKind.ESNext ? 2 /* ModuleSpecifierCompletion */ : 0 /* Exclude */;
|
|
126974
|
+
}
|
|
125974
126975
|
}
|
|
125975
126976
|
function getExtensionOptions(compilerOptions, includeExtensionsOption) {
|
|
125976
126977
|
if (includeExtensionsOption === void 0) { includeExtensionsOption = 0 /* Exclude */; }
|
|
125977
|
-
return { extensions: getSupportedExtensionsForModuleResolution(compilerOptions), includeExtensionsOption: includeExtensionsOption };
|
|
126978
|
+
return { extensions: ts.flatten(getSupportedExtensionsForModuleResolution(compilerOptions)), includeExtensionsOption: includeExtensionsOption };
|
|
125978
126979
|
}
|
|
125979
|
-
function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath,
|
|
125980
|
-
var includeExtensions = preferences.importModuleSpecifierEnding === "js" ? 2 /* ModuleSpecifierCompletion */ : 0 /* Exclude */;
|
|
126980
|
+
function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, includeExtensions) {
|
|
125981
126981
|
var extensionOptions = getExtensionOptions(compilerOptions, includeExtensions);
|
|
125982
126982
|
if (compilerOptions.rootDirs) {
|
|
125983
126983
|
return getCompletionEntriesForDirectoryFragmentWithRootDirs(compilerOptions.rootDirs, literalValue, scriptDirectory, extensionOptions, compilerOptions, host, scriptPath);
|
|
@@ -125988,8 +126988,8 @@ var ts;
|
|
|
125988
126988
|
}
|
|
125989
126989
|
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
125990
126990
|
var extensions = ts.getSupportedExtensions(compilerOptions);
|
|
125991
|
-
return
|
|
125992
|
-
|
|
126991
|
+
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ?
|
|
126992
|
+
ts.getSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, extensions) :
|
|
125993
126993
|
extensions;
|
|
125994
126994
|
}
|
|
125995
126995
|
/**
|
|
@@ -126063,11 +127063,11 @@ var ts;
|
|
|
126063
127063
|
}
|
|
126064
127064
|
var foundFileName = void 0;
|
|
126065
127065
|
var outputExtension = ts.moduleSpecifiers.tryGetJSExtensionForFile(filePath, host.getCompilationSettings());
|
|
126066
|
-
if (includeExtensionsOption === 0 /* Exclude */ && !ts.
|
|
127066
|
+
if (includeExtensionsOption === 0 /* Exclude */ && !ts.fileExtensionIsOneOf(filePath, [".json" /* Json */, ".mts" /* Mts */, ".cts" /* Cts */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".mjs" /* Mjs */, ".cjs" /* Cjs */])) {
|
|
126067
127067
|
foundFileName = ts.removeFileExtension(ts.getBaseFileName(filePath));
|
|
126068
127068
|
foundFiles.set(foundFileName, ts.tryGetExtensionFromPath(filePath));
|
|
126069
127069
|
}
|
|
126070
|
-
else if (includeExtensionsOption === 2 /* ModuleSpecifierCompletion */ && outputExtension) {
|
|
127070
|
+
else if ((ts.fileExtensionIsOneOf(filePath, [".mts" /* Mts */, ".cts" /* Cts */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]) || includeExtensionsOption === 2 /* ModuleSpecifierCompletion */) && outputExtension) {
|
|
126071
127071
|
foundFileName = ts.changeExtension(ts.getBaseFileName(filePath), outputExtension);
|
|
126072
127072
|
foundFiles.set(foundFileName, outputExtension);
|
|
126073
127073
|
}
|
|
@@ -126667,15 +127667,15 @@ var ts;
|
|
|
126667
127667
|
var entries = [];
|
|
126668
127668
|
if (isUncheckedFile(sourceFile, compilerOptions)) {
|
|
126669
127669
|
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
126670
|
-
/* contextToken */ undefined, location, sourceFile, typeChecker, compilerOptions
|
|
126671
|
-
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions
|
|
127670
|
+
/* contextToken */ undefined, location, sourceFile, typeChecker, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
|
|
127671
|
+
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries); // TODO: GH#18217
|
|
126672
127672
|
}
|
|
126673
127673
|
else {
|
|
126674
127674
|
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
|
|
126675
127675
|
return undefined;
|
|
126676
127676
|
}
|
|
126677
127677
|
getCompletionEntriesFromSymbols(symbols, entries,
|
|
126678
|
-
/* contextToken */ undefined, location, sourceFile, typeChecker, compilerOptions
|
|
127678
|
+
/* contextToken */ undefined, location, sourceFile, typeChecker, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
|
|
126679
127679
|
}
|
|
126680
127680
|
if (keywordFilters !== 0 /* None */) {
|
|
126681
127681
|
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
@@ -126781,7 +127781,7 @@ var ts;
|
|
|
126781
127781
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
126782
127782
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
126783
127783
|
}
|
|
126784
|
-
function createCompletionEntry(symbol, sortText, contextToken, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences) {
|
|
127784
|
+
function createCompletionEntry(symbol, sortText, contextToken, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, isTypeOnlyImport, useSemicolons, options, preferences) {
|
|
126785
127785
|
var _a;
|
|
126786
127786
|
var insertText;
|
|
126787
127787
|
var replacementSpan = ts.getReplacementSpanForContextToken(contextToken);
|
|
@@ -126835,7 +127835,7 @@ var ts;
|
|
|
126835
127835
|
if (originIsResolvedExport(origin)) {
|
|
126836
127836
|
sourceDisplay = [ts.textPart(origin.moduleSpecifier)];
|
|
126837
127837
|
if (importCompletionNode) {
|
|
126838
|
-
(_a = getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, origin, useSemicolons, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan);
|
|
127838
|
+
(_a = getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, isTypeOnlyImport, origin, useSemicolons, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan);
|
|
126839
127839
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
|
|
126840
127840
|
}
|
|
126841
127841
|
}
|
|
@@ -126908,7 +127908,7 @@ var ts;
|
|
|
126908
127908
|
moduleSpecifier: originIsResolvedExport(origin) ? origin.moduleSpecifier : undefined,
|
|
126909
127909
|
};
|
|
126910
127910
|
}
|
|
126911
|
-
function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, origin, useSemicolons, options, preferences) {
|
|
127911
|
+
function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, isTypeOnly, origin, useSemicolons, options, preferences) {
|
|
126912
127912
|
var sourceFile = importCompletionNode.getSourceFile();
|
|
126913
127913
|
var replacementSpan = ts.createTextSpanFromNode(importCompletionNode, sourceFile);
|
|
126914
127914
|
var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier);
|
|
@@ -126917,12 +127917,13 @@ var ts;
|
|
|
126917
127917
|
0 /* Named */;
|
|
126918
127918
|
var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
|
|
126919
127919
|
var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true);
|
|
127920
|
+
var typeOnlyPrefix = isTypeOnly ? " " + ts.tokenToString(151 /* TypeKeyword */) + " " : " ";
|
|
126920
127921
|
var suffix = useSemicolons ? ";" : "";
|
|
126921
127922
|
switch (importKind) {
|
|
126922
|
-
case 3 /* CommonJS */: return { replacementSpan: replacementSpan, insertText: "import
|
|
126923
|
-
case 1 /* Default */: return { replacementSpan: replacementSpan, insertText: "import
|
|
126924
|
-
case 2 /* Namespace */: return { replacementSpan: replacementSpan, insertText: "import * as " + escapeSnippetText(name) + " from " + quotedModuleSpecifier + suffix };
|
|
126925
|
-
case 0 /* Named */: return { replacementSpan: replacementSpan, insertText: "import { " + escapeSnippetText(name) + tabStop + " } from " + quotedModuleSpecifier + suffix };
|
|
127923
|
+
case 3 /* CommonJS */: return { replacementSpan: replacementSpan, insertText: "import" + typeOnlyPrefix + escapeSnippetText(name) + tabStop + " = require(" + quotedModuleSpecifier + ")" + suffix };
|
|
127924
|
+
case 1 /* Default */: return { replacementSpan: replacementSpan, insertText: "import" + typeOnlyPrefix + escapeSnippetText(name) + tabStop + " from " + quotedModuleSpecifier + suffix };
|
|
127925
|
+
case 2 /* Namespace */: return { replacementSpan: replacementSpan, insertText: "import" + typeOnlyPrefix + "* as " + escapeSnippetText(name) + " from " + quotedModuleSpecifier + suffix };
|
|
127926
|
+
case 0 /* Named */: return { replacementSpan: replacementSpan, insertText: "import" + typeOnlyPrefix + "{ " + escapeSnippetText(name) + tabStop + " } from " + quotedModuleSpecifier + suffix };
|
|
126926
127927
|
}
|
|
126927
127928
|
}
|
|
126928
127929
|
function quotePropertyName(sourceFile, preferences, name) {
|
|
@@ -126951,6 +127952,7 @@ var ts;
|
|
|
126951
127952
|
var start = ts.timestamp();
|
|
126952
127953
|
var variableDeclaration = getVariableDeclaration(location);
|
|
126953
127954
|
var useSemicolons = ts.probablyUsesSemicolons(sourceFile);
|
|
127955
|
+
var isTypeOnlyImport = !!importCompletionNode && ts.isTypeOnlyImportOrExportDeclaration(location.parent);
|
|
126954
127956
|
// Tracks unique names.
|
|
126955
127957
|
// Value is set to false for global variables or completions from external module exports, because we can have multiple of those;
|
|
126956
127958
|
// true otherwise. Based on the order we add things we will always see locals first, then globals, then module exports.
|
|
@@ -126966,7 +127968,7 @@ var ts;
|
|
|
126966
127968
|
var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
|
|
126967
127969
|
var sortTextId = (_a = symbolToSortTextIdMap === null || symbolToSortTextIdMap === void 0 ? void 0 : symbolToSortTextIdMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : 11 /* LocationPriority */;
|
|
126968
127970
|
var sortText = (isDeprecated(symbol, typeChecker) ? 8 /* DeprecatedOffset */ + sortTextId : sortTextId).toString();
|
|
126969
|
-
var entry = createCompletionEntry(symbol, sortText, contextToken, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences);
|
|
127971
|
+
var entry = createCompletionEntry(symbol, sortText, contextToken, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, isTypeOnlyImport, useSemicolons, compilerOptions, preferences);
|
|
126970
127972
|
if (!entry) {
|
|
126971
127973
|
continue;
|
|
126972
127974
|
}
|
|
@@ -127088,7 +128090,7 @@ var ts;
|
|
|
127088
128090
|
// completion entry.
|
|
127089
128091
|
return ts.firstDefined(symbols, function (symbol, index) {
|
|
127090
128092
|
var origin = symbolToOriginInfoMap[index];
|
|
127091
|
-
var info = getCompletionEntryDisplayNameForSymbol(symbol, compilerOptions
|
|
128093
|
+
var info = getCompletionEntryDisplayNameForSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
127092
128094
|
return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source
|
|
127093
128095
|
? { type: "symbol", symbol: symbol, location: location, origin: origin, previousToken: previousToken, isJsxInitializer: isJsxInitializer, isTypeOnlyLocation: isTypeOnlyLocation }
|
|
127094
128096
|
: undefined;
|
|
@@ -127165,7 +128167,7 @@ var ts;
|
|
|
127165
128167
|
var checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker();
|
|
127166
128168
|
var moduleSymbol = origin.moduleSymbol;
|
|
127167
128169
|
var exportedSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker));
|
|
127168
|
-
var _b = ts.codefix.getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, compilerOptions
|
|
128170
|
+
var _b = ts.codefix.getImportCompletionAction(exportedSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions)), host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _b.moduleSpecifier, codeAction = _b.codeAction;
|
|
127169
128171
|
ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier);
|
|
127170
128172
|
return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] };
|
|
127171
128173
|
}
|
|
@@ -127867,6 +128869,7 @@ var ts;
|
|
|
127867
128869
|
}
|
|
127868
128870
|
function isTypeOnlyCompletion() {
|
|
127869
128871
|
return insideJsDocTagTypeExpression
|
|
128872
|
+
|| !!importCompletionNode && ts.isTypeOnlyImportOrExportDeclaration(location.parent)
|
|
127870
128873
|
|| !isContextTokenValueLocation(contextToken) &&
|
|
127871
128874
|
(ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)
|
|
127872
128875
|
|| ts.isPartOfTypeNode(location)
|
|
@@ -129718,7 +130721,7 @@ var ts;
|
|
|
129718
130721
|
}
|
|
129719
130722
|
function acquireOrUpdateDocument(fileName, path, compilationSettings, key, scriptSnapshot, version, acquiring, scriptKind) {
|
|
129720
130723
|
scriptKind = ts.ensureScriptKind(fileName, scriptKind);
|
|
129721
|
-
var scriptTarget = scriptKind === 6 /* JSON */ ? 100 /* JSON */ : compilationSettings
|
|
130724
|
+
var scriptTarget = scriptKind === 6 /* JSON */ ? 100 /* JSON */ : ts.getEmitScriptTarget(compilationSettings);
|
|
129722
130725
|
var bucket = ts.getOrUpdate(buckets, key, function () { return new ts.Map(); });
|
|
129723
130726
|
var bucketEntry = bucket.get(path);
|
|
129724
130727
|
var entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind);
|
|
@@ -130997,7 +132000,7 @@ var ts;
|
|
|
130997
132000
|
if (!options.implementations && ts.isStringLiteralLike(node)) {
|
|
130998
132001
|
if (ts.isModuleSpecifierLike(node)) {
|
|
130999
132002
|
var fileIncludeReasons = program.getFileIncludeReasons();
|
|
131000
|
-
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;
|
|
132003
|
+
var referencedFileName = (_b = (_a = node.getSourceFile().resolvedModules) === null || _a === void 0 ? void 0 : _a.get(node.text, ts.getModeForUsageLocation(node.getSourceFile(), node))) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
|
|
131001
132004
|
var referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : undefined;
|
|
131002
132005
|
if (referencedFile) {
|
|
131003
132006
|
return [{ definition: { type: 4 /* String */, node: node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || ts.emptyArray }];
|
|
@@ -133155,9 +134158,10 @@ var ts;
|
|
|
133155
134158
|
return newFileName === undefined ? { newFileName: oldFileName, updated: false } : { newFileName: newFileName, updated: true };
|
|
133156
134159
|
}
|
|
133157
134160
|
else {
|
|
134161
|
+
var mode = ts.getModeForUsageLocation(importingSourceFile, importLiteral);
|
|
133158
134162
|
var resolved = host.resolveModuleNames
|
|
133159
|
-
? host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName)
|
|
133160
|
-
: program.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName);
|
|
134163
|
+
? host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode)
|
|
134164
|
+
: program.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
|
|
133161
134165
|
return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
|
|
133162
134166
|
}
|
|
133163
134167
|
}
|
|
@@ -133382,10 +134386,10 @@ var ts;
|
|
|
133382
134386
|
var file = program.getLibFileFromReference(libReferenceDirective);
|
|
133383
134387
|
return file && { reference: libReferenceDirective, fileName: file.fileName, file: file, unverified: false };
|
|
133384
134388
|
}
|
|
133385
|
-
if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size) {
|
|
134389
|
+
if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size()) {
|
|
133386
134390
|
var node = ts.getTokenAtPosition(sourceFile, position);
|
|
133387
|
-
if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text)) {
|
|
133388
|
-
var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text)) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
|
|
134391
|
+
if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, ts.getModeForUsageLocation(sourceFile, node))) {
|
|
134392
|
+
var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text, ts.getModeForUsageLocation(sourceFile, node))) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
|
|
133389
134393
|
var fileName = verifiedFileName || ts.resolvePath(ts.getDirectoryPath(sourceFile.fileName), node.text);
|
|
133390
134394
|
return {
|
|
133391
134395
|
file: program.getSourceFile(fileName),
|
|
@@ -138094,7 +139098,7 @@ var ts;
|
|
|
138094
139098
|
var name = importNameForConvertToDefaultImport(importNode);
|
|
138095
139099
|
if (!name)
|
|
138096
139100
|
continue;
|
|
138097
|
-
var module_1 = ts.getResolvedModule(sourceFile, moduleSpecifier.text);
|
|
139101
|
+
var module_1 = ts.getResolvedModule(sourceFile, moduleSpecifier.text, ts.getModeForUsageLocation(sourceFile, moduleSpecifier));
|
|
138098
139102
|
var resolvedFile = module_1 && program.getSourceFile(module_1.resolvedFileName);
|
|
138099
139103
|
if (resolvedFile && resolvedFile.externalModuleIndicator && ts.isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
|
|
138100
139104
|
diags.push(ts.createDiagnosticForNode(name, ts.Diagnostics.Import_may_be_converted_to_a_default_import));
|
|
@@ -138994,7 +139998,7 @@ var ts;
|
|
|
138994
139998
|
options.allowNonTsExtensions = true;
|
|
138995
139999
|
// if jsx is specified then treat file as .tsx
|
|
138996
140000
|
var inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts");
|
|
138997
|
-
var sourceFile = ts.createSourceFile(inputFileName, input, options
|
|
140001
|
+
var sourceFile = ts.createSourceFile(inputFileName, input, ts.getEmitScriptTarget(options));
|
|
138998
140002
|
if (transpileOptions.moduleName) {
|
|
138999
140003
|
sourceFile.moduleName = transpileOptions.moduleName;
|
|
139000
140004
|
}
|
|
@@ -144581,7 +145585,7 @@ var ts;
|
|
|
144581
145585
|
return propName;
|
|
144582
145586
|
}
|
|
144583
145587
|
if (ts.isStringLiteralLike(propName)) {
|
|
144584
|
-
return ts.isIdentifierText(propName.text, compilerOptions
|
|
145588
|
+
return ts.isIdentifierText(propName.text, ts.getEmitScriptTarget(compilerOptions)) ? ts.factory.createIdentifier(propName.text)
|
|
144585
145589
|
: ts.isNoSubstitutionTemplateLiteral(propName) ? ts.factory.createStringLiteral(propName.text, quotePreference === 0 /* Single */)
|
|
144586
145590
|
: propName;
|
|
144587
145591
|
}
|
|
@@ -145329,7 +146333,7 @@ var ts;
|
|
|
145329
146333
|
getCodeActions: function (context) {
|
|
145330
146334
|
var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences;
|
|
145331
146335
|
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) {
|
|
145332
|
-
var moduleExportsChangedToDefault = convertFileToEs6Module(sourceFile, program.getTypeChecker(), changes, program.getCompilerOptions()
|
|
146336
|
+
var moduleExportsChangedToDefault = convertFileToEs6Module(sourceFile, program.getTypeChecker(), changes, ts.getEmitScriptTarget(program.getCompilerOptions()), ts.getQuotePreference(sourceFile, preferences));
|
|
145333
146337
|
if (moduleExportsChangedToDefault) {
|
|
145334
146338
|
for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) {
|
|
145335
146339
|
var importingFile = _a[_i];
|
|
@@ -145344,7 +146348,7 @@ var ts;
|
|
|
145344
146348
|
function fixImportOfModuleExports(importingFile, exportingFile, changes, quotePreference) {
|
|
145345
146349
|
for (var _i = 0, _a = importingFile.imports; _i < _a.length; _i++) {
|
|
145346
146350
|
var moduleSpecifier = _a[_i];
|
|
145347
|
-
var imported = ts.getResolvedModule(importingFile, moduleSpecifier.text);
|
|
146351
|
+
var imported = ts.getResolvedModule(importingFile, moduleSpecifier.text, ts.getModeForUsageLocation(importingFile, moduleSpecifier));
|
|
145348
146352
|
if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
|
|
145349
146353
|
continue;
|
|
145350
146354
|
}
|
|
@@ -146298,7 +147302,7 @@ var ts;
|
|
|
146298
147302
|
return;
|
|
146299
147303
|
}
|
|
146300
147304
|
var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
|
|
146301
|
-
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions
|
|
147305
|
+
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) {
|
|
146302
147306
|
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 });
|
|
146303
147307
|
}
|
|
146304
147308
|
for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) {
|
|
@@ -146593,6 +147597,9 @@ var ts;
|
|
|
146593
147597
|
case ts.ModuleKind.None:
|
|
146594
147598
|
// Fall back to the `import * as ns` style import.
|
|
146595
147599
|
return 2 /* Namespace */;
|
|
147600
|
+
case ts.ModuleKind.Node12:
|
|
147601
|
+
case ts.ModuleKind.NodeNext:
|
|
147602
|
+
return importingFile.impliedNodeFormat === ts.ModuleKind.ESNext ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
146596
147603
|
default:
|
|
146597
147604
|
return ts.Debug.assertNever(moduleKind, "Unexpected moduleKind " + moduleKind);
|
|
146598
147605
|
}
|
|
@@ -146647,7 +147654,7 @@ var ts;
|
|
|
146647
147654
|
cancellationToken.throwIfCancellationRequested();
|
|
146648
147655
|
var compilerOptions = program.getCompilerOptions();
|
|
146649
147656
|
var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
|
|
146650
|
-
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions
|
|
147657
|
+
if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions)) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) {
|
|
146651
147658
|
addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program, isFromPackageJson);
|
|
146652
147659
|
}
|
|
146653
147660
|
// check exports with the same name
|
|
@@ -147169,14 +148176,14 @@ var ts;
|
|
|
147169
148176
|
if (!info)
|
|
147170
148177
|
return undefined;
|
|
147171
148178
|
var node = info.node, suggestedSymbol = info.suggestedSymbol;
|
|
147172
|
-
var target = context.host.getCompilationSettings()
|
|
148179
|
+
var target = ts.getEmitScriptTarget(context.host.getCompilationSettings());
|
|
147173
148180
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, node, suggestedSymbol, target); });
|
|
147174
148181
|
return [codefix.createCodeFixAction("spelling", changes, [ts.Diagnostics.Change_spelling_to_0, ts.symbolName(suggestedSymbol)], fixId, ts.Diagnostics.Fix_all_detected_spelling_errors)];
|
|
147175
148182
|
},
|
|
147176
148183
|
fixIds: [fixId],
|
|
147177
148184
|
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
147178
148185
|
var info = getInfo(diag.file, diag.start, context, diag.code);
|
|
147179
|
-
var target = context.host.getCompilationSettings()
|
|
148186
|
+
var target = ts.getEmitScriptTarget(context.host.getCompilationSettings());
|
|
147180
148187
|
if (info)
|
|
147181
148188
|
doChange(changes, context.sourceFile, info.node, info.suggestedSymbol, target);
|
|
147182
148189
|
}); },
|
|
@@ -147202,6 +148209,10 @@ var ts;
|
|
|
147202
148209
|
}
|
|
147203
148210
|
suggestedSymbol = checker.getSuggestedSymbolForNonexistentProperty(node, containingType);
|
|
147204
148211
|
}
|
|
148212
|
+
else if (ts.isBinaryExpression(parent) && parent.operatorToken.kind === 101 /* InKeyword */ && parent.left === node && ts.isPrivateIdentifier(node)) {
|
|
148213
|
+
var receiverType = checker.getTypeAtLocation(parent.right);
|
|
148214
|
+
suggestedSymbol = checker.getSuggestedSymbolForNonexistentProperty(node, receiverType);
|
|
148215
|
+
}
|
|
147205
148216
|
else if (ts.isQualifiedName(parent) && parent.right === node) {
|
|
147206
148217
|
var symbol = checker.getSymbolAtLocation(parent.left);
|
|
147207
148218
|
if (symbol && symbol.flags & 1536 /* Module */) {
|
|
@@ -147269,7 +148280,7 @@ var ts;
|
|
|
147269
148280
|
function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) {
|
|
147270
148281
|
if (!importDeclaration || !ts.isStringLiteralLike(importDeclaration.moduleSpecifier))
|
|
147271
148282
|
return undefined;
|
|
147272
|
-
var resolvedModule = ts.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text);
|
|
148283
|
+
var resolvedModule = ts.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text, ts.getModeForUsageLocation(sourceFile, importDeclaration.moduleSpecifier));
|
|
147273
148284
|
if (!resolvedModule)
|
|
147274
148285
|
return undefined;
|
|
147275
148286
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -148316,8 +149327,8 @@ var ts;
|
|
|
148316
149327
|
(function (codefix) {
|
|
148317
149328
|
codefix.registerCodeFix({
|
|
148318
149329
|
errorCodes: [
|
|
148319
|
-
ts.Diagnostics.
|
|
148320
|
-
ts.Diagnostics.
|
|
149330
|
+
ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
149331
|
+
ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
148321
149332
|
],
|
|
148322
149333
|
getCodeActions: function (context) {
|
|
148323
149334
|
var compilerOptions = context.program.getCompilerOptions();
|
|
@@ -148446,7 +149457,7 @@ var ts;
|
|
|
148446
149457
|
var didYouMeanStaticMemberCode = ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code;
|
|
148447
149458
|
var errorCodes = [
|
|
148448
149459
|
ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
148449
|
-
ts.Diagnostics.
|
|
149460
|
+
ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code,
|
|
148450
149461
|
didYouMeanStaticMemberCode,
|
|
148451
149462
|
];
|
|
148452
149463
|
codefix.registerCodeFix({
|
|
@@ -148469,7 +149480,7 @@ var ts;
|
|
|
148469
149480
|
});
|
|
148470
149481
|
function getInfo(sourceFile, pos, diagCode) {
|
|
148471
149482
|
var node = ts.getTokenAtPosition(sourceFile, pos);
|
|
148472
|
-
if (ts.isIdentifier(node)) {
|
|
149483
|
+
if (ts.isIdentifier(node) || ts.isPrivateIdentifier(node)) {
|
|
148473
149484
|
return { node: node, className: diagCode === didYouMeanStaticMemberCode ? ts.getContainingClass(node).name.text : undefined };
|
|
148474
149485
|
}
|
|
148475
149486
|
}
|
|
@@ -160931,7 +161942,6 @@ var ts;
|
|
|
160931
161942
|
ts.WatchType.MissingSourceMapFile = "Missing source map file";
|
|
160932
161943
|
ts.WatchType.NoopConfigFileForInferredRoot = "Noop Config file for the inferred project root";
|
|
160933
161944
|
ts.WatchType.MissingGeneratedFile = "Missing generated file";
|
|
160934
|
-
ts.WatchType.PackageJsonFile = "package.json file for import suggestions";
|
|
160935
161945
|
})(ts || (ts = {}));
|
|
160936
161946
|
/* eslint-disable @typescript-eslint/no-unnecessary-qualifier */
|
|
160937
161947
|
/**
|
|
@@ -162199,11 +163209,11 @@ var ts;
|
|
|
162199
163209
|
var path = this.toPath(file);
|
|
162200
163210
|
return !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file);
|
|
162201
163211
|
};
|
|
162202
|
-
Project.prototype.resolveModuleNames = function (moduleNames, containingFile, reusedNames, redirectedReference) {
|
|
162203
|
-
return this.resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference);
|
|
163212
|
+
Project.prototype.resolveModuleNames = function (moduleNames, containingFile, reusedNames, redirectedReference, _options, containingSourceFile) {
|
|
163213
|
+
return this.resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile);
|
|
162204
163214
|
};
|
|
162205
|
-
Project.prototype.getResolvedModuleWithFailedLookupLocationsFromCache = function (moduleName, containingFile) {
|
|
162206
|
-
return this.resolutionCache.getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile);
|
|
163215
|
+
Project.prototype.getResolvedModuleWithFailedLookupLocationsFromCache = function (moduleName, containingFile, resolutionMode) {
|
|
163216
|
+
return this.resolutionCache.getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode);
|
|
162207
163217
|
};
|
|
162208
163218
|
Project.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile, redirectedReference) {
|
|
162209
163219
|
return this.resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference);
|
|
@@ -167223,7 +168233,7 @@ var ts;
|
|
|
167223
168233
|
watchers.get(path).close();
|
|
167224
168234
|
watchers.delete(path);
|
|
167225
168235
|
}
|
|
167226
|
-
}, ts.PollingInterval.Low, this.hostConfiguration.watchOptions, ts.WatchType.
|
|
168236
|
+
}, ts.PollingInterval.Low, this.hostConfiguration.watchOptions, ts.WatchType.PackageJson));
|
|
167227
168237
|
}
|
|
167228
168238
|
};
|
|
167229
168239
|
/*@internal*/
|