@typescript-deploys/pr-build 5.4.0-pr-57008-39 → 5.4.0-pr-57029-27
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/cancellationToken.js +0 -1
- package/lib/lib.es5.d.ts +1 -0
- package/lib/tsc.js +242 -178
- package/lib/tsserver.js +743 -449
- package/lib/typescript.d.ts +52 -11
- package/lib/typescript.js +786 -482
- package/lib/typingsInstaller.js +77 -37
- package/package.json +28 -28
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.4";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240122`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3567,7 +3567,7 @@ var SymbolFlags = /* @__PURE__ */ ((SymbolFlags2) => {
|
|
|
3567
3567
|
SymbolFlags2[SymbolFlags2["Transient"] = 33554432] = "Transient";
|
|
3568
3568
|
SymbolFlags2[SymbolFlags2["Assignment"] = 67108864] = "Assignment";
|
|
3569
3569
|
SymbolFlags2[SymbolFlags2["ModuleExports"] = 134217728] = "ModuleExports";
|
|
3570
|
-
SymbolFlags2[SymbolFlags2["All"] =
|
|
3570
|
+
SymbolFlags2[SymbolFlags2["All"] = -1] = "All";
|
|
3571
3571
|
SymbolFlags2[SymbolFlags2["Enum"] = 384] = "Enum";
|
|
3572
3572
|
SymbolFlags2[SymbolFlags2["Variable"] = 3] = "Variable";
|
|
3573
3573
|
SymbolFlags2[SymbolFlags2["Value"] = 111551] = "Value";
|
|
@@ -3768,6 +3768,7 @@ var ModuleKind = /* @__PURE__ */ ((ModuleKind2) => {
|
|
|
3768
3768
|
ModuleKind2[ModuleKind2["ESNext"] = 99] = "ESNext";
|
|
3769
3769
|
ModuleKind2[ModuleKind2["Node16"] = 100] = "Node16";
|
|
3770
3770
|
ModuleKind2[ModuleKind2["NodeNext"] = 199] = "NodeNext";
|
|
3771
|
+
ModuleKind2[ModuleKind2["Preserve"] = 200] = "Preserve";
|
|
3771
3772
|
return ModuleKind2;
|
|
3772
3773
|
})(ModuleKind || {});
|
|
3773
3774
|
var ScriptKind = /* @__PURE__ */ ((ScriptKind3) => {
|
|
@@ -6006,7 +6007,7 @@ var Diagnostics = {
|
|
|
6006
6007
|
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, 1 /* 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."),
|
|
6007
6008
|
_0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
6008
6009
|
_0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
6009
|
-
|
|
6010
|
+
Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, 1 /* Error */, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
|
|
6010
6011
|
An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, 1 /* 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'."),
|
|
6011
6012
|
An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, 1 /* 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'."),
|
|
6012
6013
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, 1 /* Error */, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
@@ -6057,7 +6058,7 @@ var Diagnostics = {
|
|
|
6057
6058
|
File_redirects_to_file_0: diag(1429, 3 /* Message */, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
6058
6059
|
The_file_is_in_the_program_because_Colon: diag(1430, 3 /* Message */, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
|
|
6059
6060
|
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, 1 /* 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."),
|
|
6060
|
-
|
|
6061
|
+
Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, 1 /* Error */, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
|
|
6061
6062
|
Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters: diag(1433, 1 /* Error */, "Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters_1433", "Neither decorators nor modifiers may be applied to 'this' parameters."),
|
|
6062
6063
|
Unexpected_keyword_or_identifier: diag(1434, 1 /* Error */, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
6063
6064
|
Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, 1 /* Error */, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
|
|
@@ -6640,9 +6641,9 @@ var Diagnostics = {
|
|
|
6640
6641
|
Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers: diag(2818, 1 /* Error */, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),
|
|
6641
6642
|
Namespace_name_cannot_be_0: diag(2819, 1 /* Error */, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
|
|
6642
6643
|
Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, 1 /* Error */, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
|
|
6643
|
-
|
|
6644
|
+
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve: diag(2821, 1 /* Error */, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve_2821", "Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'."),
|
|
6644
6645
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, 1 /* Error */, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
6645
|
-
|
|
6646
|
+
Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve: diag(2823, 1 /* Error */, "Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve_2823", "Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'."),
|
|
6646
6647
|
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, 1 /* Error */, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
6647
6648
|
Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."),
|
|
6648
6649
|
Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),
|
|
@@ -6662,7 +6663,7 @@ var Diagnostics = {
|
|
|
6662
6663
|
The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined: diag(2851, 1 /* Error */, "The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_2851", "The initializer of an 'await using' declaration must be either an object with a '[Symbol.asyncDispose]()' or '[Symbol.dispose]()' method, or be 'null' or 'undefined'."),
|
|
6663
6664
|
await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(2852, 1 /* Error */, "await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_2852", "'await using' statements are only allowed within async functions and at the top levels of modules."),
|
|
6664
6665
|
await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(2853, 1 /* Error */, "await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853", "'await using' statements are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
6665
|
-
|
|
6666
|
+
Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
|
|
6666
6667
|
Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super: diag(2855, 1 /* Error */, "Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855", "Class field '{0}' defined by the parent class is not accessible in the child class via super."),
|
|
6667
6668
|
Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls: diag(2856, 1 /* Error */, "Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls_2856", "Import attributes are not allowed on statements that compile to CommonJS 'require' calls."),
|
|
6668
6669
|
Import_attributes_cannot_be_used_with_type_only_imports_or_exports: diag(2857, 1 /* Error */, "Import_attributes_cannot_be_used_with_type_only_imports_or_exports_2857", "Import attributes cannot be used with type-only imports or exports."),
|
|
@@ -6818,7 +6819,7 @@ var Diagnostics = {
|
|
|
6818
6819
|
Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: diag(5068, 1 /* Error */, "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068", "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig."),
|
|
6819
6820
|
Option_0_cannot_be_specified_without_specifying_option_1_or_option_2: diag(5069, 1 /* Error */, "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069", "Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'."),
|
|
6820
6821
|
Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic: diag(5070, 1 /* Error */, "Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic_5070", "Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'."),
|
|
6821
|
-
|
|
6822
|
+
Option_resolveJsonModule_cannot_be_specified_when_module_is_set_to_none_system_or_umd: diag(5071, 1 /* Error */, "Option_resolveJsonModule_cannot_be_specified_when_module_is_set_to_none_system_or_umd_5071", "Option '--resolveJsonModule' cannot be specified when 'module' is set to 'none', 'system', or 'umd'."),
|
|
6822
6823
|
Unknown_build_option_0: diag(5072, 1 /* Error */, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
|
|
6823
6824
|
Build_option_0_requires_a_value_of_type_1: diag(5073, 1 /* Error */, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."),
|
|
6824
6825
|
Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified: diag(5074, 1 /* Error */, "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option '--tsBuildInfoFile' is specified."),
|
|
@@ -6841,7 +6842,7 @@ var Diagnostics = {
|
|
|
6841
6842
|
The_root_value_of_a_0_file_must_be_an_object: diag(5092, 1 /* Error */, "The_root_value_of_a_0_file_must_be_an_object_5092", "The root value of a '{0}' file must be an object."),
|
|
6842
6843
|
Compiler_option_0_may_only_be_used_with_build: diag(5093, 1 /* Error */, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."),
|
|
6843
6844
|
Compiler_option_0_may_not_be_used_with_build: diag(5094, 1 /* Error */, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."),
|
|
6844
|
-
|
|
6845
|
+
Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later."),
|
|
6845
6846
|
Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."),
|
|
6846
6847
|
An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),
|
|
6847
6848
|
Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
|
|
@@ -7144,6 +7145,9 @@ var Diagnostics = {
|
|
|
7144
7145
|
There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings: diag(6278, 3 /* Message */, "There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The__6278", `There are types at '{0}', but this result could not be resolved when respecting package.json "exports". The '{1}' library may need to update its package.json or typings.`),
|
|
7145
7146
|
Resolution_of_non_relative_name_failed_trying_with_moduleResolution_bundler_to_see_if_project_may_need_configuration_update: diag(6279, 3 /* Message */, "Resolution_of_non_relative_name_failed_trying_with_moduleResolution_bundler_to_see_if_project_may_ne_6279", "Resolution of non-relative name failed; trying with '--moduleResolution bundler' to see if project may need configuration update."),
|
|
7146
7147
|
There_are_types_at_0_but_this_result_could_not_be_resolved_under_your_current_moduleResolution_setting_Consider_updating_to_node16_nodenext_or_bundler: diag(6280, 3 /* Message */, "There_are_types_at_0_but_this_result_could_not_be_resolved_under_your_current_moduleResolution_setti_6280", "There are types at '{0}', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'."),
|
|
7148
|
+
package_json_has_a_peerDependencies_field: diag(6281, 3 /* Message */, "package_json_has_a_peerDependencies_field_6281", "'package.json' has a 'peerDependencies' field."),
|
|
7149
|
+
Found_peerDependency_0_with_1_version: diag(6282, 3 /* Message */, "Found_peerDependency_0_with_1_version_6282", "Found peerDependency '{0}' with '{1}' version."),
|
|
7150
|
+
Failed_to_find_peerDependency_0: diag(6283, 3 /* Message */, "Failed_to_find_peerDependency_0_6283", "Failed to find peerDependency '{0}'."),
|
|
7147
7151
|
Enable_project_compilation: diag(6302, 3 /* Message */, "Enable_project_compilation_6302", "Enable project compilation"),
|
|
7148
7152
|
Composite_projects_may_not_disable_declaration_emit: diag(6304, 1 /* Error */, "Composite_projects_may_not_disable_declaration_emit_6304", "Composite projects may not disable declaration emit."),
|
|
7149
7153
|
Output_file_0_has_not_been_built_from_source_file_1: diag(6305, 1 /* Error */, "Output_file_0_has_not_been_built_from_source_file_1_6305", "Output file '{0}' has not been built from source file '{1}'."),
|
|
@@ -7761,6 +7765,12 @@ var Diagnostics = {
|
|
|
7761
7765
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
7762
7766
|
Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
|
|
7763
7767
|
Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
|
|
7768
|
+
Add_missing_parameter_to_0: diag(95188, 3 /* Message */, "Add_missing_parameter_to_0_95188", "Add missing parameter to '{0}'"),
|
|
7769
|
+
Add_missing_parameters_to_0: diag(95189, 3 /* Message */, "Add_missing_parameters_to_0_95189", "Add missing parameters to '{0}'"),
|
|
7770
|
+
Add_all_missing_parameters: diag(95190, 3 /* Message */, "Add_all_missing_parameters_95190", "Add all missing parameters"),
|
|
7771
|
+
Add_optional_parameter_to_0: diag(95191, 3 /* Message */, "Add_optional_parameter_to_0_95191", "Add optional parameter to '{0}'"),
|
|
7772
|
+
Add_optional_parameters_to_0: diag(95192, 3 /* Message */, "Add_optional_parameters_to_0_95192", "Add optional parameters to '{0}'"),
|
|
7773
|
+
Add_all_optional_parameters: diag(95193, 3 /* Message */, "Add_all_optional_parameters_95193", "Add all optional parameters"),
|
|
7764
7774
|
No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
|
|
7765
7775
|
Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
|
|
7766
7776
|
JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
|
|
@@ -11572,25 +11582,23 @@ function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, pack
|
|
|
11572
11582
|
return result;
|
|
11573
11583
|
}
|
|
11574
11584
|
function packageIdIsEqual(a, b) {
|
|
11575
|
-
return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
|
|
11585
|
+
return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version && a.peerDependencies === b.peerDependencies;
|
|
11576
11586
|
}
|
|
11577
11587
|
function packageIdToPackageName({ name, subModuleName }) {
|
|
11578
11588
|
return subModuleName ? `${name}/${subModuleName}` : name;
|
|
11579
11589
|
}
|
|
11580
11590
|
function packageIdToString(packageId) {
|
|
11581
|
-
return `${packageIdToPackageName(packageId)}@${packageId.version}`;
|
|
11591
|
+
return `${packageIdToPackageName(packageId)}@${packageId.version}${packageId.peerDependencies ?? ""}`;
|
|
11582
11592
|
}
|
|
11583
11593
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
11584
11594
|
return oldResolution === newResolution || oldResolution.resolvedTypeReferenceDirective === newResolution.resolvedTypeReferenceDirective || !!oldResolution.resolvedTypeReferenceDirective && !!newResolution.resolvedTypeReferenceDirective && oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName && !!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary && oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
|
|
11585
11595
|
}
|
|
11586
|
-
function hasChangesInResolutions(names,
|
|
11596
|
+
function hasChangesInResolutions(names, newResolutions, getOldResolution, comparer) {
|
|
11587
11597
|
Debug.assert(names.length === newResolutions.length);
|
|
11588
11598
|
for (let i = 0; i < names.length; i++) {
|
|
11589
11599
|
const newResolution = newResolutions[i];
|
|
11590
11600
|
const entry = names[i];
|
|
11591
|
-
const
|
|
11592
|
-
const mode = nameAndModeGetter.getMode(entry, newSourceFile);
|
|
11593
|
-
const oldResolution = getOldResolution(name, mode);
|
|
11601
|
+
const oldResolution = getOldResolution(entry);
|
|
11594
11602
|
const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
|
|
11595
11603
|
if (changed) {
|
|
11596
11604
|
return true;
|
|
@@ -16443,6 +16451,9 @@ var computedOptions = createComputedCompilerOptions({
|
|
|
16443
16451
|
case 199 /* NodeNext */:
|
|
16444
16452
|
moduleResolution = 99 /* NodeNext */;
|
|
16445
16453
|
break;
|
|
16454
|
+
case 200 /* Preserve */:
|
|
16455
|
+
moduleResolution = 100 /* Bundler */;
|
|
16456
|
+
break;
|
|
16446
16457
|
default:
|
|
16447
16458
|
moduleResolution = 1 /* Classic */;
|
|
16448
16459
|
break;
|
|
@@ -16472,6 +16483,7 @@ var computedOptions = createComputedCompilerOptions({
|
|
|
16472
16483
|
switch (computedOptions.module.computeValue(compilerOptions)) {
|
|
16473
16484
|
case 100 /* Node16 */:
|
|
16474
16485
|
case 199 /* NodeNext */:
|
|
16486
|
+
case 200 /* Preserve */:
|
|
16475
16487
|
return true;
|
|
16476
16488
|
}
|
|
16477
16489
|
return false;
|
|
@@ -16639,18 +16651,12 @@ function emitModuleKindIsNonNodeESM(moduleKind) {
|
|
|
16639
16651
|
}
|
|
16640
16652
|
function hasJsonModuleEmitEnabled(options) {
|
|
16641
16653
|
switch (getEmitModuleKind(options)) {
|
|
16642
|
-
case
|
|
16643
|
-
case
|
|
16644
|
-
case
|
|
16645
|
-
case 6 /* ES2020 */:
|
|
16646
|
-
case 7 /* ES2022 */:
|
|
16647
|
-
case 99 /* ESNext */:
|
|
16648
|
-
case 100 /* Node16 */:
|
|
16649
|
-
case 199 /* NodeNext */:
|
|
16650
|
-
return true;
|
|
16651
|
-
default:
|
|
16654
|
+
case 0 /* None */:
|
|
16655
|
+
case 4 /* System */:
|
|
16656
|
+
case 3 /* UMD */:
|
|
16652
16657
|
return false;
|
|
16653
16658
|
}
|
|
16659
|
+
return true;
|
|
16654
16660
|
}
|
|
16655
16661
|
function unreachableCodeIsError(options) {
|
|
16656
16662
|
return options.allowUnreachableCode === false;
|
|
@@ -16661,9 +16667,6 @@ function unusedLabelIsError(options) {
|
|
|
16661
16667
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
|
16662
16668
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
16663
16669
|
}
|
|
16664
|
-
function shouldResolveJsRequire(compilerOptions) {
|
|
16665
|
-
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
|
|
16666
|
-
}
|
|
16667
16670
|
function getStrictOptionValue(compilerOptions, flag) {
|
|
16668
16671
|
return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
|
|
16669
16672
|
}
|
|
@@ -16827,7 +16830,7 @@ function getPatternFromSpec(spec, basePath, usage) {
|
|
|
16827
16830
|
const pattern = spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]);
|
|
16828
16831
|
return pattern && `^(${pattern})${usage === "exclude" ? "($|/)" : "$"}`;
|
|
16829
16832
|
}
|
|
16830
|
-
function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 }) {
|
|
16833
|
+
function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 } = wildcardMatchers[usage]) {
|
|
16831
16834
|
let subpattern = "";
|
|
16832
16835
|
let hasWrittenComponent = false;
|
|
16833
16836
|
const components = getNormalizedPathComponents(spec, basePath);
|
|
@@ -17040,7 +17043,8 @@ function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtens
|
|
|
17040
17043
|
return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false;
|
|
17041
17044
|
}
|
|
17042
17045
|
function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
|
|
17043
|
-
|
|
17046
|
+
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
17047
|
+
if (preference === "js" || resolutionMode === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
|
|
17044
17048
|
if (!shouldAllowImportingTsExtension(compilerOptions)) {
|
|
17045
17049
|
return 2 /* JsExtension */;
|
|
17046
17050
|
}
|
|
@@ -24624,6 +24628,9 @@ function isOmittedExpression(node) {
|
|
|
24624
24628
|
function isExpressionWithTypeArguments(node) {
|
|
24625
24629
|
return node.kind === 233 /* ExpressionWithTypeArguments */;
|
|
24626
24630
|
}
|
|
24631
|
+
function isSatisfiesExpression(node) {
|
|
24632
|
+
return node.kind === 238 /* SatisfiesExpression */;
|
|
24633
|
+
}
|
|
24627
24634
|
function isNonNullExpression(node) {
|
|
24628
24635
|
return node.kind === 235 /* NonNullExpression */;
|
|
24629
24636
|
}
|
|
@@ -34429,7 +34436,8 @@ var moduleOptionDeclaration = {
|
|
|
34429
34436
|
es2022: 7 /* ES2022 */,
|
|
34430
34437
|
esnext: 99 /* ESNext */,
|
|
34431
34438
|
node16: 100 /* Node16 */,
|
|
34432
|
-
nodenext: 199 /* NodeNext
|
|
34439
|
+
nodenext: 199 /* NodeNext */,
|
|
34440
|
+
preserve: 200 /* Preserve */
|
|
34433
34441
|
})),
|
|
34434
34442
|
affectsSourceFile: true,
|
|
34435
34443
|
affectsModuleResolution: true,
|
|
@@ -37158,7 +37166,7 @@ function trace(host, message, ...args) {
|
|
|
37158
37166
|
function isTraceEnabled(compilerOptions, host) {
|
|
37159
37167
|
return !!compilerOptions.traceResolution && host.trace !== void 0;
|
|
37160
37168
|
}
|
|
37161
|
-
function withPackageId(packageInfo, r) {
|
|
37169
|
+
function withPackageId(packageInfo, r, state) {
|
|
37162
37170
|
let packageId;
|
|
37163
37171
|
if (r && packageInfo) {
|
|
37164
37172
|
const packageJsonContent = packageInfo.contents.packageJsonContent;
|
|
@@ -37166,7 +37174,8 @@ function withPackageId(packageInfo, r) {
|
|
|
37166
37174
|
packageId = {
|
|
37167
37175
|
name: packageJsonContent.name,
|
|
37168
37176
|
subModuleName: r.path.slice(packageInfo.packageDirectory.length + directorySeparator.length),
|
|
37169
|
-
version: packageJsonContent.version
|
|
37177
|
+
version: packageJsonContent.version,
|
|
37178
|
+
peerDependencies: getPeerDependenciesOfPackageJsonInfo(packageInfo, state)
|
|
37170
37179
|
};
|
|
37171
37180
|
}
|
|
37172
37181
|
}
|
|
@@ -37176,7 +37185,9 @@ function noPackageId(r) {
|
|
|
37176
37185
|
return withPackageId(
|
|
37177
37186
|
/*packageInfo*/
|
|
37178
37187
|
void 0,
|
|
37179
|
-
r
|
|
37188
|
+
r,
|
|
37189
|
+
/*state*/
|
|
37190
|
+
void 0
|
|
37180
37191
|
);
|
|
37181
37192
|
}
|
|
37182
37193
|
function removeIgnoredPackageId(r) {
|
|
@@ -37542,7 +37553,7 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
37542
37553
|
false,
|
|
37543
37554
|
moduleResolutionState
|
|
37544
37555
|
) : void 0;
|
|
37545
|
-
return resolvedTypeScriptOnly(withPackageId(packageInfo, resolvedFromFile));
|
|
37556
|
+
return resolvedTypeScriptOnly(withPackageId(packageInfo, resolvedFromFile, moduleResolutionState));
|
|
37546
37557
|
}
|
|
37547
37558
|
}
|
|
37548
37559
|
return resolvedTypeScriptOnly(
|
|
@@ -38027,20 +38038,7 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
38027
38038
|
} else {
|
|
38028
38039
|
let moduleResolution = compilerOptions.moduleResolution;
|
|
38029
38040
|
if (moduleResolution === void 0) {
|
|
38030
|
-
|
|
38031
|
-
case 1 /* CommonJS */:
|
|
38032
|
-
moduleResolution = 2 /* Node10 */;
|
|
38033
|
-
break;
|
|
38034
|
-
case 100 /* Node16 */:
|
|
38035
|
-
moduleResolution = 3 /* Node16 */;
|
|
38036
|
-
break;
|
|
38037
|
-
case 199 /* NodeNext */:
|
|
38038
|
-
moduleResolution = 99 /* NodeNext */;
|
|
38039
|
-
break;
|
|
38040
|
-
default:
|
|
38041
|
-
moduleResolution = 1 /* Classic */;
|
|
38042
|
-
break;
|
|
38043
|
-
}
|
|
38041
|
+
moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
38044
38042
|
if (traceEnabled) {
|
|
38045
38043
|
trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]);
|
|
38046
38044
|
}
|
|
@@ -38491,7 +38489,7 @@ function nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures,
|
|
|
38491
38489
|
false,
|
|
38492
38490
|
state
|
|
38493
38491
|
) : void 0;
|
|
38494
|
-
return withPackageId(packageInfo, resolvedFromFile);
|
|
38492
|
+
return withPackageId(packageInfo, resolvedFromFile, state);
|
|
38495
38493
|
}
|
|
38496
38494
|
}
|
|
38497
38495
|
if (!onlyRecordFailures) {
|
|
@@ -38634,7 +38632,7 @@ function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures,
|
|
|
38634
38632
|
const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
|
|
38635
38633
|
const packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
|
|
38636
38634
|
const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
|
|
38637
|
-
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
|
|
38635
|
+
return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths), state);
|
|
38638
38636
|
}
|
|
38639
38637
|
function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
|
|
38640
38638
|
return {
|
|
@@ -38676,6 +38674,42 @@ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
|
38676
38674
|
}
|
|
38677
38675
|
return packageJsonInfo.contents.versionPaths || void 0;
|
|
38678
38676
|
}
|
|
38677
|
+
function getPeerDependenciesOfPackageJsonInfo(packageJsonInfo, state) {
|
|
38678
|
+
if (packageJsonInfo.contents.peerDependencies === void 0) {
|
|
38679
|
+
packageJsonInfo.contents.peerDependencies = readPackageJsonPeerDependencies(packageJsonInfo, state) || false;
|
|
38680
|
+
}
|
|
38681
|
+
return packageJsonInfo.contents.peerDependencies || void 0;
|
|
38682
|
+
}
|
|
38683
|
+
function readPackageJsonPeerDependencies(packageJsonInfo, state) {
|
|
38684
|
+
const peerDependencies = readPackageJsonField(packageJsonInfo.contents.packageJsonContent, "peerDependencies", "object", state);
|
|
38685
|
+
if (peerDependencies === void 0)
|
|
38686
|
+
return void 0;
|
|
38687
|
+
if (state.traceEnabled)
|
|
38688
|
+
trace(state.host, Diagnostics.package_json_has_a_peerDependencies_field);
|
|
38689
|
+
const packageDirectory = realPath(packageJsonInfo.packageDirectory, state.host, state.traceEnabled);
|
|
38690
|
+
const nodeModules = packageDirectory.substring(0, packageDirectory.lastIndexOf("node_modules") + "node_modules".length) + directorySeparator;
|
|
38691
|
+
let result = "";
|
|
38692
|
+
for (const key in peerDependencies) {
|
|
38693
|
+
if (hasProperty(peerDependencies, key)) {
|
|
38694
|
+
const peerPackageJson = getPackageJsonInfo(
|
|
38695
|
+
nodeModules + key,
|
|
38696
|
+
/*onlyRecordFailures*/
|
|
38697
|
+
false,
|
|
38698
|
+
state
|
|
38699
|
+
);
|
|
38700
|
+
if (peerPackageJson) {
|
|
38701
|
+
const version2 = peerPackageJson.contents.packageJsonContent.version;
|
|
38702
|
+
result += `+${key}@${version2}`;
|
|
38703
|
+
if (state.traceEnabled)
|
|
38704
|
+
trace(state.host, Diagnostics.Found_peerDependency_0_with_1_version, key, version2);
|
|
38705
|
+
} else {
|
|
38706
|
+
if (state.traceEnabled)
|
|
38707
|
+
trace(state.host, Diagnostics.Failed_to_find_peerDependency_0, key);
|
|
38708
|
+
}
|
|
38709
|
+
}
|
|
38710
|
+
}
|
|
38711
|
+
return result;
|
|
38712
|
+
}
|
|
38679
38713
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
38680
38714
|
var _a, _b, _c, _d, _e, _f;
|
|
38681
38715
|
const { host, traceEnabled } = state;
|
|
@@ -38704,7 +38738,7 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
38704
38738
|
if (traceEnabled) {
|
|
38705
38739
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
38706
38740
|
}
|
|
38707
|
-
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
38741
|
+
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0, peerDependencies: void 0 } };
|
|
38708
38742
|
if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
|
|
38709
38743
|
state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, result);
|
|
38710
38744
|
(_e = state.affectingLocations) == null ? void 0 : _e.push(packageJsonPath);
|
|
@@ -39112,7 +39146,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
39112
39146
|
/*onlyRecordFailures*/
|
|
39113
39147
|
false,
|
|
39114
39148
|
state
|
|
39115
|
-
)));
|
|
39149
|
+
), state));
|
|
39116
39150
|
} else if (typeof target === "object" && target !== null) {
|
|
39117
39151
|
if (!Array.isArray(target)) {
|
|
39118
39152
|
traceIfEnabled(state, Diagnostics.Entering_conditional_exports);
|
|
@@ -39226,7 +39260,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
39226
39260
|
/*onlyRecordFailures*/
|
|
39227
39261
|
false,
|
|
39228
39262
|
state
|
|
39229
|
-
)));
|
|
39263
|
+
), state));
|
|
39230
39264
|
}
|
|
39231
39265
|
}
|
|
39232
39266
|
}
|
|
@@ -39357,7 +39391,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
39357
39391
|
packageInfo.contents.packageJsonContent,
|
|
39358
39392
|
getVersionPathsOfPackageJsonInfo(packageInfo, state)
|
|
39359
39393
|
);
|
|
39360
|
-
return withPackageId(packageInfo, fromDirectory);
|
|
39394
|
+
return withPackageId(packageInfo, fromDirectory, state);
|
|
39361
39395
|
}
|
|
39362
39396
|
const loader = (extensions2, candidate2, onlyRecordFailures, state2) => {
|
|
39363
39397
|
let pathAndExtension = (rest || !(state2.features & 32 /* EsmMode */)) && loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
|
|
@@ -39371,7 +39405,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
|
|
|
39371
39405
|
if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
|
|
39372
39406
|
pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
|
|
39373
39407
|
}
|
|
39374
|
-
return withPackageId(packageInfo, pathAndExtension);
|
|
39408
|
+
return withPackageId(packageInfo, pathAndExtension, state2);
|
|
39375
39409
|
};
|
|
39376
39410
|
if (rest !== "") {
|
|
39377
39411
|
packageInfo = rootPackageInfo ?? getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
|
|
@@ -39578,7 +39612,7 @@ function resolveFromTypeRoot(moduleName, state) {
|
|
|
39578
39612
|
false,
|
|
39579
39613
|
state
|
|
39580
39614
|
) : void 0;
|
|
39581
|
-
return toSearchResult(withPackageId(packageInfo, resolvedFromFile));
|
|
39615
|
+
return toSearchResult(withPackageId(packageInfo, resolvedFromFile, state));
|
|
39582
39616
|
}
|
|
39583
39617
|
const resolved = loadNodeModuleFromDirectory(4 /* Declaration */, candidate, !directoryExists, state);
|
|
39584
39618
|
if (resolved)
|
|
@@ -41772,7 +41806,7 @@ function createBinder() {
|
|
|
41772
41806
|
} else if (isJsonSourceFile(file)) {
|
|
41773
41807
|
bindSourceFileAsExternalModule();
|
|
41774
41808
|
const originalSymbol = file.symbol;
|
|
41775
|
-
declareSymbol(file.symbol.exports, file.symbol, file, 4 /* Property */,
|
|
41809
|
+
declareSymbol(file.symbol.exports, file.symbol, file, 4 /* Property */, -1 /* All */);
|
|
41776
41810
|
file.symbol = originalSymbol;
|
|
41777
41811
|
}
|
|
41778
41812
|
}
|
|
@@ -41784,7 +41818,7 @@ function createBinder() {
|
|
|
41784
41818
|
bindAnonymousDeclaration(node, 111551 /* Value */, getDeclarationName(node));
|
|
41785
41819
|
} else {
|
|
41786
41820
|
const flags = exportAssignmentIsAlias(node) ? 2097152 /* Alias */ : 4 /* Property */;
|
|
41787
|
-
const symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags,
|
|
41821
|
+
const symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags, -1 /* All */);
|
|
41788
41822
|
if (node.isExportEquals) {
|
|
41789
41823
|
setValueDeclaration(symbol, node);
|
|
41790
41824
|
}
|
|
@@ -42237,7 +42271,7 @@ function createBinder() {
|
|
|
42237
42271
|
}
|
|
42238
42272
|
if (!isBindingPattern(node.name)) {
|
|
42239
42273
|
const possibleVariableDecl = node.kind === 260 /* VariableDeclaration */ ? node : node.parent.parent;
|
|
42240
|
-
if (isInJSFile(node) &&
|
|
42274
|
+
if (isInJSFile(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 32 /* Export */)) {
|
|
42241
42275
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
42242
42276
|
} else if (isBlockOrCatchScoped(node)) {
|
|
42243
42277
|
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
|
@@ -42766,7 +42800,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
42766
42800
|
(reason) => {
|
|
42767
42801
|
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path)
|
|
42768
42802
|
return void 0;
|
|
42769
|
-
if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index))
|
|
42803
|
+
if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions))
|
|
42770
42804
|
return void 0;
|
|
42771
42805
|
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
|
|
42772
42806
|
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
|
|
@@ -44359,14 +44393,6 @@ function createTypeChecker(host) {
|
|
|
44359
44393
|
emptyArray,
|
|
44360
44394
|
emptyArray
|
|
44361
44395
|
);
|
|
44362
|
-
var resolvingApparentMappedType = createAnonymousType(
|
|
44363
|
-
/*symbol*/
|
|
44364
|
-
void 0,
|
|
44365
|
-
emptySymbols,
|
|
44366
|
-
emptyArray,
|
|
44367
|
-
emptyArray,
|
|
44368
|
-
emptyArray
|
|
44369
|
-
);
|
|
44370
44396
|
var markerSuperType = createTypeParameter();
|
|
44371
44397
|
var markerSubType = createTypeParameter();
|
|
44372
44398
|
markerSubType.constraint = markerSuperType;
|
|
@@ -46022,7 +46048,7 @@ function createTypeChecker(host) {
|
|
|
46022
46048
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
46023
46049
|
}
|
|
46024
46050
|
function getUsageModeForExpression(usage) {
|
|
46025
|
-
return isStringLiteralLike(usage) ? getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
46051
|
+
return isStringLiteralLike(usage) ? host.getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
46026
46052
|
}
|
|
46027
46053
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
46028
46054
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
@@ -46033,7 +46059,7 @@ function createTypeChecker(host) {
|
|
|
46033
46059
|
}
|
|
46034
46060
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
46035
46061
|
const usageMode = file && getUsageModeForExpression(usage);
|
|
46036
|
-
if (file && usageMode !== void 0) {
|
|
46062
|
+
if (file && usageMode !== void 0 && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
46037
46063
|
const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
|
|
46038
46064
|
if (usageMode === 99 /* ESNext */ || result) {
|
|
46039
46065
|
return result;
|
|
@@ -46566,7 +46592,7 @@ function createTypeChecker(host) {
|
|
|
46566
46592
|
break;
|
|
46567
46593
|
}
|
|
46568
46594
|
if (target === unknownSymbol) {
|
|
46569
|
-
return
|
|
46595
|
+
return -1 /* All */;
|
|
46570
46596
|
}
|
|
46571
46597
|
if (target === symbol || (seenSymbols == null ? void 0 : seenSymbols.has(target))) {
|
|
46572
46598
|
break;
|
|
@@ -46927,8 +46953,12 @@ function createTypeChecker(host) {
|
|
|
46927
46953
|
return ambientModule;
|
|
46928
46954
|
}
|
|
46929
46955
|
const currentSourceFile = getSourceFileOfNode(location);
|
|
46930
|
-
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a =
|
|
46931
|
-
|
|
46956
|
+
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isVariableDeclaration(location) && location.initializer && isRequireCall(
|
|
46957
|
+
location.initializer,
|
|
46958
|
+
/*requireStringLiteralLikeArgument*/
|
|
46959
|
+
true
|
|
46960
|
+
) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, isImportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression) || ((_f = findAncestor(location, isExportDeclaration)) == null ? void 0 : _f.moduleSpecifier);
|
|
46961
|
+
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
46932
46962
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
46933
46963
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
46934
46964
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
@@ -50082,7 +50112,7 @@ function createTypeChecker(host) {
|
|
|
50082
50112
|
}
|
|
50083
50113
|
const sym = resolveEntityName(
|
|
50084
50114
|
leftmost,
|
|
50085
|
-
|
|
50115
|
+
-1 /* All */,
|
|
50086
50116
|
/*ignoreErrors*/
|
|
50087
50117
|
true,
|
|
50088
50118
|
/*dontResolveAlias*/
|
|
@@ -50092,13 +50122,13 @@ function createTypeChecker(host) {
|
|
|
50092
50122
|
if (isSymbolAccessible(
|
|
50093
50123
|
sym,
|
|
50094
50124
|
context.enclosingDeclaration,
|
|
50095
|
-
|
|
50125
|
+
-1 /* All */,
|
|
50096
50126
|
/*shouldComputeAliasesToMakeVisible*/
|
|
50097
50127
|
false
|
|
50098
50128
|
).accessibility !== 0 /* Accessible */) {
|
|
50099
50129
|
introducesError = true;
|
|
50100
50130
|
} else {
|
|
50101
|
-
context.tracker.trackSymbol(sym, context.enclosingDeclaration,
|
|
50131
|
+
context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
|
|
50102
50132
|
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
50103
50133
|
}
|
|
50104
50134
|
if (isIdentifier(node)) {
|
|
@@ -51210,7 +51240,7 @@ function createTypeChecker(host) {
|
|
|
51210
51240
|
isLocalImport ? symbolToName(
|
|
51211
51241
|
target,
|
|
51212
51242
|
context,
|
|
51213
|
-
|
|
51243
|
+
-1 /* All */,
|
|
51214
51244
|
/*expectsIdentifier*/
|
|
51215
51245
|
false
|
|
51216
51246
|
) : factory.createExternalModuleReference(factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))
|
|
@@ -51369,7 +51399,7 @@ function createTypeChecker(host) {
|
|
|
51369
51399
|
const first2 = expr && isEntityNameExpression(expr) ? getFirstNonModuleExportsIdentifier(expr) : void 0;
|
|
51370
51400
|
const referenced = first2 && resolveEntityName(
|
|
51371
51401
|
first2,
|
|
51372
|
-
|
|
51402
|
+
-1 /* All */,
|
|
51373
51403
|
/*ignoreErrors*/
|
|
51374
51404
|
true,
|
|
51375
51405
|
/*dontResolveAlias*/
|
|
@@ -51386,7 +51416,7 @@ function createTypeChecker(host) {
|
|
|
51386
51416
|
/*modifiers*/
|
|
51387
51417
|
void 0,
|
|
51388
51418
|
isExportEquals,
|
|
51389
|
-
symbolToExpression(target, context,
|
|
51419
|
+
symbolToExpression(target, context, -1 /* All */)
|
|
51390
51420
|
));
|
|
51391
51421
|
} else {
|
|
51392
51422
|
if (first2 === expr && first2) {
|
|
@@ -51405,7 +51435,7 @@ function createTypeChecker(host) {
|
|
|
51405
51435
|
symbolToName(
|
|
51406
51436
|
target,
|
|
51407
51437
|
context,
|
|
51408
|
-
|
|
51438
|
+
-1 /* All */,
|
|
51409
51439
|
/*expectsIdentifier*/
|
|
51410
51440
|
false
|
|
51411
51441
|
)
|
|
@@ -55318,30 +55348,14 @@ function createTypeChecker(host) {
|
|
|
55318
55348
|
return !!(typeParameter.symbol && forEach(typeParameter.symbol.declarations, (decl) => isTypeParameterDeclaration(decl) && decl.default));
|
|
55319
55349
|
}
|
|
55320
55350
|
function getApparentTypeOfMappedType(type) {
|
|
55321
|
-
|
|
55322
|
-
if (type.resolvedApparentType === resolvingApparentMappedType) {
|
|
55323
|
-
return type.resolvedApparentType = type;
|
|
55324
|
-
}
|
|
55325
|
-
return type.resolvedApparentType;
|
|
55326
|
-
}
|
|
55327
|
-
type.resolvedApparentType = resolvingApparentMappedType;
|
|
55328
|
-
return type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type);
|
|
55351
|
+
return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type));
|
|
55329
55352
|
}
|
|
55330
55353
|
function getResolvedApparentTypeOfMappedType(type) {
|
|
55331
|
-
const
|
|
55332
|
-
|
|
55333
|
-
|
|
55334
|
-
let constraint;
|
|
55335
|
-
if (!type.target) {
|
|
55336
|
-
constraint = getConstraintOfTypeParameter(typeVariable);
|
|
55337
|
-
} else {
|
|
55338
|
-
const modifiersConstraint = getConstraintOfType(getModifiersTypeFromMappedType(type));
|
|
55339
|
-
if (modifiersConstraint) {
|
|
55340
|
-
constraint = getApparentType(modifiersConstraint);
|
|
55341
|
-
}
|
|
55342
|
-
}
|
|
55354
|
+
const typeVariable = getHomomorphicTypeVariable(type);
|
|
55355
|
+
if (typeVariable && !type.declaration.nameType) {
|
|
55356
|
+
const constraint = getConstraintOfTypeParameter(typeVariable);
|
|
55343
55357
|
if (constraint && everyType(constraint, isArrayOrTupleType)) {
|
|
55344
|
-
return instantiateType(
|
|
55358
|
+
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
55345
55359
|
}
|
|
55346
55360
|
}
|
|
55347
55361
|
return type;
|
|
@@ -56665,7 +56679,7 @@ function createTypeChecker(host) {
|
|
|
56665
56679
|
if (constraint) {
|
|
56666
56680
|
constraints = append(constraints, constraint);
|
|
56667
56681
|
}
|
|
56668
|
-
} else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 200 /* MappedType */ && node === parent.type) {
|
|
56682
|
+
} else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 200 /* MappedType */ && !parent.nameType && node === parent.type) {
|
|
56669
56683
|
const mappedType = getTypeFromTypeNode(parent);
|
|
56670
56684
|
if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
|
|
56671
56685
|
const typeParameter = getHomomorphicTypeVariable(mappedType);
|
|
@@ -59725,11 +59739,8 @@ function createTypeChecker(host) {
|
|
|
59725
59739
|
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
59726
59740
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
59727
59741
|
}
|
|
59728
|
-
if (isGenericTupleType(t)) {
|
|
59729
|
-
return instantiateMappedGenericTupleType(t, type, typeVariable, mapper);
|
|
59730
|
-
}
|
|
59731
59742
|
if (isTupleType(t)) {
|
|
59732
|
-
return instantiateMappedTupleType(t, type,
|
|
59743
|
+
return instantiateMappedTupleType(t, type, typeVariable, mapper);
|
|
59733
59744
|
}
|
|
59734
59745
|
}
|
|
59735
59746
|
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
@@ -59746,17 +59757,18 @@ function createTypeChecker(host) {
|
|
|
59746
59757
|
function getModifiedReadonlyState(state, modifiers) {
|
|
59747
59758
|
return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;
|
|
59748
59759
|
}
|
|
59749
|
-
function
|
|
59760
|
+
function instantiateMappedTupleType(tupleType, mappedType, typeVariable, mapper) {
|
|
59750
59761
|
const elementFlags = tupleType.target.elementFlags;
|
|
59751
|
-
const
|
|
59752
|
-
|
|
59753
|
-
|
|
59754
|
-
|
|
59755
|
-
|
|
59756
|
-
return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
|
|
59762
|
+
const fixedLength = tupleType.target.fixedLength;
|
|
59763
|
+
const fixedMapper = fixedLength ? prependTypeMapping(typeVariable, tupleType, mapper) : mapper;
|
|
59764
|
+
const newElementTypes = map(getElementTypes(tupleType), (type, i) => {
|
|
59765
|
+
const flags = elementFlags[i];
|
|
59766
|
+
return i < fixedLength ? instantiateMappedTypeTemplate(mappedType, getStringLiteralType("" + i), !!(flags & 2 /* Optional */), fixedMapper) : flags & 8 /* Variadic */ ? instantiateType(mappedType, prependTypeMapping(typeVariable, type, mapper)) : getElementTypeOfArrayType(instantiateType(mappedType, prependTypeMapping(typeVariable, createArrayType(type), mapper))) ?? unknownType;
|
|
59757
59767
|
});
|
|
59768
|
+
const modifiers = getMappedTypeModifiers(mappedType);
|
|
59769
|
+
const newElementFlags = modifiers & 4 /* IncludeOptional */ ? map(elementFlags, (f) => f & 1 /* Required */ ? 2 /* Optional */ : f) : modifiers & 8 /* ExcludeOptional */ ? map(elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : elementFlags;
|
|
59758
59770
|
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
|
|
59759
|
-
return
|
|
59771
|
+
return contains(newElementTypes, errorType) ? errorType : createTupleType(newElementTypes, newElementFlags, newReadonly, tupleType.target.labeledElementDeclarations);
|
|
59760
59772
|
}
|
|
59761
59773
|
function instantiateMappedArrayType(arrayType, mappedType, mapper) {
|
|
59762
59774
|
const elementType = instantiateMappedTypeTemplate(
|
|
@@ -59768,14 +59780,6 @@ function createTypeChecker(host) {
|
|
|
59768
59780
|
);
|
|
59769
59781
|
return isErrorType(elementType) ? errorType : createArrayType(elementType, getModifiedReadonlyState(isReadonlyArrayType(arrayType), getMappedTypeModifiers(mappedType)));
|
|
59770
59782
|
}
|
|
59771
|
-
function instantiateMappedTupleType(tupleType, mappedType, mapper) {
|
|
59772
|
-
const elementFlags = tupleType.target.elementFlags;
|
|
59773
|
-
const elementTypes = map(getElementTypes(tupleType), (_, i) => instantiateMappedTypeTemplate(mappedType, getStringLiteralType("" + i), !!(elementFlags[i] & 2 /* Optional */), mapper));
|
|
59774
|
-
const modifiers = getMappedTypeModifiers(mappedType);
|
|
59775
|
-
const newTupleModifiers = modifiers & 4 /* IncludeOptional */ ? map(elementFlags, (f) => f & 1 /* Required */ ? 2 /* Optional */ : f) : modifiers & 8 /* ExcludeOptional */ ? map(elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : elementFlags;
|
|
59776
|
-
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, modifiers);
|
|
59777
|
-
return contains(elementTypes, errorType) ? errorType : createTupleType(elementTypes, newTupleModifiers, newReadonly, tupleType.target.labeledElementDeclarations);
|
|
59778
|
-
}
|
|
59779
59783
|
function instantiateMappedTypeTemplate(type, key, isOptional, mapper) {
|
|
59780
59784
|
const templateMapper = appendTypeMapping(mapper, getTypeParameterFromMappedType(type), key);
|
|
59781
59785
|
const propType = instantiateType(getTemplateTypeFromMappedType(type.target || type), templateMapper);
|
|
@@ -60547,7 +60551,8 @@ function createTypeChecker(host) {
|
|
|
60547
60551
|
if (isOmittedExpression(elem))
|
|
60548
60552
|
continue;
|
|
60549
60553
|
const nameType = getNumberLiteralType(i);
|
|
60550
|
-
|
|
60554
|
+
const checkNode = getEffectiveCheckNode(elem);
|
|
60555
|
+
yield { errorNode: checkNode, innerExpression: checkNode, nameType };
|
|
60551
60556
|
}
|
|
60552
60557
|
}
|
|
60553
60558
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
@@ -70053,7 +70058,12 @@ function createTypeChecker(host) {
|
|
|
70053
70058
|
}
|
|
70054
70059
|
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
|
|
70055
70060
|
const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
|
|
70056
|
-
const
|
|
70061
|
+
const jsxImportIndex = compilerOptions.importHelpers ? 1 : 0;
|
|
70062
|
+
const specifier = file == null ? void 0 : file.imports[jsxImportIndex];
|
|
70063
|
+
if (specifier) {
|
|
70064
|
+
Debug.assert(nodeIsSynthesized(specifier) && specifier.text === runtimeImportSpecifier, `Expected sourceFile.imports[${jsxImportIndex}] to be the synthesized JSX runtime import`);
|
|
70065
|
+
}
|
|
70066
|
+
const mod = resolveExternalModule(specifier || location, runtimeImportSpecifier, errorMessage, location);
|
|
70057
70067
|
const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
|
|
70058
70068
|
if (links) {
|
|
70059
70069
|
links.jsxImplicitImportContainer = result || false;
|
|
@@ -70296,7 +70306,7 @@ function createTypeChecker(host) {
|
|
|
70296
70306
|
);
|
|
70297
70307
|
}
|
|
70298
70308
|
if (jsxFactorySym) {
|
|
70299
|
-
jsxFactorySym.isReferenced =
|
|
70309
|
+
jsxFactorySym.isReferenced = -1 /* All */;
|
|
70300
70310
|
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
70301
70311
|
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
70302
70312
|
}
|
|
@@ -71136,7 +71146,7 @@ function createTypeChecker(host) {
|
|
|
71136
71146
|
return;
|
|
71137
71147
|
}
|
|
71138
71148
|
}
|
|
71139
|
-
(getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced =
|
|
71149
|
+
(getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced = -1 /* All */;
|
|
71140
71150
|
}
|
|
71141
71151
|
function isSelfTypeAccess(name, parent) {
|
|
71142
71152
|
return name.kind === 110 /* ThisKeyword */ || !!parent && isEntityNameExpression(name) && parent === getResolvedSymbol(getFirstIdentifier(name));
|
|
@@ -71699,6 +71709,10 @@ function createTypeChecker(host) {
|
|
|
71699
71709
|
return false;
|
|
71700
71710
|
}
|
|
71701
71711
|
}
|
|
71712
|
+
function getEffectiveCheckNode(argument) {
|
|
71713
|
+
argument = skipParentheses(argument);
|
|
71714
|
+
return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
|
|
71715
|
+
}
|
|
71702
71716
|
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
|
|
71703
71717
|
const errorOutputContainer = { errors: void 0, skipLogging: true };
|
|
71704
71718
|
if (isJsxOpeningLikeElement(node)) {
|
|
@@ -71734,7 +71748,8 @@ function createTypeChecker(host) {
|
|
|
71734
71748
|
checkMode
|
|
71735
71749
|
);
|
|
71736
71750
|
const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
|
71737
|
-
|
|
71751
|
+
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
|
71752
|
+
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
|
71738
71753
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
|
71739
71754
|
maybeAddMissingAwaitInfo(arg, checkArgType, paramType);
|
|
71740
71755
|
return errorOutputContainer.errors || emptyArray;
|
|
@@ -71752,7 +71767,7 @@ function createTypeChecker(host) {
|
|
|
71752
71767
|
checkMode
|
|
71753
71768
|
);
|
|
71754
71769
|
const restArgCount = args.length - argCount;
|
|
71755
|
-
const errorNode = !reportErrors2 ? void 0 : restArgCount === 0 ? node : restArgCount === 1 ? args[argCount] : setTextRangePosEnd(createSyntheticExpression(node, spreadType), args[argCount].pos, args[args.length - 1].end);
|
|
71770
|
+
const errorNode = !reportErrors2 ? void 0 : restArgCount === 0 ? node : restArgCount === 1 ? getEffectiveCheckNode(args[argCount]) : setTextRangePosEnd(createSyntheticExpression(node, spreadType), args[argCount].pos, args[args.length - 1].end);
|
|
71756
71771
|
if (!checkTypeRelatedTo(
|
|
71757
71772
|
spreadType,
|
|
71758
71773
|
restType,
|
|
@@ -73094,7 +73109,7 @@ function createTypeChecker(host) {
|
|
|
73094
73109
|
return anyType;
|
|
73095
73110
|
}
|
|
73096
73111
|
}
|
|
73097
|
-
if (isInJSFile(node) &&
|
|
73112
|
+
if (isInJSFile(node) && isCommonJsRequire(node)) {
|
|
73098
73113
|
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
|
|
73099
73114
|
}
|
|
73100
73115
|
const returnType = getReturnTypeOfSignature(signature);
|
|
@@ -74574,17 +74589,18 @@ function createTypeChecker(host) {
|
|
|
74574
74589
|
const exprType = checkExpression(node.body);
|
|
74575
74590
|
const returnOrPromisedType = returnType && unwrapReturnType(returnType, functionFlags);
|
|
74576
74591
|
if (returnOrPromisedType) {
|
|
74592
|
+
const effectiveCheckNode = getEffectiveCheckNode(node.body);
|
|
74577
74593
|
if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */) {
|
|
74578
74594
|
const awaitedType = checkAwaitedType(
|
|
74579
74595
|
exprType,
|
|
74580
74596
|
/*withAlias*/
|
|
74581
74597
|
false,
|
|
74582
|
-
|
|
74598
|
+
effectiveCheckNode,
|
|
74583
74599
|
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
|
74584
74600
|
);
|
|
74585
|
-
checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType,
|
|
74601
|
+
checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
|
|
74586
74602
|
} else {
|
|
74587
|
-
checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType,
|
|
74603
|
+
checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
|
|
74588
74604
|
}
|
|
74589
74605
|
}
|
|
74590
74606
|
}
|
|
@@ -74746,13 +74762,14 @@ function createTypeChecker(host) {
|
|
|
74746
74762
|
}
|
|
74747
74763
|
case 7 /* ES2022 */:
|
|
74748
74764
|
case 99 /* ESNext */:
|
|
74765
|
+
case 200 /* Preserve */:
|
|
74749
74766
|
case 4 /* System */:
|
|
74750
74767
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
74751
74768
|
break;
|
|
74752
74769
|
}
|
|
74753
74770
|
default:
|
|
74754
74771
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
74755
|
-
const message = isAwaitExpression(node) ? Diagnostics.
|
|
74772
|
+
const message = isAwaitExpression(node) ? Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher : Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher;
|
|
74756
74773
|
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message));
|
|
74757
74774
|
hasError = true;
|
|
74758
74775
|
break;
|
|
@@ -77000,11 +77017,10 @@ function createTypeChecker(host) {
|
|
|
77000
77017
|
checkSourceElement(node.elementType);
|
|
77001
77018
|
}
|
|
77002
77019
|
function checkTupleType(node) {
|
|
77003
|
-
const elementTypes = node.elements;
|
|
77004
77020
|
let seenOptionalElement = false;
|
|
77005
77021
|
let seenRestElement = false;
|
|
77006
|
-
for (const e of
|
|
77007
|
-
|
|
77022
|
+
for (const e of node.elements) {
|
|
77023
|
+
let flags = getTupleElementFlags(e);
|
|
77008
77024
|
if (flags & 8 /* Variadic */) {
|
|
77009
77025
|
const type = getTypeFromTypeNode(e.type);
|
|
77010
77026
|
if (!isArrayLikeType(type)) {
|
|
@@ -77012,9 +77028,10 @@ function createTypeChecker(host) {
|
|
|
77012
77028
|
break;
|
|
77013
77029
|
}
|
|
77014
77030
|
if (isArrayType(type) || isTupleType(type) && type.target.combinedFlags & 4 /* Rest */) {
|
|
77015
|
-
|
|
77031
|
+
flags |= 4 /* Rest */;
|
|
77016
77032
|
}
|
|
77017
|
-
}
|
|
77033
|
+
}
|
|
77034
|
+
if (flags & 4 /* Rest */) {
|
|
77018
77035
|
if (seenRestElement) {
|
|
77019
77036
|
grammarErrorOnNode(e, Diagnostics.A_rest_element_cannot_follow_another_rest_element);
|
|
77020
77037
|
break;
|
|
@@ -77026,7 +77043,7 @@ function createTypeChecker(host) {
|
|
|
77026
77043
|
break;
|
|
77027
77044
|
}
|
|
77028
77045
|
seenOptionalElement = true;
|
|
77029
|
-
} else if (seenOptionalElement) {
|
|
77046
|
+
} else if (flags & 1 /* Required */ && seenOptionalElement) {
|
|
77030
77047
|
grammarErrorOnNode(e, Diagnostics.A_required_element_cannot_follow_an_optional_element);
|
|
77031
77048
|
break;
|
|
77032
77049
|
}
|
|
@@ -81267,8 +81284,8 @@ function createTypeChecker(host) {
|
|
|
81267
81284
|
return;
|
|
81268
81285
|
}
|
|
81269
81286
|
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
|
|
81270
|
-
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */) {
|
|
81271
|
-
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.
|
|
81287
|
+
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
|
81288
|
+
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
|
|
81272
81289
|
return grammarErrorOnNode(node, message);
|
|
81273
81290
|
}
|
|
81274
81291
|
if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
|
|
@@ -81340,7 +81357,7 @@ function createTypeChecker(host) {
|
|
|
81340
81357
|
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
|
|
81341
81358
|
}
|
|
81342
81359
|
} else {
|
|
81343
|
-
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
81360
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
81344
81361
|
grammarErrorOnNode(node, 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);
|
|
81345
81362
|
}
|
|
81346
81363
|
}
|
|
@@ -81501,7 +81518,7 @@ function createTypeChecker(host) {
|
|
|
81501
81518
|
const id = node.expression;
|
|
81502
81519
|
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
81503
81520
|
id,
|
|
81504
|
-
|
|
81521
|
+
-1 /* All */,
|
|
81505
81522
|
/*ignoreErrors*/
|
|
81506
81523
|
true,
|
|
81507
81524
|
/*dontResolveAlias*/
|
|
@@ -81575,7 +81592,7 @@ function createTypeChecker(host) {
|
|
|
81575
81592
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
81576
81593
|
}
|
|
81577
81594
|
if (node.isExportEquals) {
|
|
81578
|
-
if (moduleKind >= 5 /* ES2015 */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
|
|
81595
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
|
|
81579
81596
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
81580
81597
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
|
|
81581
81598
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
@@ -82567,7 +82584,7 @@ function createTypeChecker(host) {
|
|
|
82567
82584
|
return void 0;
|
|
82568
82585
|
case 11 /* StringLiteral */:
|
|
82569
82586
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
82570
|
-
if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 272 /* ImportDeclaration */ || node.parent.kind === 278 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || (isInJSFile(node) &&
|
|
82587
|
+
if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 272 /* ImportDeclaration */ || node.parent.kind === 278 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || (isInJSFile(node) && isRequireCall(
|
|
82571
82588
|
node.parent,
|
|
82572
82589
|
/*requireStringLiteralLikeArgument*/
|
|
82573
82590
|
false
|
|
@@ -84629,7 +84646,7 @@ function createTypeChecker(host) {
|
|
|
84629
84646
|
}
|
|
84630
84647
|
default:
|
|
84631
84648
|
diagnostics.add(
|
|
84632
|
-
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.
|
|
84649
|
+
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher)
|
|
84633
84650
|
);
|
|
84634
84651
|
break;
|
|
84635
84652
|
}
|
|
@@ -107974,7 +107991,7 @@ function transformECMAScriptModule(context) {
|
|
|
107974
107991
|
setTextRange(factory2.createNodeArray(insertStatementsAfterCustomPrologue(result.statements.slice(), importRequireStatements)), result.statements)
|
|
107975
107992
|
);
|
|
107976
107993
|
}
|
|
107977
|
-
if (!isExternalModule(node) || some(result.statements, isExternalModuleIndicator)) {
|
|
107994
|
+
if (!isExternalModule(node) || getEmitModuleKind(compilerOptions) === 200 /* Preserve */ || some(result.statements, isExternalModuleIndicator)) {
|
|
107978
107995
|
return result;
|
|
107979
107996
|
}
|
|
107980
107997
|
return factory2.updateSourceFile(
|
|
@@ -108017,6 +108034,14 @@ function transformECMAScriptModule(context) {
|
|
|
108017
108034
|
if (moduleName) {
|
|
108018
108035
|
args.push(moduleName);
|
|
108019
108036
|
}
|
|
108037
|
+
if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
108038
|
+
return factory2.createCallExpression(
|
|
108039
|
+
factory2.createIdentifier("require"),
|
|
108040
|
+
/*typeArguments*/
|
|
108041
|
+
void 0,
|
|
108042
|
+
args
|
|
108043
|
+
);
|
|
108044
|
+
}
|
|
108020
108045
|
if (!importRequireStatements) {
|
|
108021
108046
|
const createRequireName = factory2.createUniqueName("_createRequire", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
108022
108047
|
const importStatement = factory2.createImportDeclaration(
|
|
@@ -108131,7 +108156,25 @@ function transformECMAScriptModule(context) {
|
|
|
108131
108156
|
return statements;
|
|
108132
108157
|
}
|
|
108133
108158
|
function visitExportAssignment(node) {
|
|
108134
|
-
|
|
108159
|
+
if (node.isExportEquals) {
|
|
108160
|
+
if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
108161
|
+
const statement = setOriginalNode(
|
|
108162
|
+
factory2.createExpressionStatement(
|
|
108163
|
+
factory2.createAssignment(
|
|
108164
|
+
factory2.createPropertyAccessExpression(
|
|
108165
|
+
factory2.createIdentifier("module"),
|
|
108166
|
+
"exports"
|
|
108167
|
+
),
|
|
108168
|
+
node.expression
|
|
108169
|
+
)
|
|
108170
|
+
),
|
|
108171
|
+
node
|
|
108172
|
+
);
|
|
108173
|
+
return statement;
|
|
108174
|
+
}
|
|
108175
|
+
return void 0;
|
|
108176
|
+
}
|
|
108177
|
+
return node;
|
|
108135
108178
|
}
|
|
108136
108179
|
function visitExportDeclaration(node) {
|
|
108137
108180
|
if (compilerOptions.module !== void 0 && compilerOptions.module > 5 /* ES2015 */) {
|
|
@@ -108592,7 +108635,7 @@ function transformDeclarations(context) {
|
|
|
108592
108635
|
}
|
|
108593
108636
|
}
|
|
108594
108637
|
function trackReferencedAmbientModule(node, symbol) {
|
|
108595
|
-
const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol,
|
|
108638
|
+
const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol, -1 /* All */);
|
|
108596
108639
|
if (length(directives)) {
|
|
108597
108640
|
return recordTypeReferenceDirectivesIfNecessary(directives);
|
|
108598
108641
|
}
|
|
@@ -110258,6 +110301,7 @@ function getModuleTransformer(moduleKind) {
|
|
|
110258
110301
|
case 7 /* ES2022 */:
|
|
110259
110302
|
case 6 /* ES2020 */:
|
|
110260
110303
|
case 5 /* ES2015 */:
|
|
110304
|
+
case 200 /* Preserve */:
|
|
110261
110305
|
return transformECMAScriptModule;
|
|
110262
110306
|
case 4 /* System */:
|
|
110263
110307
|
return transformSystemModule;
|
|
@@ -117031,8 +117075,8 @@ function flattenDiagnosticMessageText(diag2, newLine, indent2 = 0) {
|
|
|
117031
117075
|
function getModeForFileReference(ref, containingFileMode) {
|
|
117032
117076
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
117033
117077
|
}
|
|
117034
|
-
function getModeForResolutionAtIndex(file, index) {
|
|
117035
|
-
return
|
|
117078
|
+
function getModeForResolutionAtIndex(file, index, compilerOptions) {
|
|
117079
|
+
return getModeForUsageLocationWorker(file, getModuleNameStringLiteralAt(file, index), compilerOptions);
|
|
117036
117080
|
}
|
|
117037
117081
|
function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
117038
117082
|
var _a;
|
|
@@ -117044,7 +117088,10 @@ function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
|
117044
117088
|
}
|
|
117045
117089
|
return false;
|
|
117046
117090
|
}
|
|
117047
|
-
function getModeForUsageLocation(file, usage) {
|
|
117091
|
+
function getModeForUsageLocation(file, usage, compilerOptions) {
|
|
117092
|
+
return getModeForUsageLocationWorker(file, usage, compilerOptions);
|
|
117093
|
+
}
|
|
117094
|
+
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
117048
117095
|
var _a;
|
|
117049
117096
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
117050
117097
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
@@ -117061,6 +117108,13 @@ function getModeForUsageLocation(file, usage) {
|
|
|
117061
117108
|
return override;
|
|
117062
117109
|
}
|
|
117063
117110
|
}
|
|
117111
|
+
if (compilerOptions && getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
117112
|
+
return usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(
|
|
117113
|
+
usage.parent,
|
|
117114
|
+
/*requireStringLiteralLikeArgument*/
|
|
117115
|
+
false
|
|
117116
|
+
) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
117117
|
+
}
|
|
117064
117118
|
if (file.impliedNodeFormat === void 0)
|
|
117065
117119
|
return void 0;
|
|
117066
117120
|
if (file.impliedNodeFormat !== 99 /* ESNext */) {
|
|
@@ -117106,7 +117160,7 @@ function getModuleResolutionName(literal) {
|
|
|
117106
117160
|
}
|
|
117107
117161
|
var moduleResolutionNameAndModeGetter = {
|
|
117108
117162
|
getName: getModuleResolutionName,
|
|
117109
|
-
getMode: (entry, file) => getModeForUsageLocation(file, entry)
|
|
117163
|
+
getMode: (entry, file, compilerOptions) => getModeForUsageLocation(file, entry, compilerOptions)
|
|
117110
117164
|
};
|
|
117111
117165
|
function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
117112
117166
|
return {
|
|
@@ -117151,7 +117205,7 @@ function loadWithModeAwareCache(entries, containingFile, redirectedReference, op
|
|
|
117151
117205
|
const loader = createLoader(containingFile, redirectedReference, options, host, resolutionCache);
|
|
117152
117206
|
for (const entry of entries) {
|
|
117153
117207
|
const name = loader.nameAndMode.getName(entry);
|
|
117154
|
-
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
117208
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options);
|
|
117155
117209
|
const key = createModeAwareCacheKey(name, mode);
|
|
117156
117210
|
let result = cache.get(key);
|
|
117157
117211
|
if (!result) {
|
|
@@ -117237,7 +117291,7 @@ function getReferencedFileLocation(program, ref) {
|
|
|
117237
117291
|
switch (kind) {
|
|
117238
117292
|
case 3 /* Import */:
|
|
117239
117293
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
117240
|
-
packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text,
|
|
117294
|
+
packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text, program.getModeForUsageLocation(file, importLiteral))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.packageId;
|
|
117241
117295
|
if (importLiteral.pos === -1)
|
|
117242
117296
|
return { file, packageId, text: importLiteral.text };
|
|
117243
117297
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -117766,6 +117820,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117766
117820
|
getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
|
|
117767
117821
|
isSourceFileFromExternalLibrary,
|
|
117768
117822
|
isSourceFileDefaultLibrary,
|
|
117823
|
+
getModeForUsageLocation: getModeForUsageLocation2,
|
|
117824
|
+
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
117769
117825
|
getSourceFileFromReference,
|
|
117770
117826
|
getLibFileFromReference,
|
|
117771
117827
|
sourceFileToPackageName,
|
|
@@ -117775,6 +117831,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117775
117831
|
resolvedTypeReferenceDirectiveNames,
|
|
117776
117832
|
resolvedLibReferences,
|
|
117777
117833
|
getResolvedModule,
|
|
117834
|
+
getResolvedModuleFromModuleSpecifier,
|
|
117778
117835
|
getResolvedTypeReferenceDirective,
|
|
117779
117836
|
forEachResolvedModule,
|
|
117780
117837
|
forEachResolvedTypeReferenceDirective,
|
|
@@ -117825,6 +117882,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117825
117882
|
var _a2;
|
|
117826
117883
|
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
|
|
117827
117884
|
}
|
|
117885
|
+
function getResolvedModuleFromModuleSpecifier(moduleSpecifier) {
|
|
117886
|
+
const sourceFile = getSourceFileOfNode(moduleSpecifier);
|
|
117887
|
+
Debug.assertIsDefined(sourceFile, "`moduleSpecifier` must have a `SourceFile` ancestor. Use `program.getResolvedModule` instead to provide the containing file and resolution mode.");
|
|
117888
|
+
return getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation2(sourceFile, moduleSpecifier));
|
|
117889
|
+
}
|
|
117828
117890
|
function getResolvedTypeReferenceDirective(file, typeDirectiveName, mode) {
|
|
117829
117891
|
var _a2;
|
|
117830
117892
|
return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
@@ -117997,8 +118059,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117997
118059
|
for (let i = 0; i < moduleNames.length; i++) {
|
|
117998
118060
|
const moduleName = moduleNames[i];
|
|
117999
118061
|
if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
|
|
118000
|
-
const
|
|
118001
|
-
const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, mode);
|
|
118062
|
+
const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName));
|
|
118002
118063
|
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
118003
118064
|
if (isTraceEnabled(options, host)) {
|
|
118004
118065
|
trace(
|
|
@@ -118046,7 +118107,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118046
118107
|
return result;
|
|
118047
118108
|
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
118048
118109
|
var _a2;
|
|
118049
|
-
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text,
|
|
118110
|
+
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
118050
118111
|
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
118051
118112
|
if (resolutionToFile && resolvedFile) {
|
|
118052
118113
|
return false;
|
|
@@ -118264,11 +118325,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118264
118325
|
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
118265
118326
|
const resolutionsChanged = hasChangesInResolutions(
|
|
118266
118327
|
moduleNames,
|
|
118267
|
-
newSourceFile,
|
|
118268
118328
|
resolutions,
|
|
118269
|
-
(name
|
|
118270
|
-
moduleResolutionIsEqualTo
|
|
118271
|
-
moduleResolutionNameAndModeGetter
|
|
118329
|
+
(name) => oldProgram.getResolvedModule(newSourceFile, name.text, getModeForUsageLocation2(newSourceFile, name)),
|
|
118330
|
+
moduleResolutionIsEqualTo
|
|
118272
118331
|
);
|
|
118273
118332
|
if (resolutionsChanged)
|
|
118274
118333
|
structureIsReused = 1 /* SafeModules */;
|
|
@@ -118277,11 +118336,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118277
118336
|
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
|
|
118278
118337
|
const typeReferenceResolutionsChanged = hasChangesInResolutions(
|
|
118279
118338
|
typesReferenceDirectives,
|
|
118280
|
-
newSourceFile,
|
|
118281
118339
|
typeReferenceResolutions,
|
|
118282
|
-
(name
|
|
118283
|
-
typeDirectiveIsEqualTo
|
|
118284
|
-
typeReferenceResolutionNameAndModeGetter
|
|
118340
|
+
(name) => oldProgram.getResolvedTypeReferenceDirective(newSourceFile, getTypeReferenceResolutionName(name), getModeForFileReference(name, newSourceFile.impliedNodeFormat)),
|
|
118341
|
+
typeDirectiveIsEqualTo
|
|
118285
118342
|
);
|
|
118286
118343
|
if (typeReferenceResolutionsChanged)
|
|
118287
118344
|
structureIsReused = 1 /* SafeModules */;
|
|
@@ -118948,8 +119005,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118948
119005
|
false
|
|
118949
119006
|
);
|
|
118950
119007
|
}
|
|
118951
|
-
|
|
118952
|
-
if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
|
|
119008
|
+
if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || isJavaScriptFile) {
|
|
118953
119009
|
collectDynamicImportOrRequireCalls(file);
|
|
118954
119010
|
}
|
|
118955
119011
|
file.imports = imports || emptyArray;
|
|
@@ -118998,7 +119054,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118998
119054
|
const r = /import|require/g;
|
|
118999
119055
|
while (r.exec(file2.text) !== null) {
|
|
119000
119056
|
const node = getNodeAtPosition(file2, r.lastIndex);
|
|
119001
|
-
if (
|
|
119057
|
+
if (isJavaScriptFile && isRequireCall(
|
|
119002
119058
|
node,
|
|
119003
119059
|
/*requireStringLiteralLikeArgument*/
|
|
119004
119060
|
true
|
|
@@ -119553,13 +119609,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119553
119609
|
const moduleNames = getModuleNames(file);
|
|
119554
119610
|
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
119555
119611
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
119556
|
-
const optionsForFile = (
|
|
119612
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
119557
119613
|
const resolutionsInFile = createModeAwareCache();
|
|
119558
119614
|
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
119559
119615
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
119560
119616
|
const resolution = resolutions[index].resolvedModule;
|
|
119561
119617
|
const moduleName = moduleNames[index].text;
|
|
119562
|
-
const mode =
|
|
119618
|
+
const mode = getModeForUsageLocationWorker(file, moduleNames[index], optionsForFile);
|
|
119563
119619
|
resolutionsInFile.set(moduleName, mode, resolutions[index]);
|
|
119564
119620
|
addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
|
|
119565
119621
|
if (!resolution) {
|
|
@@ -119839,7 +119895,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119839
119895
|
if (getEmitModuleResolutionKind(options) === 1 /* Classic */) {
|
|
119840
119896
|
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic, "resolveJsonModule");
|
|
119841
119897
|
} else if (!hasJsonModuleEmitEnabled(options)) {
|
|
119842
|
-
createDiagnosticForOptionName(Diagnostics.
|
|
119898
|
+
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_module_is_set_to_none_system_or_umd, "resolveJsonModule", "module");
|
|
119843
119899
|
}
|
|
119844
119900
|
}
|
|
119845
119901
|
if (options.outDir || // there is --outDir specified
|
|
@@ -119903,7 +119959,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119903
119959
|
}
|
|
119904
119960
|
}
|
|
119905
119961
|
if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
|
|
119906
|
-
createDiagnosticForOptionName(Diagnostics.
|
|
119962
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "preserveValueImports");
|
|
119907
119963
|
}
|
|
119908
119964
|
const moduleKind = getEmitModuleKind(options);
|
|
119909
119965
|
if (options.verbatimModuleSyntax) {
|
|
@@ -119930,8 +119986,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119930
119986
|
if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
119931
119987
|
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
|
|
119932
119988
|
}
|
|
119933
|
-
if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind)) {
|
|
119934
|
-
createOptionValueDiagnostic("moduleResolution", Diagnostics.
|
|
119989
|
+
if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind) && moduleKind !== 200 /* Preserve */) {
|
|
119990
|
+
createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "bundler");
|
|
119935
119991
|
}
|
|
119936
119992
|
if (ModuleKind[moduleKind] && (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && !(3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) {
|
|
119937
119993
|
const moduleKindName = ModuleKind[moduleKind];
|
|
@@ -120438,6 +120494,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120438
120494
|
}
|
|
120439
120495
|
return symlinks;
|
|
120440
120496
|
}
|
|
120497
|
+
function getModeForUsageLocation2(file, usage) {
|
|
120498
|
+
var _a2;
|
|
120499
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
120500
|
+
return getModeForUsageLocationWorker(file, usage, optionsForFile);
|
|
120501
|
+
}
|
|
120502
|
+
function getModeForResolutionAtIndex2(file, index) {
|
|
120503
|
+
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
120504
|
+
}
|
|
120441
120505
|
}
|
|
120442
120506
|
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
120443
120507
|
let setOfDeclarationDirectories;
|
|
@@ -122868,7 +122932,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122868
122932
|
const seenNamesInFile = createModeAwareCache();
|
|
122869
122933
|
for (const entry of entries) {
|
|
122870
122934
|
const name = loader.nameAndMode.getName(entry);
|
|
122871
|
-
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
122935
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options);
|
|
122872
122936
|
let resolution = resolutionsInFile.get(name, mode);
|
|
122873
122937
|
if (!seenNamesInFile.has(name, mode) && (allModuleAndTypeResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
122874
122938
|
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
@@ -122909,7 +122973,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122909
122973
|
reusedNames == null ? void 0 : reusedNames.forEach(
|
|
122910
122974
|
(entry) => seenNamesInFile.set(
|
|
122911
122975
|
loader.nameAndMode.getName(entry),
|
|
122912
|
-
loader.nameAndMode.getMode(entry, containingSourceFile),
|
|
122976
|
+
loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options),
|
|
122913
122977
|
true
|
|
122914
122978
|
)
|
|
122915
122979
|
);
|