@typescript-deploys/pr-build 5.7.0-pr-59860-2 → 5.7.0-pr-59767-6

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/typescript.js CHANGED
@@ -259,6 +259,7 @@ __export(typescript_exports, {
259
259
  canWatchAffectingLocation: () => canWatchAffectingLocation,
260
260
  canWatchAtTypes: () => canWatchAtTypes,
261
261
  canWatchDirectoryOrFile: () => canWatchDirectoryOrFile,
262
+ canWatchDirectoryOrFilePath: () => canWatchDirectoryOrFilePath,
262
263
  cartesianProduct: () => cartesianProduct,
263
264
  cast: () => cast,
264
265
  chainBundle: () => chainBundle,
@@ -591,6 +592,7 @@ __export(typescript_exports, {
591
592
  forEach: () => forEach,
592
593
  forEachAncestor: () => forEachAncestor,
593
594
  forEachAncestorDirectory: () => forEachAncestorDirectory,
595
+ forEachAncestorDirectoryStoppingAtGlobalCache: () => forEachAncestorDirectoryStoppingAtGlobalCache,
594
596
  forEachChild: () => forEachChild,
595
597
  forEachChildRecursively: () => forEachChildRecursively,
596
598
  forEachEmittedFile: () => forEachEmittedFile,
@@ -633,6 +635,7 @@ __export(typescript_exports, {
633
635
  getAllKeys: () => getAllKeys,
634
636
  getAllProjectOutputs: () => getAllProjectOutputs,
635
637
  getAllSuperTypeNodes: () => getAllSuperTypeNodes,
638
+ getAllowImportingTsExtensions: () => getAllowImportingTsExtensions,
636
639
  getAllowJSCompilerOption: () => getAllowJSCompilerOption,
637
640
  getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports,
638
641
  getAncestor: () => getAncestor,
@@ -1204,7 +1207,7 @@ __export(typescript_exports, {
1204
1207
  isBooleanLiteral: () => isBooleanLiteral,
1205
1208
  isBreakOrContinueStatement: () => isBreakOrContinueStatement,
1206
1209
  isBreakStatement: () => isBreakStatement,
1207
- isBuild: () => isBuild,
1210
+ isBuildCommand: () => isBuildCommand,
1208
1211
  isBuildInfoFile: () => isBuildInfoFile,
1209
1212
  isBuilderProgram: () => isBuilderProgram,
1210
1213
  isBundle: () => isBundle,
@@ -1620,6 +1623,7 @@ __export(typescript_exports, {
1620
1623
  isParseTreeNode: () => isParseTreeNode,
1621
1624
  isPartOfParameterDeclaration: () => isPartOfParameterDeclaration,
1622
1625
  isPartOfTypeNode: () => isPartOfTypeNode,
1626
+ isPartOfTypeOnlyImportOrExportDeclaration: () => isPartOfTypeOnlyImportOrExportDeclaration,
1623
1627
  isPartOfTypeQuery: () => isPartOfTypeQuery,
1624
1628
  isPartiallyEmittedExpression: () => isPartiallyEmittedExpression,
1625
1629
  isPatternMatch: () => isPatternMatch,
@@ -2017,6 +2021,7 @@ __export(typescript_exports, {
2017
2021
  returnTrue: () => returnTrue,
2018
2022
  returnUndefined: () => returnUndefined,
2019
2023
  returnsPromise: () => returnsPromise,
2024
+ rewriteModuleSpecifier: () => rewriteModuleSpecifier,
2020
2025
  sameFlatMap: () => sameFlatMap,
2021
2026
  sameMap: () => sameMap,
2022
2027
  sameMapping: () => sameMapping,
@@ -2062,6 +2067,7 @@ __export(typescript_exports, {
2062
2067
  setValueDeclaration: () => setValueDeclaration,
2063
2068
  shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
2064
2069
  shouldPreserveConstEnums: () => shouldPreserveConstEnums,
2070
+ shouldRewriteModuleSpecifier: () => shouldRewriteModuleSpecifier,
2065
2071
  shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
2066
2072
  showModuleSpecifier: () => showModuleSpecifier,
2067
2073
  signatureHasRestParameter: () => signatureHasRestParameter,
@@ -2213,6 +2219,7 @@ __export(typescript_exports, {
2213
2219
  tryRemoveExtension: () => tryRemoveExtension,
2214
2220
  tryRemovePrefix: () => tryRemovePrefix,
2215
2221
  tryRemoveSuffix: () => tryRemoveSuffix,
2222
+ tscBuildOption: () => tscBuildOption,
2216
2223
  typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
2217
2224
  typeAliasNamePart: () => typeAliasNamePart,
2218
2225
  typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
@@ -2266,7 +2273,7 @@ module.exports = __toCommonJS(typescript_exports);
2266
2273
 
2267
2274
  // src/compiler/corePublic.ts
2268
2275
  var versionMajorMinor = "5.7";
2269
- var version = `${versionMajorMinor}.0-insiders.20240904`;
2276
+ var version = `${versionMajorMinor}.0-insiders.20240917`;
2270
2277
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2271
2278
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2272
2279
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -7038,43 +7045,42 @@ var InternalEmitFlags = /* @__PURE__ */ ((InternalEmitFlags3) => {
7038
7045
  InternalEmitFlags3[InternalEmitFlags3["TransformPrivateStaticElements"] = 32] = "TransformPrivateStaticElements";
7039
7046
  return InternalEmitFlags3;
7040
7047
  })(InternalEmitFlags || {});
7041
- var LanguageFeatureMinimumTarget = /* @__PURE__ */ ((LanguageFeatureMinimumTarget2) => {
7042
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["Classes"] = 2 /* ES2015 */] = "Classes";
7043
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ForOf"] = 2 /* ES2015 */] = "ForOf";
7044
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["Generators"] = 2 /* ES2015 */] = "Generators";
7045
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["Iteration"] = 2 /* ES2015 */] = "Iteration";
7046
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["SpreadElements"] = 2 /* ES2015 */] = "SpreadElements";
7047
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["RestElements"] = 2 /* ES2015 */] = "RestElements";
7048
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["TaggedTemplates"] = 2 /* ES2015 */] = "TaggedTemplates";
7049
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["DestructuringAssignment"] = 2 /* ES2015 */] = "DestructuringAssignment";
7050
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["BindingPatterns"] = 2 /* ES2015 */] = "BindingPatterns";
7051
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ArrowFunctions"] = 2 /* ES2015 */] = "ArrowFunctions";
7052
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["BlockScopedVariables"] = 2 /* ES2015 */] = "BlockScopedVariables";
7053
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ObjectAssign"] = 2 /* ES2015 */] = "ObjectAssign";
7054
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["RegularExpressionFlagsUnicode"] = 2 /* ES2015 */] = "RegularExpressionFlagsUnicode";
7055
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["RegularExpressionFlagsSticky"] = 2 /* ES2015 */] = "RegularExpressionFlagsSticky";
7056
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["Exponentiation"] = 3 /* ES2016 */] = "Exponentiation";
7057
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["AsyncFunctions"] = 4 /* ES2017 */] = "AsyncFunctions";
7058
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ForAwaitOf"] = 5 /* ES2018 */] = "ForAwaitOf";
7059
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["AsyncGenerators"] = 5 /* ES2018 */] = "AsyncGenerators";
7060
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["AsyncIteration"] = 5 /* ES2018 */] = "AsyncIteration";
7061
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ObjectSpreadRest"] = 5 /* ES2018 */] = "ObjectSpreadRest";
7062
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["RegularExpressionFlagsDotAll"] = 5 /* ES2018 */] = "RegularExpressionFlagsDotAll";
7063
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["BindinglessCatch"] = 6 /* ES2019 */] = "BindinglessCatch";
7064
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["BigInt"] = 7 /* ES2020 */] = "BigInt";
7065
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["NullishCoalesce"] = 7 /* ES2020 */] = "NullishCoalesce";
7066
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["OptionalChaining"] = 7 /* ES2020 */] = "OptionalChaining";
7067
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["LogicalAssignment"] = 8 /* ES2021 */] = "LogicalAssignment";
7068
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["TopLevelAwait"] = 9 /* ES2022 */] = "TopLevelAwait";
7069
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ClassFields"] = 9 /* ES2022 */] = "ClassFields";
7070
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["PrivateNamesAndClassStaticBlocks"] = 9 /* ES2022 */] = "PrivateNamesAndClassStaticBlocks";
7071
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["RegularExpressionFlagsHasIndices"] = 9 /* ES2022 */] = "RegularExpressionFlagsHasIndices";
7072
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ShebangComments"] = 99 /* ESNext */] = "ShebangComments";
7073
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["UsingAndAwaitUsing"] = 99 /* ESNext */] = "UsingAndAwaitUsing";
7074
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["ClassAndClassElementDecorators"] = 99 /* ESNext */] = "ClassAndClassElementDecorators";
7075
- LanguageFeatureMinimumTarget2[LanguageFeatureMinimumTarget2["RegularExpressionFlagsUnicodeSets"] = 99 /* ESNext */] = "RegularExpressionFlagsUnicodeSets";
7076
- return LanguageFeatureMinimumTarget2;
7077
- })(LanguageFeatureMinimumTarget || {});
7048
+ var LanguageFeatureMinimumTarget = {
7049
+ Classes: 2 /* ES2015 */,
7050
+ ForOf: 2 /* ES2015 */,
7051
+ Generators: 2 /* ES2015 */,
7052
+ Iteration: 2 /* ES2015 */,
7053
+ SpreadElements: 2 /* ES2015 */,
7054
+ RestElements: 2 /* ES2015 */,
7055
+ TaggedTemplates: 2 /* ES2015 */,
7056
+ DestructuringAssignment: 2 /* ES2015 */,
7057
+ BindingPatterns: 2 /* ES2015 */,
7058
+ ArrowFunctions: 2 /* ES2015 */,
7059
+ BlockScopedVariables: 2 /* ES2015 */,
7060
+ ObjectAssign: 2 /* ES2015 */,
7061
+ RegularExpressionFlagsUnicode: 2 /* ES2015 */,
7062
+ RegularExpressionFlagsSticky: 2 /* ES2015 */,
7063
+ Exponentiation: 3 /* ES2016 */,
7064
+ AsyncFunctions: 4 /* ES2017 */,
7065
+ ForAwaitOf: 5 /* ES2018 */,
7066
+ AsyncGenerators: 5 /* ES2018 */,
7067
+ AsyncIteration: 5 /* ES2018 */,
7068
+ ObjectSpreadRest: 5 /* ES2018 */,
7069
+ RegularExpressionFlagsDotAll: 5 /* ES2018 */,
7070
+ BindinglessCatch: 6 /* ES2019 */,
7071
+ BigInt: 7 /* ES2020 */,
7072
+ NullishCoalesce: 7 /* ES2020 */,
7073
+ OptionalChaining: 7 /* ES2020 */,
7074
+ LogicalAssignment: 8 /* ES2021 */,
7075
+ TopLevelAwait: 9 /* ES2022 */,
7076
+ ClassFields: 9 /* ES2022 */,
7077
+ PrivateNamesAndClassStaticBlocks: 9 /* ES2022 */,
7078
+ RegularExpressionFlagsHasIndices: 9 /* ES2022 */,
7079
+ ShebangComments: 99 /* ESNext */,
7080
+ UsingAndAwaitUsing: 99 /* ESNext */,
7081
+ ClassAndClassElementDecorators: 99 /* ESNext */,
7082
+ RegularExpressionFlagsUnicodeSets: 99 /* ESNext */
7083
+ };
7078
7084
  var ExternalEmitHelpers = /* @__PURE__ */ ((ExternalEmitHelpers2) => {
7079
7085
  ExternalEmitHelpers2[ExternalEmitHelpers2["Extends"] = 1] = "Extends";
7080
7086
  ExternalEmitHelpers2[ExternalEmitHelpers2["Assign"] = 2] = "Assign";
@@ -10118,6 +10124,9 @@ var Diagnostics = {
10118
10124
  This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
10119
10125
  This_kind_of_expression_is_always_truthy: diag(2872, 1 /* Error */, "This_kind_of_expression_is_always_truthy_2872", "This kind of expression is always truthy."),
10120
10126
  This_kind_of_expression_is_always_falsy: diag(2873, 1 /* Error */, "This_kind_of_expression_is_always_falsy_2873", "This kind of expression is always falsy."),
10127
+ This_relative_import_path_is_unsafe_to_rewrite_because_it_looks_like_a_file_name_but_actually_resolves_to_0: diag(2874, 1 /* Error */, "This_relative_import_path_is_unsafe_to_rewrite_because_it_looks_like_a_file_name_but_actually_resolv_2874", 'This relative import path is unsafe to rewrite because it looks like a file name, but actually resolves to "{0}".'),
10128
+ This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_during_emit_because_it_is_not_a_relative_path: diag(2875, 1 /* Error */, "This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_duri_2875", "This import uses a '{0}' extension to resolve to an input TypeScript file, but will not be rewritten during emit because it is not a relative path."),
10129
+ This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files: diag(2876, 1 /* Error */, "This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_b_2876", "This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files."),
10121
10130
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
10122
10131
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
10123
10132
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -10675,6 +10684,7 @@ var Diagnostics = {
10675
10684
  Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
10676
10685
  Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors: diag(6419, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors_6419", "Project '{0}' is out of date because buildinfo file '{1}' indicates that program needs to report errors."),
10677
10686
  Project_0_is_out_of_date_because_1: diag(6420, 3 /* Message */, "Project_0_is_out_of_date_because_1_6420", "Project '{0}' is out of date because {1}."),
10687
+ Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_in_output_files: diag(6421, 3 /* Message */, "Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_i_6421", "Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files."),
10678
10688
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
10679
10689
  The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
10680
10690
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -11471,11 +11481,11 @@ var charCodeToRegExpFlag = /* @__PURE__ */ new Map([
11471
11481
  [121 /* y */, 128 /* Sticky */]
11472
11482
  ]);
11473
11483
  var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
11474
- [1 /* HasIndices */, 9 /* RegularExpressionFlagsHasIndices */],
11475
- [16 /* DotAll */, 5 /* RegularExpressionFlagsDotAll */],
11476
- [32 /* Unicode */, 2 /* RegularExpressionFlagsUnicode */],
11477
- [64 /* UnicodeSets */, 99 /* RegularExpressionFlagsUnicodeSets */],
11478
- [128 /* Sticky */, 2 /* RegularExpressionFlagsSticky */]
11484
+ [1 /* HasIndices */, LanguageFeatureMinimumTarget.RegularExpressionFlagsHasIndices],
11485
+ [16 /* DotAll */, LanguageFeatureMinimumTarget.RegularExpressionFlagsDotAll],
11486
+ [32 /* Unicode */, LanguageFeatureMinimumTarget.RegularExpressionFlagsUnicode],
11487
+ [64 /* UnicodeSets */, LanguageFeatureMinimumTarget.RegularExpressionFlagsUnicodeSets],
11488
+ [128 /* Sticky */, LanguageFeatureMinimumTarget.RegularExpressionFlagsSticky]
11479
11489
  ]);
11480
11490
  var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6e3, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43e3, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500];
11481
11491
  var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6e3, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43e3, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500];
@@ -15364,6 +15374,9 @@ function isTypeOnlyExportDeclaration(node) {
15364
15374
  function isTypeOnlyImportOrExportDeclaration(node) {
15365
15375
  return isTypeOnlyImportDeclaration(node) || isTypeOnlyExportDeclaration(node);
15366
15376
  }
15377
+ function isPartOfTypeOnlyImportOrExportDeclaration(node) {
15378
+ return findAncestor(node, isTypeOnlyImportOrExportDeclaration) !== void 0;
15379
+ }
15367
15380
  function isStringTextContainingNode(node) {
15368
15381
  return node.kind === 11 /* StringLiteral */ || isTemplateLiteralKind(node.kind);
15369
15382
  }
@@ -18700,6 +18713,9 @@ function tryGetImportFromModuleSpecifier(node) {
18700
18713
  return void 0;
18701
18714
  }
18702
18715
  }
18716
+ function shouldRewriteModuleSpecifier(specifier, compilerOptions) {
18717
+ return !!compilerOptions.rewriteRelativeImportExtensions && pathIsRelative(specifier) && !isDeclarationFileName(specifier);
18718
+ }
18703
18719
  function getExternalModuleName(node) {
18704
18720
  switch (node.kind) {
18705
18721
  case 272 /* ImportDeclaration */:
@@ -18744,17 +18760,15 @@ function forEachImportClauseDeclaration(node, action) {
18744
18760
  }
18745
18761
  }
18746
18762
  function hasQuestionToken(node) {
18747
- if (node) {
18748
- switch (node.kind) {
18749
- case 169 /* Parameter */:
18750
- case 174 /* MethodDeclaration */:
18751
- case 173 /* MethodSignature */:
18752
- case 304 /* ShorthandPropertyAssignment */:
18753
- case 303 /* PropertyAssignment */:
18754
- case 172 /* PropertyDeclaration */:
18755
- case 171 /* PropertySignature */:
18756
- return node.questionToken !== void 0;
18757
- }
18763
+ switch (node.kind) {
18764
+ case 169 /* Parameter */:
18765
+ case 174 /* MethodDeclaration */:
18766
+ case 173 /* MethodSignature */:
18767
+ case 304 /* ShorthandPropertyAssignment */:
18768
+ case 303 /* PropertyAssignment */:
18769
+ case 172 /* PropertyDeclaration */:
18770
+ case 171 /* PropertySignature */:
18771
+ return node.questionToken !== void 0;
18758
18772
  }
18759
18773
  return false;
18760
18774
  }
@@ -21004,6 +21018,12 @@ function getLinesBetweenPositionAndNextNonWhitespaceCharacter(pos, stopPos, sour
21004
21018
  );
21005
21019
  return getLinesBetweenPositions(sourceFile, pos, Math.min(stopPos, nextPos));
21006
21020
  }
21021
+ function rangeContainsRange(r1, r2) {
21022
+ return startEndContainsRange(r1.pos, r1.end, r2);
21023
+ }
21024
+ function startEndContainsRange(start, end, range) {
21025
+ return start <= range.pos && end >= range.end;
21026
+ }
21007
21027
  function getPreviousNonWhitespacePosition(pos, stopPos = 0, sourceFile) {
21008
21028
  while (pos-- > stopPos) {
21009
21029
  if (!isWhiteSpaceLike(sourceFile.text.charCodeAt(pos))) {
@@ -21668,7 +21688,13 @@ function importSyntaxAffectsModuleResolution(options) {
21668
21688
  function createComputedCompilerOptions(options) {
21669
21689
  return options;
21670
21690
  }
21671
- var computedOptions = createComputedCompilerOptions({
21691
+ var _computedOptions = createComputedCompilerOptions({
21692
+ allowImportingTsExtensions: {
21693
+ dependencies: ["rewriteRelativeImportExtensions"],
21694
+ computeValue: (compilerOptions) => {
21695
+ return !!(compilerOptions.allowImportingTsExtensions || compilerOptions.rewriteRelativeImportExtensions);
21696
+ }
21697
+ },
21672
21698
  target: {
21673
21699
  dependencies: ["module"],
21674
21700
  computeValue: (compilerOptions) => {
@@ -21679,7 +21705,7 @@ var computedOptions = createComputedCompilerOptions({
21679
21705
  module: {
21680
21706
  dependencies: ["target"],
21681
21707
  computeValue: (compilerOptions) => {
21682
- return typeof compilerOptions.module === "number" ? compilerOptions.module : computedOptions.target.computeValue(compilerOptions) >= 2 /* ES2015 */ ? 5 /* ES2015 */ : 1 /* CommonJS */;
21708
+ return typeof compilerOptions.module === "number" ? compilerOptions.module : _computedOptions.target.computeValue(compilerOptions) >= 2 /* ES2015 */ ? 5 /* ES2015 */ : 1 /* CommonJS */;
21683
21709
  }
21684
21710
  },
21685
21711
  moduleResolution: {
@@ -21687,7 +21713,7 @@ var computedOptions = createComputedCompilerOptions({
21687
21713
  computeValue: (compilerOptions) => {
21688
21714
  let moduleResolution = compilerOptions.moduleResolution;
21689
21715
  if (moduleResolution === void 0) {
21690
- switch (computedOptions.module.computeValue(compilerOptions)) {
21716
+ switch (_computedOptions.module.computeValue(compilerOptions)) {
21691
21717
  case 1 /* CommonJS */:
21692
21718
  moduleResolution = 2 /* Node10 */;
21693
21719
  break;
@@ -21711,7 +21737,7 @@ var computedOptions = createComputedCompilerOptions({
21711
21737
  moduleDetection: {
21712
21738
  dependencies: ["module", "target"],
21713
21739
  computeValue: (compilerOptions) => {
21714
- return compilerOptions.moduleDetection || (computedOptions.module.computeValue(compilerOptions) === 100 /* Node16 */ || computedOptions.module.computeValue(compilerOptions) === 199 /* NodeNext */ ? 3 /* Force */ : 2 /* Auto */);
21740
+ return compilerOptions.moduleDetection || (_computedOptions.module.computeValue(compilerOptions) === 100 /* Node16 */ || _computedOptions.module.computeValue(compilerOptions) === 199 /* NodeNext */ ? 3 /* Force */ : 2 /* Auto */);
21715
21741
  }
21716
21742
  },
21717
21743
  isolatedModules: {
@@ -21726,7 +21752,7 @@ var computedOptions = createComputedCompilerOptions({
21726
21752
  if (compilerOptions.esModuleInterop !== void 0) {
21727
21753
  return compilerOptions.esModuleInterop;
21728
21754
  }
21729
- switch (computedOptions.module.computeValue(compilerOptions)) {
21755
+ switch (_computedOptions.module.computeValue(compilerOptions)) {
21730
21756
  case 100 /* Node16 */:
21731
21757
  case 199 /* NodeNext */:
21732
21758
  case 200 /* Preserve */:
@@ -21741,13 +21767,13 @@ var computedOptions = createComputedCompilerOptions({
21741
21767
  if (compilerOptions.allowSyntheticDefaultImports !== void 0) {
21742
21768
  return compilerOptions.allowSyntheticDefaultImports;
21743
21769
  }
21744
- return computedOptions.esModuleInterop.computeValue(compilerOptions) || computedOptions.module.computeValue(compilerOptions) === 4 /* System */ || computedOptions.moduleResolution.computeValue(compilerOptions) === 100 /* Bundler */;
21770
+ return _computedOptions.esModuleInterop.computeValue(compilerOptions) || _computedOptions.module.computeValue(compilerOptions) === 4 /* System */ || _computedOptions.moduleResolution.computeValue(compilerOptions) === 100 /* Bundler */;
21745
21771
  }
21746
21772
  },
21747
21773
  resolvePackageJsonExports: {
21748
21774
  dependencies: ["moduleResolution"],
21749
21775
  computeValue: (compilerOptions) => {
21750
- const moduleResolution = computedOptions.moduleResolution.computeValue(compilerOptions);
21776
+ const moduleResolution = _computedOptions.moduleResolution.computeValue(compilerOptions);
21751
21777
  if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
21752
21778
  return false;
21753
21779
  }
@@ -21766,7 +21792,7 @@ var computedOptions = createComputedCompilerOptions({
21766
21792
  resolvePackageJsonImports: {
21767
21793
  dependencies: ["moduleResolution", "resolvePackageJsonExports"],
21768
21794
  computeValue: (compilerOptions) => {
21769
- const moduleResolution = computedOptions.moduleResolution.computeValue(compilerOptions);
21795
+ const moduleResolution = _computedOptions.moduleResolution.computeValue(compilerOptions);
21770
21796
  if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
21771
21797
  return false;
21772
21798
  }
@@ -21788,7 +21814,7 @@ var computedOptions = createComputedCompilerOptions({
21788
21814
  if (compilerOptions.resolveJsonModule !== void 0) {
21789
21815
  return compilerOptions.resolveJsonModule;
21790
21816
  }
21791
- return computedOptions.moduleResolution.computeValue(compilerOptions) === 100 /* Bundler */;
21817
+ return _computedOptions.moduleResolution.computeValue(compilerOptions) === 100 /* Bundler */;
21792
21818
  }
21793
21819
  },
21794
21820
  declaration: {
@@ -21800,7 +21826,7 @@ var computedOptions = createComputedCompilerOptions({
21800
21826
  preserveConstEnums: {
21801
21827
  dependencies: ["isolatedModules", "verbatimModuleSyntax"],
21802
21828
  computeValue: (compilerOptions) => {
21803
- return !!(compilerOptions.preserveConstEnums || computedOptions.isolatedModules.computeValue(compilerOptions));
21829
+ return !!(compilerOptions.preserveConstEnums || _computedOptions.isolatedModules.computeValue(compilerOptions));
21804
21830
  }
21805
21831
  },
21806
21832
  incremental: {
@@ -21812,7 +21838,7 @@ var computedOptions = createComputedCompilerOptions({
21812
21838
  declarationMap: {
21813
21839
  dependencies: ["declaration", "composite"],
21814
21840
  computeValue: (compilerOptions) => {
21815
- return !!(compilerOptions.declarationMap && computedOptions.declaration.computeValue(compilerOptions));
21841
+ return !!(compilerOptions.declarationMap && _computedOptions.declaration.computeValue(compilerOptions));
21816
21842
  }
21817
21843
  },
21818
21844
  allowJs: {
@@ -21824,7 +21850,7 @@ var computedOptions = createComputedCompilerOptions({
21824
21850
  useDefineForClassFields: {
21825
21851
  dependencies: ["target", "module"],
21826
21852
  computeValue: (compilerOptions) => {
21827
- return compilerOptions.useDefineForClassFields === void 0 ? computedOptions.target.computeValue(compilerOptions) >= 9 /* ES2022 */ : compilerOptions.useDefineForClassFields;
21853
+ return compilerOptions.useDefineForClassFields === void 0 ? _computedOptions.target.computeValue(compilerOptions) >= 9 /* ES2022 */ : compilerOptions.useDefineForClassFields;
21828
21854
  }
21829
21855
  },
21830
21856
  noImplicitAny: {
@@ -21882,22 +21908,24 @@ var computedOptions = createComputedCompilerOptions({
21882
21908
  }
21883
21909
  }
21884
21910
  });
21885
- var getEmitScriptTarget = computedOptions.target.computeValue;
21886
- var getEmitModuleKind = computedOptions.module.computeValue;
21887
- var getEmitModuleResolutionKind = computedOptions.moduleResolution.computeValue;
21888
- var getEmitModuleDetectionKind = computedOptions.moduleDetection.computeValue;
21889
- var getIsolatedModules = computedOptions.isolatedModules.computeValue;
21890
- var getESModuleInterop = computedOptions.esModuleInterop.computeValue;
21891
- var getAllowSyntheticDefaultImports = computedOptions.allowSyntheticDefaultImports.computeValue;
21892
- var getResolvePackageJsonExports = computedOptions.resolvePackageJsonExports.computeValue;
21893
- var getResolvePackageJsonImports = computedOptions.resolvePackageJsonImports.computeValue;
21894
- var getResolveJsonModule = computedOptions.resolveJsonModule.computeValue;
21895
- var getEmitDeclarations = computedOptions.declaration.computeValue;
21896
- var shouldPreserveConstEnums = computedOptions.preserveConstEnums.computeValue;
21897
- var isIncrementalCompilation = computedOptions.incremental.computeValue;
21898
- var getAreDeclarationMapsEnabled = computedOptions.declarationMap.computeValue;
21899
- var getAllowJSCompilerOption = computedOptions.allowJs.computeValue;
21900
- var getUseDefineForClassFields = computedOptions.useDefineForClassFields.computeValue;
21911
+ var computedOptions = _computedOptions;
21912
+ var getAllowImportingTsExtensions = _computedOptions.allowImportingTsExtensions.computeValue;
21913
+ var getEmitScriptTarget = _computedOptions.target.computeValue;
21914
+ var getEmitModuleKind = _computedOptions.module.computeValue;
21915
+ var getEmitModuleResolutionKind = _computedOptions.moduleResolution.computeValue;
21916
+ var getEmitModuleDetectionKind = _computedOptions.moduleDetection.computeValue;
21917
+ var getIsolatedModules = _computedOptions.isolatedModules.computeValue;
21918
+ var getESModuleInterop = _computedOptions.esModuleInterop.computeValue;
21919
+ var getAllowSyntheticDefaultImports = _computedOptions.allowSyntheticDefaultImports.computeValue;
21920
+ var getResolvePackageJsonExports = _computedOptions.resolvePackageJsonExports.computeValue;
21921
+ var getResolvePackageJsonImports = _computedOptions.resolvePackageJsonImports.computeValue;
21922
+ var getResolveJsonModule = _computedOptions.resolveJsonModule.computeValue;
21923
+ var getEmitDeclarations = _computedOptions.declaration.computeValue;
21924
+ var shouldPreserveConstEnums = _computedOptions.preserveConstEnums.computeValue;
21925
+ var isIncrementalCompilation = _computedOptions.incremental.computeValue;
21926
+ var getAreDeclarationMapsEnabled = _computedOptions.declarationMap.computeValue;
21927
+ var getAllowJSCompilerOption = _computedOptions.allowJs.computeValue;
21928
+ var getUseDefineForClassFields = _computedOptions.useDefineForClassFields.computeValue;
21901
21929
  function emitModuleKindIsNonNodeESM(moduleKind) {
21902
21930
  return moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */;
21903
21931
  }
@@ -31282,23 +31310,21 @@ function hasRecordedExternalHelpers(sourceFile) {
31282
31310
  }
31283
31311
  function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFactory, sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar, hasImportDefault) {
31284
31312
  if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
31285
- let namedBindings;
31286
31313
  const moduleKind = getEmitModuleKind(compilerOptions);
31287
- if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions) === 99 /* ESNext */) {
31288
- const helpers = getEmitHelpers(sourceFile);
31314
+ const impliedModuleKind = getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions);
31315
+ const helpers = getImportedHelpers(sourceFile);
31316
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || impliedModuleKind === 99 /* ESNext */ || impliedModuleKind === void 0 && moduleKind === 200 /* Preserve */) {
31289
31317
  if (helpers) {
31290
31318
  const helperNames = [];
31291
31319
  for (const helper of helpers) {
31292
- if (!helper.scoped) {
31293
- const importName = helper.importName;
31294
- if (importName) {
31295
- pushIfUnique(helperNames, importName);
31296
- }
31320
+ const importName = helper.importName;
31321
+ if (importName) {
31322
+ pushIfUnique(helperNames, importName);
31297
31323
  }
31298
31324
  }
31299
31325
  if (some(helperNames)) {
31300
31326
  helperNames.sort(compareStringsCaseSensitive);
31301
- namedBindings = nodeFactory.createNamedImports(
31327
+ const namedBindings = nodeFactory.createNamedImports(
31302
31328
  map(helperNames, (name) => isFileLevelUniqueName(sourceFile, name) ? nodeFactory.createImportSpecifier(
31303
31329
  /*isTypeOnly*/
31304
31330
  false,
@@ -31315,57 +31341,54 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
31315
31341
  const parseNode = getOriginalNode(sourceFile, isSourceFile);
31316
31342
  const emitNode = getOrCreateEmitNode(parseNode);
31317
31343
  emitNode.externalHelpers = true;
31344
+ const externalHelpersImportDeclaration = nodeFactory.createImportDeclaration(
31345
+ /*modifiers*/
31346
+ void 0,
31347
+ nodeFactory.createImportClause(
31348
+ /*isTypeOnly*/
31349
+ false,
31350
+ /*name*/
31351
+ void 0,
31352
+ namedBindings
31353
+ ),
31354
+ nodeFactory.createStringLiteral(externalHelpersModuleNameText),
31355
+ /*attributes*/
31356
+ void 0
31357
+ );
31358
+ addInternalEmitFlags(externalHelpersImportDeclaration, 2 /* NeverApplyImportHelper */);
31359
+ return externalHelpersImportDeclaration;
31318
31360
  }
31319
31361
  }
31320
31362
  } else {
31321
- const externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(nodeFactory, sourceFile, compilerOptions, hasExportStarsToExportValues, hasImportStar || hasImportDefault);
31363
+ const externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(nodeFactory, sourceFile, compilerOptions, helpers, hasExportStarsToExportValues, hasImportStar || hasImportDefault);
31322
31364
  if (externalHelpersModuleName) {
31323
- namedBindings = nodeFactory.createNamespaceImport(externalHelpersModuleName);
31324
- }
31325
- }
31326
- if (namedBindings) {
31327
- const externalHelpersImportDeclaration = nodeFactory.createImportDeclaration(
31328
- /*modifiers*/
31329
- void 0,
31330
- nodeFactory.createImportClause(
31365
+ const externalHelpersImportDeclaration = nodeFactory.createImportEqualsDeclaration(
31366
+ /*modifiers*/
31367
+ void 0,
31331
31368
  /*isTypeOnly*/
31332
31369
  false,
31333
- /*name*/
31334
- void 0,
31335
- namedBindings
31336
- ),
31337
- nodeFactory.createStringLiteral(externalHelpersModuleNameText),
31338
- /*attributes*/
31339
- void 0
31340
- );
31341
- addInternalEmitFlags(externalHelpersImportDeclaration, 2 /* NeverApplyImportHelper */);
31342
- return externalHelpersImportDeclaration;
31370
+ externalHelpersModuleName,
31371
+ nodeFactory.createExternalModuleReference(nodeFactory.createStringLiteral(externalHelpersModuleNameText))
31372
+ );
31373
+ addInternalEmitFlags(externalHelpersImportDeclaration, 2 /* NeverApplyImportHelper */);
31374
+ return externalHelpersImportDeclaration;
31375
+ }
31343
31376
  }
31344
31377
  }
31345
31378
  }
31346
- function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOptions, hasExportStarsToExportValues, hasImportStarOrImportDefault) {
31347
- if (compilerOptions.importHelpers && isEffectiveExternalModule(node, compilerOptions)) {
31348
- const externalHelpersModuleName = getExternalHelpersModuleName(node);
31349
- if (externalHelpersModuleName) {
31350
- return externalHelpersModuleName;
31351
- }
31352
- let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && getEmitModuleFormatOfFileWorker(node, compilerOptions) < 4 /* System */;
31353
- if (!create) {
31354
- const helpers = getEmitHelpers(node);
31355
- if (helpers) {
31356
- for (const helper of helpers) {
31357
- if (!helper.scoped) {
31358
- create = true;
31359
- break;
31360
- }
31361
- }
31362
- }
31363
- }
31364
- if (create) {
31365
- const parseNode = getOriginalNode(node, isSourceFile);
31366
- const emitNode = getOrCreateEmitNode(parseNode);
31367
- return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = factory2.createUniqueName(externalHelpersModuleNameText));
31368
- }
31379
+ function getImportedHelpers(sourceFile) {
31380
+ return filter(getEmitHelpers(sourceFile), (helper) => !helper.scoped);
31381
+ }
31382
+ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOptions, helpers, hasExportStarsToExportValues, hasImportStarOrImportDefault) {
31383
+ const externalHelpersModuleName = getExternalHelpersModuleName(node);
31384
+ if (externalHelpersModuleName) {
31385
+ return externalHelpersModuleName;
31386
+ }
31387
+ const create = some(helpers) || (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && getEmitModuleFormatOfFileWorker(node, compilerOptions) < 4 /* System */;
31388
+ if (create) {
31389
+ const parseNode = getOriginalNode(node, isSourceFile);
31390
+ const emitNode = getOrCreateEmitNode(parseNode);
31391
+ return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = factory2.createUniqueName(externalHelpersModuleNameText));
31369
31392
  }
31370
31393
  }
31371
31394
  function getLocalNameForExternalImport(factory2, node, sourceFile) {
@@ -40542,15 +40565,6 @@ var commandOptionsWithoutBuild = [
40542
40565
  paramType: Diagnostics.FILE_OR_DIRECTORY,
40543
40566
  description: Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json
40544
40567
  },
40545
- {
40546
- name: "build",
40547
- type: "boolean",
40548
- shortName: "b",
40549
- showInSimplifiedHelpView: true,
40550
- category: Diagnostics.Command_line_Options,
40551
- description: Diagnostics.Build_one_or_more_projects_and_their_dependencies_if_out_of_date,
40552
- defaultValueDescription: false
40553
- },
40554
40568
  {
40555
40569
  name: "showConfig",
40556
40570
  type: "boolean",
@@ -41075,6 +41089,15 @@ var commandOptionsWithoutBuild = [
41075
41089
  defaultValueDescription: false,
41076
41090
  transpileOptionValue: void 0
41077
41091
  },
41092
+ {
41093
+ name: "rewriteRelativeImportExtensions",
41094
+ type: "boolean",
41095
+ affectsSemanticDiagnostics: true,
41096
+ affectsBuildInfo: true,
41097
+ category: Diagnostics.Modules,
41098
+ description: Diagnostics.Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_in_output_files,
41099
+ defaultValueDescription: false
41100
+ },
41078
41101
  {
41079
41102
  name: "resolvePackageJsonExports",
41080
41103
  type: "boolean",
@@ -41535,7 +41558,17 @@ var commandLineOptionOfCustomType = optionDeclarations.filter(isCommandLineOptio
41535
41558
  function isCommandLineOptionOfCustomType(option) {
41536
41559
  return !isString(option.type);
41537
41560
  }
41561
+ var tscBuildOption = {
41562
+ name: "build",
41563
+ type: "boolean",
41564
+ shortName: "b",
41565
+ showInSimplifiedHelpView: true,
41566
+ category: Diagnostics.Command_line_Options,
41567
+ description: Diagnostics.Build_one_or_more_projects_and_their_dependencies_if_out_of_date,
41568
+ defaultValueDescription: false
41569
+ };
41538
41570
  var optionsForBuild = [
41571
+ tscBuildOption,
41539
41572
  {
41540
41573
  name: "verbose",
41541
41574
  shortName: "v",
@@ -41674,8 +41707,14 @@ function getOptionName(option) {
41674
41707
  }
41675
41708
  function createUnknownOptionError(unknownOption, diagnostics, unknownOptionErrorText, node, sourceFile) {
41676
41709
  var _a;
41677
- if ((_a = diagnostics.alternateMode) == null ? void 0 : _a.getOptionsNameMap().optionsNameMap.has(unknownOption.toLowerCase())) {
41678
- return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.alternateMode.diagnostic, unknownOption);
41710
+ const otherOption = (_a = diagnostics.alternateMode) == null ? void 0 : _a.getOptionsNameMap().optionsNameMap.get(unknownOption.toLowerCase());
41711
+ if (otherOption) {
41712
+ return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(
41713
+ sourceFile,
41714
+ node,
41715
+ otherOption !== tscBuildOption ? diagnostics.alternateMode.diagnostic : Diagnostics.Option_build_must_be_the_first_command_line_argument,
41716
+ unknownOption
41717
+ );
41679
41718
  }
41680
41719
  const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
41681
41720
  return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
@@ -41864,10 +41903,10 @@ var buildOptionsDidYouMeanDiagnostics = {
41864
41903
  unknownDidYouMeanDiagnostic: Diagnostics.Unknown_build_option_0_Did_you_mean_1,
41865
41904
  optionTypeMismatchDiagnostic: Diagnostics.Build_option_0_requires_a_value_of_type_1
41866
41905
  };
41867
- function parseBuildCommand(args) {
41906
+ function parseBuildCommand(commandLine) {
41868
41907
  const { options, watchOptions, fileNames: projects, errors } = parseCommandLineWorker(
41869
41908
  buildOptionsDidYouMeanDiagnostics,
41870
- args
41909
+ commandLine
41871
41910
  );
41872
41911
  const buildOptions = options;
41873
41912
  if (projects.length === 0) {
@@ -42810,7 +42849,7 @@ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutio
42810
42849
  if (ownConfig.raw.compileOnSave === void 0 && result.compileOnSave) ownConfig.raw.compileOnSave = result.compileOnSave;
42811
42850
  if (sourceFile && result.extendedSourceFiles) sourceFile.extendedSourceFiles = arrayFrom(result.extendedSourceFiles.keys());
42812
42851
  ownConfig.options = assign(result.options, ownConfig.options);
42813
- ownConfig.watchOptions = ownConfig.watchOptions && result.watchOptions ? assign(result.watchOptions, ownConfig.watchOptions) : ownConfig.watchOptions || result.watchOptions;
42852
+ ownConfig.watchOptions = ownConfig.watchOptions && result.watchOptions ? assignWatchOptions(result, ownConfig.watchOptions) : ownConfig.watchOptions || result.watchOptions;
42814
42853
  }
42815
42854
  return ownConfig;
42816
42855
  function applyExtendedConfig(result, extendedConfigPath) {
@@ -42834,9 +42873,14 @@ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutio
42834
42873
  result.compileOnSave = extendsRaw.compileOnSave;
42835
42874
  }
42836
42875
  assign(result.options, extendedConfig.options);
42837
- result.watchOptions = result.watchOptions && extendedConfig.watchOptions ? assign({}, result.watchOptions, extendedConfig.watchOptions) : result.watchOptions || extendedConfig.watchOptions;
42876
+ result.watchOptions = result.watchOptions && extendedConfig.watchOptions ? assignWatchOptions(result, extendedConfig.watchOptions) : result.watchOptions || extendedConfig.watchOptions;
42838
42877
  }
42839
42878
  }
42879
+ function assignWatchOptions(result, watchOptions) {
42880
+ if (result.watchOptionsCopied) return assign(result.watchOptions, watchOptions);
42881
+ result.watchOptionsCopied = true;
42882
+ return assign({}, result.watchOptions, watchOptions);
42883
+ }
42840
42884
  }
42841
42885
  function parseOwnConfigOfJson(json, host, basePath, configFileName, errors) {
42842
42886
  if (hasProperty(json, "excludes")) {
@@ -43879,7 +43923,7 @@ function getConditions(options, resolutionMode) {
43879
43923
  }
43880
43924
  function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
43881
43925
  const moduleResolutionState = getTemporaryModuleResolutionState(cache == null ? void 0 : cache.getPackageJsonInfoCache(), host, options);
43882
- return forEachAncestorDirectory(containingDirectory, (ancestorDirectory) => {
43926
+ return forEachAncestorDirectoryStoppingAtGlobalCache(host, containingDirectory, (ancestorDirectory) => {
43883
43927
  if (getBaseFileName(ancestorDirectory) !== "node_modules") {
43884
43928
  const nodeModulesFolder = combinePaths(ancestorDirectory, "node_modules");
43885
43929
  const candidate = combinePaths(nodeModulesFolder, packageName);
@@ -44802,10 +44846,11 @@ function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecor
44802
44846
  }
44803
44847
  return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
44804
44848
  }
44805
- function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
44849
+ function loadFileNameFromPackageJsonField(extensions, candidate, packageJsonValue, onlyRecordFailures, state) {
44806
44850
  if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
44807
44851
  const result = tryFile(candidate, onlyRecordFailures, state);
44808
- return result !== void 0 ? { path: candidate, ext: tryExtractTSExtension(candidate), resolvedUsingTsExtension: void 0 } : void 0;
44852
+ const ext = tryExtractTSExtension(candidate);
44853
+ return result !== void 0 ? { path: candidate, ext, resolvedUsingTsExtension: packageJsonValue ? !endsWith(packageJsonValue, ext) : void 0 } : void 0;
44809
44854
  }
44810
44855
  if (state.isConfigLookup && extensions === 8 /* Json */ && fileExtensionIs(candidate, ".json" /* Json */)) {
44811
44856
  const result = tryFile(candidate, onlyRecordFailures, state);
@@ -44967,6 +45012,7 @@ function loadEntrypointsFromExportMap(scope, exports2, state, extensions) {
44967
45012
  const result = loadFileNameFromPackageJsonField(
44968
45013
  extensions,
44969
45014
  finalPath,
45015
+ target,
44970
45016
  /*onlyRecordFailures*/
44971
45017
  false,
44972
45018
  state
@@ -45011,7 +45057,8 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
45011
45057
  };
45012
45058
  }
45013
45059
  function getPackageScopeForPath(directory, state) {
45014
- return forEachAncestorDirectory(
45060
+ return forEachAncestorDirectoryStoppingAtGlobalCache(
45061
+ state.host,
45015
45062
  directory,
45016
45063
  (dir) => getPackageJsonInfo(
45017
45064
  dir,
@@ -45107,7 +45154,14 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
45107
45154
  }
45108
45155
  }
45109
45156
  const loader = (extensions2, candidate2, onlyRecordFailures2, state2) => {
45110
- const fromFile = loadFileNameFromPackageJsonField(extensions2, candidate2, onlyRecordFailures2, state2);
45157
+ const fromFile = loadFileNameFromPackageJsonField(
45158
+ extensions2,
45159
+ candidate2,
45160
+ /*packageJsonValue*/
45161
+ void 0,
45162
+ onlyRecordFailures2,
45163
+ state2
45164
+ );
45111
45165
  if (fromFile) {
45112
45166
  return noPackageId(fromFile);
45113
45167
  }
@@ -45316,13 +45370,13 @@ function comparePatternKeys(a, b) {
45316
45370
  const bPatternIndex = b.indexOf("*");
45317
45371
  const baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
45318
45372
  const baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
45319
- if (baseLenA > baseLenB) return -1;
45320
- if (baseLenB > baseLenA) return 1;
45321
- if (aPatternIndex === -1) return 1;
45322
- if (bPatternIndex === -1) return -1;
45323
- if (a.length > b.length) return -1;
45324
- if (b.length > a.length) return 1;
45325
- return 0;
45373
+ if (baseLenA > baseLenB) return -1 /* LessThan */;
45374
+ if (baseLenB > baseLenA) return 1 /* GreaterThan */;
45375
+ if (aPatternIndex === -1) return 1 /* GreaterThan */;
45376
+ if (bPatternIndex === -1) return -1 /* LessThan */;
45377
+ if (a.length > b.length) return -1 /* LessThan */;
45378
+ if (b.length > a.length) return 1 /* GreaterThan */;
45379
+ return 0 /* EqualTo */;
45326
45380
  }
45327
45381
  function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
45328
45382
  const loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
@@ -45463,6 +45517,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
45463
45517
  return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(
45464
45518
  extensions,
45465
45519
  finalPath,
45520
+ target,
45466
45521
  /*onlyRecordFailures*/
45467
45522
  false,
45468
45523
  state
@@ -45575,6 +45630,8 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
45575
45630
  return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(
45576
45631
  extensions,
45577
45632
  possibleInputWithInputExtension,
45633
+ /*packageJsonValue*/
45634
+ void 0,
45578
45635
  /*onlyRecordFailures*/
45579
45636
  false,
45580
45637
  state
@@ -45650,17 +45707,30 @@ function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName,
45650
45707
  return lookup(secondaryExtensions);
45651
45708
  }
45652
45709
  function lookup(extensions2) {
45653
- return forEachAncestorDirectory(normalizeSlashes(directory), (ancestorDirectory) => {
45654
- if (getBaseFileName(ancestorDirectory) !== "node_modules") {
45655
- const resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, ancestorDirectory, redirectedReference, state);
45656
- if (resolutionFromCache) {
45657
- return resolutionFromCache;
45710
+ return forEachAncestorDirectoryStoppingAtGlobalCache(
45711
+ state.host,
45712
+ normalizeSlashes(directory),
45713
+ (ancestorDirectory) => {
45714
+ if (getBaseFileName(ancestorDirectory) !== "node_modules") {
45715
+ const resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, ancestorDirectory, redirectedReference, state);
45716
+ if (resolutionFromCache) {
45717
+ return resolutionFromCache;
45718
+ }
45719
+ return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions2, moduleName, ancestorDirectory, state, typesScopeOnly, cache, redirectedReference));
45658
45720
  }
45659
- return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions2, moduleName, ancestorDirectory, state, typesScopeOnly, cache, redirectedReference));
45660
45721
  }
45661
- });
45722
+ );
45662
45723
  }
45663
45724
  }
45725
+ function forEachAncestorDirectoryStoppingAtGlobalCache(host, directory, callback) {
45726
+ var _a;
45727
+ const globalCache = (_a = host == null ? void 0 : host.getGlobalTypingsCacheLocation) == null ? void 0 : _a.call(host);
45728
+ return forEachAncestorDirectory(directory, (ancestorDirectory) => {
45729
+ const result = callback(ancestorDirectory);
45730
+ if (result !== void 0) return result;
45731
+ if (ancestorDirectory === globalCache) return false;
45732
+ }) || void 0;
45733
+ }
45664
45734
  function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
45665
45735
  const nodeModulesFolder = combinePaths(directory, "node_modules");
45666
45736
  const nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host);
@@ -45856,28 +45926,32 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
45856
45926
  return { value: resolvedUsingSettings };
45857
45927
  }
45858
45928
  if (!isExternalModuleNameRelative(moduleName)) {
45859
- const resolved2 = forEachAncestorDirectory(containingDirectory, (directory) => {
45860
- const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
45861
- cache,
45862
- moduleName,
45863
- /*mode*/
45864
- void 0,
45865
- directory,
45866
- redirectedReference,
45867
- state
45868
- );
45869
- if (resolutionFromCache) {
45870
- return resolutionFromCache;
45929
+ const resolved2 = forEachAncestorDirectoryStoppingAtGlobalCache(
45930
+ state.host,
45931
+ containingDirectory,
45932
+ (directory) => {
45933
+ const resolutionFromCache = tryFindNonRelativeModuleNameInCache(
45934
+ cache,
45935
+ moduleName,
45936
+ /*mode*/
45937
+ void 0,
45938
+ directory,
45939
+ redirectedReference,
45940
+ state
45941
+ );
45942
+ if (resolutionFromCache) {
45943
+ return resolutionFromCache;
45944
+ }
45945
+ const searchName = normalizePath(combinePaths(directory, moduleName));
45946
+ return toSearchResult(loadModuleFromFileNoPackageId(
45947
+ extensions,
45948
+ searchName,
45949
+ /*onlyRecordFailures*/
45950
+ false,
45951
+ state
45952
+ ));
45871
45953
  }
45872
- const searchName = normalizePath(combinePaths(directory, moduleName));
45873
- return toSearchResult(loadModuleFromFileNoPackageId(
45874
- extensions,
45875
- searchName,
45876
- /*onlyRecordFailures*/
45877
- false,
45878
- state
45879
- ));
45880
- });
45954
+ );
45881
45955
  if (resolved2) return resolved2;
45882
45956
  if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) {
45883
45957
  let resolved3 = loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
@@ -45920,7 +45994,7 @@ function resolveFromTypeRoot(moduleName, state) {
45920
45994
  }
45921
45995
  }
45922
45996
  function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
45923
- return !!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName);
45997
+ return getAllowImportingTsExtensions(compilerOptions) || !!fromFileName && isDeclarationFileName(fromFileName);
45924
45998
  }
45925
45999
  function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) {
45926
46000
  const traceEnabled = isTraceEnabled(compilerOptions, host);
@@ -49502,9 +49576,11 @@ function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
49502
49576
  if (host.getNearestAncestorDirectoryWithPackageJson) {
49503
49577
  return host.getNearestAncestorDirectoryWithPackageJson(fileName);
49504
49578
  }
49505
- return forEachAncestorDirectory(fileName, (directory) => {
49506
- return host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
49507
- });
49579
+ return forEachAncestorDirectoryStoppingAtGlobalCache(
49580
+ host,
49581
+ fileName,
49582
+ (directory) => host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0
49583
+ );
49508
49584
  }
49509
49585
  function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
49510
49586
  var _a;
@@ -49522,25 +49598,29 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
49522
49598
  }
49523
49599
  const symlinkedDirectories = (_a = host.getSymlinkCache) == null ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
49524
49600
  const fullImportedFileName = getNormalizedAbsolutePath(importedFileName, cwd);
49525
- const result = symlinkedDirectories && forEachAncestorDirectory(getDirectoryPath(fullImportedFileName), (realPathDirectory) => {
49526
- const symlinkDirectories = symlinkedDirectories.get(ensureTrailingDirectorySeparator(toPath(realPathDirectory, cwd, getCanonicalFileName)));
49527
- if (!symlinkDirectories) return void 0;
49528
- if (startsWithDirectory(importingFileName, realPathDirectory, getCanonicalFileName)) {
49529
- return false;
49530
- }
49531
- return forEach(targets, (target) => {
49532
- if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
49533
- return;
49534
- }
49535
- const relative = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
49536
- for (const symlinkDirectory of symlinkDirectories) {
49537
- const option = resolvePath(symlinkDirectory, relative);
49538
- const result2 = cb(option, target === referenceRedirect);
49539
- shouldFilterIgnoredPaths = true;
49540
- if (result2) return result2;
49601
+ const result = symlinkedDirectories && forEachAncestorDirectoryStoppingAtGlobalCache(
49602
+ host,
49603
+ getDirectoryPath(fullImportedFileName),
49604
+ (realPathDirectory) => {
49605
+ const symlinkDirectories = symlinkedDirectories.get(ensureTrailingDirectorySeparator(toPath(realPathDirectory, cwd, getCanonicalFileName)));
49606
+ if (!symlinkDirectories) return void 0;
49607
+ if (startsWithDirectory(importingFileName, realPathDirectory, getCanonicalFileName)) {
49608
+ return false;
49541
49609
  }
49542
- });
49543
- });
49610
+ return forEach(targets, (target) => {
49611
+ if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
49612
+ return;
49613
+ }
49614
+ const relative = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
49615
+ for (const symlinkDirectory of symlinkDirectories) {
49616
+ const option = resolvePath(symlinkDirectory, relative);
49617
+ const result2 = cb(option, target === referenceRedirect);
49618
+ shouldFilterIgnoredPaths = true;
49619
+ if (result2) return result2;
49620
+ }
49621
+ });
49622
+ }
49623
+ );
49544
49624
  return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
49545
49625
  }
49546
49626
  function getAllModulePaths(info, importedFileName, host, preferences, compilerOptions, options = {}) {
@@ -50439,6 +50519,7 @@ function createTypeChecker(host) {
50439
50519
  getBaseTypeOfLiteralType,
50440
50520
  getWidenedType,
50441
50521
  getWidenedLiteralType,
50522
+ fillMissingTypeArguments,
50442
50523
  getTypeFromTypeNode: (nodeIn) => {
50443
50524
  const node = getParseTreeNode(nodeIn, isTypeNode);
50444
50525
  return node ? getTypeFromTypeNode(node) : errorType;
@@ -53282,6 +53363,36 @@ function createTypeChecker(host) {
53282
53363
  const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
53283
53364
  error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
53284
53365
  }
53366
+ } else if (compilerOptions.rewriteRelativeImportExtensions && !(location.flags & 33554432 /* Ambient */) && !isDeclarationFileName(moduleReference) && !isLiteralImportTypeNode(location) && !isPartOfTypeOnlyImportOrExportDeclaration(location)) {
53367
+ const shouldRewrite = shouldRewriteModuleSpecifier(moduleReference, compilerOptions);
53368
+ if (!resolvedModule.resolvedUsingTsExtension && shouldRewrite) {
53369
+ error2(
53370
+ errorNode,
53371
+ Diagnostics.This_relative_import_path_is_unsafe_to_rewrite_because_it_looks_like_a_file_name_but_actually_resolves_to_0,
53372
+ getRelativePathFromFile(getNormalizedAbsolutePath(currentSourceFile.fileName, host.getCurrentDirectory()), resolvedModule.resolvedFileName, hostGetCanonicalFileName(host))
53373
+ );
53374
+ } else if (resolvedModule.resolvedUsingTsExtension && !shouldRewrite && sourceFileMayBeEmitted(sourceFile, host)) {
53375
+ error2(
53376
+ errorNode,
53377
+ Diagnostics.This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_during_emit_because_it_is_not_a_relative_path,
53378
+ getAnyExtensionFromPath(moduleReference)
53379
+ );
53380
+ } else if (resolvedModule.resolvedUsingTsExtension && shouldRewrite) {
53381
+ const redirect = host.getResolvedProjectReferenceToRedirect(sourceFile.path);
53382
+ if (redirect) {
53383
+ const ignoreCase = !host.useCaseSensitiveFileNames();
53384
+ const ownRootDir = host.getCommonSourceDirectory();
53385
+ const otherRootDir = getCommonSourceDirectoryOfConfig(redirect.commandLine, ignoreCase);
53386
+ const rootDirPath = getRelativePathFromDirectory(ownRootDir, otherRootDir, ignoreCase);
53387
+ const outDirPath = getRelativePathFromDirectory(compilerOptions.outDir || ownRootDir, redirect.commandLine.options.outDir || otherRootDir, ignoreCase);
53388
+ if (rootDirPath !== outDirPath) {
53389
+ error2(
53390
+ errorNode,
53391
+ Diagnostics.This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files
53392
+ );
53393
+ }
53394
+ }
53395
+ }
53285
53396
  }
53286
53397
  if (sourceFile.symbol) {
53287
53398
  if (errorNode && resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
@@ -57093,7 +57204,7 @@ function createTypeChecker(host) {
57093
57204
  }
57094
57205
  return factory.updateImportTypeNode(
57095
57206
  node,
57096
- factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)),
57207
+ factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier2(node, node.argument.literal)),
57097
57208
  visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
57098
57209
  visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
57099
57210
  visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
@@ -57247,7 +57358,7 @@ function createTypeChecker(host) {
57247
57358
  function getNameForJSDocFunctionParameter(p, index) {
57248
57359
  return p.name && isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`;
57249
57360
  }
57250
- function rewriteModuleSpecifier(parent2, lit) {
57361
+ function rewriteModuleSpecifier2(parent2, lit) {
57251
57362
  if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
57252
57363
  let name = lit.text;
57253
57364
  const nodeSymbol = getNodeLinks(node).resolvedSymbol;
@@ -60970,20 +61081,11 @@ function createTypeChecker(host) {
60970
61081
  return type;
60971
61082
  }
60972
61083
  function isLateBindableName(node) {
60973
- return isLateBindableAST(node) && isTypeUsableAsPropertyName(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(node.argumentExpression));
60974
- }
60975
- function isLateBindableIndexSignature(node) {
60976
- return isLateBindableAST(node) && isTypeUsableAsIndexSignature(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(node.argumentExpression));
60977
- }
60978
- function isLateBindableAST(node) {
60979
61084
  if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
60980
61085
  return false;
60981
61086
  }
60982
61087
  const expr = isComputedPropertyName(node) ? node.expression : node.argumentExpression;
60983
- return isEntityNameExpression(expr);
60984
- }
60985
- function isTypeUsableAsIndexSignature(type) {
60986
- return isTypeAssignableTo(type, stringNumberSymbolType);
61088
+ return isEntityNameExpression(expr) && isTypeUsableAsPropertyName(isComputedPropertyName(node) ? checkComputedPropertyName(node) : checkExpressionCached(expr));
60987
61089
  }
60988
61090
  function isLateBoundName(name) {
60989
61091
  return name.charCodeAt(0) === 95 /* _ */ && name.charCodeAt(1) === 95 /* _ */ && name.charCodeAt(2) === 64 /* at */;
@@ -60992,10 +61094,6 @@ function createTypeChecker(host) {
60992
61094
  const name = getNameOfDeclaration(node);
60993
61095
  return !!name && isLateBindableName(name);
60994
61096
  }
60995
- function hasLateBindableIndexSignature(node) {
60996
- const name = getNameOfDeclaration(node);
60997
- return !!name && isLateBindableIndexSignature(name);
60998
- }
60999
61097
  function hasBindableName(node) {
61000
61098
  return !hasDynamicName(node) || hasLateBindableName(node);
61001
61099
  }
@@ -61049,24 +61147,6 @@ function createTypeChecker(host) {
61049
61147
  }
61050
61148
  return links.resolvedSymbol;
61051
61149
  }
61052
- function lateBindIndexSignature(parent2, earlySymbols, lateSymbols, decl) {
61053
- let indexSymbol = lateSymbols.get("__index" /* Index */);
61054
- if (!indexSymbol) {
61055
- const early = earlySymbols == null ? void 0 : earlySymbols.get("__index" /* Index */);
61056
- if (!early) {
61057
- indexSymbol = createSymbol(0 /* None */, "__index" /* Index */, 4096 /* Late */);
61058
- } else {
61059
- indexSymbol = cloneSymbol(early);
61060
- indexSymbol.links.checkFlags |= 4096 /* Late */;
61061
- }
61062
- lateSymbols.set("__index" /* Index */, indexSymbol);
61063
- }
61064
- if (!indexSymbol.declarations) {
61065
- indexSymbol.declarations = [decl];
61066
- } else if (!decl.symbol.isReplaceableByMethod) {
61067
- indexSymbol.declarations.push(decl);
61068
- }
61069
- }
61070
61150
  function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
61071
61151
  const links = getSymbolLinks(symbol);
61072
61152
  if (!links[resolutionKind]) {
@@ -61081,8 +61161,6 @@ function createTypeChecker(host) {
61081
61161
  if (isStatic2 === hasStaticModifier(member)) {
61082
61162
  if (hasLateBindableName(member)) {
61083
61163
  lateBindMember(symbol, earlySymbols, lateSymbols, member);
61084
- } else if (hasLateBindableIndexSignature(member)) {
61085
- lateBindIndexSignature(symbol, earlySymbols, lateSymbols, member);
61086
61164
  }
61087
61165
  }
61088
61166
  }
@@ -63346,7 +63424,7 @@ function createTypeChecker(host) {
63346
63424
  return signature.isolatedSignatureType;
63347
63425
  }
63348
63426
  function getIndexSymbol(symbol) {
63349
- return symbol.members ? getIndexSymbolFromSymbolTable(getMembersOfSymbol(symbol)) : void 0;
63427
+ return symbol.members ? getIndexSymbolFromSymbolTable(symbol.members) : void 0;
63350
63428
  }
63351
63429
  function getIndexSymbolFromSymbolTable(symbolTable) {
63352
63430
  return symbolTable.get("__index" /* Index */);
@@ -63362,25 +63440,15 @@ function createTypeChecker(host) {
63362
63440
  if (indexSymbol.declarations) {
63363
63441
  const indexInfos = [];
63364
63442
  for (const declaration of indexSymbol.declarations) {
63365
- if (isIndexSignatureDeclaration(declaration)) {
63366
- if (declaration.parameters.length === 1) {
63367
- const parameter = declaration.parameters[0];
63368
- if (parameter.type) {
63369
- forEachType(getTypeFromTypeNode(parameter.type), (keyType) => {
63370
- if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos, keyType)) {
63371
- indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration, 8 /* Readonly */), declaration));
63372
- }
63373
- });
63374
- }
63443
+ if (declaration.parameters.length === 1) {
63444
+ const parameter = declaration.parameters[0];
63445
+ if (parameter.type) {
63446
+ forEachType(getTypeFromTypeNode(parameter.type), (keyType) => {
63447
+ if (isValidIndexKeyType(keyType) && !findIndexInfo(indexInfos, keyType)) {
63448
+ indexInfos.push(createIndexInfo(keyType, declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, hasEffectiveModifier(declaration, 8 /* Readonly */), declaration));
63449
+ }
63450
+ });
63375
63451
  }
63376
- } else if (hasLateBindableIndexSignature(declaration)) {
63377
- const declName = isBinaryExpression(declaration) ? declaration.left : declaration.name;
63378
- const keyType = isElementAccessExpression(declName) ? checkExpressionCached(declName.argumentExpression) : checkComputedPropertyName(declName);
63379
- forEachType(keyType, (keyType2) => {
63380
- if (isValidIndexKeyType(keyType2) && !findIndexInfo(indexInfos, keyType2)) {
63381
- indexInfos.push(createIndexInfo(keyType2, getTypeOfVariableOrParameterOrProperty(declaration.symbol), hasEffectiveModifier(declaration, 8 /* Readonly */)));
63382
- }
63383
- });
63384
63452
  }
63385
63453
  }
63386
63454
  return indexInfos;
@@ -77113,7 +77181,7 @@ function createTypeChecker(host) {
77113
77181
  return globalRegExpType;
77114
77182
  }
77115
77183
  function checkSpreadExpression(node, checkMode) {
77116
- if (languageVersion < 2 /* SpreadElements */) {
77184
+ if (languageVersion < LanguageFeatureMinimumTarget.SpreadElements) {
77117
77185
  checkExternalEmitHelpers(node, compilerOptions.downlevelIteration ? 1536 /* SpreadIncludes */ : 1024 /* SpreadArray */);
77118
77186
  }
77119
77187
  const arrayOrIterableType = checkExpression(node.expression, checkMode);
@@ -77147,7 +77215,7 @@ function createTypeChecker(host) {
77147
77215
  for (let i = 0; i < elementCount; i++) {
77148
77216
  const e = elements[i];
77149
77217
  if (e.kind === 230 /* SpreadElement */) {
77150
- if (languageVersion < 2 /* SpreadElements */) {
77218
+ if (languageVersion < LanguageFeatureMinimumTarget.SpreadElements) {
77151
77219
  checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* SpreadIncludes */ : 1024 /* SpreadArray */);
77152
77220
  }
77153
77221
  const spreadType = checkExpression(e.expression, checkMode, forceTuple);
@@ -77372,7 +77440,7 @@ function createTypeChecker(host) {
77372
77440
  addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type);
77373
77441
  }
77374
77442
  } else if (memberDecl.kind === 305 /* SpreadAssignment */) {
77375
- if (languageVersion < 2 /* ObjectAssign */) {
77443
+ if (languageVersion < LanguageFeatureMinimumTarget.ObjectAssign) {
77376
77444
  checkExternalEmitHelpers(memberDecl, 2 /* Assign */);
77377
77445
  }
77378
77446
  if (propertiesArray.length > 0) {
@@ -78349,7 +78417,7 @@ function createTypeChecker(host) {
78349
78417
  const isAnyLike = isTypeAny(apparentType) || apparentType === silentNeverType;
78350
78418
  let prop;
78351
78419
  if (isPrivateIdentifier(right)) {
78352
- if (languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */ || !useDefineForClassFields) {
78420
+ if (languageVersion < LanguageFeatureMinimumTarget.PrivateNamesAndClassStaticBlocks || languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators || !useDefineForClassFields) {
78353
78421
  if (assignmentKind !== 0 /* None */) {
78354
78422
  checkExternalEmitHelpers(node, 1048576 /* ClassPrivateFieldSet */);
78355
78423
  }
@@ -80966,7 +81034,7 @@ function createTypeChecker(host) {
80966
81034
  }
80967
81035
  function checkTaggedTemplateExpression(node) {
80968
81036
  if (!checkGrammarTaggedTemplateChain(node)) checkGrammarTypeArguments(node, node.typeArguments);
80969
- if (languageVersion < 2 /* TaggedTemplates */) {
81037
+ if (languageVersion < LanguageFeatureMinimumTarget.TaggedTemplates) {
80970
81038
  checkExternalEmitHelpers(node, 262144 /* MakeTemplateObject */);
80971
81039
  }
80972
81040
  const signature = getResolvedSignature(node);
@@ -82678,7 +82746,7 @@ function createTypeChecker(host) {
82678
82746
  return silentNeverType;
82679
82747
  }
82680
82748
  if (isPrivateIdentifier(left)) {
82681
- if (languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */ || !useDefineForClassFields) {
82749
+ if (languageVersion < LanguageFeatureMinimumTarget.PrivateNamesAndClassStaticBlocks || languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators || !useDefineForClassFields) {
82682
82750
  checkExternalEmitHelpers(left, 2097152 /* ClassPrivateFieldIn */);
82683
82751
  }
82684
82752
  if (!getNodeLinks(left).resolvedSymbol && getContainingClass(left)) {
@@ -82739,7 +82807,7 @@ function createTypeChecker(host) {
82739
82807
  if (propertyIndex < properties.length - 1) {
82740
82808
  error2(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
82741
82809
  } else {
82742
- if (languageVersion < 5 /* ObjectSpreadRest */) {
82810
+ if (languageVersion < LanguageFeatureMinimumTarget.ObjectSpreadRest) {
82743
82811
  checkExternalEmitHelpers(property, 4 /* Rest */);
82744
82812
  }
82745
82813
  const nonRestNames = [];
@@ -82760,7 +82828,7 @@ function createTypeChecker(host) {
82760
82828
  }
82761
82829
  function checkArrayLiteralAssignment(node, sourceType, checkMode) {
82762
82830
  const elements = node.elements;
82763
- if (languageVersion < 2 /* DestructuringAssignment */ && compilerOptions.downlevelIteration) {
82831
+ if (languageVersion < LanguageFeatureMinimumTarget.DestructuringAssignment && compilerOptions.downlevelIteration) {
82764
82832
  checkExternalEmitHelpers(node, 512 /* Read */);
82765
82833
  }
82766
82834
  const possiblyOutOfBoundsType = checkIteratedTypeOrElementType(65 /* Destructuring */ | 128 /* PossiblyOutOfBounds */, sourceType, undefinedType, node) || errorType;
@@ -83534,10 +83602,10 @@ function createTypeChecker(host) {
83534
83602
  }
83535
83603
  const isAsync = (functionFlags & 2 /* Async */) !== 0;
83536
83604
  if (node.asteriskToken) {
83537
- if (isAsync && languageVersion < 5 /* AsyncGenerators */) {
83605
+ if (isAsync && languageVersion < LanguageFeatureMinimumTarget.AsyncGenerators) {
83538
83606
  checkExternalEmitHelpers(node, 26624 /* AsyncDelegatorIncludes */);
83539
83607
  }
83540
- if (!isAsync && languageVersion < 2 /* Generators */ && compilerOptions.downlevelIteration) {
83608
+ if (!isAsync && languageVersion < LanguageFeatureMinimumTarget.Generators && compilerOptions.downlevelIteration) {
83541
83609
  checkExternalEmitHelpers(node, 256 /* Values */);
83542
83610
  }
83543
83611
  }
@@ -84367,13 +84435,13 @@ function createTypeChecker(host) {
84367
84435
  }
84368
84436
  const functionFlags = getFunctionFlags(node);
84369
84437
  if (!(functionFlags & 4 /* Invalid */)) {
84370
- if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 5 /* AsyncGenerators */) {
84438
+ if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < LanguageFeatureMinimumTarget.AsyncGenerators) {
84371
84439
  checkExternalEmitHelpers(node, 6144 /* AsyncGeneratorIncludes */);
84372
84440
  }
84373
- if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */ && languageVersion < 4 /* AsyncFunctions */) {
84441
+ if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */ && languageVersion < LanguageFeatureMinimumTarget.AsyncFunctions) {
84374
84442
  checkExternalEmitHelpers(node, 64 /* Awaiter */);
84375
84443
  }
84376
- if ((functionFlags & 3 /* AsyncGenerator */) !== 0 /* Normal */ && languageVersion < 2 /* Generators */) {
84444
+ if ((functionFlags & 3 /* AsyncGenerator */) !== 0 /* Normal */ && languageVersion < LanguageFeatureMinimumTarget.Generators) {
84377
84445
  checkExternalEmitHelpers(node, 128 /* Generator */);
84378
84446
  }
84379
84447
  }
@@ -84556,17 +84624,15 @@ function createTypeChecker(host) {
84556
84624
  if (indexSymbol == null ? void 0 : indexSymbol.declarations) {
84557
84625
  const indexSignatureMap = /* @__PURE__ */ new Map();
84558
84626
  for (const declaration of indexSymbol.declarations) {
84559
- if (isIndexSignatureDeclaration(declaration)) {
84560
- if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
84561
- forEachType(getTypeFromTypeNode(declaration.parameters[0].type), (type) => {
84562
- const entry = indexSignatureMap.get(getTypeId(type));
84563
- if (entry) {
84564
- entry.declarations.push(declaration);
84565
- } else {
84566
- indexSignatureMap.set(getTypeId(type), { type, declarations: [declaration] });
84567
- }
84568
- });
84569
- }
84627
+ if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
84628
+ forEachType(getTypeFromTypeNode(declaration.parameters[0].type), (type) => {
84629
+ const entry = indexSignatureMap.get(getTypeId(type));
84630
+ if (entry) {
84631
+ entry.declarations.push(declaration);
84632
+ } else {
84633
+ indexSignatureMap.set(getTypeId(type), { type, declarations: [declaration] });
84634
+ }
84635
+ });
84570
84636
  }
84571
84637
  }
84572
84638
  indexSignatureMap.forEach((entry) => {
@@ -84608,7 +84674,7 @@ function createTypeChecker(host) {
84608
84674
  }
84609
84675
  function setNodeLinksForPrivateIdentifierScope(node) {
84610
84676
  if (isPrivateIdentifier(node.name)) {
84611
- if (languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */ || !useDefineForClassFields) {
84677
+ if (languageVersion < LanguageFeatureMinimumTarget.PrivateNamesAndClassStaticBlocks || languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators || !useDefineForClassFields) {
84612
84678
  for (let lexicalScope = getEnclosingBlockScopeContainer(node); !!lexicalScope; lexicalScope = getEnclosingBlockScopeContainer(lexicalScope)) {
84613
84679
  getNodeLinks(lexicalScope).flags |= 1048576 /* ContainsClassWithPrivateIdentifiers */;
84614
84680
  }
@@ -85748,7 +85814,7 @@ function createTypeChecker(host) {
85748
85814
  if (node.kind === 169 /* Parameter */) {
85749
85815
  checkExternalEmitHelpers(firstDecorator, 32 /* Param */);
85750
85816
  }
85751
- } else if (languageVersion < 99 /* ClassAndClassElementDecorators */) {
85817
+ } else if (languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators) {
85752
85818
  checkExternalEmitHelpers(firstDecorator, 8 /* ESDecorateAndRunInitializers */);
85753
85819
  if (isClassDeclaration(node)) {
85754
85820
  if (!node.name) {
@@ -86414,7 +86480,7 @@ function createTypeChecker(host) {
86414
86480
  potentialUnusedRenamedBindingElementsInTypes.push(node);
86415
86481
  return;
86416
86482
  }
86417
- if (isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5 /* ObjectSpreadRest */) {
86483
+ if (isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < LanguageFeatureMinimumTarget.ObjectSpreadRest) {
86418
86484
  checkExternalEmitHelpers(node, 4 /* Rest */);
86419
86485
  }
86420
86486
  if (node.propertyName && node.propertyName.kind === 167 /* ComputedPropertyName */) {
@@ -86450,7 +86516,7 @@ function createTypeChecker(host) {
86450
86516
  }
86451
86517
  }
86452
86518
  if (isBindingPattern(node.name)) {
86453
- if (node.name.kind === 207 /* ArrayBindingPattern */ && languageVersion < 2 /* BindingPatterns */ && compilerOptions.downlevelIteration) {
86519
+ if (node.name.kind === 207 /* ArrayBindingPattern */ && languageVersion < LanguageFeatureMinimumTarget.BindingPatterns && compilerOptions.downlevelIteration) {
86454
86520
  checkExternalEmitHelpers(node, 512 /* Read */);
86455
86521
  }
86456
86522
  forEach(node.name.elements, checkSourceElement);
@@ -86604,7 +86670,7 @@ function createTypeChecker(host) {
86604
86670
  }
86605
86671
  function checkVariableDeclarationList(node) {
86606
86672
  const blockScopeKind = getCombinedNodeFlags(node) & 7 /* BlockScoped */;
86607
- if ((blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */) && languageVersion < 99 /* UsingAndAwaitUsing */) {
86673
+ if ((blockScopeKind === 4 /* Using */ || blockScopeKind === 6 /* AwaitUsing */) && languageVersion < LanguageFeatureMinimumTarget.UsingAndAwaitUsing) {
86608
86674
  checkExternalEmitHelpers(node, 16777216 /* AddDisposableResourceAndDisposeResources */);
86609
86675
  }
86610
86676
  forEach(node.declarations, checkSourceElement);
@@ -86818,11 +86884,11 @@ function createTypeChecker(host) {
86818
86884
  grammarErrorOnNode(node.awaitModifier, Diagnostics.for_await_loops_cannot_be_used_inside_a_class_static_block);
86819
86885
  } else {
86820
86886
  const functionFlags = getFunctionFlags(container);
86821
- if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 5 /* ForAwaitOf */) {
86887
+ if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < LanguageFeatureMinimumTarget.ForAwaitOf) {
86822
86888
  checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */);
86823
86889
  }
86824
86890
  }
86825
- } else if (compilerOptions.downlevelIteration && languageVersion < 2 /* ForOf */) {
86891
+ } else if (compilerOptions.downlevelIteration && languageVersion < LanguageFeatureMinimumTarget.ForOf) {
86826
86892
  checkExternalEmitHelpers(node, 256 /* ForOfIncludes */);
86827
86893
  }
86828
86894
  if (node.initializer.kind === 261 /* VariableDeclarationList */) {
@@ -87863,12 +87929,12 @@ function createTypeChecker(host) {
87863
87929
  return true;
87864
87930
  }
87865
87931
  function getFirstTransformableStaticClassElement(node) {
87866
- const willTransformStaticElementsOfDecoratedClass = !legacyDecorators && languageVersion < 99 /* ClassAndClassElementDecorators */ && classOrConstructorParameterIsDecorated(
87932
+ const willTransformStaticElementsOfDecoratedClass = !legacyDecorators && languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators && classOrConstructorParameterIsDecorated(
87867
87933
  /*useLegacyDecorators*/
87868
87934
  false,
87869
87935
  node
87870
87936
  );
87871
- const willTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* PrivateNamesAndClassStaticBlocks */ || languageVersion < 99 /* ClassAndClassElementDecorators */;
87937
+ const willTransformPrivateElementsOrClassStaticBlocks = languageVersion < LanguageFeatureMinimumTarget.PrivateNamesAndClassStaticBlocks || languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators;
87872
87938
  const willTransformInitializers = !emitStandardClassFields;
87873
87939
  if (willTransformStaticElementsOfDecoratedClass || willTransformPrivateElementsOrClassStaticBlocks) {
87874
87940
  for (const member of node.members) {
@@ -87895,7 +87961,7 @@ function createTypeChecker(host) {
87895
87961
  if (node.name) return;
87896
87962
  const parent2 = walkUpOuterExpressions(node);
87897
87963
  if (!isNamedEvaluationSource(parent2)) return;
87898
- const willTransformESDecorators = !legacyDecorators && languageVersion < 99 /* ClassAndClassElementDecorators */;
87964
+ const willTransformESDecorators = !legacyDecorators && languageVersion < LanguageFeatureMinimumTarget.ClassAndClassElementDecorators;
87899
87965
  let location;
87900
87966
  if (willTransformESDecorators && classOrConstructorParameterIsDecorated(
87901
87967
  /*useLegacyDecorators*/
@@ -87955,7 +88021,7 @@ function createTypeChecker(host) {
87955
88021
  const baseTypeNode = getEffectiveBaseTypeNode(node);
87956
88022
  if (baseTypeNode) {
87957
88023
  forEach(baseTypeNode.typeArguments, checkSourceElement);
87958
- if (languageVersion < 2 /* Classes */) {
88024
+ if (languageVersion < LanguageFeatureMinimumTarget.Classes) {
87959
88025
  checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */);
87960
88026
  }
87961
88027
  const extendsNode = getClassExtendsHeritageElement(node);
@@ -91474,29 +91540,7 @@ function createTypeChecker(host) {
91474
91540
  return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, internalFlags, tracker);
91475
91541
  },
91476
91542
  isImportRequiredByAugmentation,
91477
- isDefinitelyReferenceToGlobalSymbolObject,
91478
- createLateBoundIndexSignatures: (cls, enclosing, flags, internalFlags, tracker) => {
91479
- const sym = cls.symbol;
91480
- const staticInfos = getIndexInfosOfType(getTypeOfSymbol(sym));
91481
- const instanceIndexSymbol = getIndexSymbol(sym);
91482
- const instanceInfos = instanceIndexSymbol && getIndexInfosOfIndexSymbol(instanceIndexSymbol);
91483
- let result;
91484
- for (const infoList of [staticInfos, instanceInfos]) {
91485
- if (!length(infoList)) continue;
91486
- result || (result = []);
91487
- for (const info of infoList) {
91488
- if (info.declaration) continue;
91489
- const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
91490
- if (node && infoList === staticInfos) {
91491
- (node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
91492
- }
91493
- if (node) {
91494
- result.push(node);
91495
- }
91496
- }
91497
- }
91498
- return result;
91499
- }
91543
+ isDefinitelyReferenceToGlobalSymbolObject
91500
91544
  };
91501
91545
  function isImportRequiredByAugmentation(node) {
91502
91546
  const file = getSourceFileOfNode(node);
@@ -93388,7 +93432,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
93388
93432
  var _a;
93389
93433
  return (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host);
93390
93434
  },
93391
- useCaseSensitiveFileNames: maybeBind(host, host.useCaseSensitiveFileNames),
93435
+ useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
93392
93436
  redirectTargetsMap: host.redirectTargetsMap,
93393
93437
  getProjectReferenceRedirect: (fileName) => host.getProjectReferenceRedirect(fileName),
93394
93438
  isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
@@ -93396,7 +93440,8 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
93396
93440
  getFileIncludeReasons: () => host.getFileIncludeReasons(),
93397
93441
  readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0,
93398
93442
  getDefaultResolutionModeForFile: (file) => host.getDefaultResolutionModeForFile(file),
93399
- getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index)
93443
+ getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index),
93444
+ getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation)
93400
93445
  };
93401
93446
  }
93402
93447
  var SymbolTrackerImpl = class _SymbolTrackerImpl {
@@ -95826,6 +95871,13 @@ function isSimpleParameter(node) {
95826
95871
  function isSimpleParameterList(nodes) {
95827
95872
  return every(nodes, isSimpleParameter);
95828
95873
  }
95874
+ function rewriteModuleSpecifier(node, compilerOptions) {
95875
+ if (!node || !isStringLiteral(node) || !shouldRewriteModuleSpecifier(node.text, compilerOptions)) {
95876
+ return node;
95877
+ }
95878
+ const updatedText = changeExtension(node.text, getOutputExtension(node.text, compilerOptions));
95879
+ return updatedText !== node.text ? setOriginalNode(setTextRange(factory.createStringLiteral(updatedText, node.singleQuote), node), node) : node;
95880
+ }
95829
95881
 
95830
95882
  // src/compiler/transformers/destructuring.ts
95831
95883
  var FlattenLevel = /* @__PURE__ */ ((FlattenLevel2) => {
@@ -98154,7 +98206,14 @@ function transformTypeScript(context) {
98154
98206
  return void 0;
98155
98207
  }
98156
98208
  if (!node.exportClause || isNamespaceExport(node.exportClause)) {
98157
- return node;
98209
+ return factory2.updateExportDeclaration(
98210
+ node,
98211
+ node.modifiers,
98212
+ node.isTypeOnly,
98213
+ node.exportClause,
98214
+ node.moduleSpecifier,
98215
+ node.attributes
98216
+ );
98158
98217
  }
98159
98218
  const allowEmpty = !!compilerOptions.verbatimModuleSyntax;
98160
98219
  const exportClause = visitNode(
@@ -98193,8 +98252,10 @@ function transformTypeScript(context) {
98193
98252
  return void 0;
98194
98253
  }
98195
98254
  if (isExternalModuleImportEqualsDeclaration(node)) {
98196
- const isReferenced = shouldEmitAliasDeclaration(node);
98197
- return isReferenced ? visitEachChild(node, visitor, context) : void 0;
98255
+ if (!shouldEmitAliasDeclaration(node)) {
98256
+ return void 0;
98257
+ }
98258
+ return visitEachChild(node, visitor, context);
98198
98259
  }
98199
98260
  if (!shouldEmitImportEqualsDeclaration(node)) {
98200
98261
  return void 0;
@@ -113561,7 +113622,7 @@ function transformModule(context) {
113561
113622
  }
113562
113623
  const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions);
113563
113624
  const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression);
113564
- const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
113625
+ const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : rewriteModuleSpecifier(firstArgument, compilerOptions);
113565
113626
  const containsLexicalThis = !!(node.transformFlags & 16384 /* ContainsLexicalThis */);
113566
113627
  switch (compilerOptions.module) {
113567
113628
  case 2 /* AMD */:
@@ -113892,7 +113953,7 @@ function transformModule(context) {
113892
113953
  const moduleName = getExternalModuleNameLiteral(factory2, importNode, currentSourceFile, host, resolver, compilerOptions);
113893
113954
  const args = [];
113894
113955
  if (moduleName) {
113895
- args.push(moduleName);
113956
+ args.push(rewriteModuleSpecifier(moduleName, compilerOptions));
113896
113957
  }
113897
113958
  return factory2.createCallExpression(
113898
113959
  factory2.createIdentifier("require"),
@@ -115987,6 +116048,8 @@ function transformECMAScriptModule(context) {
115987
116048
  context.onSubstituteNode = onSubstituteNode;
115988
116049
  context.enableEmitNotification(307 /* SourceFile */);
115989
116050
  context.enableSubstitution(80 /* Identifier */);
116051
+ const noSubstitution = /* @__PURE__ */ new Set();
116052
+ let importCallsToRewrite;
115990
116053
  let helperNameSubstitutions;
115991
116054
  let currentSourceFile;
115992
116055
  let importRequireStatements;
@@ -115998,6 +116061,7 @@ function transformECMAScriptModule(context) {
115998
116061
  if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
115999
116062
  currentSourceFile = node;
116000
116063
  importRequireStatements = void 0;
116064
+ importCallsToRewrite = compilerOptions.rewriteRelativeImportExtensions ? mapDefined(node.imports, (name) => isImportCall(name.parent) && shouldRewriteModuleSpecifier(name.text, compilerOptions) ? name.parent : void 0) : void 0;
116001
116065
  let result = updateExternalModule(node);
116002
116066
  currentSourceFile = void 0;
116003
116067
  if (importRequireStatements) {
@@ -116021,7 +116085,7 @@ function transformECMAScriptModule(context) {
116021
116085
  if (externalHelpersImportDeclaration) {
116022
116086
  const statements = [];
116023
116087
  const statementOffset = factory2.copyPrologue(node.statements, statements);
116024
- append(statements, externalHelpersImportDeclaration);
116088
+ addRange(statements, visitArray([externalHelpersImportDeclaration], visitor, isStatement));
116025
116089
  addRange(statements, visitNodes2(node.statements, visitor, isStatement, statementOffset));
116026
116090
  return factory2.updateSourceFile(
116027
116091
  node,
@@ -116040,14 +116104,50 @@ function transformECMAScriptModule(context) {
116040
116104
  case 278 /* ExportDeclaration */:
116041
116105
  const exportDecl = node;
116042
116106
  return visitExportDeclaration(exportDecl);
116107
+ case 272 /* ImportDeclaration */:
116108
+ return visitImportDeclaration(node);
116109
+ case 213 /* CallExpression */:
116110
+ if (node === (importCallsToRewrite == null ? void 0 : importCallsToRewrite[0])) {
116111
+ importCallsToRewrite.shift();
116112
+ return visitImportCall(node);
116113
+ }
116114
+ break;
116115
+ default:
116116
+ if ((importCallsToRewrite == null ? void 0 : importCallsToRewrite.length) && rangeContainsRange(node, importCallsToRewrite[0])) {
116117
+ return visitEachChild(node, visitor, context);
116118
+ }
116043
116119
  }
116044
116120
  return node;
116045
116121
  }
116122
+ function visitImportDeclaration(node) {
116123
+ if (!compilerOptions.rewriteRelativeImportExtensions) {
116124
+ return node;
116125
+ }
116126
+ const updatedModuleSpecifier = rewriteModuleSpecifier(node.moduleSpecifier, compilerOptions);
116127
+ if (updatedModuleSpecifier === node.moduleSpecifier) {
116128
+ return node;
116129
+ }
116130
+ return factory2.updateImportDeclaration(
116131
+ node,
116132
+ node.modifiers,
116133
+ node.importClause,
116134
+ updatedModuleSpecifier,
116135
+ node.attributes
116136
+ );
116137
+ }
116138
+ function visitImportCall(node) {
116139
+ return factory2.updateCallExpression(
116140
+ node,
116141
+ node.expression,
116142
+ node.typeArguments,
116143
+ [rewriteModuleSpecifier(node.arguments[0], compilerOptions), ...node.arguments.slice(1)]
116144
+ );
116145
+ }
116046
116146
  function createRequireCall2(importNode) {
116047
116147
  const moduleName = getExternalModuleNameLiteral(factory2, importNode, Debug.checkDefined(currentSourceFile), host, resolver, compilerOptions);
116048
116148
  const args = [];
116049
116149
  if (moduleName) {
116050
- args.push(moduleName);
116150
+ args.push(rewriteModuleSpecifier(moduleName, compilerOptions));
116051
116151
  }
116052
116152
  if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
116053
116153
  return factory2.createCallExpression(
@@ -116192,11 +116292,16 @@ function transformECMAScriptModule(context) {
116192
116292
  return node;
116193
116293
  }
116194
116294
  function visitExportDeclaration(node) {
116195
- if (compilerOptions.module !== void 0 && compilerOptions.module > 5 /* ES2015 */) {
116196
- return node;
116197
- }
116198
- if (!node.exportClause || !isNamespaceExport(node.exportClause) || !node.moduleSpecifier) {
116199
- return node;
116295
+ const updatedModuleSpecifier = rewriteModuleSpecifier(node.moduleSpecifier, compilerOptions);
116296
+ if (compilerOptions.module !== void 0 && compilerOptions.module > 5 /* ES2015 */ || !node.exportClause || !isNamespaceExport(node.exportClause) || !node.moduleSpecifier) {
116297
+ return !node.moduleSpecifier || updatedModuleSpecifier === node.moduleSpecifier ? node : factory2.updateExportDeclaration(
116298
+ node,
116299
+ node.modifiers,
116300
+ node.isTypeOnly,
116301
+ node.exportClause,
116302
+ updatedModuleSpecifier,
116303
+ node.attributes
116304
+ );
116200
116305
  }
116201
116306
  const oldIdentifier = node.exportClause.name;
116202
116307
  const synthName = factory2.getGeneratedNameForNode(oldIdentifier);
@@ -116212,7 +116317,7 @@ function transformECMAScriptModule(context) {
116212
116317
  synthName
116213
116318
  )
116214
116319
  ),
116215
- node.moduleSpecifier,
116320
+ updatedModuleSpecifier,
116216
116321
  node.attributes
116217
116322
  );
116218
116323
  setOriginalNode(importDecl, node.exportClause);
@@ -116236,7 +116341,9 @@ function transformECMAScriptModule(context) {
116236
116341
  if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
116237
116342
  helperNameSubstitutions = /* @__PURE__ */ new Map();
116238
116343
  }
116344
+ currentSourceFile = node;
116239
116345
  previousOnEmitNode(hint, node, emitCallback);
116346
+ currentSourceFile = void 0;
116240
116347
  helperNameSubstitutions = void 0;
116241
116348
  } else {
116242
116349
  previousOnEmitNode(hint, node, emitCallback);
@@ -116244,18 +116351,29 @@ function transformECMAScriptModule(context) {
116244
116351
  }
116245
116352
  function onSubstituteNode(hint, node) {
116246
116353
  node = previousOnSubstituteNode(hint, node);
116247
- if (helperNameSubstitutions && isIdentifier(node) && getEmitFlags(node) & 8192 /* HelperName */) {
116354
+ if (node.id && noSubstitution.has(node.id)) {
116355
+ return node;
116356
+ }
116357
+ if (isIdentifier(node) && getEmitFlags(node) & 8192 /* HelperName */) {
116248
116358
  return substituteHelperName(node);
116249
116359
  }
116250
116360
  return node;
116251
116361
  }
116252
116362
  function substituteHelperName(node) {
116253
- const name = idText(node);
116254
- let substitution = helperNameSubstitutions.get(name);
116255
- if (!substitution) {
116256
- helperNameSubstitutions.set(name, substitution = factory2.createUniqueName(name, 16 /* Optimistic */ | 32 /* FileLevel */));
116363
+ const externalHelpersModuleName = currentSourceFile && getExternalHelpersModuleName(currentSourceFile);
116364
+ if (externalHelpersModuleName) {
116365
+ noSubstitution.add(getNodeId(node));
116366
+ return factory2.createPropertyAccessExpression(externalHelpersModuleName, node);
116257
116367
  }
116258
- return substitution;
116368
+ if (helperNameSubstitutions) {
116369
+ const name = idText(node);
116370
+ let substitution = helperNameSubstitutions.get(name);
116371
+ if (!substitution) {
116372
+ helperNameSubstitutions.set(name, substitution = factory2.createUniqueName(name, 16 /* Optimistic */ | 32 /* FileLevel */));
116373
+ }
116374
+ return substitution;
116375
+ }
116376
+ return node;
116259
116377
  }
116260
116378
  }
116261
116379
 
@@ -117345,7 +117463,7 @@ function transformDeclarations(context) {
117345
117463
  }
117346
117464
  return setCommentRange(updated, getCommentRange(original));
117347
117465
  }
117348
- function rewriteModuleSpecifier(parent2, input) {
117466
+ function rewriteModuleSpecifier2(parent2, input) {
117349
117467
  if (!input) return void 0;
117350
117468
  resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent2.kind !== 267 /* ModuleDeclaration */ && parent2.kind !== 205 /* ImportType */;
117351
117469
  if (isStringLiteralLike(input)) {
@@ -117367,7 +117485,7 @@ function transformDeclarations(context) {
117367
117485
  decl.modifiers,
117368
117486
  decl.isTypeOnly,
117369
117487
  decl.name,
117370
- factory2.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))
117488
+ factory2.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier2(decl, specifier))
117371
117489
  );
117372
117490
  } else {
117373
117491
  const oldDiag = getSymbolAccessibilityDiagnostic;
@@ -117383,7 +117501,7 @@ function transformDeclarations(context) {
117383
117501
  decl,
117384
117502
  decl.modifiers,
117385
117503
  decl.importClause,
117386
- rewriteModuleSpecifier(decl, decl.moduleSpecifier),
117504
+ rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
117387
117505
  tryGetResolutionModeOverride(decl.attributes)
117388
117506
  );
117389
117507
  }
@@ -117399,7 +117517,7 @@ function transformDeclarations(context) {
117399
117517
  /*namedBindings*/
117400
117518
  void 0
117401
117519
  ),
117402
- rewriteModuleSpecifier(decl, decl.moduleSpecifier),
117520
+ rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
117403
117521
  tryGetResolutionModeOverride(decl.attributes)
117404
117522
  );
117405
117523
  }
@@ -117417,7 +117535,7 @@ function transformDeclarations(context) {
117417
117535
  visibleDefaultBinding,
117418
117536
  namedBindings
117419
117537
  ),
117420
- rewriteModuleSpecifier(decl, decl.moduleSpecifier),
117538
+ rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
117421
117539
  tryGetResolutionModeOverride(decl.attributes)
117422
117540
  ) : void 0;
117423
117541
  }
@@ -117432,7 +117550,7 @@ function transformDeclarations(context) {
117432
117550
  visibleDefaultBinding,
117433
117551
  bindingList && bindingList.length ? factory2.updateNamedImports(decl.importClause.namedBindings, bindingList) : void 0
117434
117552
  ),
117435
- rewriteModuleSpecifier(decl, decl.moduleSpecifier),
117553
+ rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
117436
117554
  tryGetResolutionModeOverride(decl.attributes)
117437
117555
  );
117438
117556
  }
@@ -117445,7 +117563,7 @@ function transformDeclarations(context) {
117445
117563
  decl.modifiers,
117446
117564
  /*importClause*/
117447
117565
  void 0,
117448
- rewriteModuleSpecifier(decl, decl.moduleSpecifier),
117566
+ rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
117449
117567
  tryGetResolutionModeOverride(decl.attributes)
117450
117568
  );
117451
117569
  }
@@ -117759,7 +117877,7 @@ function transformDeclarations(context) {
117759
117877
  if (!isLiteralImportTypeNode(input)) return cleanup(input);
117760
117878
  return cleanup(factory2.updateImportTypeNode(
117761
117879
  input,
117762
- factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)),
117880
+ factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier2(input, input.argument.literal)),
117763
117881
  input.attributes,
117764
117882
  input.qualifier,
117765
117883
  visitNodes2(input.typeArguments, visitDeclarationSubtree, isTypeNode),
@@ -117812,7 +117930,7 @@ function transformDeclarations(context) {
117812
117930
  input.modifiers,
117813
117931
  input.isTypeOnly,
117814
117932
  input.exportClause,
117815
- rewriteModuleSpecifier(input, input.moduleSpecifier),
117933
+ rewriteModuleSpecifier2(input, input.moduleSpecifier),
117816
117934
  tryGetResolutionModeOverride(input.attributes)
117817
117935
  );
117818
117936
  }
@@ -118062,7 +118180,7 @@ function transformDeclarations(context) {
118062
118180
  return cleanup(updateModuleDeclarationAndKeyword(
118063
118181
  input,
118064
118182
  mods,
118065
- isExternalModuleAugmentation(input) ? rewriteModuleSpecifier(input, input.name) : input.name,
118183
+ isExternalModuleAugmentation(input) ? rewriteModuleSpecifier2(input, input.name) : input.name,
118066
118184
  body
118067
118185
  ));
118068
118186
  } else {
@@ -118148,8 +118266,7 @@ function transformDeclarations(context) {
118148
118266
  void 0
118149
118267
  )
118150
118268
  ] : void 0;
118151
- const lateIndexes = resolver.createLateBoundIndexSignatures(input, enclosingDeclaration, declarationEmitNodeBuilderFlags, declarationEmitInternalNodeBuilderFlags, symbolTracker);
118152
- const memberNodes = concatenate(concatenate(concatenate(privateIdentifier, lateIndexes), parameterProperties), visitNodes2(input.members, visitDeclarationSubtree, isClassElement));
118269
+ const memberNodes = concatenate(concatenate(privateIdentifier, parameterProperties), visitNodes2(input.members, visitDeclarationSubtree, isClassElement));
118153
118270
  const members = factory2.createNodeArray(memberNodes);
118154
118271
  const extendsClause = getEffectiveBaseTypeNode(input);
118155
118272
  if (extendsClause && !isEntityNameExpression(extendsClause.expression) && extendsClause.expression.kind !== 106 /* NullKeyword */) {
@@ -119465,8 +119582,7 @@ var notImplementedResolver = {
119465
119582
  isBindingCapturedByNode: notImplemented,
119466
119583
  getDeclarationStatementsForSourceFile: notImplemented,
119467
119584
  isImportRequiredByAugmentation: notImplemented,
119468
- isDefinitelyReferenceToGlobalSymbolObject: notImplemented,
119469
- createLateBoundIndexSignatures: notImplemented
119585
+ isDefinitelyReferenceToGlobalSymbolObject: notImplemented
119470
119586
  };
119471
119587
  var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
119472
119588
  var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@@ -125577,7 +125693,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125577
125693
  getCanonicalFileName,
125578
125694
  getFileIncludeReasons: () => fileReasons,
125579
125695
  structureIsReused,
125580
- writeFile: writeFile2
125696
+ writeFile: writeFile2,
125697
+ getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation)
125581
125698
  };
125582
125699
  onProgramCreateComplete();
125583
125700
  verifyCompilerOptions();
@@ -126143,7 +126260,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126143
126260
  getFileIncludeReasons: program.getFileIncludeReasons,
126144
126261
  createHash: maybeBind(host, host.createHash),
126145
126262
  getModuleResolutionCache: () => program.getModuleResolutionCache(),
126146
- trace: maybeBind(host, host.trace)
126263
+ trace: maybeBind(host, host.trace),
126264
+ getGlobalTypingsCacheLocation: program.getGlobalTypingsCacheLocation
126147
126265
  };
126148
126266
  }
126149
126267
  function writeFile2(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -127675,7 +127793,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127675
127793
  createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
127676
127794
  }
127677
127795
  }
127678
- if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly)) {
127796
+ if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly || options.rewriteRelativeImportExtensions)) {
127679
127797
  createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set);
127680
127798
  }
127681
127799
  const moduleResolution = getEmitModuleResolutionKind(options);
@@ -130510,6 +130628,9 @@ function canWatchDirectoryOrFile(pathComponents2, length2) {
130510
130628
  const perceivedOsRootLength = perceivedOsRootLengthForWatching(pathComponents2, length2);
130511
130629
  return length2 > perceivedOsRootLength + 1;
130512
130630
  }
130631
+ function canWatchDirectoryOrFilePath(path) {
130632
+ return canWatchDirectoryOrFile(getPathComponents(path));
130633
+ }
130513
130634
  function canWatchAtTypes(atTypes) {
130514
130635
  return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(getDirectoryPath(atTypes));
130515
130636
  }
@@ -130521,12 +130642,12 @@ function isInDirectoryPath(dirComponents, fileOrDirComponents) {
130521
130642
  return true;
130522
130643
  }
130523
130644
  function canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(fileOrDirPath) {
130524
- return canWatchDirectoryOrFile(getPathComponents(fileOrDirPath));
130645
+ return canWatchDirectoryOrFilePath(fileOrDirPath);
130525
130646
  }
130526
130647
  function canWatchAffectingLocation(filePath) {
130527
130648
  return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(filePath);
130528
130649
  }
130529
- function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, getCurrentDirectory, preferNonRecursiveWatch) {
130650
+ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, isRootWatchable, getCurrentDirectory, preferNonRecursiveWatch) {
130530
130651
  const failedLookupPathComponents = getPathComponents(failedLookupLocationPath);
130531
130652
  failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
130532
130653
  const failedLookupComponents = getPathComponents(failedLookupLocation);
@@ -130535,7 +130656,7 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
130535
130656
  const nodeModulesIndex = failedLookupPathComponents.indexOf("node_modules");
130536
130657
  if (nodeModulesIndex !== -1 && nodeModulesIndex + 1 <= perceivedOsRootLength + 1) return void 0;
130537
130658
  const lastNodeModulesIndex = failedLookupPathComponents.lastIndexOf("node_modules");
130538
- if (isInDirectoryPath(rootPathComponents, failedLookupPathComponents)) {
130659
+ if (isRootWatchable && isInDirectoryPath(rootPathComponents, failedLookupPathComponents)) {
130539
130660
  if (failedLookupPathComponents.length > rootPathComponents.length + 1) {
130540
130661
  return getDirectoryOfFailedLookupWatch(
130541
130662
  failedLookupComponents,
@@ -130607,9 +130728,9 @@ function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, lengt
130607
130728
  packageDirPath: packageDirLength !== void 0 ? getPathFromPathComponents(dirPathComponents, packageDirLength) : void 0
130608
130729
  };
130609
130730
  }
130610
- function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, preferNonRecursiveWatch, filterCustomPath) {
130731
+ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, isRootWatchable, getCurrentDirectory, preferNonRecursiveWatch, filterCustomPath) {
130611
130732
  const typeRootPathComponents = getPathComponents(typeRootPath);
130612
- if (isInDirectoryPath(rootPathComponents, typeRootPathComponents)) {
130733
+ if (isRootWatchable && isInDirectoryPath(rootPathComponents, typeRootPathComponents)) {
130613
130734
  return rootPath;
130614
130735
  }
130615
130736
  typeRoot = isRootedDiskPath(typeRoot) ? normalizePath(typeRoot) : getNormalizedAbsolutePath(typeRoot, getCurrentDirectory());
@@ -130650,10 +130771,10 @@ function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirected
130650
130771
  function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
130651
130772
  const host = getModuleResolutionHost(resolutionHost);
130652
130773
  const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
130653
- if (!resolutionHost.getGlobalCache) {
130774
+ if (!resolutionHost.getGlobalTypingsCacheLocation) {
130654
130775
  return primaryResult;
130655
130776
  }
130656
- const globalCache = resolutionHost.getGlobalCache();
130777
+ const globalCache = resolutionHost.getGlobalTypingsCacheLocation();
130657
130778
  if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
130658
130779
  const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
130659
130780
  Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
@@ -130717,6 +130838,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
130717
130838
  const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
130718
130839
  const rootPath = resolutionHost.toPath(rootDir);
130719
130840
  const rootPathComponents = getPathComponents(rootPath);
130841
+ const isRootWatchable = canWatchDirectoryOrFile(rootPathComponents);
130720
130842
  const isSymlinkCache = /* @__PURE__ */ new Map();
130721
130843
  const packageDirWatchers = /* @__PURE__ */ new Map();
130722
130844
  const dirPathToSymlinkPackageRefCount = /* @__PURE__ */ new Map();
@@ -131128,6 +131250,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
131128
131250
  rootDir,
131129
131251
  rootPath,
131130
131252
  rootPathComponents,
131253
+ isRootWatchable,
131131
131254
  getCurrentDirectory,
131132
131255
  resolutionHost.preferNonRecursiveWatch
131133
131256
  );
@@ -131316,6 +131439,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
131316
131439
  rootDir,
131317
131440
  rootPath,
131318
131441
  rootPathComponents,
131442
+ isRootWatchable,
131319
131443
  getCurrentDirectory,
131320
131444
  resolutionHost.preferNonRecursiveWatch
131321
131445
  );
@@ -131459,6 +131583,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
131459
131583
  return false;
131460
131584
  }
131461
131585
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
131586
+ (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
131462
131587
  const packagePath = parseNodeModuleFromPath(
131463
131588
  fileOrDirectoryPath,
131464
131589
  /*isFolder*/
@@ -131540,6 +131665,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
131540
131665
  resolutionHost.toPath(typeRoot),
131541
131666
  rootPath,
131542
131667
  rootPathComponents,
131668
+ isRootWatchable,
131543
131669
  getCurrentDirectory,
131544
131670
  resolutionHost.preferNonRecursiveWatch,
131545
131671
  (dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2) || dirPathToSymlinkPackageRefCount.has(dirPath2)
@@ -132297,6 +132423,7 @@ function createWatchProgram(host) {
132297
132423
  let updateLevel;
132298
132424
  let missingFilesMap;
132299
132425
  let watchedWildcardDirectories;
132426
+ let staleWatches = /* @__PURE__ */ new Map([[void 0, void 0]]);
132300
132427
  let timerToUpdateProgram;
132301
132428
  let timerToInvalidateFailedLookupResolutions;
132302
132429
  let parsedConfigs;
@@ -132385,8 +132512,6 @@ function createWatchProgram(host) {
132385
132512
  const customHasInvalidLibResolutions = host.resolveLibrary ? maybeBind(host, host.hasInvalidatedLibResolutions) || returnTrue : returnFalse;
132386
132513
  builderProgram = readBuilderProgram(compilerOptions, compilerHost);
132387
132514
  synchronizeProgram();
132388
- watchConfigFileWildCardDirectories();
132389
- if (configFileName) updateExtendedConfigFilesWatches(toPath3(configFileName), compilerOptions, watchOptions, WatchType.ExtendedConfigFile);
132390
132515
  return configFileName ? { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, close, getResolutionCache } : { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, updateRootFileNames, close, getResolutionCache };
132391
132516
  function close() {
132392
132517
  clearInvalidateResolutionsOfFailedLookupLocations();
@@ -132489,6 +132614,16 @@ function createWatchProgram(host) {
132489
132614
  compilerHost.directoryExists = originalDirectoryExists;
132490
132615
  compilerHost.createDirectory = originalCreateDirectory;
132491
132616
  compilerHost.writeFile = originalWriteFile;
132617
+ staleWatches == null ? void 0 : staleWatches.forEach((configFile, configPath) => {
132618
+ if (!configPath) {
132619
+ watchConfigFileWildCardDirectories();
132620
+ if (configFileName) updateExtendedConfigFilesWatches(toPath3(configFileName), compilerOptions, watchOptions, WatchType.ExtendedConfigFile);
132621
+ } else {
132622
+ const config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
132623
+ if (config) watchReferencedProject(configFile, configPath, config);
132624
+ }
132625
+ });
132626
+ staleWatches = void 0;
132492
132627
  return builderProgram;
132493
132628
  }
132494
132629
  function createNewProgram(hasInvalidatedResolutions, hasInvalidatedLibResolutions) {
@@ -132695,9 +132830,8 @@ function createWatchProgram(host) {
132695
132830
  }
132696
132831
  parseConfigFile2();
132697
132832
  hasChangedCompilerOptions = true;
132833
+ (staleWatches ?? (staleWatches = /* @__PURE__ */ new Map())).set(void 0, void 0);
132698
132834
  synchronizeProgram();
132699
- watchConfigFileWildCardDirectories();
132700
- updateExtendedConfigFilesWatches(toPath3(configFileName), compilerOptions, watchOptions, WatchType.ExtendedConfigFile);
132701
132835
  }
132702
132836
  function parseConfigFile2() {
132703
132837
  Debug.assert(configFileName);
@@ -132749,7 +132883,7 @@ function createWatchProgram(host) {
132749
132883
  } else {
132750
132884
  (parsedConfigs || (parsedConfigs = /* @__PURE__ */ new Map())).set(configPath, config = { parsedCommandLine });
132751
132885
  }
132752
- watchReferencedProject(configFileName2, configPath, config);
132886
+ (staleWatches ?? (staleWatches = /* @__PURE__ */ new Map())).set(configPath, configFileName2);
132753
132887
  return parsedCommandLine;
132754
132888
  }
132755
132889
  function getParsedCommandLineFromConfigFileHost(configFileName2) {
@@ -134766,7 +134900,7 @@ function shouldBePretty(sys2, options) {
134766
134900
  return options.pretty;
134767
134901
  }
134768
134902
  function getOptionsForHelp(commandLine) {
134769
- return !!commandLine.options.all ? toSorted(optionDeclarations, (a, b) => compareStringsCaseInsensitive(a.name, b.name)) : filter(optionDeclarations.slice(), (v) => !!v.showInSimplifiedHelpView);
134903
+ return !!commandLine.options.all ? toSorted(optionDeclarations.concat(tscBuildOption), (a, b) => compareStringsCaseInsensitive(a.name, b.name)) : filter(optionDeclarations.concat(tscBuildOption), (v) => !!v.showInSimplifiedHelpView);
134770
134904
  }
134771
134905
  function printVersion(sys2) {
134772
134906
  sys2.write(getDiagnosticText(Diagnostics.Version_0, version) + sys2.newLine);
@@ -135090,7 +135224,7 @@ function printAllHelp(sys2, compilerOptions, buildOptions, watchOptions) {
135090
135224
  output = [...output, ...generateSectionOptionsOutput(
135091
135225
  sys2,
135092
135226
  getDiagnosticText(Diagnostics.BUILD_OPTIONS),
135093
- buildOptions,
135227
+ filter(buildOptions, (option) => option !== tscBuildOption),
135094
135228
  /*subCategory*/
135095
135229
  false,
135096
135230
  formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds")
@@ -135104,7 +135238,7 @@ function printBuildHelp(sys2, buildOptions) {
135104
135238
  output = [...output, ...generateSectionOptionsOutput(
135105
135239
  sys2,
135106
135240
  getDiagnosticText(Diagnostics.BUILD_OPTIONS),
135107
- buildOptions,
135241
+ filter(buildOptions, (option) => option !== tscBuildOption),
135108
135242
  /*subCategory*/
135109
135243
  false,
135110
135244
  formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds")
@@ -135141,10 +135275,6 @@ function printHelp(sys2, commandLine) {
135141
135275
  }
135142
135276
  function executeCommandLineWorker(sys2, cb, commandLine) {
135143
135277
  let reportDiagnostic = createDiagnosticReporter(sys2);
135144
- if (commandLine.options.build) {
135145
- reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_build_must_be_the_first_command_line_argument));
135146
- return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */);
135147
- }
135148
135278
  let configFileName;
135149
135279
  if (commandLine.options.locale) {
135150
135280
  validateLocaleAndSetLanguage(commandLine.options.locale, sys2, commandLine.errors);
@@ -135290,16 +135420,16 @@ function executeCommandLineWorker(sys2, cb, commandLine) {
135290
135420
  }
135291
135421
  }
135292
135422
  }
135293
- function isBuild(commandLineArgs) {
135423
+ function isBuildCommand(commandLineArgs) {
135294
135424
  if (commandLineArgs.length > 0 && commandLineArgs[0].charCodeAt(0) === 45 /* minus */) {
135295
135425
  const firstOption = commandLineArgs[0].slice(commandLineArgs[0].charCodeAt(1) === 45 /* minus */ ? 2 : 1).toLowerCase();
135296
- return firstOption === "build" || firstOption === "b";
135426
+ return firstOption === tscBuildOption.name || firstOption === tscBuildOption.shortName;
135297
135427
  }
135298
135428
  return false;
135299
135429
  }
135300
135430
  function executeCommandLine(system, cb, commandLineArgs) {
135301
- if (isBuild(commandLineArgs)) {
135302
- const { buildOptions, watchOptions, projects, errors } = parseBuildCommand(commandLineArgs.slice(1));
135431
+ if (isBuildCommand(commandLineArgs)) {
135432
+ const { buildOptions, watchOptions, projects, errors } = parseBuildCommand(commandLineArgs);
135303
135433
  if (buildOptions.generateCpuProfile && system.enableCPUProfiler) {
135304
135434
  system.enableCPUProfiler(buildOptions.generateCpuProfile, () => performBuild(
135305
135435
  system,
@@ -137250,9 +137380,6 @@ function getLineStartPositionForPosition(position, sourceFile) {
137250
137380
  const line = sourceFile.getLineAndCharacterOfPosition(position).line;
137251
137381
  return lineStarts[line];
137252
137382
  }
137253
- function rangeContainsRange(r1, r2) {
137254
- return startEndContainsRange(r1.pos, r1.end, r2);
137255
- }
137256
137383
  function rangeContainsRangeExclusive(r1, r2) {
137257
137384
  return rangeContainsPositionExclusive(r1, r2.pos) && rangeContainsPositionExclusive(r1, r2.end);
137258
137385
  }
@@ -137262,9 +137389,6 @@ function rangeContainsPosition(r, pos) {
137262
137389
  function rangeContainsPositionExclusive(r, pos) {
137263
137390
  return r.pos < pos && pos < r.end;
137264
137391
  }
137265
- function startEndContainsRange(start, end, range) {
137266
- return start <= range.pos && end >= range.end;
137267
- }
137268
137392
  function rangeContainsStartEnd(range, start, end) {
137269
137393
  return range.pos <= start && range.end >= end;
137270
137394
  }
@@ -138284,7 +138408,7 @@ function createModuleSpecifierResolutionHost(program, host) {
138284
138408
  fileExists: (fileName) => program.fileExists(fileName),
138285
138409
  getCurrentDirectory: () => host.getCurrentDirectory(),
138286
138410
  readFile: maybeBind(host, host.readFile),
138287
- useCaseSensitiveFileNames: maybeBind(host, host.useCaseSensitiveFileNames),
138411
+ useCaseSensitiveFileNames: maybeBind(host, host.useCaseSensitiveFileNames) || program.useCaseSensitiveFileNames,
138288
138412
  getSymlinkCache: maybeBind(host, host.getSymlinkCache) || program.getSymlinkCache,
138289
138413
  getModuleSpecifierCache: maybeBind(host, host.getModuleSpecifierCache),
138290
138414
  getPackageJsonInfoCache: () => {
@@ -139136,28 +139260,33 @@ function tryAndIgnoreErrors(cb) {
139136
139260
  function tryIOAndConsumeErrors(host, toApply, ...args) {
139137
139261
  return tryAndIgnoreErrors(() => toApply && toApply.apply(host, args));
139138
139262
  }
139139
- function findPackageJsons(startDirectory, host, stopDirectory) {
139263
+ function findPackageJsons(startDirectory, host) {
139140
139264
  const paths = [];
139141
- forEachAncestorDirectory(startDirectory, (ancestor) => {
139142
- if (ancestor === stopDirectory) {
139143
- return true;
139144
- }
139145
- const currentConfigPath = combinePaths(ancestor, "package.json");
139146
- if (tryFileExists(host, currentConfigPath)) {
139147
- paths.push(currentConfigPath);
139265
+ forEachAncestorDirectoryStoppingAtGlobalCache(
139266
+ host,
139267
+ startDirectory,
139268
+ (ancestor) => {
139269
+ const currentConfigPath = combinePaths(ancestor, "package.json");
139270
+ if (tryFileExists(host, currentConfigPath)) {
139271
+ paths.push(currentConfigPath);
139272
+ }
139148
139273
  }
139149
- });
139274
+ );
139150
139275
  return paths;
139151
139276
  }
139152
139277
  function findPackageJson(directory, host) {
139153
139278
  let packageJson;
139154
- forEachAncestorDirectory(directory, (ancestor) => {
139155
- if (ancestor === "node_modules") return true;
139156
- packageJson = findConfigFile(ancestor, (f) => tryFileExists(host, f), "package.json");
139157
- if (packageJson) {
139158
- return true;
139279
+ forEachAncestorDirectoryStoppingAtGlobalCache(
139280
+ host,
139281
+ directory,
139282
+ (ancestor) => {
139283
+ if (ancestor === "node_modules") return true;
139284
+ packageJson = findConfigFile(ancestor, (f) => tryFileExists(host, f), "package.json");
139285
+ if (packageJson) {
139286
+ return true;
139287
+ }
139159
139288
  }
139160
- });
139289
+ );
139161
139290
  return packageJson;
139162
139291
  }
139163
139292
  function getPackageJsonsVisibleToFile(fileName, host) {
@@ -139165,15 +139294,19 @@ function getPackageJsonsVisibleToFile(fileName, host) {
139165
139294
  return [];
139166
139295
  }
139167
139296
  const packageJsons = [];
139168
- forEachAncestorDirectory(getDirectoryPath(fileName), (ancestor) => {
139169
- const packageJsonFileName = combinePaths(ancestor, "package.json");
139170
- if (host.fileExists(packageJsonFileName)) {
139171
- const info = createPackageJsonInfo(packageJsonFileName, host);
139172
- if (info) {
139173
- packageJsons.push(info);
139297
+ forEachAncestorDirectoryStoppingAtGlobalCache(
139298
+ host,
139299
+ getDirectoryPath(fileName),
139300
+ (ancestor) => {
139301
+ const packageJsonFileName = combinePaths(ancestor, "package.json");
139302
+ if (host.fileExists(packageJsonFileName)) {
139303
+ const info = createPackageJsonInfo(packageJsonFileName, host);
139304
+ if (info) {
139305
+ packageJsons.push(info);
139306
+ }
139174
139307
  }
139175
139308
  }
139176
- });
139309
+ );
139177
139310
  return packageJsons;
139178
139311
  }
139179
139312
  function createPackageJsonInfo(fileName, host) {
@@ -139860,7 +139993,13 @@ function isImportable(program, fromFile, toFile, toModule, preferences, packageJ
139860
139993
  false,
139861
139994
  (toPath3) => {
139862
139995
  const file = program.getSourceFile(toPath3);
139863
- return (file === toFile || !file) && isImportablePath(fromFile.fileName, toPath3, getCanonicalFileName, globalTypingsCache);
139996
+ return (file === toFile || !file) && isImportablePath(
139997
+ fromFile.fileName,
139998
+ toPath3,
139999
+ getCanonicalFileName,
140000
+ globalTypingsCache,
140001
+ moduleSpecifierResolutionHost
140002
+ );
139864
140003
  }
139865
140004
  );
139866
140005
  if (packageJsonFilter) {
@@ -139873,8 +140012,12 @@ function isImportable(program, fromFile, toFile, toModule, preferences, packageJ
139873
140012
  function fileContainsPackageImport(sourceFile, packageName) {
139874
140013
  return sourceFile.imports && sourceFile.imports.some((i) => i.text === packageName || i.text.startsWith(packageName + "/"));
139875
140014
  }
139876
- function isImportablePath(fromPath, toPath3, getCanonicalFileName, globalCachePath) {
139877
- const toNodeModules = forEachAncestorDirectory(toPath3, (ancestor) => getBaseFileName(ancestor) === "node_modules" ? ancestor : void 0);
140015
+ function isImportablePath(fromPath, toPath3, getCanonicalFileName, globalCachePath, host) {
140016
+ const toNodeModules = forEachAncestorDirectoryStoppingAtGlobalCache(
140017
+ host,
140018
+ toPath3,
140019
+ (ancestor) => getBaseFileName(ancestor) === "node_modules" ? ancestor : void 0
140020
+ );
139878
140021
  const toNodeModulesParent = toNodeModules && getDirectoryPath(getCanonicalFileName(toNodeModules));
139879
140022
  return toNodeModulesParent === void 0 || startsWith(getCanonicalFileName(fromPath), toNodeModulesParent) || !!globalCachePath && startsWith(getCanonicalFileName(globalCachePath), toNodeModulesParent);
139880
140023
  }
@@ -139945,13 +140088,17 @@ function getIsExcluded(excludePatterns, host) {
139945
140088
  if (excludePatterns.some((p) => p.test(fileName))) return true;
139946
140089
  if ((realpathsWithSymlinks == null ? void 0 : realpathsWithSymlinks.size) && pathContainsNodeModules(fileName)) {
139947
140090
  let dir = getDirectoryPath(fileName);
139948
- return forEachAncestorDirectory(getDirectoryPath(path), (dirPath) => {
139949
- const symlinks = realpathsWithSymlinks.get(ensureTrailingDirectorySeparator(dirPath));
139950
- if (symlinks) {
139951
- return symlinks.some((s) => excludePatterns.some((p) => p.test(fileName.replace(dir, s))));
140091
+ return forEachAncestorDirectoryStoppingAtGlobalCache(
140092
+ host,
140093
+ getDirectoryPath(path),
140094
+ (dirPath) => {
140095
+ const symlinks = realpathsWithSymlinks.get(ensureTrailingDirectorySeparator(dirPath));
140096
+ if (symlinks) {
140097
+ return symlinks.some((s) => excludePatterns.some((p) => p.test(fileName.replace(dir, s))));
140098
+ }
140099
+ dir = getDirectoryPath(dir);
139952
140100
  }
139953
- dir = getDirectoryPath(dir);
139954
- }) ?? false;
140101
+ ) ?? false;
139955
140102
  }
139956
140103
  return false;
139957
140104
  };
@@ -150326,7 +150473,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
150326
150473
  resolveLibrary: maybeBind(host, host.resolveLibrary),
150327
150474
  useSourceOfProjectReferenceRedirect: maybeBind(host, host.useSourceOfProjectReferenceRedirect),
150328
150475
  getParsedCommandLine,
150329
- jsDocParsingMode: host.jsDocParsingMode
150476
+ jsDocParsingMode: host.jsDocParsingMode,
150477
+ getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation)
150330
150478
  };
150331
150479
  const originalGetSourceFile = compilerHost.getSourceFile;
150332
150480
  const { getSourceFileWithCache } = changeCompilerHostLikeToUseCache(
@@ -152638,8 +152786,10 @@ __export(ts_codefix_exports, {
152638
152786
  setJsonCompilerOptionValue: () => setJsonCompilerOptionValue,
152639
152787
  setJsonCompilerOptionValues: () => setJsonCompilerOptionValues,
152640
152788
  tryGetAutoImportableReferenceFromTypeNode: () => tryGetAutoImportableReferenceFromTypeNode,
152789
+ typeNodeToAutoImportableTypeNode: () => typeNodeToAutoImportableTypeNode,
152641
152790
  typePredicateToAutoImportableTypeNode: () => typePredicateToAutoImportableTypeNode,
152642
- typeToAutoImportableTypeNode: () => typeToAutoImportableTypeNode
152791
+ typeToAutoImportableTypeNode: () => typeToAutoImportableTypeNode,
152792
+ typeToMinimizedReferenceType: () => typeToMinimizedReferenceType
152643
152793
  });
152644
152794
 
152645
152795
  // src/services/codeFixProvider.ts
@@ -155830,9 +155980,19 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
155830
155980
  );
155831
155981
  if (fix) {
155832
155982
  const localName = ((_b = tryCast(referenceImport == null ? void 0 : referenceImport.name, isIdentifier)) == null ? void 0 : _b.text) ?? symbolName2;
155983
+ let addAsTypeOnly;
155984
+ let propertyName;
155833
155985
  if (referenceImport && isTypeOnlyImportDeclaration(referenceImport) && (fix.kind === 3 /* AddNew */ || fix.kind === 2 /* AddToExisting */) && fix.addAsTypeOnly === 1 /* Allowed */) {
155834
- fix = { ...fix, addAsTypeOnly: 2 /* Required */ };
155986
+ addAsTypeOnly = 2 /* Required */;
155987
+ }
155988
+ if (exportedSymbol.name !== localName) {
155989
+ propertyName = exportedSymbol.name;
155835
155990
  }
155991
+ fix = {
155992
+ ...fix,
155993
+ ...addAsTypeOnly === void 0 ? {} : { addAsTypeOnly },
155994
+ ...propertyName === void 0 ? {} : { propertyName }
155995
+ };
155836
155996
  addImport({ fix, symbolName: localName ?? symbolName2, errorIdentifierText: void 0 });
155837
155997
  }
155838
155998
  }
@@ -155898,7 +156058,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
155898
156058
  removeExisting.add(declaration);
155899
156059
  }
155900
156060
  function addImport(info) {
155901
- var _a, _b;
156061
+ var _a, _b, _c;
155902
156062
  const { fix, symbolName: symbolName2 } = info;
155903
156063
  switch (fix.kind) {
155904
156064
  case 0 /* UseNamespace */:
@@ -155908,40 +156068,40 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
155908
156068
  importType.push(fix);
155909
156069
  break;
155910
156070
  case 2 /* AddToExisting */: {
155911
- const { importClauseOrBindingPattern, importKind, addAsTypeOnly } = fix;
156071
+ const { importClauseOrBindingPattern, importKind, addAsTypeOnly, propertyName } = fix;
155912
156072
  let entry = addToExisting.get(importClauseOrBindingPattern);
155913
156073
  if (!entry) {
155914
156074
  addToExisting.set(importClauseOrBindingPattern, entry = { importClauseOrBindingPattern, defaultImport: void 0, namedImports: /* @__PURE__ */ new Map() });
155915
156075
  }
155916
156076
  if (importKind === 0 /* Named */) {
155917
- const prevValue = entry == null ? void 0 : entry.namedImports.get(symbolName2);
155918
- entry.namedImports.set(symbolName2, reduceAddAsTypeOnlyValues(prevValue, addAsTypeOnly));
156077
+ const prevTypeOnly = (_a = entry == null ? void 0 : entry.namedImports.get(symbolName2)) == null ? void 0 : _a.addAsTypeOnly;
156078
+ entry.namedImports.set(symbolName2, { addAsTypeOnly: reduceAddAsTypeOnlyValues(prevTypeOnly, addAsTypeOnly), propertyName });
155919
156079
  } else {
155920
156080
  Debug.assert(entry.defaultImport === void 0 || entry.defaultImport.name === symbolName2, "(Add to Existing) Default import should be missing or match symbolName");
155921
156081
  entry.defaultImport = {
155922
156082
  name: symbolName2,
155923
- addAsTypeOnly: reduceAddAsTypeOnlyValues((_a = entry.defaultImport) == null ? void 0 : _a.addAsTypeOnly, addAsTypeOnly)
156083
+ addAsTypeOnly: reduceAddAsTypeOnlyValues((_b = entry.defaultImport) == null ? void 0 : _b.addAsTypeOnly, addAsTypeOnly)
155924
156084
  };
155925
156085
  }
155926
156086
  break;
155927
156087
  }
155928
156088
  case 3 /* AddNew */: {
155929
- const { moduleSpecifier, importKind, useRequire, addAsTypeOnly } = fix;
156089
+ const { moduleSpecifier, importKind, useRequire, addAsTypeOnly, propertyName } = fix;
155930
156090
  const entry = getNewImportEntry(moduleSpecifier, importKind, useRequire, addAsTypeOnly);
155931
156091
  Debug.assert(entry.useRequire === useRequire, "(Add new) Tried to add an `import` and a `require` for the same module");
155932
156092
  switch (importKind) {
155933
156093
  case 1 /* Default */:
155934
156094
  Debug.assert(entry.defaultImport === void 0 || entry.defaultImport.name === symbolName2, "(Add new) Default import should be missing or match symbolName");
155935
- entry.defaultImport = { name: symbolName2, addAsTypeOnly: reduceAddAsTypeOnlyValues((_b = entry.defaultImport) == null ? void 0 : _b.addAsTypeOnly, addAsTypeOnly) };
156095
+ entry.defaultImport = { name: symbolName2, addAsTypeOnly: reduceAddAsTypeOnlyValues((_c = entry.defaultImport) == null ? void 0 : _c.addAsTypeOnly, addAsTypeOnly) };
155936
156096
  break;
155937
156097
  case 0 /* Named */:
155938
156098
  const prevValue = (entry.namedImports || (entry.namedImports = /* @__PURE__ */ new Map())).get(symbolName2);
155939
- entry.namedImports.set(symbolName2, reduceAddAsTypeOnlyValues(prevValue, addAsTypeOnly));
156099
+ entry.namedImports.set(symbolName2, [reduceAddAsTypeOnlyValues(prevValue, addAsTypeOnly), propertyName]);
155940
156100
  break;
155941
156101
  case 3 /* CommonJS */:
155942
156102
  if (compilerOptions.verbatimModuleSyntax) {
155943
156103
  const prevValue2 = (entry.namedImports || (entry.namedImports = /* @__PURE__ */ new Map())).get(symbolName2);
155944
- entry.namedImports.set(symbolName2, reduceAddAsTypeOnlyValues(prevValue2, addAsTypeOnly));
156104
+ entry.namedImports.set(symbolName2, [reduceAddAsTypeOnlyValues(prevValue2, addAsTypeOnly), propertyName]);
155945
156105
  } else {
155946
156106
  Debug.assert(entry.namespaceLikeImport === void 0 || entry.namespaceLikeImport.name === symbolName2, "Namespacelike import shoudl be missing or match symbolName");
155947
156107
  entry.namespaceLikeImport = { importKind, name: symbolName2, addAsTypeOnly };
@@ -156095,7 +156255,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
156095
156255
  sourceFile,
156096
156256
  importClauseOrBindingPattern,
156097
156257
  defaultImport,
156098
- arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
156258
+ arrayFrom(namedImports.entries(), ([name, { addAsTypeOnly, propertyName }]) => ({ addAsTypeOnly, propertyName, name })),
156099
156259
  importSpecifiersToRemoveWhileAdding,
156100
156260
  preferences
156101
156261
  );
@@ -156108,7 +156268,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
156108
156268
  moduleSpecifier,
156109
156269
  quotePreference,
156110
156270
  defaultImport,
156111
- namedImports && arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
156271
+ namedImports && arrayFrom(namedImports.entries(), ([name, [addAsTypeOnly, propertyName]]) => ({ addAsTypeOnly, propertyName, name })),
156112
156272
  namespaceLikeImport,
156113
156273
  compilerOptions,
156114
156274
  preferences
@@ -157008,8 +157168,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
157008
157168
  ...namedImports.map((i) => factory.createBindingElement(
157009
157169
  /*dotDotDotToken*/
157010
157170
  void 0,
157011
- /*propertyName*/
157012
- void 0,
157171
+ i.propertyName,
157013
157172
  i.name
157014
157173
  ))
157015
157174
  ])
@@ -157020,12 +157179,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
157020
157179
  addElementToBindingPattern(clause, defaultImport.name, "default");
157021
157180
  }
157022
157181
  for (const specifier of namedImports) {
157023
- addElementToBindingPattern(
157024
- clause,
157025
- specifier.name,
157026
- /*propertyName*/
157027
- void 0
157028
- );
157182
+ addElementToBindingPattern(clause, specifier.name, specifier.propertyName);
157029
157183
  }
157030
157184
  return;
157031
157185
  }
@@ -157041,8 +157195,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
157041
157195
  namedImports.map(
157042
157196
  (namedImport) => factory.createImportSpecifier(
157043
157197
  (!clause.isTypeOnly || promoteFromTypeOnly2) && shouldUseTypeOnly(namedImport, preferences),
157044
- /*propertyName*/
157045
- void 0,
157198
+ namedImport.propertyName === void 0 ? void 0 : factory.createIdentifier(namedImport.propertyName),
157046
157199
  factory.createIdentifier(namedImport.name)
157047
157200
  )
157048
157201
  ),
@@ -157137,8 +157290,7 @@ function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImp
157137
157290
  namedImports == null ? void 0 : namedImports.map(
157138
157291
  (namedImport) => factory.createImportSpecifier(
157139
157292
  !topLevelTypeOnly && shouldUseTypeOnly(namedImport, preferences),
157140
- /*propertyName*/
157141
- void 0,
157293
+ namedImport.propertyName === void 0 ? void 0 : factory.createIdentifier(namedImport.propertyName),
157142
157294
  factory.createIdentifier(namedImport.name)
157143
157295
  )
157144
157296
  ),
@@ -157176,11 +157328,10 @@ function getNewRequires(moduleSpecifier, quotePreference, defaultImport, namedIm
157176
157328
  const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
157177
157329
  let statements;
157178
157330
  if (defaultImport || (namedImports == null ? void 0 : namedImports.length)) {
157179
- const bindingElements = (namedImports == null ? void 0 : namedImports.map(({ name }) => factory.createBindingElement(
157331
+ const bindingElements = (namedImports == null ? void 0 : namedImports.map(({ name, propertyName }) => factory.createBindingElement(
157180
157332
  /*dotDotDotToken*/
157181
157333
  void 0,
157182
- /*propertyName*/
157183
- void 0,
157334
+ propertyName,
157184
157335
  name
157185
157336
  ))) || [];
157186
157337
  if (defaultImport) {
@@ -161014,7 +161165,7 @@ function withContext(context, typePrintMode, cb) {
161014
161165
  }
161015
161166
  function typeToTypeNode2(type, enclosingDeclaration, flags = 0 /* None */) {
161016
161167
  let isTruncated = false;
161017
- const result2 = typeToAutoImportableTypeNode(typeChecker, importAdder, type, enclosingDeclaration, scriptTarget, declarationEmitNodeBuilderFlags2 | flags, declarationEmitInternalNodeBuilderFlags2, {
161168
+ const minimizedTypeNode = typeToMinimizedReferenceType(typeChecker, type, enclosingDeclaration, declarationEmitNodeBuilderFlags2 | flags, declarationEmitInternalNodeBuilderFlags2, {
161018
161169
  moduleResolverHost: program,
161019
161170
  trackSymbol() {
161020
161171
  return true;
@@ -161023,6 +161174,10 @@ function withContext(context, typePrintMode, cb) {
161023
161174
  isTruncated = true;
161024
161175
  }
161025
161176
  });
161177
+ if (!minimizedTypeNode) {
161178
+ return void 0;
161179
+ }
161180
+ const result2 = typeNodeToAutoImportableTypeNode(minimizedTypeNode, importAdder, scriptTarget);
161026
161181
  return isTruncated ? factory.createKeywordTypeNode(133 /* AnyKeyword */) : result2;
161027
161182
  }
161028
161183
  function typePredicateToTypeNode(typePredicate, enclosingDeclaration, flags = 0 /* None */) {
@@ -162726,7 +162881,13 @@ function createTypeParameterName(index) {
162726
162881
  return 84 /* T */ + index <= 90 /* Z */ ? String.fromCharCode(84 /* T */ + index) : `T${index}`;
162727
162882
  }
162728
162883
  function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, scriptTarget, flags, internalFlags, tracker) {
162729
- let typeNode = checker.typeToTypeNode(type, contextNode, flags, internalFlags, tracker);
162884
+ const typeNode = checker.typeToTypeNode(type, contextNode, flags, internalFlags, tracker);
162885
+ if (!typeNode) {
162886
+ return void 0;
162887
+ }
162888
+ return typeNodeToAutoImportableTypeNode(typeNode, importAdder, scriptTarget);
162889
+ }
162890
+ function typeNodeToAutoImportableTypeNode(typeNode, importAdder, scriptTarget) {
162730
162891
  if (typeNode && isImportTypeNode(typeNode)) {
162731
162892
  const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
162732
162893
  if (importableReference) {
@@ -162736,6 +162897,42 @@ function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, s
162736
162897
  }
162737
162898
  return getSynthesizedDeepClone(typeNode);
162738
162899
  }
162900
+ function endOfRequiredTypeParameters(checker, type) {
162901
+ Debug.assert(type.typeArguments);
162902
+ const fullTypeArguments = type.typeArguments;
162903
+ const target = type.target;
162904
+ for (let cutoff = 0; cutoff < fullTypeArguments.length; cutoff++) {
162905
+ const typeArguments = fullTypeArguments.slice(0, cutoff);
162906
+ const filledIn = checker.fillMissingTypeArguments(
162907
+ typeArguments,
162908
+ target.typeParameters,
162909
+ cutoff,
162910
+ /*isJavaScriptImplicitAny*/
162911
+ false
162912
+ );
162913
+ if (filledIn.every((fill, i) => fill === fullTypeArguments[i])) {
162914
+ return cutoff;
162915
+ }
162916
+ }
162917
+ return fullTypeArguments.length;
162918
+ }
162919
+ function typeToMinimizedReferenceType(checker, type, contextNode, flags, internalFlags, tracker) {
162920
+ let typeNode = checker.typeToTypeNode(type, contextNode, flags, internalFlags, tracker);
162921
+ if (!typeNode) {
162922
+ return void 0;
162923
+ }
162924
+ if (isTypeReferenceNode(typeNode)) {
162925
+ const genericType = type;
162926
+ if (genericType.typeArguments && typeNode.typeArguments) {
162927
+ const cutoff = endOfRequiredTypeParameters(checker, genericType);
162928
+ if (cutoff < typeNode.typeArguments.length) {
162929
+ const newTypeArguments = factory.createNodeArray(typeNode.typeArguments.slice(0, cutoff));
162930
+ typeNode = factory.updateTypeReferenceNode(typeNode, typeNode.typeName, newTypeArguments);
162931
+ }
162932
+ }
162933
+ }
162934
+ return typeNode;
162935
+ }
162739
162936
  function typePredicateToAutoImportableTypeNode(checker, importAdder, typePredicate, contextNode, scriptTarget, flags, internalFlags, tracker) {
162740
162937
  let typePredicateNode = checker.typePredicateToTypePredicateNode(typePredicate, contextNode, flags, internalFlags, tracker);
162741
162938
  if ((typePredicateNode == null ? void 0 : typePredicateNode.type) && isImportTypeNode(typePredicateNode.type)) {
@@ -165724,7 +165921,7 @@ function getSourceFromOrigin(origin) {
165724
165921
  }
165725
165922
  function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
165726
165923
  const start = timestamp();
165727
- const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location);
165924
+ const closestSymbolDeclaration = getClosestSymbolDeclaration(contextToken, location);
165728
165925
  const useSemicolons = probablyUsesSemicolons(sourceFile);
165729
165926
  const typeChecker = program.getTypeChecker();
165730
165927
  const uniques = /* @__PURE__ */ new Map();
@@ -165794,15 +165991,26 @@ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, con
165794
165991
  if (isExportAssignment(location.parent)) {
165795
165992
  return true;
165796
165993
  }
165797
- if (tryCast(variableOrParameterDeclaration, isVariableDeclaration) && symbol.valueDeclaration === variableOrParameterDeclaration) {
165994
+ if (tryCast(closestSymbolDeclaration, isVariableDeclaration) && symbol.valueDeclaration === closestSymbolDeclaration) {
165798
165995
  return false;
165799
165996
  }
165800
165997
  const symbolDeclaration = symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
165801
- if (variableOrParameterDeclaration && symbolDeclaration && (isTypeParameterDeclaration(variableOrParameterDeclaration) && isTypeParameterDeclaration(symbolDeclaration) || isParameter(variableOrParameterDeclaration) && isParameter(symbolDeclaration))) {
165802
- const symbolDeclarationPos = symbolDeclaration.pos;
165803
- const parameters = isParameter(variableOrParameterDeclaration) ? variableOrParameterDeclaration.parent.parameters : isInferTypeNode(variableOrParameterDeclaration.parent) ? void 0 : variableOrParameterDeclaration.parent.typeParameters;
165804
- if (symbolDeclarationPos >= variableOrParameterDeclaration.pos && parameters && symbolDeclarationPos < parameters.end) {
165805
- return false;
165998
+ if (closestSymbolDeclaration && symbolDeclaration) {
165999
+ if (isParameter(closestSymbolDeclaration) && isParameter(symbolDeclaration)) {
166000
+ const parameters = closestSymbolDeclaration.parent.parameters;
166001
+ if (symbolDeclaration.pos >= closestSymbolDeclaration.pos && symbolDeclaration.pos < parameters.end) {
166002
+ return false;
166003
+ }
166004
+ } else if (isTypeParameterDeclaration(closestSymbolDeclaration) && isTypeParameterDeclaration(symbolDeclaration)) {
166005
+ if (closestSymbolDeclaration === symbolDeclaration && (contextToken == null ? void 0 : contextToken.kind) === 96 /* ExtendsKeyword */) {
166006
+ return false;
166007
+ }
166008
+ if (isInTypeParameterDefault(contextToken) && !isInferTypeNode(closestSymbolDeclaration.parent)) {
166009
+ const typeParameters = closestSymbolDeclaration.parent.typeParameters;
166010
+ if (typeParameters && symbolDeclaration.pos >= closestSymbolDeclaration.pos && symbolDeclaration.pos < typeParameters.end) {
166011
+ return false;
166012
+ }
166013
+ }
165806
166014
  }
165807
166015
  }
165808
166016
  const symbolOrigin = skipAlias(symbol, typeChecker);
@@ -168085,11 +168293,28 @@ function isModuleSpecifierMissingOrEmpty(specifier) {
168085
168293
  if (nodeIsMissing(specifier)) return true;
168086
168294
  return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text);
168087
168295
  }
168088
- function getVariableOrParameterDeclaration(contextToken, location) {
168296
+ function getClosestSymbolDeclaration(contextToken, location) {
168089
168297
  if (!contextToken) return;
168090
- const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
168091
- const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node));
168092
- return possiblyParameterDeclaration || possiblyVariableDeclaration;
168298
+ let closestDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
168299
+ if (!closestDeclaration) {
168300
+ closestDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node));
168301
+ }
168302
+ return closestDeclaration;
168303
+ }
168304
+ function isInTypeParameterDefault(contextToken) {
168305
+ if (!contextToken) {
168306
+ return false;
168307
+ }
168308
+ let node = contextToken;
168309
+ let parent2 = contextToken.parent;
168310
+ while (parent2) {
168311
+ if (isTypeParameterDeclaration(parent2)) {
168312
+ return parent2.default === node || node.kind === 64 /* EqualsToken */;
168313
+ }
168314
+ node = parent2;
168315
+ parent2 = parent2.parent;
168316
+ }
168317
+ return false;
168093
168318
  }
168094
168319
  function isArrowFunctionBody(node) {
168095
168320
  return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/;
@@ -168855,7 +169080,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
168855
169080
  return nodeModulesDirectoryLookup(ancestor);
168856
169081
  };
168857
169082
  }
168858
- forEachAncestorDirectory(scriptPath, ancestorLookup);
169083
+ forEachAncestorDirectoryStoppingAtGlobalCache(host, scriptPath, ancestorLookup);
168859
169084
  }
168860
169085
  }
168861
169086
  return arrayFrom(result.values());
@@ -180473,6 +180698,7 @@ __export(ts_exports2, {
180473
180698
  canWatchAffectingLocation: () => canWatchAffectingLocation,
180474
180699
  canWatchAtTypes: () => canWatchAtTypes,
180475
180700
  canWatchDirectoryOrFile: () => canWatchDirectoryOrFile,
180701
+ canWatchDirectoryOrFilePath: () => canWatchDirectoryOrFilePath,
180476
180702
  cartesianProduct: () => cartesianProduct,
180477
180703
  cast: () => cast,
180478
180704
  chainBundle: () => chainBundle,
@@ -180805,6 +181031,7 @@ __export(ts_exports2, {
180805
181031
  forEach: () => forEach,
180806
181032
  forEachAncestor: () => forEachAncestor,
180807
181033
  forEachAncestorDirectory: () => forEachAncestorDirectory,
181034
+ forEachAncestorDirectoryStoppingAtGlobalCache: () => forEachAncestorDirectoryStoppingAtGlobalCache,
180808
181035
  forEachChild: () => forEachChild,
180809
181036
  forEachChildRecursively: () => forEachChildRecursively,
180810
181037
  forEachEmittedFile: () => forEachEmittedFile,
@@ -180847,6 +181074,7 @@ __export(ts_exports2, {
180847
181074
  getAllKeys: () => getAllKeys,
180848
181075
  getAllProjectOutputs: () => getAllProjectOutputs,
180849
181076
  getAllSuperTypeNodes: () => getAllSuperTypeNodes,
181077
+ getAllowImportingTsExtensions: () => getAllowImportingTsExtensions,
180850
181078
  getAllowJSCompilerOption: () => getAllowJSCompilerOption,
180851
181079
  getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports,
180852
181080
  getAncestor: () => getAncestor,
@@ -181418,7 +181646,7 @@ __export(ts_exports2, {
181418
181646
  isBooleanLiteral: () => isBooleanLiteral,
181419
181647
  isBreakOrContinueStatement: () => isBreakOrContinueStatement,
181420
181648
  isBreakStatement: () => isBreakStatement,
181421
- isBuild: () => isBuild,
181649
+ isBuildCommand: () => isBuildCommand,
181422
181650
  isBuildInfoFile: () => isBuildInfoFile,
181423
181651
  isBuilderProgram: () => isBuilderProgram,
181424
181652
  isBundle: () => isBundle,
@@ -181834,6 +182062,7 @@ __export(ts_exports2, {
181834
182062
  isParseTreeNode: () => isParseTreeNode,
181835
182063
  isPartOfParameterDeclaration: () => isPartOfParameterDeclaration,
181836
182064
  isPartOfTypeNode: () => isPartOfTypeNode,
182065
+ isPartOfTypeOnlyImportOrExportDeclaration: () => isPartOfTypeOnlyImportOrExportDeclaration,
181837
182066
  isPartOfTypeQuery: () => isPartOfTypeQuery,
181838
182067
  isPartiallyEmittedExpression: () => isPartiallyEmittedExpression,
181839
182068
  isPatternMatch: () => isPatternMatch,
@@ -182231,6 +182460,7 @@ __export(ts_exports2, {
182231
182460
  returnTrue: () => returnTrue,
182232
182461
  returnUndefined: () => returnUndefined,
182233
182462
  returnsPromise: () => returnsPromise,
182463
+ rewriteModuleSpecifier: () => rewriteModuleSpecifier,
182234
182464
  sameFlatMap: () => sameFlatMap,
182235
182465
  sameMap: () => sameMap,
182236
182466
  sameMapping: () => sameMapping,
@@ -182276,6 +182506,7 @@ __export(ts_exports2, {
182276
182506
  setValueDeclaration: () => setValueDeclaration,
182277
182507
  shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
182278
182508
  shouldPreserveConstEnums: () => shouldPreserveConstEnums,
182509
+ shouldRewriteModuleSpecifier: () => shouldRewriteModuleSpecifier,
182279
182510
  shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
182280
182511
  showModuleSpecifier: () => showModuleSpecifier,
182281
182512
  signatureHasRestParameter: () => signatureHasRestParameter,
@@ -182427,6 +182658,7 @@ __export(ts_exports2, {
182427
182658
  tryRemoveExtension: () => tryRemoveExtension,
182428
182659
  tryRemovePrefix: () => tryRemovePrefix,
182429
182660
  tryRemoveSuffix: () => tryRemoveSuffix,
182661
+ tscBuildOption: () => tscBuildOption,
182430
182662
  typeAcquisitionDeclarations: () => typeAcquisitionDeclarations,
182431
182663
  typeAliasNamePart: () => typeAliasNamePart,
182432
182664
  typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
@@ -182652,6 +182884,7 @@ __export(ts_server_exports3, {
182652
182884
  formatDiagnosticToProtocol: () => formatDiagnosticToProtocol,
182653
182885
  formatMessage: () => formatMessage2,
182654
182886
  getBaseConfigFileName: () => getBaseConfigFileName,
182887
+ getDetailWatchInfo: () => getDetailWatchInfo,
182655
182888
  getLocationInNewDocument: () => getLocationInNewDocument,
182656
182889
  hasArgument: () => hasArgument,
182657
182890
  hasNoTypeScriptSource: () => hasNoTypeScriptSource,
@@ -184070,10 +184303,9 @@ function unresolvedImportsChanged(imports1, imports2) {
184070
184303
  }
184071
184304
  var Project2 = class _Project {
184072
184305
  /** @internal */
184073
- constructor(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, lastFileExceededProgramSize, compilerOptions, compileOnSaveEnabled, watchOptions, directoryStructureHost, currentDirectory) {
184306
+ constructor(projectName, projectKind, projectService, hasExplicitListOfFiles, lastFileExceededProgramSize, compilerOptions, compileOnSaveEnabled, watchOptions, directoryStructureHost, currentDirectory) {
184074
184307
  this.projectKind = projectKind;
184075
184308
  this.projectService = projectService;
184076
- this.documentRegistry = documentRegistry;
184077
184309
  this.compilerOptions = compilerOptions;
184078
184310
  this.compileOnSaveEnabled = compileOnSaveEnabled;
184079
184311
  this.watchOptions = watchOptions;
@@ -184166,7 +184398,11 @@ var Project2 = class _Project {
184166
184398
  /*logChangesWhenResolvingModule*/
184167
184399
  true
184168
184400
  );
184169
- this.languageService = createLanguageService(this, this.documentRegistry, this.projectService.serverMode);
184401
+ this.languageService = createLanguageService(
184402
+ this,
184403
+ this.projectService.documentRegistry,
184404
+ this.projectService.serverMode
184405
+ );
184170
184406
  if (lastFileExceededProgramSize) {
184171
184407
  this.disableLanguageService(lastFileExceededProgramSize);
184172
184408
  }
@@ -184240,7 +184476,7 @@ var Project2 = class _Project {
184240
184476
  }
184241
184477
  /** @internal */
184242
184478
  getGlobalTypingsCacheLocation() {
184243
- return this.getGlobalCache();
184479
+ return this.getTypeAcquisition().enable ? this.projectService.typingsInstaller.globalTypingsCacheLocation : void 0;
184244
184480
  }
184245
184481
  /** @internal */
184246
184482
  getSymlinkCache() {
@@ -184455,10 +184691,6 @@ var Project2 = class _Project {
184455
184691
  this.projectService.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(this);
184456
184692
  }
184457
184693
  /** @internal */
184458
- getGlobalCache() {
184459
- return this.getTypeAcquisition().enable ? this.projectService.typingsInstaller.globalTypingsCacheLocation : void 0;
184460
- }
184461
- /** @internal */
184462
184694
  fileIsOpen(filePath) {
184463
184695
  return this.projectService.openFiles.has(filePath);
184464
184696
  }
@@ -184988,14 +185220,15 @@ var Project2 = class _Project {
184988
185220
  const canonicalPath = this.toPath(path);
184989
185221
  toRemove.delete(canonicalPath);
184990
185222
  if (!this.typingWatchers.has(canonicalPath)) {
185223
+ const watchType = typingsWatcherType === "FileWatcher" /* FileWatcher */ ? WatchType.TypingInstallerLocationFile : WatchType.TypingInstallerLocationDirectory;
184991
185224
  this.typingWatchers.set(
184992
185225
  canonicalPath,
184993
- typingsWatcherType === "FileWatcher" /* FileWatcher */ ? this.projectService.watchFactory.watchFile(
185226
+ canWatchDirectoryOrFilePath(canonicalPath) ? typingsWatcherType === "FileWatcher" /* FileWatcher */ ? this.projectService.watchFactory.watchFile(
184994
185227
  path,
184995
185228
  () => !this.typingWatchers.isInvoked ? this.onTypingInstallerWatchInvoke() : this.writeLog(`TypingWatchers already invoked`),
184996
185229
  2e3 /* High */,
184997
185230
  this.projectService.getWatchOptions(this),
184998
- WatchType.TypingInstallerLocationFile,
185231
+ watchType,
184999
185232
  this
185000
185233
  ) : this.projectService.watchFactory.watchDirectory(
185001
185234
  path,
@@ -185007,9 +185240,9 @@ var Project2 = class _Project {
185007
185240
  },
185008
185241
  1 /* Recursive */,
185009
185242
  this.projectService.getWatchOptions(this),
185010
- WatchType.TypingInstallerLocationDirectory,
185243
+ watchType,
185011
185244
  this
185012
- )
185245
+ ) : (this.writeLog(`Skipping watcher creation at ${path}:: ${getDetailWatchInfo(watchType, this)}`), noopFileWatcher)
185013
185246
  );
185014
185247
  }
185015
185248
  };
@@ -185551,7 +185784,7 @@ var Project2 = class _Project {
185551
185784
  }
185552
185785
  /** @internal */
185553
185786
  getNearestAncestorDirectoryWithPackageJson(fileName) {
185554
- return this.projectService.getNearestAncestorDirectoryWithPackageJson(fileName);
185787
+ return this.projectService.getNearestAncestorDirectoryWithPackageJson(fileName, this);
185555
185788
  }
185556
185789
  /** @internal */
185557
185790
  getPackageJsonsForAutoImport(rootDir) {
@@ -185622,7 +185855,11 @@ var Project2 = class _Project {
185622
185855
  if (dependencySelection) {
185623
185856
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "getPackageJsonAutoImportProvider");
185624
185857
  const start = timestamp();
185625
- this.autoImportProviderHost = AutoImportProviderProject.create(dependencySelection, this, this.getHostForAutoImportProvider(), this.documentRegistry) ?? false;
185858
+ this.autoImportProviderHost = AutoImportProviderProject.create(
185859
+ dependencySelection,
185860
+ this,
185861
+ this.getHostForAutoImportProvider()
185862
+ ) ?? false;
185626
185863
  if (this.autoImportProviderHost) {
185627
185864
  updateProjectIfDirty(this.autoImportProviderHost);
185628
185865
  this.sendPerformanceEvent("CreatePackageJsonAutoImportProvider", timestamp() - start);
@@ -185649,11 +185886,12 @@ var Project2 = class _Project {
185649
185886
  /** @internal */
185650
185887
  getNoDtsResolutionProject(rootFile) {
185651
185888
  Debug.assert(this.projectService.serverMode === 0 /* Semantic */);
185652
- if (!this.noDtsResolutionProject) {
185653
- this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject(), this.currentDirectory);
185654
- }
185889
+ this.noDtsResolutionProject ?? (this.noDtsResolutionProject = new AuxiliaryProject(this));
185655
185890
  if (this.noDtsResolutionProject.rootFile !== rootFile) {
185656
- this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this.noDtsResolutionProject, [rootFile]);
185891
+ this.projectService.setFileNamesOfAutoImportProviderOrAuxillaryProject(
185892
+ this.noDtsResolutionProject,
185893
+ [rootFile]
185894
+ );
185657
185895
  this.noDtsResolutionProject.rootFile = rootFile;
185658
185896
  }
185659
185897
  return this.noDtsResolutionProject;
@@ -185672,6 +185910,7 @@ var Project2 = class _Project {
185672
185910
  (_d = this.getScriptInfo(rootFile)) == null ? void 0 : _d.editContent(0, updatedText.length, originalText);
185673
185911
  }
185674
185912
  }
185913
+ /** @internal */
185675
185914
  getCompilerOptionsForNoDtsResolutionProject() {
185676
185915
  return {
185677
185916
  ...this.getCompilerOptions(),
@@ -185714,15 +185953,13 @@ function extractUnresolvedImportsFromSourceFile(program, file, ambientModules, c
185714
185953
  }
185715
185954
  var InferredProject2 = class extends Project2 {
185716
185955
  /** @internal */
185717
- constructor(projectService, documentRegistry, compilerOptions, watchOptions, projectRootPath, currentDirectory, typeAcquisition) {
185956
+ constructor(projectService, compilerOptions, watchOptions, projectRootPath, currentDirectory, typeAcquisition) {
185718
185957
  super(
185719
185958
  projectService.newInferredProjectName(),
185720
185959
  0 /* Inferred */,
185721
185960
  projectService,
185722
- documentRegistry,
185723
- // TODO: GH#18217
185724
- /*files*/
185725
- void 0,
185961
+ /*hasExplicitListOfFiles*/
185962
+ false,
185726
185963
  /*lastFileExceededProgramSize*/
185727
185964
  void 0,
185728
185965
  compilerOptions,
@@ -185807,23 +186044,22 @@ var InferredProject2 = class extends Project2 {
185807
186044
  }
185808
186045
  };
185809
186046
  var AuxiliaryProject = class extends Project2 {
185810
- constructor(projectService, documentRegistry, compilerOptions, currentDirectory) {
186047
+ constructor(hostProject) {
185811
186048
  super(
185812
- projectService.newAuxiliaryProjectName(),
186049
+ hostProject.projectService.newAuxiliaryProjectName(),
185813
186050
  4 /* Auxiliary */,
185814
- projectService,
185815
- documentRegistry,
186051
+ hostProject.projectService,
185816
186052
  /*hasExplicitListOfFiles*/
185817
186053
  false,
185818
186054
  /*lastFileExceededProgramSize*/
185819
186055
  void 0,
185820
- compilerOptions,
186056
+ hostProject.getCompilerOptionsForNoDtsResolutionProject(),
185821
186057
  /*compileOnSaveEnabled*/
185822
186058
  false,
185823
186059
  /*watchOptions*/
185824
186060
  void 0,
185825
- projectService.host,
185826
- currentDirectory
186061
+ hostProject.projectService.host,
186062
+ hostProject.currentDirectory
185827
186063
  );
185828
186064
  }
185829
186065
  isOrphan() {
@@ -185835,12 +186071,11 @@ var AuxiliaryProject = class extends Project2 {
185835
186071
  };
185836
186072
  var _AutoImportProviderProject = class _AutoImportProviderProject extends Project2 {
185837
186073
  /** @internal */
185838
- constructor(hostProject, initialRootNames, documentRegistry, compilerOptions) {
186074
+ constructor(hostProject, initialRootNames, compilerOptions) {
185839
186075
  super(
185840
186076
  hostProject.projectService.newAutoImportProviderProjectName(),
185841
186077
  3 /* AutoImportProvider */,
185842
186078
  hostProject.projectService,
185843
- documentRegistry,
185844
186079
  /*hasExplicitListOfFiles*/
185845
186080
  false,
185846
186081
  /*lastFileExceededProgramSize*/
@@ -186001,7 +186236,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
186001
186236
  }
186002
186237
  }
186003
186238
  /** @internal */
186004
- static create(dependencySelection, hostProject, host, documentRegistry) {
186239
+ static create(dependencySelection, hostProject, host) {
186005
186240
  if (dependencySelection === 0 /* Off */) {
186006
186241
  return void 0;
186007
186242
  }
@@ -186013,7 +186248,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
186013
186248
  if (!rootNames.length) {
186014
186249
  return void 0;
186015
186250
  }
186016
- return new _AutoImportProviderProject(hostProject, rootNames, documentRegistry, compilerOptions);
186251
+ return new _AutoImportProviderProject(hostProject, rootNames, compilerOptions);
186017
186252
  }
186018
186253
  /** @internal */
186019
186254
  isEmpty() {
@@ -186033,7 +186268,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
186033
186268
  this.getCompilationSettings()
186034
186269
  );
186035
186270
  }
186036
- this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this, rootFileNames);
186271
+ this.projectService.setFileNamesOfAutoImportProviderOrAuxillaryProject(this, rootFileNames);
186037
186272
  this.rootFileNames = rootFileNames;
186038
186273
  const oldProgram = this.getCurrentProgram();
186039
186274
  const hasSameSetOfFiles = super.updateGraph();
@@ -186102,12 +186337,11 @@ _AutoImportProviderProject.compilerOptionsOverrides = {
186102
186337
  var AutoImportProviderProject = _AutoImportProviderProject;
186103
186338
  var ConfiguredProject2 = class extends Project2 {
186104
186339
  /** @internal */
186105
- constructor(configFileName, canonicalConfigFilePath, projectService, documentRegistry, cachedDirectoryStructureHost, pendingUpdateReason) {
186340
+ constructor(configFileName, canonicalConfigFilePath, projectService, cachedDirectoryStructureHost, pendingUpdateReason) {
186106
186341
  super(
186107
186342
  configFileName,
186108
186343
  1 /* Configured */,
186109
186344
  projectService,
186110
- documentRegistry,
186111
186345
  /*hasExplicitListOfFiles*/
186112
186346
  false,
186113
186347
  /*lastFileExceededProgramSize*/
@@ -186307,12 +186541,11 @@ var ConfiguredProject2 = class extends Project2 {
186307
186541
  };
186308
186542
  var ExternalProject = class extends Project2 {
186309
186543
  /** @internal */
186310
- constructor(externalProjectName, projectService, documentRegistry, compilerOptions, lastFileExceededProgramSize, compileOnSaveEnabled, projectFilePath, watchOptions) {
186544
+ constructor(externalProjectName, projectService, compilerOptions, lastFileExceededProgramSize, compileOnSaveEnabled, projectFilePath, watchOptions) {
186311
186545
  super(
186312
186546
  externalProjectName,
186313
186547
  2 /* External */,
186314
186548
  projectService,
186315
- documentRegistry,
186316
186549
  /*hasExplicitListOfFiles*/
186317
186550
  true,
186318
186551
  lastFileExceededProgramSize,
@@ -186935,7 +187168,12 @@ var _ProjectService = class _ProjectService {
186935
187168
  hostInfo: "Unknown host",
186936
187169
  extraFileExtensions: []
186937
187170
  };
186938
- this.documentRegistry = createDocumentRegistryInternal(this.host.useCaseSensitiveFileNames, this.currentDirectory, this.jsDocParsingMode, this);
187171
+ this.documentRegistry = createDocumentRegistryInternal(
187172
+ this.host.useCaseSensitiveFileNames,
187173
+ this.currentDirectory,
187174
+ this.jsDocParsingMode,
187175
+ this
187176
+ );
186939
187177
  const watchLogLevel = this.logger.hasLevel(3 /* verbose */) ? 2 /* Verbose */ : this.logger.loggingEnabled() ? 1 /* TriggerOnly */ : 0 /* None */;
186940
187178
  const log = watchLogLevel !== 0 /* None */ ? (s) => this.logger.info(s) : noop;
186941
187179
  this.packageJsonCache = createPackageJsonCache(this);
@@ -187707,7 +187945,7 @@ var _ProjectService = class _ProjectService {
187707
187945
  Debug.checkDefined(configFileExistenceInfo.watcher);
187708
187946
  if ((_c = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _c.size) {
187709
187947
  if (configFileExistenceInfo.inferredProjectRoots) {
187710
- if (!canWatchDirectoryOrFile(getPathComponents(getDirectoryPath(canonicalConfigFilePath)))) {
187948
+ if (!canWatchDirectoryOrFilePath(getDirectoryPath(canonicalConfigFilePath))) {
187711
187949
  configFileExistenceInfo.watcher.close();
187712
187950
  configFileExistenceInfo.watcher = noopConfigFileWatcher;
187713
187951
  }
@@ -187770,7 +188008,7 @@ var _ProjectService = class _ProjectService {
187770
188008
  configFileExistenceInfo.inferredProjectRoots = (configFileExistenceInfo.inferredProjectRoots ?? 0) + 1;
187771
188009
  }
187772
188010
  (configFileExistenceInfo.openFilesImpactedByConfigFile ?? (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Set())).add(info.path);
187773
- configFileExistenceInfo.watcher || (configFileExistenceInfo.watcher = canWatchDirectoryOrFile(getPathComponents(getDirectoryPath(canonicalConfigFilePath))) ? this.watchFactory.watchFile(
188011
+ configFileExistenceInfo.watcher || (configFileExistenceInfo.watcher = canWatchDirectoryOrFilePath(getDirectoryPath(canonicalConfigFilePath)) ? this.watchFactory.watchFile(
187774
188012
  configFileName,
187775
188013
  (_filename, eventKind) => this.onConfigFileChanged(configFileName, canonicalConfigFilePath, eventKind),
187776
188014
  2e3 /* High */,
@@ -187919,7 +188157,6 @@ var _ProjectService = class _ProjectService {
187919
188157
  const project = new ExternalProject(
187920
188158
  projectFileName,
187921
188159
  this,
187922
- this.documentRegistry,
187923
188160
  compilerOptions,
187924
188161
  /*lastFileExceededProgramSize*/
187925
188162
  this.getFilenameForExceededTotalSizeLimitForNonTsFiles(projectFileName, compilerOptions, files, externalFilePropertyReader),
@@ -188008,7 +188245,6 @@ var _ProjectService = class _ProjectService {
188008
188245
  configFileName,
188009
188246
  canonicalConfigFilePath,
188010
188247
  this,
188011
- this.documentRegistry,
188012
188248
  configFileExistenceInfo.config.cachedDirectoryStructureHost,
188013
188249
  reason
188014
188250
  );
@@ -188285,7 +188521,7 @@ var _ProjectService = class _ProjectService {
188285
188521
  return fileNames;
188286
188522
  }
188287
188523
  /** @internal */
188288
- setFileNamesOfAutpImportProviderOrAuxillaryProject(project, fileNames) {
188524
+ setFileNamesOfAutoImportProviderOrAuxillaryProject(project, fileNames) {
188289
188525
  this.updateNonInferredProjectFiles(project, fileNames, fileNamePropertyReader);
188290
188526
  }
188291
188527
  /** @internal */
@@ -188375,9 +188611,11 @@ var _ProjectService = class _ProjectService {
188375
188611
  return this.inferredProjects[0];
188376
188612
  }
188377
188613
  return this.createInferredProject(
188378
- "",
188614
+ this.currentDirectory,
188379
188615
  /*isSingleInferredProject*/
188380
- true
188616
+ true,
188617
+ /*projectRootPath*/
188618
+ void 0
188381
188619
  );
188382
188620
  }
188383
188621
  getOrCreateSingleInferredWithoutProjectRoot(currentDirectory) {
@@ -188388,7 +188626,13 @@ var _ProjectService = class _ProjectService {
188388
188626
  return inferredProject;
188389
188627
  }
188390
188628
  }
188391
- return this.createInferredProject(currentDirectory);
188629
+ return this.createInferredProject(
188630
+ currentDirectory,
188631
+ /*isSingleInferredProject*/
188632
+ false,
188633
+ /*projectRootPath*/
188634
+ void 0
188635
+ );
188392
188636
  }
188393
188637
  createInferredProject(currentDirectory, isSingleInferredProject, projectRootPath) {
188394
188638
  const compilerOptions = projectRootPath && this.compilerOptionsForInferredProjectsPerProjectRoot.get(projectRootPath) || this.compilerOptionsForInferredProjects;
@@ -188405,7 +188649,14 @@ var _ProjectService = class _ProjectService {
188405
188649
  typeAcquisition = this.typeAcquisitionForInferredProjects;
188406
188650
  }
188407
188651
  watchOptionsAndErrors = watchOptionsAndErrors || void 0;
188408
- const project = new InferredProject2(this, this.documentRegistry, compilerOptions, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions, projectRootPath, currentDirectory, typeAcquisition);
188652
+ const project = new InferredProject2(
188653
+ this,
188654
+ compilerOptions,
188655
+ watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions,
188656
+ projectRootPath,
188657
+ currentDirectory,
188658
+ typeAcquisition
188659
+ );
188409
188660
  project.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
188410
188661
  if (isSingleInferredProject) {
188411
188662
  this.inferredProjects.unshift(project);
@@ -189910,7 +190161,7 @@ Dynamic files must always be opened with service's current directory or service
189910
190161
  switch (packageJsonCache.directoryHasPackageJson(directory)) {
189911
190162
  // Sync and check same directory again
189912
190163
  case 3 /* Maybe */:
189913
- packageJsonCache.searchDirectoryAndAncestors(directory);
190164
+ packageJsonCache.searchDirectoryAndAncestors(directory, project);
189914
190165
  return processDirectory(directory);
189915
190166
  // Check package.json
189916
190167
  case -1 /* True */:
@@ -189923,21 +190174,29 @@ Dynamic files must always be opened with service's current directory or service
189923
190174
  return true;
189924
190175
  }
189925
190176
  };
189926
- forEachAncestorDirectory(getDirectoryPath(fileName), processDirectory);
190177
+ forEachAncestorDirectoryStoppingAtGlobalCache(
190178
+ project,
190179
+ getDirectoryPath(fileName),
190180
+ processDirectory
190181
+ );
189927
190182
  return result;
189928
190183
  }
189929
190184
  /** @internal */
189930
- getNearestAncestorDirectoryWithPackageJson(fileName) {
189931
- return forEachAncestorDirectory(fileName, (directory) => {
189932
- switch (this.packageJsonCache.directoryHasPackageJson(directory)) {
189933
- case -1 /* True */:
189934
- return directory;
189935
- case 0 /* False */:
189936
- return void 0;
189937
- case 3 /* Maybe */:
189938
- return this.host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
190185
+ getNearestAncestorDirectoryWithPackageJson(fileName, project) {
190186
+ return forEachAncestorDirectoryStoppingAtGlobalCache(
190187
+ project,
190188
+ fileName,
190189
+ (directory) => {
190190
+ switch (this.packageJsonCache.directoryHasPackageJson(directory)) {
190191
+ case -1 /* True */:
190192
+ return directory;
190193
+ case 0 /* False */:
190194
+ return void 0;
190195
+ case 3 /* Maybe */:
190196
+ return this.host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
190197
+ }
189939
190198
  }
189940
- });
190199
+ );
189941
190200
  }
189942
190201
  watchPackageJsonFile(file, path, project) {
189943
190202
  Debug.assert(project !== void 0);
@@ -190150,19 +190409,23 @@ function createPackageJsonCache(host) {
190150
190409
  return packageJsons.get(host.toPath(combinePaths(directory, "package.json"))) || void 0;
190151
190410
  },
190152
190411
  directoryHasPackageJson: (directory) => directoryHasPackageJson(host.toPath(directory)),
190153
- searchDirectoryAndAncestors: (directory) => {
190154
- forEachAncestorDirectory(directory, (ancestor) => {
190155
- const ancestorPath = host.toPath(ancestor);
190156
- if (directoryHasPackageJson(ancestorPath) !== 3 /* Maybe */) {
190157
- return true;
190158
- }
190159
- const packageJsonFileName = combinePaths(ancestor, "package.json");
190160
- if (tryFileExists(host, packageJsonFileName)) {
190161
- addOrUpdate(packageJsonFileName, combinePaths(ancestorPath, "package.json"));
190162
- } else {
190163
- directoriesWithoutPackageJson.set(ancestorPath, true);
190412
+ searchDirectoryAndAncestors: (directory, project) => {
190413
+ forEachAncestorDirectoryStoppingAtGlobalCache(
190414
+ project,
190415
+ directory,
190416
+ (ancestor) => {
190417
+ const ancestorPath = host.toPath(ancestor);
190418
+ if (directoryHasPackageJson(ancestorPath) !== 3 /* Maybe */) {
190419
+ return true;
190420
+ }
190421
+ const packageJsonFileName = combinePaths(ancestor, "package.json");
190422
+ if (tryFileExists(host, packageJsonFileName)) {
190423
+ addOrUpdate(packageJsonFileName, combinePaths(ancestorPath, "package.json"));
190424
+ } else {
190425
+ directoriesWithoutPackageJson.set(ancestorPath, true);
190426
+ }
190164
190427
  }
190165
- });
190428
+ );
190166
190429
  }
190167
190430
  };
190168
190431
  function addOrUpdate(fileName, path) {
@@ -194565,6 +194828,7 @@ __export(ts_server_exports4, {
194565
194828
  formatDiagnosticToProtocol: () => formatDiagnosticToProtocol,
194566
194829
  formatMessage: () => formatMessage2,
194567
194830
  getBaseConfigFileName: () => getBaseConfigFileName,
194831
+ getDetailWatchInfo: () => getDetailWatchInfo,
194568
194832
  getLocationInNewDocument: () => getLocationInNewDocument,
194569
194833
  hasArgument: () => hasArgument,
194570
194834
  hasNoTypeScriptSource: () => hasNoTypeScriptSource,
@@ -194837,6 +195101,7 @@ if (typeof console !== "undefined") {
194837
195101
  canWatchAffectingLocation,
194838
195102
  canWatchAtTypes,
194839
195103
  canWatchDirectoryOrFile,
195104
+ canWatchDirectoryOrFilePath,
194840
195105
  cartesianProduct,
194841
195106
  cast,
194842
195107
  chainBundle,
@@ -195169,6 +195434,7 @@ if (typeof console !== "undefined") {
195169
195434
  forEach,
195170
195435
  forEachAncestor,
195171
195436
  forEachAncestorDirectory,
195437
+ forEachAncestorDirectoryStoppingAtGlobalCache,
195172
195438
  forEachChild,
195173
195439
  forEachChildRecursively,
195174
195440
  forEachEmittedFile,
@@ -195211,6 +195477,7 @@ if (typeof console !== "undefined") {
195211
195477
  getAllKeys,
195212
195478
  getAllProjectOutputs,
195213
195479
  getAllSuperTypeNodes,
195480
+ getAllowImportingTsExtensions,
195214
195481
  getAllowJSCompilerOption,
195215
195482
  getAllowSyntheticDefaultImports,
195216
195483
  getAncestor,
@@ -195782,7 +196049,7 @@ if (typeof console !== "undefined") {
195782
196049
  isBooleanLiteral,
195783
196050
  isBreakOrContinueStatement,
195784
196051
  isBreakStatement,
195785
- isBuild,
196052
+ isBuildCommand,
195786
196053
  isBuildInfoFile,
195787
196054
  isBuilderProgram,
195788
196055
  isBundle,
@@ -196198,6 +196465,7 @@ if (typeof console !== "undefined") {
196198
196465
  isParseTreeNode,
196199
196466
  isPartOfParameterDeclaration,
196200
196467
  isPartOfTypeNode,
196468
+ isPartOfTypeOnlyImportOrExportDeclaration,
196201
196469
  isPartOfTypeQuery,
196202
196470
  isPartiallyEmittedExpression,
196203
196471
  isPatternMatch,
@@ -196595,6 +196863,7 @@ if (typeof console !== "undefined") {
196595
196863
  returnTrue,
196596
196864
  returnUndefined,
196597
196865
  returnsPromise,
196866
+ rewriteModuleSpecifier,
196598
196867
  sameFlatMap,
196599
196868
  sameMap,
196600
196869
  sameMapping,
@@ -196640,6 +196909,7 @@ if (typeof console !== "undefined") {
196640
196909
  setValueDeclaration,
196641
196910
  shouldAllowImportingTsExtension,
196642
196911
  shouldPreserveConstEnums,
196912
+ shouldRewriteModuleSpecifier,
196643
196913
  shouldUseUriStyleNodeCoreModules,
196644
196914
  showModuleSpecifier,
196645
196915
  signatureHasRestParameter,
@@ -196791,6 +197061,7 @@ if (typeof console !== "undefined") {
196791
197061
  tryRemoveExtension,
196792
197062
  tryRemovePrefix,
196793
197063
  tryRemoveSuffix,
197064
+ tscBuildOption,
196794
197065
  typeAcquisitionDeclarations,
196795
197066
  typeAliasNamePart,
196796
197067
  typeDirectiveIsEqualTo,