typescript 5.3.0-dev.20230921 → 5.3.0-dev.20230923
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/tsc.js +342 -227
- package/lib/tsserver.js +564 -300
- package/lib/typescript.d.ts +93 -3
- package/lib/typescript.js +564 -304
- package/lib/typingsInstaller.js +54 -47
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -103,6 +103,7 @@ __export(server_exports, {
|
|
|
103
103
|
InternalEmitFlags: () => InternalEmitFlags,
|
|
104
104
|
InternalSymbolName: () => InternalSymbolName,
|
|
105
105
|
InvalidatedProjectKind: () => InvalidatedProjectKind,
|
|
106
|
+
JSDocParsingMode: () => JSDocParsingMode,
|
|
106
107
|
JsDoc: () => ts_JsDoc_exports,
|
|
107
108
|
JsTyping: () => ts_JsTyping_exports,
|
|
108
109
|
JsxEmit: () => JsxEmit,
|
|
@@ -430,6 +431,7 @@ __export(server_exports, {
|
|
|
430
431
|
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
431
432
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
432
433
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
434
|
+
createModuleResolutionLoaderUsingGlobalCache: () => createModuleResolutionLoaderUsingGlobalCache,
|
|
433
435
|
createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
|
|
434
436
|
createMultiMap: () => createMultiMap,
|
|
435
437
|
createNodeConverters: () => createNodeConverters,
|
|
@@ -858,6 +860,7 @@ __export(server_exports, {
|
|
|
858
860
|
getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
|
|
859
861
|
getLeftmostAccessExpression: () => getLeftmostAccessExpression,
|
|
860
862
|
getLeftmostExpression: () => getLeftmostExpression,
|
|
863
|
+
getLibraryNameFromLibFileName: () => getLibraryNameFromLibFileName,
|
|
861
864
|
getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
|
|
862
865
|
getLineInfo: () => getLineInfo,
|
|
863
866
|
getLineOfLocalPosition: () => getLineOfLocalPosition,
|
|
@@ -1252,6 +1255,7 @@ __export(server_exports, {
|
|
|
1252
1255
|
isClassDeclaration: () => isClassDeclaration,
|
|
1253
1256
|
isClassElement: () => isClassElement,
|
|
1254
1257
|
isClassExpression: () => isClassExpression,
|
|
1258
|
+
isClassFieldAndNotAutoAccessor: () => isClassFieldAndNotAutoAccessor,
|
|
1255
1259
|
isClassLike: () => isClassLike,
|
|
1256
1260
|
isClassMemberModifier: () => isClassMemberModifier,
|
|
1257
1261
|
isClassNamedEvaluationHelperBlock: () => isClassNamedEvaluationHelperBlock,
|
|
@@ -2323,7 +2327,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2323
2327
|
|
|
2324
2328
|
// src/compiler/corePublic.ts
|
|
2325
2329
|
var versionMajorMinor = "5.3";
|
|
2326
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2330
|
+
var version = `${versionMajorMinor}.0-dev.20230923`;
|
|
2327
2331
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2328
2332
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2329
2333
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7417,6 +7421,13 @@ var commentPragmas = {
|
|
|
7417
7421
|
kind: 4 /* MultiLine */
|
|
7418
7422
|
}
|
|
7419
7423
|
};
|
|
7424
|
+
var JSDocParsingMode = /* @__PURE__ */ ((JSDocParsingMode7) => {
|
|
7425
|
+
JSDocParsingMode7[JSDocParsingMode7["ParseAll"] = 0] = "ParseAll";
|
|
7426
|
+
JSDocParsingMode7[JSDocParsingMode7["ParseNone"] = 1] = "ParseNone";
|
|
7427
|
+
JSDocParsingMode7[JSDocParsingMode7["ParseForTypeErrors"] = 2] = "ParseForTypeErrors";
|
|
7428
|
+
JSDocParsingMode7[JSDocParsingMode7["ParseForTypeInfo"] = 3] = "ParseForTypeInfo";
|
|
7429
|
+
return JSDocParsingMode7;
|
|
7430
|
+
})(JSDocParsingMode || {});
|
|
7420
7431
|
|
|
7421
7432
|
// src/compiler/sys.ts
|
|
7422
7433
|
function generateDjb2Hash(data) {
|
|
@@ -10157,6 +10168,7 @@ var Diagnostics = {
|
|
|
10157
10168
|
await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(2852, 1 /* Error */, "await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_2852", "'await using' statements are only allowed within async functions and at the top levels of modules."),
|
|
10158
10169
|
await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(2853, 1 /* Error */, "await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853", "'await using' statements are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
10159
10170
|
Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
10171
|
+
Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super: diag(2855, 1 /* Error */, "Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855", "Class field '{0}' defined by the parent class is not accessible in the child class via super."),
|
|
10160
10172
|
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}'."),
|
|
10161
10173
|
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}'."),
|
|
10162
10174
|
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}'."),
|
|
@@ -11204,7 +11216,7 @@ var Diagnostics = {
|
|
|
11204
11216
|
Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
|
|
11205
11217
|
Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
|
|
11206
11218
|
Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
|
|
11207
|
-
|
|
11219
|
+
Can_only_convert_string_concatenations_and_string_literals: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenations_and_string_literals_95154", "Can only convert string concatenations and string literals"),
|
|
11208
11220
|
Selection_is_not_a_valid_statement_or_statements: diag(95155, 3 /* Message */, "Selection_is_not_a_valid_statement_or_statements_95155", "Selection is not a valid statement or statements"),
|
|
11209
11221
|
Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
|
|
11210
11222
|
Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
|
|
@@ -11448,7 +11460,7 @@ var unicodeESNextIdentifierStart = [65, 90, 97, 122, 170, 170, 181, 181, 186, 18
|
|
|
11448
11460
|
var unicodeESNextIdentifierPart = [48, 57, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 183, 183, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 895, 895, 902, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1519, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2045, 2045, 2048, 2093, 2112, 2139, 2144, 2154, 2208, 2228, 2230, 2237, 2259, 2273, 2275, 2403, 2406, 2415, 2417, 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, 2556, 2556, 2558, 2558, 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, 2809, 2815, 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, 3072, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3162, 3168, 3171, 3174, 3183, 3200, 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, 3328, 3331, 3333, 3340, 3342, 3344, 3346, 3396, 3398, 3400, 3402, 3406, 3412, 3415, 3423, 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, 3558, 3567, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 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, 4969, 4977, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 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, 6264, 6272, 6314, 6320, 6389, 6400, 6430, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6832, 6845, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7376, 7378, 7380, 7418, 7424, 7673, 7675, 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, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 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, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40943, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42737, 42775, 42783, 42786, 42888, 42891, 42943, 42946, 42950, 42999, 43047, 43072, 43123, 43136, 43205, 43216, 43225, 43232, 43255, 43259, 43259, 43261, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43488, 43518, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43879, 43888, 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, 65071, 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, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66045, 66045, 66176, 66204, 66208, 66256, 66272, 66272, 66304, 66335, 66349, 66378, 66384, 66426, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66720, 66729, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 67072, 67382, 67392, 67413, 67424, 67431, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68099, 68101, 68102, 68108, 68115, 68117, 68119, 68121, 68149, 68152, 68154, 68159, 68159, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68326, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68903, 68912, 68921, 69376, 69404, 69415, 69415, 69424, 69456, 69600, 69622, 69632, 69702, 69734, 69743, 69759, 69818, 69840, 69864, 69872, 69881, 69888, 69940, 69942, 69951, 69956, 69958, 69968, 70003, 70006, 70006, 70016, 70084, 70089, 70092, 70096, 70106, 70108, 70108, 70144, 70161, 70163, 70199, 70206, 70206, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70378, 70384, 70393, 70400, 70403, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70459, 70468, 70471, 70472, 70475, 70477, 70480, 70480, 70487, 70487, 70493, 70499, 70502, 70508, 70512, 70516, 70656, 70730, 70736, 70745, 70750, 70751, 70784, 70853, 70855, 70855, 70864, 70873, 71040, 71093, 71096, 71104, 71128, 71133, 71168, 71232, 71236, 71236, 71248, 71257, 71296, 71352, 71360, 71369, 71424, 71450, 71453, 71467, 71472, 71481, 71680, 71738, 71840, 71913, 71935, 71935, 72096, 72103, 72106, 72151, 72154, 72161, 72163, 72164, 72192, 72254, 72263, 72263, 72272, 72345, 72349, 72349, 72384, 72440, 72704, 72712, 72714, 72758, 72760, 72768, 72784, 72793, 72818, 72847, 72850, 72871, 72873, 72886, 72960, 72966, 72968, 72969, 72971, 73014, 73018, 73018, 73020, 73021, 73023, 73031, 73040, 73049, 73056, 73061, 73063, 73064, 73066, 73102, 73104, 73105, 73107, 73112, 73120, 73129, 73440, 73462, 73728, 74649, 74752, 74862, 74880, 75075, 77824, 78894, 82944, 83526, 92160, 92728, 92736, 92766, 92768, 92777, 92880, 92909, 92912, 92916, 92928, 92982, 92992, 92995, 93008, 93017, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94031, 94087, 94095, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101106, 110592, 110878, 110928, 110930, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 113821, 113822, 119141, 119145, 119149, 119154, 119163, 119170, 119173, 119179, 119210, 119213, 119362, 119364, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 120782, 120831, 121344, 121398, 121403, 121452, 121461, 121461, 121476, 121476, 121499, 121503, 121505, 121519, 122880, 122886, 122888, 122904, 122907, 122913, 122915, 122916, 122918, 122922, 123136, 123180, 123184, 123197, 123200, 123209, 123214, 123214, 123584, 123641, 124928, 125124, 125136, 125142, 125184, 125259, 125264, 125273, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173782, 173824, 177972, 177984, 178205, 178208, 183969, 183984, 191456, 194560, 195101, 917760, 917999];
|
|
11449
11461
|
var commentDirectiveRegExSingleLine = /^\/\/\/?\s*@(ts-expect-error|ts-ignore)/;
|
|
11450
11462
|
var commentDirectiveRegExMultiLine = /^(?:\/|\*)*\s*@(ts-expect-error|ts-ignore)/;
|
|
11451
|
-
var
|
|
11463
|
+
var jsDocSeeOrLink = /@(?:see|link)/i;
|
|
11452
11464
|
function lookupInUnicodeMap(code, map2) {
|
|
11453
11465
|
if (code < map2[0]) {
|
|
11454
11466
|
return false;
|
|
@@ -11955,7 +11967,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
11955
11967
|
var tokenFlags;
|
|
11956
11968
|
var commentDirectives;
|
|
11957
11969
|
var inJSDocType = 0;
|
|
11958
|
-
var
|
|
11970
|
+
var scriptKind = 0 /* Unknown */;
|
|
11971
|
+
var jsDocParsingMode = 0 /* ParseAll */;
|
|
11959
11972
|
setText(text, start2, length2);
|
|
11960
11973
|
var scanner2 = {
|
|
11961
11974
|
getTokenFullStart: () => fullStartPos,
|
|
@@ -11999,14 +12012,15 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
11999
12012
|
setText,
|
|
12000
12013
|
setScriptTarget,
|
|
12001
12014
|
setLanguageVariant,
|
|
12015
|
+
setScriptKind,
|
|
12016
|
+
setJSDocParsingMode,
|
|
12002
12017
|
setOnError,
|
|
12003
12018
|
resetTokenState,
|
|
12004
12019
|
setTextPos: resetTokenState,
|
|
12005
12020
|
setInJSDocType,
|
|
12006
12021
|
tryScan,
|
|
12007
12022
|
lookAhead,
|
|
12008
|
-
scanRange
|
|
12009
|
-
setSkipNonSemanticJSDoc
|
|
12023
|
+
scanRange
|
|
12010
12024
|
};
|
|
12011
12025
|
if (Debug.isDebugging) {
|
|
12012
12026
|
Object.defineProperty(scanner2, "__debugShowCurrentPositionInText", {
|
|
@@ -12794,7 +12808,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12794
12808
|
tokenFlags |= 1 /* PrecedingLineBreak */;
|
|
12795
12809
|
}
|
|
12796
12810
|
}
|
|
12797
|
-
if (isJSDoc2 && (
|
|
12811
|
+
if (isJSDoc2 && shouldParseJSDoc()) {
|
|
12798
12812
|
tokenFlags |= 2 /* PrecedingJSDocComment */;
|
|
12799
12813
|
}
|
|
12800
12814
|
commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart);
|
|
@@ -13053,6 +13067,21 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13053
13067
|
}
|
|
13054
13068
|
}
|
|
13055
13069
|
}
|
|
13070
|
+
function shouldParseJSDoc() {
|
|
13071
|
+
switch (jsDocParsingMode) {
|
|
13072
|
+
case 0 /* ParseAll */:
|
|
13073
|
+
return true;
|
|
13074
|
+
case 1 /* ParseNone */:
|
|
13075
|
+
return false;
|
|
13076
|
+
}
|
|
13077
|
+
if (scriptKind !== 3 /* TS */ && scriptKind !== 4 /* TSX */) {
|
|
13078
|
+
return true;
|
|
13079
|
+
}
|
|
13080
|
+
if (jsDocParsingMode === 3 /* ParseForTypeInfo */) {
|
|
13081
|
+
return false;
|
|
13082
|
+
}
|
|
13083
|
+
return jsDocSeeOrLink.test(text.slice(fullStartPos, pos));
|
|
13084
|
+
}
|
|
13056
13085
|
function reScanInvalidIdentifier() {
|
|
13057
13086
|
Debug.assert(token === 0 /* Unknown */, "'reScanInvalidIdentifier' should only be called when the current token is 'SyntaxKind.Unknown'.");
|
|
13058
13087
|
pos = tokenStart = fullStartPos;
|
|
@@ -13467,8 +13496,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13467
13496
|
function setLanguageVariant(variant) {
|
|
13468
13497
|
languageVariant = variant;
|
|
13469
13498
|
}
|
|
13470
|
-
function
|
|
13471
|
-
|
|
13499
|
+
function setScriptKind(kind) {
|
|
13500
|
+
scriptKind = kind;
|
|
13501
|
+
}
|
|
13502
|
+
function setJSDocParsingMode(kind) {
|
|
13503
|
+
jsDocParsingMode = kind;
|
|
13472
13504
|
}
|
|
13473
13505
|
function resetTokenState(position) {
|
|
13474
13506
|
Debug.assert(position >= 0);
|
|
@@ -14443,6 +14475,9 @@ function isAccessor(node) {
|
|
|
14443
14475
|
function isAutoAccessorPropertyDeclaration(node) {
|
|
14444
14476
|
return isPropertyDeclaration(node) && hasAccessorModifier(node);
|
|
14445
14477
|
}
|
|
14478
|
+
function isClassFieldAndNotAutoAccessor(node) {
|
|
14479
|
+
return node.parent && isClassLike(node.parent) && isPropertyDeclaration(node) && !hasAccessorModifier(node);
|
|
14480
|
+
}
|
|
14446
14481
|
function isMethodOrAccessor(node) {
|
|
14447
14482
|
switch (node.kind) {
|
|
14448
14483
|
case 174 /* MethodDeclaration */:
|
|
@@ -15145,8 +15180,8 @@ function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
|
15145
15180
|
return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId) && oldResolution.node10Result === newResolution.node10Result;
|
|
15146
15181
|
}
|
|
15147
15182
|
function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
|
|
15148
|
-
var _a
|
|
15149
|
-
const node10Result = (
|
|
15183
|
+
var _a;
|
|
15184
|
+
const node10Result = (_a = host.getResolvedModule(sourceFile, moduleReference, mode)) == null ? void 0 : _a.node10Result;
|
|
15150
15185
|
const result = node10Result ? chainDiagnosticMessages(
|
|
15151
15186
|
/*details*/
|
|
15152
15187
|
void 0,
|
|
@@ -15188,14 +15223,14 @@ function packageIdToString(packageId) {
|
|
|
15188
15223
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
15189
15224
|
return oldResolution === newResolution || oldResolution.resolvedTypeReferenceDirective === newResolution.resolvedTypeReferenceDirective || !!oldResolution.resolvedTypeReferenceDirective && !!newResolution.resolvedTypeReferenceDirective && oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName && !!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary && oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
|
|
15190
15225
|
}
|
|
15191
|
-
function hasChangesInResolutions(names, newSourceFile, newResolutions,
|
|
15226
|
+
function hasChangesInResolutions(names, newSourceFile, newResolutions, getOldResolution, comparer, nameAndModeGetter) {
|
|
15192
15227
|
Debug.assert(names.length === newResolutions.length);
|
|
15193
15228
|
for (let i = 0; i < names.length; i++) {
|
|
15194
15229
|
const newResolution = newResolutions[i];
|
|
15195
15230
|
const entry = names[i];
|
|
15196
15231
|
const name = nameAndModeGetter.getName(entry);
|
|
15197
15232
|
const mode = nameAndModeGetter.getMode(entry, newSourceFile);
|
|
15198
|
-
const oldResolution =
|
|
15233
|
+
const oldResolution = getOldResolution(name, mode);
|
|
15199
15234
|
const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
|
|
15200
15235
|
if (changed) {
|
|
15201
15236
|
return true;
|
|
@@ -20594,11 +20629,11 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
|
|
|
20594
20629
|
(symlinkedDirectories || (symlinkedDirectories = /* @__PURE__ */ new Map())).set(symlinkPath, real);
|
|
20595
20630
|
}
|
|
20596
20631
|
},
|
|
20597
|
-
setSymlinksFromResolutions(
|
|
20632
|
+
setSymlinksFromResolutions(forEachResolvedModule, forEachResolvedTypeReferenceDirective, typeReferenceDirectives) {
|
|
20598
20633
|
Debug.assert(!hasProcessedResolutions);
|
|
20599
20634
|
hasProcessedResolutions = true;
|
|
20600
|
-
|
|
20601
|
-
|
|
20635
|
+
forEachResolvedModule((resolution) => processResolution(this, resolution.resolvedModule));
|
|
20636
|
+
forEachResolvedTypeReferenceDirective((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
20602
20637
|
typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
20603
20638
|
},
|
|
20604
20639
|
hasProcessedResolutions: () => hasProcessedResolutions
|
|
@@ -30639,7 +30674,7 @@ function gatherPossibleChildren(node) {
|
|
|
30639
30674
|
function setExternalModuleIndicator(sourceFile) {
|
|
30640
30675
|
sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile);
|
|
30641
30676
|
}
|
|
30642
|
-
function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind
|
|
30677
|
+
function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind) {
|
|
30643
30678
|
var _a, _b, _c, _d;
|
|
30644
30679
|
(_a = tracing) == null ? void 0 : _a.push(
|
|
30645
30680
|
tracing.Phase.Parse,
|
|
@@ -30654,7 +30689,8 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
|
|
|
30654
30689
|
const {
|
|
30655
30690
|
languageVersion,
|
|
30656
30691
|
setExternalModuleIndicator: overrideSetExternalModuleIndicator,
|
|
30657
|
-
impliedNodeFormat: format
|
|
30692
|
+
impliedNodeFormat: format,
|
|
30693
|
+
jsDocParsingMode
|
|
30658
30694
|
} = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : { languageVersion: languageVersionOrOptions };
|
|
30659
30695
|
if (languageVersion === 100 /* JSON */) {
|
|
30660
30696
|
result = Parser.parseSourceFile(
|
|
@@ -30666,7 +30702,7 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
|
|
|
30666
30702
|
setParentNodes,
|
|
30667
30703
|
6 /* JSON */,
|
|
30668
30704
|
noop,
|
|
30669
|
-
|
|
30705
|
+
jsDocParsingMode
|
|
30670
30706
|
);
|
|
30671
30707
|
} else {
|
|
30672
30708
|
const setIndicator = format === void 0 ? overrideSetExternalModuleIndicator : (file) => {
|
|
@@ -30682,7 +30718,7 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
|
|
|
30682
30718
|
setParentNodes,
|
|
30683
30719
|
scriptKind,
|
|
30684
30720
|
setIndicator,
|
|
30685
|
-
|
|
30721
|
+
jsDocParsingMode
|
|
30686
30722
|
);
|
|
30687
30723
|
}
|
|
30688
30724
|
(_c = perfLogger) == null ? void 0 : _c.logStopParseSourceFile();
|
|
@@ -30816,7 +30852,7 @@ var Parser;
|
|
|
30816
30852
|
var contextFlags;
|
|
30817
30853
|
var topLevel = true;
|
|
30818
30854
|
var parseErrorBeforeNextFinishedNode = false;
|
|
30819
|
-
function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride,
|
|
30855
|
+
function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride, jsDocParsingMode = 0 /* ParseAll */) {
|
|
30820
30856
|
var _a;
|
|
30821
30857
|
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
|
|
30822
30858
|
if (scriptKind2 === 6 /* JSON */) {
|
|
@@ -30838,9 +30874,8 @@ var Parser;
|
|
|
30838
30874
|
result2.pragmas = emptyMap;
|
|
30839
30875
|
return result2;
|
|
30840
30876
|
}
|
|
30841
|
-
|
|
30842
|
-
|
|
30843
|
-
const result = parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicatorOverride || setExternalModuleIndicator, skipNonSemanticJSDoc);
|
|
30877
|
+
initializeState(fileName2, sourceText2, languageVersion2, syntaxCursor2, scriptKind2, jsDocParsingMode);
|
|
30878
|
+
const result = parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicatorOverride || setExternalModuleIndicator, jsDocParsingMode);
|
|
30844
30879
|
clearState();
|
|
30845
30880
|
return result;
|
|
30846
30881
|
}
|
|
@@ -30853,8 +30888,7 @@ var Parser;
|
|
|
30853
30888
|
/*syntaxCursor*/
|
|
30854
30889
|
void 0,
|
|
30855
30890
|
1 /* JS */,
|
|
30856
|
-
/*
|
|
30857
|
-
false
|
|
30891
|
+
0 /* ParseAll */
|
|
30858
30892
|
);
|
|
30859
30893
|
nextToken();
|
|
30860
30894
|
const entityName = parseEntityName(
|
|
@@ -30867,15 +30901,7 @@ var Parser;
|
|
|
30867
30901
|
}
|
|
30868
30902
|
Parser2.parseIsolatedEntityName = parseIsolatedEntityName2;
|
|
30869
30903
|
function parseJsonText2(fileName2, sourceText2, languageVersion2 = 2 /* ES2015 */, syntaxCursor2, setParentNodes = false) {
|
|
30870
|
-
initializeState(
|
|
30871
|
-
fileName2,
|
|
30872
|
-
sourceText2,
|
|
30873
|
-
languageVersion2,
|
|
30874
|
-
syntaxCursor2,
|
|
30875
|
-
6 /* JSON */,
|
|
30876
|
-
/*skipNonSemanticJSDoc*/
|
|
30877
|
-
false
|
|
30878
|
-
);
|
|
30904
|
+
initializeState(fileName2, sourceText2, languageVersion2, syntaxCursor2, 6 /* JSON */, 0 /* ParseAll */);
|
|
30879
30905
|
sourceFlags = contextFlags;
|
|
30880
30906
|
nextToken();
|
|
30881
30907
|
const pos = getNodePos();
|
|
@@ -30956,7 +30982,7 @@ var Parser;
|
|
|
30956
30982
|
return result;
|
|
30957
30983
|
}
|
|
30958
30984
|
Parser2.parseJsonText = parseJsonText2;
|
|
30959
|
-
function initializeState(_fileName, _sourceText, _languageVersion, _syntaxCursor, _scriptKind,
|
|
30985
|
+
function initializeState(_fileName, _sourceText, _languageVersion, _syntaxCursor, _scriptKind, _jsDocParsingMode) {
|
|
30960
30986
|
NodeConstructor2 = objectAllocator.getNodeConstructor();
|
|
30961
30987
|
TokenConstructor2 = objectAllocator.getTokenConstructor();
|
|
30962
30988
|
IdentifierConstructor2 = objectAllocator.getIdentifierConstructor();
|
|
@@ -30992,13 +31018,15 @@ var Parser;
|
|
|
30992
31018
|
scanner2.setOnError(scanError);
|
|
30993
31019
|
scanner2.setScriptTarget(languageVersion);
|
|
30994
31020
|
scanner2.setLanguageVariant(languageVariant);
|
|
30995
|
-
scanner2.
|
|
31021
|
+
scanner2.setScriptKind(scriptKind);
|
|
31022
|
+
scanner2.setJSDocParsingMode(_jsDocParsingMode);
|
|
30996
31023
|
}
|
|
30997
31024
|
function clearState() {
|
|
30998
31025
|
scanner2.clearCommentDirectives();
|
|
30999
31026
|
scanner2.setText("");
|
|
31000
31027
|
scanner2.setOnError(void 0);
|
|
31001
|
-
scanner2.
|
|
31028
|
+
scanner2.setScriptKind(0 /* Unknown */);
|
|
31029
|
+
scanner2.setJSDocParsingMode(0 /* ParseAll */);
|
|
31002
31030
|
sourceText = void 0;
|
|
31003
31031
|
languageVersion = void 0;
|
|
31004
31032
|
syntaxCursor = void 0;
|
|
@@ -31012,7 +31040,7 @@ var Parser;
|
|
|
31012
31040
|
notParenthesizedArrow = void 0;
|
|
31013
31041
|
topLevel = true;
|
|
31014
31042
|
}
|
|
31015
|
-
function parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicator2,
|
|
31043
|
+
function parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicator2, jsDocParsingMode) {
|
|
31016
31044
|
const isDeclarationFile = isDeclarationFileName(fileName);
|
|
31017
31045
|
if (isDeclarationFile) {
|
|
31018
31046
|
contextFlags |= 33554432 /* Ambient */;
|
|
@@ -31031,7 +31059,7 @@ var Parser;
|
|
|
31031
31059
|
sourceFile.identifierCount = identifierCount;
|
|
31032
31060
|
sourceFile.identifiers = identifiers;
|
|
31033
31061
|
sourceFile.parseDiagnostics = attachFileToDiagnostics(parseDiagnostics, sourceFile);
|
|
31034
|
-
sourceFile.
|
|
31062
|
+
sourceFile.jsDocParsingMode = jsDocParsingMode;
|
|
31035
31063
|
if (jsDocDiagnostics) {
|
|
31036
31064
|
sourceFile.jsDocDiagnostics = attachFileToDiagnostics(jsDocDiagnostics, sourceFile);
|
|
31037
31065
|
}
|
|
@@ -36466,8 +36494,7 @@ var Parser;
|
|
|
36466
36494
|
/*syntaxCursor*/
|
|
36467
36495
|
void 0,
|
|
36468
36496
|
1 /* JS */,
|
|
36469
|
-
/*
|
|
36470
|
-
false
|
|
36497
|
+
0 /* ParseAll */
|
|
36471
36498
|
);
|
|
36472
36499
|
scanner2.setText(content, start2, length2);
|
|
36473
36500
|
currentToken = scanner2.scan();
|
|
@@ -36532,8 +36559,7 @@ var Parser;
|
|
|
36532
36559
|
/*syntaxCursor*/
|
|
36533
36560
|
void 0,
|
|
36534
36561
|
1 /* JS */,
|
|
36535
|
-
/*
|
|
36536
|
-
false
|
|
36562
|
+
0 /* ParseAll */
|
|
36537
36563
|
);
|
|
36538
36564
|
const jsDoc = doInsideOfContext(16777216 /* JSDoc */, () => parseJSDocCommentWorker(start2, length2));
|
|
36539
36565
|
const sourceFile = { languageVariant: 0 /* Standard */, text: content };
|
|
@@ -37490,7 +37516,7 @@ var IncrementalParser;
|
|
|
37490
37516
|
true,
|
|
37491
37517
|
sourceFile.scriptKind,
|
|
37492
37518
|
sourceFile.setExternalModuleIndicator,
|
|
37493
|
-
sourceFile.
|
|
37519
|
+
sourceFile.jsDocParsingMode
|
|
37494
37520
|
);
|
|
37495
37521
|
}
|
|
37496
37522
|
const incrementalSourceFile = sourceFile;
|
|
@@ -37515,7 +37541,7 @@ var IncrementalParser;
|
|
|
37515
37541
|
true,
|
|
37516
37542
|
sourceFile.scriptKind,
|
|
37517
37543
|
sourceFile.setExternalModuleIndicator,
|
|
37518
|
-
sourceFile.
|
|
37544
|
+
sourceFile.jsDocParsingMode
|
|
37519
37545
|
);
|
|
37520
37546
|
result.commentDirectives = getNewCommentDirectives(
|
|
37521
37547
|
sourceFile.commentDirectives,
|
|
@@ -42771,7 +42797,9 @@ function loadEntrypointsFromExportMap(scope, exports, state, extensions) {
|
|
|
42771
42797
|
extensionsToExtensionsArray(extensions),
|
|
42772
42798
|
/*excludes*/
|
|
42773
42799
|
void 0,
|
|
42774
|
-
[
|
|
42800
|
+
[
|
|
42801
|
+
isDeclarationFileName(target) ? target.replace("*", "**/*") : changeAnyExtension(target.replace("*", "**/*"), getDeclarationEmitExtensionForPath(target))
|
|
42802
|
+
]
|
|
42775
42803
|
).forEach((entry) => {
|
|
42776
42804
|
entrypoints = appendIfUnique(entrypoints, {
|
|
42777
42805
|
path: entry,
|
|
@@ -50978,7 +51006,7 @@ function createTypeChecker(host) {
|
|
|
50978
51006
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
50979
51007
|
}
|
|
50980
51008
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
50981
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k
|
|
51009
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
50982
51010
|
if (startsWith(moduleReference, "@types/")) {
|
|
50983
51011
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
50984
51012
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -50996,7 +51024,7 @@ function createTypeChecker(host) {
|
|
|
50996
51024
|
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
|
|
50997
51025
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
50998
51026
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
50999
|
-
const resolvedModule = (
|
|
51027
|
+
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
51000
51028
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
51001
51029
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
51002
51030
|
if (sourceFile) {
|
|
@@ -51004,7 +51032,7 @@ function createTypeChecker(host) {
|
|
|
51004
51032
|
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
51005
51033
|
}
|
|
51006
51034
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
51007
|
-
const importOrExport = ((
|
|
51035
|
+
const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
51008
51036
|
if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
51009
51037
|
error2(
|
|
51010
51038
|
errorNode,
|
|
@@ -51013,7 +51041,7 @@ function createTypeChecker(host) {
|
|
|
51013
51041
|
);
|
|
51014
51042
|
}
|
|
51015
51043
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
51016
|
-
const importOrExport = ((
|
|
51044
|
+
const importOrExport = ((_i = findAncestor(location, isImportDeclaration)) == null ? void 0 : _i.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
51017
51045
|
if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
51018
51046
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
51019
51047
|
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
@@ -51034,7 +51062,7 @@ function createTypeChecker(host) {
|
|
|
51034
51062
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
51035
51063
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
51036
51064
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
51037
|
-
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (
|
|
51065
|
+
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_j = overrideClauseHost.assertions) == null ? void 0 : _j.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
51038
51066
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
51039
51067
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
51040
51068
|
error2(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
|
|
@@ -51141,7 +51169,7 @@ function createTypeChecker(host) {
|
|
|
51141
51169
|
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
51142
51170
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
51143
51171
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
51144
|
-
const suggestedExt = (
|
|
51172
|
+
const suggestedExt = (_k = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _k[1];
|
|
51145
51173
|
if (suggestedExt) {
|
|
51146
51174
|
error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
51147
51175
|
} else {
|
|
@@ -57899,7 +57927,28 @@ function createTypeChecker(host) {
|
|
|
57899
57927
|
}
|
|
57900
57928
|
}
|
|
57901
57929
|
}
|
|
57902
|
-
|
|
57930
|
+
let resolved = combineSymbolTables(earlySymbols, lateSymbols);
|
|
57931
|
+
if (symbol.flags & 33554432 /* Transient */ && links.cjsExportMerged && symbol.declarations) {
|
|
57932
|
+
for (const decl of symbol.declarations) {
|
|
57933
|
+
const original = getSymbolLinks(decl.symbol)[resolutionKind];
|
|
57934
|
+
if (!resolved) {
|
|
57935
|
+
resolved = original;
|
|
57936
|
+
continue;
|
|
57937
|
+
}
|
|
57938
|
+
if (!original)
|
|
57939
|
+
continue;
|
|
57940
|
+
original.forEach((s, name) => {
|
|
57941
|
+
const existing = resolved.get(name);
|
|
57942
|
+
if (!existing)
|
|
57943
|
+
resolved.set(name, s);
|
|
57944
|
+
else if (existing === s)
|
|
57945
|
+
return;
|
|
57946
|
+
else
|
|
57947
|
+
resolved.set(name, mergeSymbol(existing, s));
|
|
57948
|
+
});
|
|
57949
|
+
}
|
|
57950
|
+
}
|
|
57951
|
+
links[resolutionKind] = resolved || emptySymbols;
|
|
57903
57952
|
}
|
|
57904
57953
|
return links[resolutionKind];
|
|
57905
57954
|
}
|
|
@@ -73794,6 +73843,7 @@ function createTypeChecker(host) {
|
|
|
73794
73843
|
return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode);
|
|
73795
73844
|
}
|
|
73796
73845
|
function checkPropertyAccessibilityAtLocation(location, isSuper, writing, containingType, prop, errorNode) {
|
|
73846
|
+
var _a;
|
|
73797
73847
|
const flags = getDeclarationModifierFlagsFromSymbol(prop, writing);
|
|
73798
73848
|
if (isSuper) {
|
|
73799
73849
|
if (languageVersion < 2 /* ES2015 */) {
|
|
@@ -73810,6 +73860,12 @@ function createTypeChecker(host) {
|
|
|
73810
73860
|
}
|
|
73811
73861
|
return false;
|
|
73812
73862
|
}
|
|
73863
|
+
if (!(flags & 32 /* Static */) && ((_a = prop.declarations) == null ? void 0 : _a.some(isClassFieldAndNotAutoAccessor))) {
|
|
73864
|
+
if (errorNode) {
|
|
73865
|
+
error2(errorNode, Diagnostics.Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super, symbolToString(prop));
|
|
73866
|
+
}
|
|
73867
|
+
return false;
|
|
73868
|
+
}
|
|
73813
73869
|
}
|
|
73814
73870
|
if (flags & 256 /* Abstract */ && symbolHasNonMethodDeclaration(prop) && (isThisProperty(location) || isThisInitializedObjectBindingExpression(location) || isObjectBindingPattern(location.parent) && isThisInitializedDeclaration(location.parent.parent))) {
|
|
73815
73871
|
const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop));
|
|
@@ -74215,11 +74271,17 @@ function createTypeChecker(host) {
|
|
|
74215
74271
|
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
|
|
74216
74272
|
}
|
|
74217
74273
|
function isUncheckedJSSuggestion(node, suggestion, excludeClasses) {
|
|
74274
|
+
var _a;
|
|
74218
74275
|
const file = getSourceFileOfNode(node);
|
|
74219
74276
|
if (file) {
|
|
74220
74277
|
if (compilerOptions.checkJs === void 0 && file.checkJsDirective === void 0 && (file.scriptKind === 1 /* JS */ || file.scriptKind === 2 /* JSX */)) {
|
|
74221
74278
|
const declarationFile = forEach(suggestion == null ? void 0 : suggestion.declarations, getSourceFileOfNode);
|
|
74222
|
-
|
|
74279
|
+
const suggestionHasNoExtendsOrDecorators = !(suggestion == null ? void 0 : suggestion.valueDeclaration) || !isClassLike(suggestion.valueDeclaration) || ((_a = suggestion.valueDeclaration.heritageClauses) == null ? void 0 : _a.length) || classOrConstructorParameterIsDecorated(
|
|
74280
|
+
/*useLegacyDecorators*/
|
|
74281
|
+
false,
|
|
74282
|
+
suggestion.valueDeclaration
|
|
74283
|
+
);
|
|
74284
|
+
return !(file !== declarationFile && !!declarationFile && isGlobalSourceFile(declarationFile)) && !(excludeClasses && suggestion && suggestion.flags & 32 /* Class */ && suggestionHasNoExtendsOrDecorators) && !(!!node && excludeClasses && isPropertyAccessExpression(node) && node.expression.kind === 110 /* ThisKeyword */ && suggestionHasNoExtendsOrDecorators);
|
|
74223
74285
|
}
|
|
74224
74286
|
}
|
|
74225
74287
|
return false;
|
|
@@ -114107,6 +114169,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
114107
114169
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
114108
114170
|
extendedDiagnostics: compilerOptions.extendedDiagnostics,
|
|
114109
114171
|
onlyPrintJsDocStyle: true,
|
|
114172
|
+
omitBraceSourceMapPositions: true,
|
|
114110
114173
|
writeBundleFileInfo: !!bundleBuildInfo,
|
|
114111
114174
|
recordInternalSection: !!bundleBuildInfo,
|
|
114112
114175
|
relativeToBuildInfo
|
|
@@ -114517,6 +114580,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
114517
114580
|
onAfterEmitToken
|
|
114518
114581
|
} = handlers;
|
|
114519
114582
|
var extendedDiagnostics = !!printerOptions.extendedDiagnostics;
|
|
114583
|
+
var omitBraceSourcePositions = !!printerOptions.omitBraceSourceMapPositions;
|
|
114520
114584
|
var newLine = getNewLineCharacter(printerOptions);
|
|
114521
114585
|
var moduleKind = getEmitModuleKind(printerOptions);
|
|
114522
114586
|
var bundledHelpers = /* @__PURE__ */ new Map();
|
|
@@ -116512,7 +116576,11 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116512
116576
|
decreaseIndent();
|
|
116513
116577
|
}
|
|
116514
116578
|
}
|
|
116515
|
-
|
|
116579
|
+
if (!omitBraceSourcePositions && (token === 19 /* OpenBraceToken */ || token === 20 /* CloseBraceToken */)) {
|
|
116580
|
+
pos = writeToken(token, pos, writer2, contextNode);
|
|
116581
|
+
} else {
|
|
116582
|
+
pos = writeTokenText(token, writer2, pos);
|
|
116583
|
+
}
|
|
116516
116584
|
if (isSimilarNode && contextNode.end !== pos) {
|
|
116517
116585
|
const isJsxExprContext = contextNode.kind === 294 /* JsxExpression */;
|
|
116518
116586
|
emitTrailingCommentsOfPosition(
|
|
@@ -119744,7 +119812,7 @@ function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, ge
|
|
|
119744
119812
|
function createCompilerHost(options, setParentNodes) {
|
|
119745
119813
|
return createCompilerHostWorker(options, setParentNodes);
|
|
119746
119814
|
}
|
|
119747
|
-
function createGetSourceFile(readFile, getCompilerOptions, setParentNodes
|
|
119815
|
+
function createGetSourceFile(readFile, getCompilerOptions, setParentNodes) {
|
|
119748
119816
|
return (fileName, languageVersionOrOptions, onError) => {
|
|
119749
119817
|
let text;
|
|
119750
119818
|
try {
|
|
@@ -119758,15 +119826,7 @@ function createGetSourceFile(readFile, getCompilerOptions, setParentNodes, skipN
|
|
|
119758
119826
|
}
|
|
119759
119827
|
text = "";
|
|
119760
119828
|
}
|
|
119761
|
-
return text !== void 0 ? createSourceFile(
|
|
119762
|
-
fileName,
|
|
119763
|
-
text,
|
|
119764
|
-
languageVersionOrOptions,
|
|
119765
|
-
setParentNodes,
|
|
119766
|
-
/*scriptKind*/
|
|
119767
|
-
void 0,
|
|
119768
|
-
skipNonSemanticJSDocParsing
|
|
119769
|
-
) : void 0;
|
|
119829
|
+
return text !== void 0 ? createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes) : void 0;
|
|
119770
119830
|
};
|
|
119771
119831
|
}
|
|
119772
119832
|
function createWriteFileMeasuringIO(actualWriteFile, createDirectory, directoryExists) {
|
|
@@ -119790,7 +119850,7 @@ function createWriteFileMeasuringIO(actualWriteFile, createDirectory, directoryE
|
|
|
119790
119850
|
}
|
|
119791
119851
|
};
|
|
119792
119852
|
}
|
|
119793
|
-
function createCompilerHostWorker(options, setParentNodes,
|
|
119853
|
+
function createCompilerHostWorker(options, setParentNodes, system = sys) {
|
|
119794
119854
|
const existingDirectories = /* @__PURE__ */ new Map();
|
|
119795
119855
|
const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames);
|
|
119796
119856
|
function directoryExists(directoryPath) {
|
|
@@ -119809,7 +119869,7 @@ function createCompilerHostWorker(options, setParentNodes, skipNonSemanticJSDocP
|
|
|
119809
119869
|
const newLine = getNewLineCharacter(options);
|
|
119810
119870
|
const realpath = system.realpath && ((path) => system.realpath(path));
|
|
119811
119871
|
const compilerHost = {
|
|
119812
|
-
getSourceFile: createGetSourceFile((fileName) => compilerHost.readFile(fileName), () => options, setParentNodes
|
|
119872
|
+
getSourceFile: createGetSourceFile((fileName) => compilerHost.readFile(fileName), () => options, setParentNodes),
|
|
119813
119873
|
getDefaultLibLocation,
|
|
119814
119874
|
getDefaultLibFileName: (options2) => combinePaths(getDefaultLibLocation(), getDefaultLibFileName(options2)),
|
|
119815
119875
|
writeFile: createWriteFileMeasuringIO(
|
|
@@ -120293,14 +120353,14 @@ function isReferenceFileLocation(location) {
|
|
|
120293
120353
|
return location.pos !== void 0;
|
|
120294
120354
|
}
|
|
120295
120355
|
function getReferencedFileLocation(program, ref) {
|
|
120296
|
-
var _a, _b, _c, _d
|
|
120356
|
+
var _a, _b, _c, _d;
|
|
120297
120357
|
const file = Debug.checkDefined(program.getSourceFileByPath(ref.file));
|
|
120298
120358
|
const { kind, index } = ref;
|
|
120299
120359
|
let pos, end, packageId, resolutionMode;
|
|
120300
120360
|
switch (kind) {
|
|
120301
120361
|
case 3 /* Import */:
|
|
120302
120362
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
120303
|
-
packageId = (
|
|
120363
|
+
packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.packageId;
|
|
120304
120364
|
if (importLiteral.pos === -1)
|
|
120305
120365
|
return { file, packageId, text: importLiteral.text };
|
|
120306
120366
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -120311,7 +120371,7 @@ function getReferencedFileLocation(program, ref) {
|
|
|
120311
120371
|
break;
|
|
120312
120372
|
case 5 /* TypeReferenceDirective */:
|
|
120313
120373
|
({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
|
|
120314
|
-
packageId = (
|
|
120374
|
+
packageId = (_d = (_c = program.getResolvedTypeReferenceDirective(file, toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) == null ? void 0 : _c.resolvedTypeReferenceDirective) == null ? void 0 : _d.packageId;
|
|
120315
120375
|
break;
|
|
120316
120376
|
case 7 /* LibReferenceDirective */:
|
|
120317
120377
|
({ pos, end } = file.libReferenceDirectives[index]);
|
|
@@ -120843,6 +120903,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120843
120903
|
resolvedModules,
|
|
120844
120904
|
resolvedTypeReferenceDirectiveNames,
|
|
120845
120905
|
resolvedLibReferences,
|
|
120906
|
+
getResolvedModule,
|
|
120907
|
+
getResolvedTypeReferenceDirective,
|
|
120908
|
+
forEachResolvedModule,
|
|
120909
|
+
forEachResolvedTypeReferenceDirective,
|
|
120846
120910
|
getCurrentPackagesMap: () => packageMap,
|
|
120847
120911
|
typesPackageExists,
|
|
120848
120912
|
packageBundlesTypes,
|
|
@@ -120886,19 +120950,35 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120886
120950
|
measure("Program", "beforeProgram", "afterProgram");
|
|
120887
120951
|
(_p = tracing) == null ? void 0 : _p.pop();
|
|
120888
120952
|
return program;
|
|
120953
|
+
function getResolvedModule(file, moduleName, mode) {
|
|
120954
|
+
var _a2;
|
|
120955
|
+
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
|
|
120956
|
+
}
|
|
120957
|
+
function getResolvedTypeReferenceDirective(file, typeDirectiveName, mode) {
|
|
120958
|
+
var _a2;
|
|
120959
|
+
return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
120960
|
+
}
|
|
120961
|
+
function forEachResolvedModule(callback, file) {
|
|
120962
|
+
forEachResolution(resolvedModules, callback, file);
|
|
120963
|
+
}
|
|
120964
|
+
function forEachResolvedTypeReferenceDirective(callback, file) {
|
|
120965
|
+
forEachResolution(resolvedTypeReferenceDirectiveNames, callback, file);
|
|
120966
|
+
}
|
|
120967
|
+
function forEachResolution(resolutionCache, callback, file) {
|
|
120968
|
+
var _a2;
|
|
120969
|
+
if (file)
|
|
120970
|
+
(_a2 = resolutionCache == null ? void 0 : resolutionCache.get(file.path)) == null ? void 0 : _a2.forEach((resolution, name, mode) => callback(resolution, name, mode, file.path));
|
|
120971
|
+
else
|
|
120972
|
+
resolutionCache == null ? void 0 : resolutionCache.forEach((resolutions, filePath) => resolutions.forEach((resolution, name, mode) => callback(resolution, name, mode, filePath)));
|
|
120973
|
+
}
|
|
120889
120974
|
function getPackagesMap() {
|
|
120890
120975
|
if (packageMap)
|
|
120891
120976
|
return packageMap;
|
|
120892
120977
|
packageMap = /* @__PURE__ */ new Map();
|
|
120893
|
-
|
|
120894
|
-
(
|
|
120895
|
-
|
|
120896
|
-
|
|
120897
|
-
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
120898
|
-
packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
|
|
120899
|
-
});
|
|
120900
|
-
}
|
|
120901
|
-
);
|
|
120978
|
+
forEachResolvedModule(({ resolvedModule }) => {
|
|
120979
|
+
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
120980
|
+
packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
|
|
120981
|
+
});
|
|
120902
120982
|
return packageMap;
|
|
120903
120983
|
}
|
|
120904
120984
|
function typesPackageExists(packageName) {
|
|
@@ -121030,7 +121110,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121030
121110
|
return classifiableNames;
|
|
121031
121111
|
}
|
|
121032
121112
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
121033
|
-
var _a2, _b2;
|
|
121034
121113
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
121035
121114
|
return resolveModuleNamesWorker(
|
|
121036
121115
|
moduleNames,
|
|
@@ -121048,7 +121127,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121048
121127
|
const moduleName = moduleNames[i];
|
|
121049
121128
|
if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
|
|
121050
121129
|
const mode = getModeForUsageLocation(file, moduleName);
|
|
121051
|
-
const oldResolution =
|
|
121130
|
+
const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, mode);
|
|
121052
121131
|
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
121053
121132
|
if (isTraceEnabled(options, host)) {
|
|
121054
121133
|
trace(
|
|
@@ -121095,8 +121174,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121095
121174
|
Debug.assert(j === resolutions.length);
|
|
121096
121175
|
return result;
|
|
121097
121176
|
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
121098
|
-
var
|
|
121099
|
-
const resolutionToFile = (
|
|
121177
|
+
var _a2;
|
|
121178
|
+
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
121100
121179
|
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
121101
121180
|
if (resolutionToFile && resolvedFile) {
|
|
121102
121181
|
return false;
|
|
@@ -121112,7 +121191,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121112
121191
|
}
|
|
121113
121192
|
}
|
|
121114
121193
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
121115
|
-
var _a2
|
|
121194
|
+
var _a2;
|
|
121116
121195
|
if (structureIsReused === 0 /* Not */) {
|
|
121117
121196
|
return resolveTypeReferenceDirectiveNamesWorker(
|
|
121118
121197
|
typeDirectiveNames,
|
|
@@ -121132,7 +121211,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121132
121211
|
if (canReuseResolutions) {
|
|
121133
121212
|
const typeDirectiveName = getTypeReferenceResolutionName(entry);
|
|
121134
121213
|
const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
121135
|
-
const oldResolution =
|
|
121214
|
+
const oldResolution = !isString(containingFile) ? oldProgram == null ? void 0 : oldProgram.getResolvedTypeReferenceDirective(containingFile, typeDirectiveName, mode) : (_a2 = oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
121136
121215
|
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
121137
121216
|
if (isTraceEnabled(options, host)) {
|
|
121138
121217
|
trace(
|
|
@@ -121192,7 +121271,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121192
121271
|
);
|
|
121193
121272
|
}
|
|
121194
121273
|
function tryReuseStructureFromOldProgram() {
|
|
121195
|
-
var _a2
|
|
121274
|
+
var _a2;
|
|
121196
121275
|
if (!oldProgram) {
|
|
121197
121276
|
return 0 /* Not */;
|
|
121198
121277
|
}
|
|
@@ -121312,20 +121391,29 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121312
121391
|
const moduleNames = getModuleNames(newSourceFile);
|
|
121313
121392
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
121314
121393
|
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
121315
|
-
const
|
|
121316
|
-
|
|
121394
|
+
const resolutionsChanged = hasChangesInResolutions(
|
|
121395
|
+
moduleNames,
|
|
121396
|
+
newSourceFile,
|
|
121397
|
+
resolutions,
|
|
121398
|
+
(name, mode) => oldProgram.getResolvedModule(newSourceFile, name, mode),
|
|
121399
|
+
moduleResolutionIsEqualTo,
|
|
121400
|
+
moduleResolutionNameAndModeGetter
|
|
121401
|
+
);
|
|
121317
121402
|
if (resolutionsChanged)
|
|
121318
121403
|
structureIsReused = 1 /* SafeModules */;
|
|
121319
121404
|
const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
121320
121405
|
const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
121321
121406
|
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
|
|
121322
|
-
const
|
|
121323
|
-
|
|
121324
|
-
|
|
121407
|
+
const typeReferenceResolutionsChanged = hasChangesInResolutions(
|
|
121408
|
+
typesReferenceDirectives,
|
|
121409
|
+
newSourceFile,
|
|
121410
|
+
typeReferenceResolutions,
|
|
121411
|
+
(name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedTypeReferenceDirective(newSourceFile, name, mode),
|
|
121412
|
+
typeDirectiveIsEqualTo,
|
|
121413
|
+
typeReferenceResolutionNameAndModeGetter
|
|
121414
|
+
);
|
|
121415
|
+
if (typeReferenceResolutionsChanged)
|
|
121325
121416
|
structureIsReused = 1 /* SafeModules */;
|
|
121326
|
-
} else if (oldTypeResolutions) {
|
|
121327
|
-
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, oldTypeResolutions);
|
|
121328
|
-
}
|
|
121329
121417
|
}
|
|
121330
121418
|
if (structureIsReused !== 2 /* Completely */) {
|
|
121331
121419
|
return structureIsReused;
|
|
@@ -122195,7 +122283,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122195
122283
|
const result = getImpliedNodeFormatForFileWorker(getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache2 == null ? void 0 : moduleResolutionCache2.getPackageJsonInfoCache(), host2, options2);
|
|
122196
122284
|
const languageVersion = getEmitScriptTarget(options2);
|
|
122197
122285
|
const setExternalModuleIndicator2 = getSetExternalModuleIndicator(options2);
|
|
122198
|
-
return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2 } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2 };
|
|
122286
|
+
return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode };
|
|
122199
122287
|
}
|
|
122200
122288
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
122201
122289
|
var _a2;
|
|
@@ -123472,7 +123560,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123472
123560
|
symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
123473
123561
|
}
|
|
123474
123562
|
if (files && !symlinks.hasProcessedResolutions()) {
|
|
123475
|
-
symlinks.setSymlinksFromResolutions(
|
|
123563
|
+
symlinks.setSymlinksFromResolutions(forEachResolvedModule, forEachResolvedTypeReferenceDirective, automaticTypeDirectiveResolutions);
|
|
123476
123564
|
}
|
|
123477
123565
|
return symlinks;
|
|
123478
123566
|
}
|
|
@@ -123834,7 +123922,6 @@ var BuilderState;
|
|
|
123834
123922
|
return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
|
|
123835
123923
|
}
|
|
123836
123924
|
function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
|
|
123837
|
-
var _a;
|
|
123838
123925
|
let referencedFiles;
|
|
123839
123926
|
if (sourceFile.imports && sourceFile.imports.length > 0) {
|
|
123840
123927
|
const checker = program.getTypeChecker();
|
|
@@ -123850,17 +123937,14 @@ var BuilderState;
|
|
|
123850
123937
|
addReferencedFile(referencedPath);
|
|
123851
123938
|
}
|
|
123852
123939
|
}
|
|
123853
|
-
|
|
123854
|
-
|
|
123855
|
-
|
|
123856
|
-
|
|
123857
|
-
|
|
123858
|
-
|
|
123859
|
-
|
|
123860
|
-
|
|
123861
|
-
addReferencedFile(typeFilePath);
|
|
123862
|
-
});
|
|
123863
|
-
}
|
|
123940
|
+
program.forEachResolvedTypeReferenceDirective(({ resolvedTypeReferenceDirective }) => {
|
|
123941
|
+
if (!resolvedTypeReferenceDirective) {
|
|
123942
|
+
return;
|
|
123943
|
+
}
|
|
123944
|
+
const fileName = resolvedTypeReferenceDirective.resolvedFileName;
|
|
123945
|
+
const typeFilePath = getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName);
|
|
123946
|
+
addReferencedFile(typeFilePath);
|
|
123947
|
+
}, sourceFile);
|
|
123864
123948
|
if (sourceFile.moduleAugmentations.length) {
|
|
123865
123949
|
const checker = program.getTypeChecker();
|
|
123866
123950
|
for (const moduleName of sourceFile.moduleAugmentations) {
|
|
@@ -125605,6 +125689,47 @@ function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirec
|
|
|
125605
125689
|
function getRootPathSplitLength(rootPath) {
|
|
125606
125690
|
return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0);
|
|
125607
125691
|
}
|
|
125692
|
+
function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirectedReference, options, resolutionHost, moduleResolutionCache) {
|
|
125693
|
+
return {
|
|
125694
|
+
nameAndMode: moduleResolutionNameAndModeGetter,
|
|
125695
|
+
resolve: (moduleName, resoluionMode) => resolveModuleNameUsingGlobalCache(
|
|
125696
|
+
resolutionHost,
|
|
125697
|
+
moduleResolutionCache,
|
|
125698
|
+
moduleName,
|
|
125699
|
+
containingFile,
|
|
125700
|
+
options,
|
|
125701
|
+
redirectedReference,
|
|
125702
|
+
resoluionMode
|
|
125703
|
+
)
|
|
125704
|
+
};
|
|
125705
|
+
}
|
|
125706
|
+
function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
|
|
125707
|
+
var _a;
|
|
125708
|
+
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
125709
|
+
const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
125710
|
+
if (!resolutionHost.getGlobalCache) {
|
|
125711
|
+
return primaryResult;
|
|
125712
|
+
}
|
|
125713
|
+
const globalCache = resolutionHost.getGlobalCache();
|
|
125714
|
+
if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
125715
|
+
const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
|
|
125716
|
+
Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
|
|
125717
|
+
resolutionHost.projectName,
|
|
125718
|
+
compilerOptions,
|
|
125719
|
+
host,
|
|
125720
|
+
globalCache,
|
|
125721
|
+
moduleResolutionCache
|
|
125722
|
+
);
|
|
125723
|
+
if (resolvedModule) {
|
|
125724
|
+
primaryResult.resolvedModule = resolvedModule;
|
|
125725
|
+
primaryResult.failedLookupLocations = updateResolutionField(primaryResult.failedLookupLocations, failedLookupLocations);
|
|
125726
|
+
primaryResult.affectingLocations = updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
125727
|
+
primaryResult.resolutionDiagnostics = updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
125728
|
+
return primaryResult;
|
|
125729
|
+
}
|
|
125730
|
+
}
|
|
125731
|
+
return primaryResult;
|
|
125732
|
+
}
|
|
125608
125733
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
125609
125734
|
let filesWithChangedSetOfUnresolvedImports;
|
|
125610
125735
|
let filesWithInvalidatedResolutions;
|
|
@@ -125651,6 +125776,16 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125651
125776
|
const rootPathComponents = getPathComponents(rootPath);
|
|
125652
125777
|
const typeRootsWatches = /* @__PURE__ */ new Map();
|
|
125653
125778
|
return {
|
|
125779
|
+
rootDirForResolution,
|
|
125780
|
+
resolvedModuleNames,
|
|
125781
|
+
resolvedTypeReferenceDirectives,
|
|
125782
|
+
resolvedLibraries,
|
|
125783
|
+
resolvedFileToResolution,
|
|
125784
|
+
resolutionsWithFailedLookups,
|
|
125785
|
+
resolutionsWithOnlyAffectingLocations,
|
|
125786
|
+
directoryWatchesOfFailedLookups,
|
|
125787
|
+
fileWatchesOfAffectingLocations,
|
|
125788
|
+
watchFailedLookupLocationsOfExternalModuleResolutions,
|
|
125654
125789
|
getModuleResolutionCache: () => moduleResolutionCache,
|
|
125655
125790
|
startRecordingFilesWithChangedResolutions,
|
|
125656
125791
|
finishRecordingFilesWithChangedResolutions,
|
|
@@ -125753,7 +125888,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125753
125888
|
if (!((_a = newProgram == null ? void 0 : newProgram.resolvedLibReferences) == null ? void 0 : _a.has(libFileName))) {
|
|
125754
125889
|
stopWatchFailedLookupLocationOfResolution(
|
|
125755
125890
|
resolution,
|
|
125756
|
-
resolutionHost.toPath(getInferredLibraryNameResolveFrom(
|
|
125891
|
+
resolutionHost.toPath(getInferredLibraryNameResolveFrom(resolutionHost.getCompilationSettings(), getCurrentDirectory(), libFileName)),
|
|
125757
125892
|
getResolvedModule
|
|
125758
125893
|
);
|
|
125759
125894
|
resolvedLibraries.delete(libFileName);
|
|
@@ -125795,58 +125930,22 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125795
125930
|
}
|
|
125796
125931
|
});
|
|
125797
125932
|
}
|
|
125798
|
-
directoryWatchesOfFailedLookups.forEach(
|
|
125799
|
-
|
|
125800
|
-
directoryWatchesOfFailedLookups.delete(path);
|
|
125801
|
-
watcher.watcher.close();
|
|
125802
|
-
}
|
|
125803
|
-
});
|
|
125804
|
-
fileWatchesOfAffectingLocations.forEach((watcher, path) => {
|
|
125805
|
-
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
125806
|
-
fileWatchesOfAffectingLocations.delete(path);
|
|
125807
|
-
watcher.watcher.close();
|
|
125808
|
-
}
|
|
125809
|
-
});
|
|
125933
|
+
directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
|
|
125934
|
+
fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
|
|
125810
125935
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
125811
125936
|
}
|
|
125812
|
-
function
|
|
125813
|
-
|
|
125814
|
-
|
|
125815
|
-
|
|
125816
|
-
if (!resolutionHost.getGlobalCache) {
|
|
125817
|
-
return primaryResult;
|
|
125818
|
-
}
|
|
125819
|
-
const globalCache = resolutionHost.getGlobalCache();
|
|
125820
|
-
if (globalCache !== void 0 && !isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
125821
|
-
const { resolvedModule, failedLookupLocations, affectingLocations, resolutionDiagnostics } = loadModuleFromGlobalCache(
|
|
125822
|
-
Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName),
|
|
125823
|
-
resolutionHost.projectName,
|
|
125824
|
-
compilerOptions,
|
|
125825
|
-
host,
|
|
125826
|
-
globalCache,
|
|
125827
|
-
moduleResolutionCache
|
|
125828
|
-
);
|
|
125829
|
-
if (resolvedModule) {
|
|
125830
|
-
primaryResult.resolvedModule = resolvedModule;
|
|
125831
|
-
primaryResult.failedLookupLocations = updateResolutionField(primaryResult.failedLookupLocations, failedLookupLocations);
|
|
125832
|
-
primaryResult.affectingLocations = updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
125833
|
-
primaryResult.resolutionDiagnostics = updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
125834
|
-
return primaryResult;
|
|
125835
|
-
}
|
|
125937
|
+
function closeDirectoryWatchesOfFailedLookup(watcher, path) {
|
|
125938
|
+
if (watcher.refCount === 0) {
|
|
125939
|
+
directoryWatchesOfFailedLookups.delete(path);
|
|
125940
|
+
watcher.watcher.close();
|
|
125836
125941
|
}
|
|
125837
|
-
return primaryResult;
|
|
125838
125942
|
}
|
|
125839
|
-
function
|
|
125840
|
-
|
|
125841
|
-
|
|
125842
|
-
|
|
125843
|
-
|
|
125844
|
-
|
|
125845
|
-
options,
|
|
125846
|
-
redirectedReference,
|
|
125847
|
-
resoluionMode
|
|
125848
|
-
)
|
|
125849
|
-
};
|
|
125943
|
+
function closeFileWatcherOfAffectingLocation(watcher, path) {
|
|
125944
|
+
var _a;
|
|
125945
|
+
if (watcher.files === 0 && watcher.resolutions === 0 && !((_a = watcher.symlinks) == null ? void 0 : _a.size)) {
|
|
125946
|
+
fileWatchesOfAffectingLocations.delete(path);
|
|
125947
|
+
watcher.watcher.close();
|
|
125948
|
+
}
|
|
125850
125949
|
}
|
|
125851
125950
|
function resolveNamesWithLocalCache({
|
|
125852
125951
|
entries,
|
|
@@ -125883,9 +125982,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125883
125982
|
resolutionHost.onDiscoveredSymlink();
|
|
125884
125983
|
}
|
|
125885
125984
|
resolutionsInFile.set(name, mode, resolution);
|
|
125886
|
-
|
|
125887
|
-
|
|
125888
|
-
|
|
125985
|
+
if (resolution !== existingResolution) {
|
|
125986
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution);
|
|
125987
|
+
if (existingResolution) {
|
|
125988
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
125989
|
+
}
|
|
125889
125990
|
}
|
|
125890
125991
|
if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
|
|
125891
125992
|
filesWithChangedSetOfUnresolvedImports.push(path);
|
|
@@ -125974,10 +126075,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125974
126075
|
options,
|
|
125975
126076
|
reusedNames,
|
|
125976
126077
|
perFileCache: resolvedModuleNames,
|
|
125977
|
-
loader:
|
|
126078
|
+
loader: createModuleResolutionLoaderUsingGlobalCache(
|
|
125978
126079
|
containingFile,
|
|
125979
126080
|
redirectedReference,
|
|
125980
|
-
options
|
|
126081
|
+
options,
|
|
126082
|
+
resolutionHost,
|
|
126083
|
+
moduleResolutionCache
|
|
125981
126084
|
),
|
|
125982
126085
|
getResolutionWithResolvedFileName: getResolvedModule,
|
|
125983
126086
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
@@ -126031,7 +126134,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126031
126134
|
);
|
|
126032
126135
|
if (resolution && !resolution.isInvalidated)
|
|
126033
126136
|
return resolution;
|
|
126034
|
-
return
|
|
126137
|
+
return resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, resolutionHost.getCompilationSettings());
|
|
126035
126138
|
}
|
|
126036
126139
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
126037
126140
|
return endsWith(dirPath, "/node_modules/@types");
|
|
@@ -126131,52 +126234,63 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126131
126234
|
return;
|
|
126132
126235
|
}
|
|
126133
126236
|
let locationToWatch = affectingLocation;
|
|
126237
|
+
let isSymlink = false;
|
|
126238
|
+
let symlinkWatcher;
|
|
126134
126239
|
if (resolutionHost.realpath) {
|
|
126135
126240
|
locationToWatch = resolutionHost.realpath(affectingLocation);
|
|
126136
126241
|
if (affectingLocation !== locationToWatch) {
|
|
126137
|
-
|
|
126138
|
-
|
|
126139
|
-
|
|
126140
|
-
|
|
126141
|
-
|
|
126142
|
-
|
|
126143
|
-
|
|
126144
|
-
|
|
126145
|
-
|
|
126146
|
-
|
|
126147
|
-
|
|
126242
|
+
isSymlink = true;
|
|
126243
|
+
symlinkWatcher = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
126244
|
+
}
|
|
126245
|
+
}
|
|
126246
|
+
const resolutions = forResolution ? 1 : 0;
|
|
126247
|
+
const files = forResolution ? 0 : 1;
|
|
126248
|
+
if (!isSymlink || !symlinkWatcher) {
|
|
126249
|
+
const watcher = {
|
|
126250
|
+
watcher: canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
|
|
126251
|
+
cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
|
|
126252
|
+
invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache().getInternalMap());
|
|
126253
|
+
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
126254
|
+
}) : noopFileWatcher,
|
|
126255
|
+
resolutions: isSymlink ? 0 : resolutions,
|
|
126256
|
+
files: isSymlink ? 0 : files,
|
|
126257
|
+
symlinks: void 0
|
|
126258
|
+
};
|
|
126259
|
+
fileWatchesOfAffectingLocations.set(locationToWatch, watcher);
|
|
126260
|
+
if (isSymlink)
|
|
126261
|
+
symlinkWatcher = watcher;
|
|
126148
126262
|
}
|
|
126149
|
-
|
|
126150
|
-
|
|
126151
|
-
|
|
126152
|
-
|
|
126153
|
-
|
|
126154
|
-
|
|
126155
|
-
|
|
126156
|
-
|
|
126157
|
-
|
|
126158
|
-
|
|
126159
|
-
|
|
126160
|
-
|
|
126161
|
-
|
|
126162
|
-
|
|
126163
|
-
|
|
126164
|
-
|
|
126165
|
-
|
|
126166
|
-
actualWatcher.close();
|
|
126167
|
-
actualWatcher = noopFileWatcher;
|
|
126168
|
-
}
|
|
126169
|
-
} : actualWatcher,
|
|
126170
|
-
resolutions: forResolution ? 1 : 0,
|
|
126171
|
-
files: forResolution ? 0 : 1,
|
|
126172
|
-
paths
|
|
126173
|
-
};
|
|
126174
|
-
fileWatchesOfAffectingLocations.set(locationToWatch, watcher);
|
|
126175
|
-
if (affectingLocation !== locationToWatch) {
|
|
126263
|
+
if (isSymlink) {
|
|
126264
|
+
Debug.assert(!!symlinkWatcher);
|
|
126265
|
+
const watcher = {
|
|
126266
|
+
watcher: {
|
|
126267
|
+
close: () => {
|
|
126268
|
+
var _a;
|
|
126269
|
+
const symlinkWatcher2 = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
126270
|
+
if (((_a = symlinkWatcher2 == null ? void 0 : symlinkWatcher2.symlinks) == null ? void 0 : _a.delete(affectingLocation)) && !symlinkWatcher2.symlinks.size && !symlinkWatcher2.resolutions && !symlinkWatcher2.files) {
|
|
126271
|
+
fileWatchesOfAffectingLocations.delete(locationToWatch);
|
|
126272
|
+
symlinkWatcher2.watcher.close();
|
|
126273
|
+
}
|
|
126274
|
+
}
|
|
126275
|
+
},
|
|
126276
|
+
resolutions,
|
|
126277
|
+
files,
|
|
126278
|
+
symlinks: void 0
|
|
126279
|
+
};
|
|
126176
126280
|
fileWatchesOfAffectingLocations.set(affectingLocation, watcher);
|
|
126177
|
-
|
|
126281
|
+
(symlinkWatcher.symlinks ?? (symlinkWatcher.symlinks = /* @__PURE__ */ new Set())).add(affectingLocation);
|
|
126178
126282
|
}
|
|
126179
126283
|
}
|
|
126284
|
+
function invalidateAffectingFileWatcher(path, packageJsonMap) {
|
|
126285
|
+
var _a;
|
|
126286
|
+
const watcher = fileWatchesOfAffectingLocations.get(path);
|
|
126287
|
+
if (watcher == null ? void 0 : watcher.resolutions)
|
|
126288
|
+
(affectingPathChecks ?? (affectingPathChecks = /* @__PURE__ */ new Set())).add(path);
|
|
126289
|
+
if (watcher == null ? void 0 : watcher.files)
|
|
126290
|
+
(affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path);
|
|
126291
|
+
(_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
|
|
126292
|
+
packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
|
|
126293
|
+
}
|
|
126180
126294
|
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
126181
126295
|
const program = resolutionHost.getCurrentProgram();
|
|
126182
126296
|
if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
@@ -126198,7 +126312,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126198
126312
|
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
|
|
126199
126313
|
}
|
|
126200
126314
|
}
|
|
126201
|
-
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) {
|
|
126315
|
+
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove) {
|
|
126202
126316
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
126203
126317
|
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
126204
126318
|
failedLookupLocation,
|
|
@@ -126213,12 +126327,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126213
126327
|
if (dirPath === rootPath) {
|
|
126214
126328
|
removeAtRoot = true;
|
|
126215
126329
|
} else {
|
|
126216
|
-
removeDirectoryWatcher(dirPath);
|
|
126330
|
+
removeDirectoryWatcher(dirPath, syncDirWatcherRemove);
|
|
126217
126331
|
}
|
|
126218
126332
|
}
|
|
126219
126333
|
return removeAtRoot;
|
|
126220
126334
|
}
|
|
126221
|
-
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
126335
|
+
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
|
|
126222
126336
|
Debug.checkDefined(resolution.files).delete(filePath);
|
|
126223
126337
|
resolution.refCount--;
|
|
126224
126338
|
if (resolution.refCount) {
|
|
@@ -126236,13 +126350,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126236
126350
|
let removeAtRoot = false;
|
|
126237
126351
|
if (failedLookupLocations) {
|
|
126238
126352
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
126239
|
-
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
|
|
126353
|
+
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot, syncDirWatcherRemove);
|
|
126240
126354
|
}
|
|
126241
126355
|
}
|
|
126242
126356
|
if (node10Result)
|
|
126243
|
-
removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot);
|
|
126357
|
+
removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot, syncDirWatcherRemove);
|
|
126244
126358
|
if (removeAtRoot)
|
|
126245
|
-
removeDirectoryWatcher(rootPath);
|
|
126359
|
+
removeDirectoryWatcher(rootPath, syncDirWatcherRemove);
|
|
126246
126360
|
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
126247
126361
|
resolutionsWithOnlyAffectingLocations.delete(resolution);
|
|
126248
126362
|
}
|
|
@@ -126250,12 +126364,16 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126250
126364
|
for (const affectingLocation of affectingLocations) {
|
|
126251
126365
|
const watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
126252
126366
|
watcher.resolutions--;
|
|
126367
|
+
if (syncDirWatcherRemove)
|
|
126368
|
+
closeFileWatcherOfAffectingLocation(watcher, affectingLocation);
|
|
126253
126369
|
}
|
|
126254
126370
|
}
|
|
126255
126371
|
}
|
|
126256
|
-
function removeDirectoryWatcher(dirPath) {
|
|
126372
|
+
function removeDirectoryWatcher(dirPath, syncDirWatcherRemove) {
|
|
126257
126373
|
const dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
126258
126374
|
dirWatcher.refCount--;
|
|
126375
|
+
if (syncDirWatcherRemove)
|
|
126376
|
+
closeDirectoryWatchesOfFailedLookup(dirWatcher, dirPath);
|
|
126259
126377
|
}
|
|
126260
126378
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
126261
126379
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, (fileOrDirectory) => {
|
|
@@ -126266,10 +126384,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126266
126384
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
126267
126385
|
}, nonRecursive ? 0 /* None */ : 1 /* Recursive */);
|
|
126268
126386
|
}
|
|
126269
|
-
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) {
|
|
126387
|
+
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
|
|
126270
126388
|
const resolutions = cache.get(filePath);
|
|
126271
126389
|
if (resolutions) {
|
|
126272
|
-
resolutions.forEach(
|
|
126390
|
+
resolutions.forEach(
|
|
126391
|
+
(resolution) => stopWatchFailedLookupLocationOfResolution(
|
|
126392
|
+
resolution,
|
|
126393
|
+
filePath,
|
|
126394
|
+
getResolutionWithResolvedFileName,
|
|
126395
|
+
syncDirWatcherRemove
|
|
126396
|
+
)
|
|
126397
|
+
);
|
|
126273
126398
|
cache.delete(filePath);
|
|
126274
126399
|
}
|
|
126275
126400
|
}
|
|
@@ -126284,9 +126409,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126284
126409
|
return;
|
|
126285
126410
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
126286
126411
|
}
|
|
126287
|
-
function removeResolutionsOfFile(filePath) {
|
|
126288
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
|
|
126289
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
126412
|
+
function removeResolutionsOfFile(filePath, syncDirWatcherRemove) {
|
|
126413
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule, syncDirWatcherRemove);
|
|
126414
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective, syncDirWatcherRemove);
|
|
126290
126415
|
}
|
|
126291
126416
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
126292
126417
|
if (!resolutions)
|
|
@@ -126940,8 +127065,7 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
|
|
|
126940
127065
|
(fileName, encoding) => !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding),
|
|
126941
127066
|
getCompilerOptions,
|
|
126942
127067
|
/*setParentNodes*/
|
|
126943
|
-
void 0
|
|
126944
|
-
host.skipNonSemanticJSDocParsing
|
|
127068
|
+
void 0
|
|
126945
127069
|
),
|
|
126946
127070
|
getDefaultLibLocation: maybeBind(host, host.getDefaultLibLocation),
|
|
126947
127071
|
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
|
|
@@ -126963,7 +127087,8 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
|
|
|
126963
127087
|
getEnvironmentVariable: maybeBind(host, host.getEnvironmentVariable) || (() => ""),
|
|
126964
127088
|
createHash: maybeBind(host, host.createHash),
|
|
126965
127089
|
readDirectory: maybeBind(host, host.readDirectory),
|
|
126966
|
-
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
127090
|
+
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
127091
|
+
jsDocParsingMode: host.jsDocParsingMode
|
|
126967
127092
|
};
|
|
126968
127093
|
return compilerHost;
|
|
126969
127094
|
}
|
|
@@ -127127,12 +127252,11 @@ function readBuilderProgram(compilerOptions, host) {
|
|
|
127127
127252
|
return void 0;
|
|
127128
127253
|
return createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, host);
|
|
127129
127254
|
}
|
|
127130
|
-
function createIncrementalCompilerHost(options, system = sys
|
|
127255
|
+
function createIncrementalCompilerHost(options, system = sys) {
|
|
127131
127256
|
const host = createCompilerHostWorker(
|
|
127132
127257
|
options,
|
|
127133
127258
|
/*setParentNodes*/
|
|
127134
127259
|
void 0,
|
|
127135
|
-
skipNonSemanticJSDocParsing,
|
|
127136
127260
|
system
|
|
127137
127261
|
);
|
|
127138
127262
|
host.createHash = maybeBind(system, system.createHash);
|
|
@@ -127274,7 +127398,7 @@ function createWatchProgram(host) {
|
|
|
127274
127398
|
watchConfigFileWildCardDirectories();
|
|
127275
127399
|
if (configFileName)
|
|
127276
127400
|
updateExtendedConfigFilesWatches(toPath3(configFileName), compilerOptions, watchOptions, WatchType.ExtendedConfigFile);
|
|
127277
|
-
return configFileName ? { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, close } : { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, updateRootFileNames, close };
|
|
127401
|
+
return configFileName ? { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, close, getResolutionCache } : { getCurrentProgram: getCurrentBuilderProgram, getProgram: updateProgram, updateRootFileNames, close, getResolutionCache };
|
|
127278
127402
|
function close() {
|
|
127279
127403
|
clearInvalidateResolutionsOfFailedLookupLocations();
|
|
127280
127404
|
resolutionCache.clear();
|
|
@@ -127314,6 +127438,9 @@ function createWatchProgram(host) {
|
|
|
127314
127438
|
parsedConfigs = void 0;
|
|
127315
127439
|
}
|
|
127316
127440
|
}
|
|
127441
|
+
function getResolutionCache() {
|
|
127442
|
+
return resolutionCache;
|
|
127443
|
+
}
|
|
127317
127444
|
function getCurrentBuilderProgram() {
|
|
127318
127445
|
return builderProgram;
|
|
127319
127446
|
}
|
|
@@ -132684,7 +132811,7 @@ function indexInTextChange(change, name) {
|
|
|
132684
132811
|
return idx === -1 ? -1 : idx + 1;
|
|
132685
132812
|
}
|
|
132686
132813
|
function needsParentheses(expression) {
|
|
132687
|
-
return isBinaryExpression(expression) && expression.operatorToken.kind === 28 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression);
|
|
132814
|
+
return isBinaryExpression(expression) && expression.operatorToken.kind === 28 /* CommaToken */ || isObjectLiteralExpression(expression) || (isAsExpression(expression) || isSatisfiesExpression(expression)) && isObjectLiteralExpression(expression.expression);
|
|
132688
132815
|
}
|
|
132689
132816
|
function getContextualTypeFromParent(node, checker, contextFlags) {
|
|
132690
132817
|
const parent2 = walkUpParenthesizedExpressions(node.parent);
|
|
@@ -135056,10 +135183,10 @@ var DocumentHighlights;
|
|
|
135056
135183
|
function isDocumentRegistryEntry(entry) {
|
|
135057
135184
|
return !!entry.sourceFile;
|
|
135058
135185
|
}
|
|
135059
|
-
function createDocumentRegistry(useCaseSensitiveFileNames2, currentDirectory) {
|
|
135060
|
-
return createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirectory);
|
|
135186
|
+
function createDocumentRegistry(useCaseSensitiveFileNames2, currentDirectory, jsDocParsingMode) {
|
|
135187
|
+
return createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirectory, jsDocParsingMode);
|
|
135061
135188
|
}
|
|
135062
|
-
function createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirectory = "", externalCache) {
|
|
135189
|
+
function createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirectory = "", jsDocParsingMode, externalCache) {
|
|
135063
135190
|
const buckets = /* @__PURE__ */ new Map();
|
|
135064
135191
|
const getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames2);
|
|
135065
135192
|
function reportStats() {
|
|
@@ -135143,9 +135270,11 @@ function createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirec
|
|
|
135143
135270
|
const sourceFileOptions = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : {
|
|
135144
135271
|
languageVersion: scriptTarget,
|
|
135145
135272
|
impliedNodeFormat: host && getImpliedNodeFormatForFile(path, (_d = (_c = (_b = (_a = host.getCompilerHost) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getModuleResolutionCache) == null ? void 0 : _c.call(_b)) == null ? void 0 : _d.getPackageJsonInfoCache(), host, compilationSettings),
|
|
135146
|
-
setExternalModuleIndicator: getSetExternalModuleIndicator(compilationSettings)
|
|
135273
|
+
setExternalModuleIndicator: getSetExternalModuleIndicator(compilationSettings),
|
|
135274
|
+
jsDocParsingMode
|
|
135147
135275
|
};
|
|
135148
135276
|
sourceFileOptions.languageVersion = scriptTarget;
|
|
135277
|
+
Debug.assertEqual(jsDocParsingMode, sourceFileOptions.jsDocParsingMode);
|
|
135149
135278
|
const oldBucketCount = buckets.size;
|
|
135150
135279
|
const keyWithMode = getDocumentRegistryBucketKeyWithMode(key, sourceFileOptions.impliedNodeFormat);
|
|
135151
135280
|
const bucket = getOrUpdate(buckets, keyWithMode, () => /* @__PURE__ */ new Map());
|
|
@@ -135397,14 +135526,13 @@ function combinePathsSafe(pathA, pathB) {
|
|
|
135397
135526
|
return ensurePathIsNonModuleName(combineNormal(pathA, pathB));
|
|
135398
135527
|
}
|
|
135399
135528
|
function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) {
|
|
135400
|
-
var _a, _b;
|
|
135401
135529
|
if (importedModuleSymbol) {
|
|
135402
135530
|
const oldFileName = find(importedModuleSymbol.declarations, isSourceFile).fileName;
|
|
135403
135531
|
const newFileName = oldToNew(oldFileName);
|
|
135404
135532
|
return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true };
|
|
135405
135533
|
} else {
|
|
135406
135534
|
const mode = getModeForUsageLocation(importingSourceFile, importLiteral);
|
|
135407
|
-
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ?
|
|
135535
|
+
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? program.getResolvedModule(importingSourceFile, importLiteral.text, mode) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
|
|
135408
135536
|
return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
|
|
135409
135537
|
}
|
|
135410
135538
|
}
|
|
@@ -136299,7 +136427,7 @@ function createSourceFileLike(text, lineMap) {
|
|
|
136299
136427
|
// src/services/suggestionDiagnostics.ts
|
|
136300
136428
|
var visitedNestedConvertibleFunctions = /* @__PURE__ */ new Map();
|
|
136301
136429
|
function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
136302
|
-
var _a
|
|
136430
|
+
var _a;
|
|
136303
136431
|
program.getSemanticDiagnostics(sourceFile, cancellationToken);
|
|
136304
136432
|
const diags = [];
|
|
136305
136433
|
const checker = program.getTypeChecker();
|
|
@@ -136316,7 +136444,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
|
136316
136444
|
const name = importNameForConvertToDefaultImport(importNode);
|
|
136317
136445
|
if (!name)
|
|
136318
136446
|
continue;
|
|
136319
|
-
const module2 = (
|
|
136447
|
+
const module2 = (_a = program.getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))) == null ? void 0 : _a.resolvedModule;
|
|
136320
136448
|
const resolvedFile = module2 && program.getSourceFile(module2.resolvedFileName);
|
|
136321
136449
|
if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
|
|
136322
136450
|
diags.push(createDiagnosticForNode(name, Diagnostics.Import_may_be_converted_to_a_default_import));
|
|
@@ -136566,7 +136694,8 @@ function transpileModule(input, transpileOptions) {
|
|
|
136566
136694
|
compilerHost,
|
|
136567
136695
|
options
|
|
136568
136696
|
),
|
|
136569
|
-
setExternalModuleIndicator: getSetExternalModuleIndicator(options)
|
|
136697
|
+
setExternalModuleIndicator: getSetExternalModuleIndicator(options),
|
|
136698
|
+
jsDocParsingMode: 1 /* ParseNone */
|
|
136570
136699
|
}
|
|
136571
136700
|
);
|
|
136572
136701
|
if (transpileOptions.moduleName) {
|
|
@@ -138719,10 +138848,10 @@ function getTargetFileImportsAndAddExportInOldFile(oldFile, targetFile, importsT
|
|
|
138719
138848
|
const targetSourceFile = program.getSourceFile(targetFile);
|
|
138720
138849
|
for (const oldStatement of oldFile.statements) {
|
|
138721
138850
|
forEachImportInStatement(oldStatement, (i) => {
|
|
138722
|
-
var _a
|
|
138851
|
+
var _a;
|
|
138723
138852
|
const moduleSpecifier = moduleSpecifierFromImport(i);
|
|
138724
|
-
const resolved =
|
|
138725
|
-
const fileName = (
|
|
138853
|
+
const resolved = program.getResolvedModule(oldFile, moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
|
|
138854
|
+
const fileName = (_a = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _a.resolvedFileName;
|
|
138726
138855
|
if (fileName && targetSourceFile) {
|
|
138727
138856
|
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.path, fileName, createModuleSpecifierResolutionHost(program, host));
|
|
138728
138857
|
append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
@@ -139853,7 +139982,12 @@ function getConvertibleArrowFunctionAtPosition(file, startPosition, considerFunc
|
|
|
139853
139982
|
} else if (refactorKindBeginsWith(removeBracesAction.kind, kind) && isBlock(func.body) && func.body.statements.length === 1) {
|
|
139854
139983
|
const firstStatement = first(func.body.statements);
|
|
139855
139984
|
if (isReturnStatement(firstStatement)) {
|
|
139856
|
-
|
|
139985
|
+
const expression = firstStatement.expression && isObjectLiteralExpression(getLeftmostExpression(
|
|
139986
|
+
firstStatement.expression,
|
|
139987
|
+
/*stopAtCallExpressions*/
|
|
139988
|
+
false
|
|
139989
|
+
)) ? factory.createParenthesizedExpression(firstStatement.expression) : firstStatement.expression;
|
|
139990
|
+
return { func, addBraces: false, expression, returnStatement: firstStatement };
|
|
139857
139991
|
}
|
|
139858
139992
|
}
|
|
139859
139993
|
return void 0;
|
|
@@ -140647,12 +140781,16 @@ function getRefactorActionsToConvertToTemplateString(context) {
|
|
|
140647
140781
|
const { file, startPosition } = context;
|
|
140648
140782
|
const node = getNodeOrParentOfParentheses(file, startPosition);
|
|
140649
140783
|
const maybeBinary = getParentBinaryExpression(node);
|
|
140784
|
+
const nodeIsStringLiteral = isStringLiteral(maybeBinary);
|
|
140650
140785
|
const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
|
|
140651
|
-
if (
|
|
140786
|
+
if (nodeIsStringLiteral && context.triggerReason !== "invoked") {
|
|
140787
|
+
return emptyArray;
|
|
140788
|
+
}
|
|
140789
|
+
if (isExpressionNode(maybeBinary) && (nodeIsStringLiteral || isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation)) {
|
|
140652
140790
|
refactorInfo.actions.push(convertStringAction);
|
|
140653
140791
|
return [refactorInfo];
|
|
140654
140792
|
} else if (context.preferences.provideRefactorNotApplicableReason) {
|
|
140655
|
-
refactorInfo.actions.push({ ...convertStringAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.
|
|
140793
|
+
refactorInfo.actions.push({ ...convertStringAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenations_and_string_literals) });
|
|
140656
140794
|
return [refactorInfo];
|
|
140657
140795
|
}
|
|
140658
140796
|
return emptyArray;
|
|
@@ -143757,7 +143895,9 @@ var SyntaxTreeCache = class {
|
|
|
143757
143895
|
this.host,
|
|
143758
143896
|
this.host.getCompilationSettings()
|
|
143759
143897
|
),
|
|
143760
|
-
setExternalModuleIndicator: getSetExternalModuleIndicator(this.host.getCompilationSettings())
|
|
143898
|
+
setExternalModuleIndicator: getSetExternalModuleIndicator(this.host.getCompilationSettings()),
|
|
143899
|
+
// These files are used to produce syntax-based highlighting, which reads JSDoc, so we must use ParseAll.
|
|
143900
|
+
jsDocParsingMode: 0 /* ParseAll */
|
|
143761
143901
|
};
|
|
143762
143902
|
sourceFile = createLanguageServiceSourceFile(
|
|
143763
143903
|
fileName,
|
|
@@ -143817,7 +143957,8 @@ function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version2, t
|
|
|
143817
143957
|
const options = {
|
|
143818
143958
|
languageVersion: sourceFile.languageVersion,
|
|
143819
143959
|
impliedNodeFormat: sourceFile.impliedNodeFormat,
|
|
143820
|
-
setExternalModuleIndicator: sourceFile.setExternalModuleIndicator
|
|
143960
|
+
setExternalModuleIndicator: sourceFile.setExternalModuleIndicator,
|
|
143961
|
+
jsDocParsingMode: sourceFile.jsDocParsingMode
|
|
143821
143962
|
};
|
|
143822
143963
|
return createLanguageServiceSourceFile(
|
|
143823
143964
|
sourceFile.fileName,
|
|
@@ -144019,7 +144160,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
144019
144160
|
resolveTypeReferenceDirectiveReferences: maybeBind(host, host.resolveTypeReferenceDirectiveReferences),
|
|
144020
144161
|
resolveLibrary: maybeBind(host, host.resolveLibrary),
|
|
144021
144162
|
useSourceOfProjectReferenceRedirect: maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
144022
|
-
getParsedCommandLine
|
|
144163
|
+
getParsedCommandLine,
|
|
144164
|
+
jsDocParsingMode: host.jsDocParsingMode
|
|
144023
144165
|
};
|
|
144024
144166
|
const originalGetSourceFile = compilerHost.getSourceFile;
|
|
144025
144167
|
const { getSourceFileWithCache } = changeCompilerHostLikeToUseCache(
|
|
@@ -145263,6 +145405,9 @@ var LanguageServiceShimHostAdapter = class {
|
|
|
145263
145405
|
return map(typeDirectiveNames, (name) => getProperty(typeDirectivesForFile, isString(name) ? name : toFileNameLowerCase(name.fileName)));
|
|
145264
145406
|
};
|
|
145265
145407
|
}
|
|
145408
|
+
if ("jsDocParsingMode" in this.shimHost) {
|
|
145409
|
+
this.jsDocParsingMode = this.shimHost.jsDocParsingMode;
|
|
145410
|
+
}
|
|
145266
145411
|
}
|
|
145267
145412
|
log(s) {
|
|
145268
145413
|
if (this.loggingEnabled) {
|
|
@@ -149004,9 +149149,9 @@ registerCodeFix({
|
|
|
149004
149149
|
}
|
|
149005
149150
|
});
|
|
149006
149151
|
function fixImportOfModuleExports(importingFile, exportingFile, program, changes, quotePreference) {
|
|
149007
|
-
var _a
|
|
149152
|
+
var _a;
|
|
149008
149153
|
for (const moduleSpecifier of importingFile.imports) {
|
|
149009
|
-
const imported = (
|
|
149154
|
+
const imported = (_a = program.getResolvedModule(importingFile, moduleSpecifier.text, getModeForUsageLocation(importingFile, moduleSpecifier))) == null ? void 0 : _a.resolvedModule;
|
|
149010
149155
|
if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
|
|
149011
149156
|
continue;
|
|
149012
149157
|
}
|
|
@@ -151127,11 +151272,11 @@ function promoteFromTypeOnly(changes, aliasDeclaration, program, sourceFile, pre
|
|
|
151127
151272
|
Debug.failBadSyntaxKind(aliasDeclaration);
|
|
151128
151273
|
}
|
|
151129
151274
|
function promoteImportClause(importClause) {
|
|
151130
|
-
var _a
|
|
151275
|
+
var _a;
|
|
151131
151276
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
|
|
151132
151277
|
if (!compilerOptions.allowImportingTsExtensions) {
|
|
151133
151278
|
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
|
|
151134
|
-
const resolvedModule = moduleSpecifier && ((
|
|
151279
|
+
const resolvedModule = moduleSpecifier && ((_a = program.getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))) == null ? void 0 : _a.resolvedModule);
|
|
151135
151280
|
if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
|
|
151136
151281
|
const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
|
|
151137
151282
|
changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
|
|
@@ -151799,7 +151944,7 @@ registerCodeFix({
|
|
|
151799
151944
|
}
|
|
151800
151945
|
});
|
|
151801
151946
|
function getInfo7(sourceFile, pos, program) {
|
|
151802
|
-
var _a, _b
|
|
151947
|
+
var _a, _b;
|
|
151803
151948
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
151804
151949
|
if (isIdentifier(token)) {
|
|
151805
151950
|
const importDeclaration = findAncestor(token, isImportDeclaration);
|
|
@@ -151808,18 +151953,19 @@ function getInfo7(sourceFile, pos, program) {
|
|
|
151808
151953
|
const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : void 0;
|
|
151809
151954
|
if (moduleSpecifier === void 0)
|
|
151810
151955
|
return void 0;
|
|
151811
|
-
const resolvedModule = (
|
|
151956
|
+
const resolvedModule = (_a = program.getResolvedModule(
|
|
151957
|
+
sourceFile,
|
|
151812
151958
|
moduleSpecifier,
|
|
151813
151959
|
/*mode*/
|
|
151814
151960
|
void 0
|
|
151815
|
-
)) == null ? void 0 :
|
|
151961
|
+
)) == null ? void 0 : _a.resolvedModule;
|
|
151816
151962
|
if (resolvedModule === void 0)
|
|
151817
151963
|
return void 0;
|
|
151818
151964
|
const moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
|
|
151819
151965
|
if (moduleSourceFile === void 0 || isSourceFileFromLibrary(program, moduleSourceFile))
|
|
151820
151966
|
return void 0;
|
|
151821
151967
|
const moduleSymbol = moduleSourceFile.symbol;
|
|
151822
|
-
const locals = (
|
|
151968
|
+
const locals = (_b = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _b.locals;
|
|
151823
151969
|
if (locals === void 0)
|
|
151824
151970
|
return void 0;
|
|
151825
151971
|
const localSymbol = locals.get(token.escapedText);
|
|
@@ -152074,10 +152220,10 @@ function convertSemanticMeaningToSymbolFlags(meaning) {
|
|
|
152074
152220
|
return flags;
|
|
152075
152221
|
}
|
|
152076
152222
|
function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) {
|
|
152077
|
-
var _a
|
|
152223
|
+
var _a;
|
|
152078
152224
|
if (!importDeclaration || !isStringLiteralLike(importDeclaration.moduleSpecifier))
|
|
152079
152225
|
return void 0;
|
|
152080
|
-
const resolvedModule = (
|
|
152226
|
+
const resolvedModule = (_a = context.program.getResolvedModule(sourceFile, importDeclaration.moduleSpecifier.text, getModeForUsageLocation(sourceFile, importDeclaration.moduleSpecifier))) == null ? void 0 : _a.resolvedModule;
|
|
152081
152227
|
if (!resolvedModule)
|
|
152082
152228
|
return void 0;
|
|
152083
152229
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -161075,8 +161221,9 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
|
|
|
161075
161221
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
|
|
161076
161222
|
}
|
|
161077
161223
|
case 2 /* Types */: {
|
|
161224
|
+
const quoteChar = contextToken.kind === 15 /* NoSubstitutionTemplateLiteral */ ? 96 /* backtick */ : startsWith(getTextOfNode(contextToken), "'") ? 39 /* singleQuote */ : 34 /* doubleQuote */;
|
|
161078
161225
|
const entries = completion.types.map((type) => ({
|
|
161079
|
-
name: type.value,
|
|
161226
|
+
name: escapeString(type.value, quoteChar),
|
|
161080
161227
|
kindModifiers: "" /* none */,
|
|
161081
161228
|
kind: "string" /* string */,
|
|
161082
161229
|
sortText: SortText.LocationPriority,
|
|
@@ -162880,7 +163027,7 @@ function declarationIsWriteAccess(decl) {
|
|
|
162880
163027
|
var Core;
|
|
162881
163028
|
((Core2) => {
|
|
162882
163029
|
function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options = {}, sourceFilesSet = new Set(sourceFiles.map((f) => f.fileName))) {
|
|
162883
|
-
var _a, _b
|
|
163030
|
+
var _a, _b;
|
|
162884
163031
|
node = getAdjustedNode2(node, options);
|
|
162885
163032
|
if (isSourceFile(node)) {
|
|
162886
163033
|
const resolvedRef = ts_GoToDefinition_exports.getReferenceAtPosition(node, position, program);
|
|
@@ -162919,7 +163066,7 @@ var Core;
|
|
|
162919
163066
|
if (!options.implementations && isStringLiteralLike(node)) {
|
|
162920
163067
|
if (isModuleSpecifierLike(node)) {
|
|
162921
163068
|
const fileIncludeReasons = program.getFileIncludeReasons();
|
|
162922
|
-
const referencedFileName = (
|
|
163069
|
+
const referencedFileName = (_b = (_a = program.getResolvedModule(node.getSourceFile(), node.text, getModeForUsageLocation(node.getSourceFile(), node))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.resolvedFileName;
|
|
162923
163070
|
const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0;
|
|
162924
163071
|
if (referencedFile) {
|
|
162925
163072
|
return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }];
|
|
@@ -164322,7 +164469,7 @@ __export(ts_GoToDefinition_exports, {
|
|
|
164322
164469
|
|
|
164323
164470
|
// src/services/goToDefinition.ts
|
|
164324
164471
|
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
164325
|
-
var _a
|
|
164472
|
+
var _a;
|
|
164326
164473
|
const resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
164327
164474
|
const fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || emptyArray;
|
|
164328
164475
|
if (resolvedRef == null ? void 0 : resolvedRef.file) {
|
|
@@ -164395,7 +164542,7 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
|
164395
164542
|
}
|
|
164396
164543
|
}
|
|
164397
164544
|
if (!symbol && isModuleSpecifierLike(fallbackNode)) {
|
|
164398
|
-
const ref = (
|
|
164545
|
+
const ref = (_a = program.getResolvedModule(sourceFile, fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode))) == null ? void 0 : _a.resolvedModule;
|
|
164399
164546
|
if (ref) {
|
|
164400
164547
|
return [{
|
|
164401
164548
|
name: fallbackNode.text,
|
|
@@ -164490,7 +164637,7 @@ function getDefinitionFromOverriddenMember(typeChecker, node) {
|
|
|
164490
164637
|
return getDefinitionFromSymbol(typeChecker, symbol, node);
|
|
164491
164638
|
}
|
|
164492
164639
|
function getReferenceAtPosition(sourceFile, position, program) {
|
|
164493
|
-
var _a, _b
|
|
164640
|
+
var _a, _b;
|
|
164494
164641
|
const referencePath = findReferenceInPosition(sourceFile.referencedFiles, position);
|
|
164495
164642
|
if (referencePath) {
|
|
164496
164643
|
const file = program.getSourceFileFromReference(sourceFile, referencePath);
|
|
@@ -164507,11 +164654,11 @@ function getReferenceAtPosition(sourceFile, position, program) {
|
|
|
164507
164654
|
const file = program.getLibFileFromReference(libReferenceDirective);
|
|
164508
164655
|
return file && { reference: libReferenceDirective, fileName: file.fileName, file, unverified: false };
|
|
164509
164656
|
}
|
|
164510
|
-
|
|
164511
|
-
if (resolvedModules == null ? void 0 : resolvedModules.size()) {
|
|
164657
|
+
if (sourceFile.imports.length || sourceFile.moduleAugmentations.length) {
|
|
164512
164658
|
const node = getTouchingToken(sourceFile, position);
|
|
164513
|
-
|
|
164514
|
-
|
|
164659
|
+
let resolution;
|
|
164660
|
+
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && (resolution = program.getResolvedModule(sourceFile, node.text, getModeForUsageLocation(sourceFile, node)))) {
|
|
164661
|
+
const verifiedFileName = (_b = resolution.resolvedModule) == null ? void 0 : _b.resolvedFileName;
|
|
164515
164662
|
const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text);
|
|
164516
164663
|
return {
|
|
164517
164664
|
file: program.getSourceFile(fileName),
|
|
@@ -169273,7 +169420,7 @@ var changesToText;
|
|
|
169273
169420
|
const sourceFile = createSourceFile(
|
|
169274
169421
|
"any file name",
|
|
169275
169422
|
nonFormattedText,
|
|
169276
|
-
99 /* ESNext */,
|
|
169423
|
+
{ languageVersion: 99 /* ESNext */, jsDocParsingMode: 1 /* ParseNone */ },
|
|
169277
169424
|
/*setParentNodes*/
|
|
169278
169425
|
true,
|
|
169279
169426
|
scriptKind
|
|
@@ -172558,6 +172705,7 @@ __export(ts_exports2, {
|
|
|
172558
172705
|
InternalEmitFlags: () => InternalEmitFlags,
|
|
172559
172706
|
InternalSymbolName: () => InternalSymbolName,
|
|
172560
172707
|
InvalidatedProjectKind: () => InvalidatedProjectKind,
|
|
172708
|
+
JSDocParsingMode: () => JSDocParsingMode,
|
|
172561
172709
|
JsDoc: () => ts_JsDoc_exports,
|
|
172562
172710
|
JsTyping: () => ts_JsTyping_exports,
|
|
172563
172711
|
JsxEmit: () => JsxEmit,
|
|
@@ -172885,6 +173033,7 @@ __export(ts_exports2, {
|
|
|
172885
173033
|
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
172886
173034
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
172887
173035
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
173036
|
+
createModuleResolutionLoaderUsingGlobalCache: () => createModuleResolutionLoaderUsingGlobalCache,
|
|
172888
173037
|
createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
|
|
172889
173038
|
createMultiMap: () => createMultiMap,
|
|
172890
173039
|
createNodeConverters: () => createNodeConverters,
|
|
@@ -173313,6 +173462,7 @@ __export(ts_exports2, {
|
|
|
173313
173462
|
getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
|
|
173314
173463
|
getLeftmostAccessExpression: () => getLeftmostAccessExpression,
|
|
173315
173464
|
getLeftmostExpression: () => getLeftmostExpression,
|
|
173465
|
+
getLibraryNameFromLibFileName: () => getLibraryNameFromLibFileName,
|
|
173316
173466
|
getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
|
|
173317
173467
|
getLineInfo: () => getLineInfo,
|
|
173318
173468
|
getLineOfLocalPosition: () => getLineOfLocalPosition,
|
|
@@ -173707,6 +173857,7 @@ __export(ts_exports2, {
|
|
|
173707
173857
|
isClassDeclaration: () => isClassDeclaration,
|
|
173708
173858
|
isClassElement: () => isClassElement,
|
|
173709
173859
|
isClassExpression: () => isClassExpression,
|
|
173860
|
+
isClassFieldAndNotAutoAccessor: () => isClassFieldAndNotAutoAccessor,
|
|
173710
173861
|
isClassLike: () => isClassLike,
|
|
173711
173862
|
isClassMemberModifier: () => isClassMemberModifier,
|
|
173712
173863
|
isClassNamedEvaluationHelperBlock: () => isClassNamedEvaluationHelperBlock,
|
|
@@ -174925,9 +175076,12 @@ __export(ts_server_exports3, {
|
|
|
174925
175076
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
174926
175077
|
AuxiliaryProject: () => AuxiliaryProject,
|
|
174927
175078
|
CharRangeSection: () => CharRangeSection,
|
|
175079
|
+
CloseFileWatcherEvent: () => CloseFileWatcherEvent,
|
|
174928
175080
|
CommandNames: () => CommandNames,
|
|
174929
175081
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
174930
175082
|
ConfiguredProject: () => ConfiguredProject2,
|
|
175083
|
+
CreateDirectoryWatcherEvent: () => CreateDirectoryWatcherEvent,
|
|
175084
|
+
CreateFileWatcherEvent: () => CreateFileWatcherEvent,
|
|
174931
175085
|
Errors: () => Errors,
|
|
174932
175086
|
EventBeginInstallTypes: () => EventBeginInstallTypes,
|
|
174933
175087
|
EventEndInstallTypes: () => EventEndInstallTypes,
|
|
@@ -175683,6 +175837,7 @@ var CommandTypes = /* @__PURE__ */ ((CommandTypes2) => {
|
|
|
175683
175837
|
CommandTypes2["ProvideCallHierarchyIncomingCalls"] = "provideCallHierarchyIncomingCalls";
|
|
175684
175838
|
CommandTypes2["ProvideCallHierarchyOutgoingCalls"] = "provideCallHierarchyOutgoingCalls";
|
|
175685
175839
|
CommandTypes2["ProvideInlayHints"] = "provideInlayHints";
|
|
175840
|
+
CommandTypes2["WatchChange"] = "watchChange";
|
|
175686
175841
|
return CommandTypes2;
|
|
175687
175842
|
})(CommandTypes || {});
|
|
175688
175843
|
var OrganizeImportsMode2 = /* @__PURE__ */ ((OrganizeImportsMode3) => {
|
|
@@ -176521,6 +176676,7 @@ var Project3 = class _Project {
|
|
|
176521
176676
|
this.directoryStructureHost = directoryStructureHost;
|
|
176522
176677
|
this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory);
|
|
176523
176678
|
this.getCanonicalFileName = this.projectService.toCanonicalFileName;
|
|
176679
|
+
this.jsDocParsingMode = this.projectService.jsDocParsingMode;
|
|
176524
176680
|
this.cancellationToken = new ThrottledCancellationToken(this.projectService.cancellationToken, this.projectService.throttleWaitMilliseconds);
|
|
176525
176681
|
if (!this.compilerOptions) {
|
|
176526
176682
|
this.compilerOptions = getDefaultCompilerOptions2();
|
|
@@ -176645,8 +176801,8 @@ var Project3 = class _Project {
|
|
|
176645
176801
|
}
|
|
176646
176802
|
if (this.program && !this.symlinks.hasProcessedResolutions()) {
|
|
176647
176803
|
this.symlinks.setSymlinksFromResolutions(
|
|
176648
|
-
this.program.
|
|
176649
|
-
this.program.
|
|
176804
|
+
this.program.forEachResolvedModule,
|
|
176805
|
+
this.program.forEachResolvedTypeReferenceDirective,
|
|
176650
176806
|
this.program.getAutomaticTypeDirectiveResolutions()
|
|
176651
176807
|
);
|
|
176652
176808
|
}
|
|
@@ -177429,12 +177585,23 @@ var Project3 = class _Project {
|
|
|
177429
177585
|
for (const f of oldProgram.getSourceFiles()) {
|
|
177430
177586
|
const newFile = this.program.getSourceFileByPath(f.resolvedPath);
|
|
177431
177587
|
if (!newFile || f.resolvedPath === f.path && newFile.resolvedPath !== f.path) {
|
|
177432
|
-
this.detachScriptInfoFromProject(
|
|
177588
|
+
this.detachScriptInfoFromProject(
|
|
177589
|
+
f.fileName,
|
|
177590
|
+
!!this.program.getSourceFileByPath(f.path),
|
|
177591
|
+
/*syncDirWatcherRemove*/
|
|
177592
|
+
true
|
|
177593
|
+
);
|
|
177433
177594
|
}
|
|
177434
177595
|
}
|
|
177435
177596
|
oldProgram.forEachResolvedProjectReference((resolvedProjectReference) => {
|
|
177436
177597
|
if (!this.program.getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
|
|
177437
|
-
this.detachScriptInfoFromProject(
|
|
177598
|
+
this.detachScriptInfoFromProject(
|
|
177599
|
+
resolvedProjectReference.sourceFile.fileName,
|
|
177600
|
+
/*noRemoveResolution*/
|
|
177601
|
+
void 0,
|
|
177602
|
+
/*syncDirWatcherRemove*/
|
|
177603
|
+
true
|
|
177604
|
+
);
|
|
177438
177605
|
}
|
|
177439
177606
|
});
|
|
177440
177607
|
}
|
|
@@ -177474,6 +177641,7 @@ var Project3 = class _Project {
|
|
|
177474
177641
|
this.resolutionCache.updateTypeRootsWatch();
|
|
177475
177642
|
}
|
|
177476
177643
|
}
|
|
177644
|
+
this.projectService.verifyProgram(this);
|
|
177477
177645
|
if (this.exportMapCache && !this.exportMapCache.isEmpty()) {
|
|
177478
177646
|
this.exportMapCache.releaseSymbols();
|
|
177479
177647
|
if (this.hasAddedorRemovedFiles || oldProgram && !this.program.structureIsReused) {
|
|
@@ -177546,12 +177714,12 @@ var Project3 = class _Project {
|
|
|
177546
177714
|
sendPerformanceEvent(kind, durationMs) {
|
|
177547
177715
|
this.projectService.sendPerformanceEvent(kind, durationMs);
|
|
177548
177716
|
}
|
|
177549
|
-
detachScriptInfoFromProject(uncheckedFileName, noRemoveResolution) {
|
|
177717
|
+
detachScriptInfoFromProject(uncheckedFileName, noRemoveResolution, syncDirWatcherRemove) {
|
|
177550
177718
|
const scriptInfoToDetach = this.projectService.getScriptInfo(uncheckedFileName);
|
|
177551
177719
|
if (scriptInfoToDetach) {
|
|
177552
177720
|
scriptInfoToDetach.detachFromProject(this);
|
|
177553
177721
|
if (!noRemoveResolution) {
|
|
177554
|
-
this.resolutionCache.removeResolutionsOfFile(scriptInfoToDetach.path);
|
|
177722
|
+
this.resolutionCache.removeResolutionsOfFile(scriptInfoToDetach.path, syncDirWatcherRemove);
|
|
177555
177723
|
}
|
|
177556
177724
|
}
|
|
177557
177725
|
}
|
|
@@ -178062,16 +178230,12 @@ function getUnresolvedImports(program, cachedUnresolvedImportsPerFile) {
|
|
|
178062
178230
|
}
|
|
178063
178231
|
function extractUnresolvedImportsFromSourceFile(program, file, ambientModules, cachedUnresolvedImportsPerFile) {
|
|
178064
178232
|
return getOrUpdate(cachedUnresolvedImportsPerFile, file.path, () => {
|
|
178065
|
-
var _a;
|
|
178066
|
-
const resolvedModules = (_a = program.resolvedModules) == null ? void 0 : _a.get(file.path);
|
|
178067
|
-
if (!resolvedModules)
|
|
178068
|
-
return emptyArray2;
|
|
178069
178233
|
let unresolvedImports;
|
|
178070
|
-
|
|
178234
|
+
program.forEachResolvedModule(({ resolvedModule }, name) => {
|
|
178071
178235
|
if ((!resolvedModule || !resolutionExtensionIsTSOrJson(resolvedModule.extension)) && !isExternalModuleNameRelative(name) && !ambientModules.some((m) => m === name)) {
|
|
178072
178236
|
unresolvedImports = append(unresolvedImports, parsePackageName(name).packageName);
|
|
178073
178237
|
}
|
|
178074
|
-
});
|
|
178238
|
+
}, file);
|
|
178075
178239
|
return unresolvedImports || emptyArray2;
|
|
178076
178240
|
});
|
|
178077
178241
|
}
|
|
@@ -178314,11 +178478,12 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
|
|
|
178314
178478
|
);
|
|
178315
178479
|
if (entrypoints) {
|
|
178316
178480
|
const real = (_a2 = host.realpath) == null ? void 0 : _a2.call(host, packageJson.packageDirectory);
|
|
178317
|
-
const
|
|
178481
|
+
const realPath2 = real ? hostProject.toPath(real) : void 0;
|
|
178482
|
+
const isSymlink = realPath2 && realPath2 !== hostProject.toPath(packageJson.packageDirectory);
|
|
178318
178483
|
if (isSymlink) {
|
|
178319
178484
|
symlinkCache.setSymlinkedDirectory(packageJson.packageDirectory, {
|
|
178320
178485
|
real,
|
|
178321
|
-
realPath:
|
|
178486
|
+
realPath: realPath2
|
|
178322
178487
|
});
|
|
178323
178488
|
}
|
|
178324
178489
|
return mapDefined(entrypoints, (entrypoint) => {
|
|
@@ -178730,6 +178895,9 @@ var ConfigFileDiagEvent = "configFileDiag";
|
|
|
178730
178895
|
var ProjectLanguageServiceStateEvent = "projectLanguageServiceState";
|
|
178731
178896
|
var ProjectInfoTelemetryEvent = "projectInfo";
|
|
178732
178897
|
var OpenFileInfoTelemetryEvent = "openFileInfo";
|
|
178898
|
+
var CreateFileWatcherEvent = "createFileWatcher";
|
|
178899
|
+
var CreateDirectoryWatcherEvent = "createDirectoryWatcher";
|
|
178900
|
+
var CloseFileWatcherEvent = "closeFileWatcher";
|
|
178733
178901
|
var ensureProjectForOpenFileSchedule = "*ensureProjectForOpenFiles*";
|
|
178734
178902
|
function prepareConvertersForEnumLikeCompilerOptions(commandLineOptions) {
|
|
178735
178903
|
const map2 = /* @__PURE__ */ new Map();
|
|
@@ -178993,6 +179161,87 @@ function createProjectNameFactoryWithCounter(nameFactory) {
|
|
|
178993
179161
|
let nextId = 1;
|
|
178994
179162
|
return () => nameFactory(nextId++);
|
|
178995
179163
|
}
|
|
179164
|
+
function getHostWatcherMap() {
|
|
179165
|
+
return { idToCallbacks: /* @__PURE__ */ new Map(), pathToId: /* @__PURE__ */ new Map() };
|
|
179166
|
+
}
|
|
179167
|
+
function createWatchFactoryHostUsingWatchEvents(service, canUseWatchEvents) {
|
|
179168
|
+
if (!canUseWatchEvents || !service.eventHandler || !service.session)
|
|
179169
|
+
return void 0;
|
|
179170
|
+
const watchedFiles = getHostWatcherMap();
|
|
179171
|
+
const watchedDirectories = getHostWatcherMap();
|
|
179172
|
+
const watchedDirectoriesRecursive = getHostWatcherMap();
|
|
179173
|
+
let ids = 1;
|
|
179174
|
+
service.session.addProtocolHandler("watchChange" /* WatchChange */, (req) => {
|
|
179175
|
+
onWatchChange(req.arguments);
|
|
179176
|
+
return { responseRequired: false };
|
|
179177
|
+
});
|
|
179178
|
+
return {
|
|
179179
|
+
watchFile: watchFile2,
|
|
179180
|
+
watchDirectory,
|
|
179181
|
+
getCurrentDirectory: () => service.host.getCurrentDirectory(),
|
|
179182
|
+
useCaseSensitiveFileNames: service.host.useCaseSensitiveFileNames
|
|
179183
|
+
};
|
|
179184
|
+
function watchFile2(path, callback) {
|
|
179185
|
+
return getOrCreateFileWatcher(
|
|
179186
|
+
watchedFiles,
|
|
179187
|
+
path,
|
|
179188
|
+
callback,
|
|
179189
|
+
(id) => ({ eventName: CreateFileWatcherEvent, data: { id, path } })
|
|
179190
|
+
);
|
|
179191
|
+
}
|
|
179192
|
+
function watchDirectory(path, callback, recursive) {
|
|
179193
|
+
return getOrCreateFileWatcher(
|
|
179194
|
+
recursive ? watchedDirectoriesRecursive : watchedDirectories,
|
|
179195
|
+
path,
|
|
179196
|
+
callback,
|
|
179197
|
+
(id) => ({ eventName: CreateDirectoryWatcherEvent, data: { id, path, recursive: !!recursive } })
|
|
179198
|
+
);
|
|
179199
|
+
}
|
|
179200
|
+
function getOrCreateFileWatcher({ pathToId, idToCallbacks }, path, callback, event) {
|
|
179201
|
+
const key = service.toPath(path);
|
|
179202
|
+
let id = pathToId.get(key);
|
|
179203
|
+
if (!id)
|
|
179204
|
+
pathToId.set(key, id = ids++);
|
|
179205
|
+
let callbacks = idToCallbacks.get(id);
|
|
179206
|
+
if (!callbacks) {
|
|
179207
|
+
idToCallbacks.set(id, callbacks = /* @__PURE__ */ new Set());
|
|
179208
|
+
service.eventHandler(event(id));
|
|
179209
|
+
}
|
|
179210
|
+
callbacks.add(callback);
|
|
179211
|
+
return {
|
|
179212
|
+
close() {
|
|
179213
|
+
const callbacks2 = idToCallbacks.get(id);
|
|
179214
|
+
if (!(callbacks2 == null ? void 0 : callbacks2.delete(callback)))
|
|
179215
|
+
return;
|
|
179216
|
+
if (callbacks2.size)
|
|
179217
|
+
return;
|
|
179218
|
+
idToCallbacks.delete(id);
|
|
179219
|
+
pathToId.delete(key);
|
|
179220
|
+
service.eventHandler({ eventName: CloseFileWatcherEvent, data: { id } });
|
|
179221
|
+
}
|
|
179222
|
+
};
|
|
179223
|
+
}
|
|
179224
|
+
function onWatchChange({ id, path, eventType }) {
|
|
179225
|
+
onFileWatcherCallback(id, path, eventType);
|
|
179226
|
+
onDirectoryWatcherCallback(watchedDirectories, id, path, eventType);
|
|
179227
|
+
onDirectoryWatcherCallback(watchedDirectoriesRecursive, id, path, eventType);
|
|
179228
|
+
}
|
|
179229
|
+
function onFileWatcherCallback(id, eventPath, eventType) {
|
|
179230
|
+
var _a;
|
|
179231
|
+
(_a = watchedFiles.idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
|
|
179232
|
+
const eventKind = eventType === "create" ? 0 /* Created */ : eventType === "delete" ? 2 /* Deleted */ : 1 /* Changed */;
|
|
179233
|
+
callback(eventPath, eventKind);
|
|
179234
|
+
});
|
|
179235
|
+
}
|
|
179236
|
+
function onDirectoryWatcherCallback({ idToCallbacks }, id, eventPath, eventType) {
|
|
179237
|
+
var _a;
|
|
179238
|
+
if (eventType === "update")
|
|
179239
|
+
return;
|
|
179240
|
+
(_a = idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
|
|
179241
|
+
callback(eventPath);
|
|
179242
|
+
});
|
|
179243
|
+
}
|
|
179244
|
+
}
|
|
178996
179245
|
var _ProjectService = class _ProjectService {
|
|
178997
179246
|
constructor(opts) {
|
|
178998
179247
|
/**
|
|
@@ -179072,6 +179321,8 @@ var _ProjectService = class _ProjectService {
|
|
|
179072
179321
|
this.extendedConfigCache = /* @__PURE__ */ new Map();
|
|
179073
179322
|
/** @internal */
|
|
179074
179323
|
this.verifyDocumentRegistry = noop;
|
|
179324
|
+
/** @internal */
|
|
179325
|
+
this.verifyProgram = noop;
|
|
179075
179326
|
var _a;
|
|
179076
179327
|
this.host = opts.host;
|
|
179077
179328
|
this.logger = opts.logger;
|
|
@@ -179087,6 +179338,7 @@ var _ProjectService = class _ProjectService {
|
|
|
179087
179338
|
this.allowLocalPluginLoads = !!opts.allowLocalPluginLoads;
|
|
179088
179339
|
this.typesMapLocation = opts.typesMapLocation === void 0 ? combinePaths(getDirectoryPath(this.getExecutingFilePath()), "typesMap.json") : opts.typesMapLocation;
|
|
179089
179340
|
this.session = opts.session;
|
|
179341
|
+
this.jsDocParsingMode = opts.jsDocParsingMode;
|
|
179090
179342
|
if (opts.serverMode !== void 0) {
|
|
179091
179343
|
this.serverMode = opts.serverMode;
|
|
179092
179344
|
} else {
|
|
@@ -179112,14 +179364,19 @@ var _ProjectService = class _ProjectService {
|
|
|
179112
179364
|
hostInfo: "Unknown host",
|
|
179113
179365
|
extraFileExtensions: []
|
|
179114
179366
|
};
|
|
179115
|
-
this.documentRegistry = createDocumentRegistryInternal(this.host.useCaseSensitiveFileNames, this.currentDirectory, this);
|
|
179367
|
+
this.documentRegistry = createDocumentRegistryInternal(this.host.useCaseSensitiveFileNames, this.currentDirectory, this.jsDocParsingMode, this);
|
|
179116
179368
|
const watchLogLevel = this.logger.hasLevel(3 /* verbose */) ? 2 /* Verbose */ : this.logger.loggingEnabled() ? 1 /* TriggerOnly */ : 0 /* None */;
|
|
179117
179369
|
const log = watchLogLevel !== 0 /* None */ ? (s) => this.logger.info(s) : noop;
|
|
179118
179370
|
this.packageJsonCache = createPackageJsonCache(this);
|
|
179119
179371
|
this.watchFactory = this.serverMode !== 0 /* Semantic */ ? {
|
|
179120
179372
|
watchFile: returnNoopFileWatcher,
|
|
179121
179373
|
watchDirectory: returnNoopFileWatcher
|
|
179122
|
-
} : getWatchFactory(
|
|
179374
|
+
} : getWatchFactory(
|
|
179375
|
+
createWatchFactoryHostUsingWatchEvents(this, opts.canUseWatchEvents) || this.host,
|
|
179376
|
+
watchLogLevel,
|
|
179377
|
+
log,
|
|
179378
|
+
getDetailWatchInfo
|
|
179379
|
+
);
|
|
179123
179380
|
(_a = opts.incrementalVerifier) == null ? void 0 : _a.call(opts, this);
|
|
179124
179381
|
}
|
|
179125
179382
|
toPath(fileName) {
|
|
@@ -183343,6 +183600,7 @@ var Session3 = class _Session {
|
|
|
183343
183600
|
typesMapLocation: opts.typesMapLocation,
|
|
183344
183601
|
serverMode: opts.serverMode,
|
|
183345
183602
|
session: this,
|
|
183603
|
+
canUseWatchEvents: opts.canUseWatchEvents,
|
|
183346
183604
|
incrementalVerifier: opts.incrementalVerifier
|
|
183347
183605
|
};
|
|
183348
183606
|
this.projectService = new ProjectService3(settings);
|
|
@@ -183396,43 +183654,41 @@ var Session3 = class _Session {
|
|
|
183396
183654
|
defaultEventHandler(event) {
|
|
183397
183655
|
switch (event.eventName) {
|
|
183398
183656
|
case ProjectsUpdatedInBackgroundEvent:
|
|
183399
|
-
|
|
183400
|
-
this.projectsUpdatedInBackgroundEvent(openFiles);
|
|
183657
|
+
this.projectsUpdatedInBackgroundEvent(event.data.openFiles);
|
|
183401
183658
|
break;
|
|
183402
183659
|
case ProjectLoadingStartEvent:
|
|
183403
|
-
|
|
183404
|
-
|
|
183405
|
-
|
|
183406
|
-
|
|
183407
|
-
);
|
|
183660
|
+
this.event({
|
|
183661
|
+
projectName: event.data.project.getProjectName(),
|
|
183662
|
+
reason: event.data.reason
|
|
183663
|
+
}, event.eventName);
|
|
183408
183664
|
break;
|
|
183409
183665
|
case ProjectLoadingFinishEvent:
|
|
183410
|
-
|
|
183411
|
-
|
|
183666
|
+
this.event({
|
|
183667
|
+
projectName: event.data.project.getProjectName()
|
|
183668
|
+
}, event.eventName);
|
|
183412
183669
|
break;
|
|
183413
183670
|
case LargeFileReferencedEvent:
|
|
183414
|
-
|
|
183415
|
-
|
|
183671
|
+
case CreateFileWatcherEvent:
|
|
183672
|
+
case CreateDirectoryWatcherEvent:
|
|
183673
|
+
case CloseFileWatcherEvent:
|
|
183674
|
+
this.event(event.data, event.eventName);
|
|
183416
183675
|
break;
|
|
183417
183676
|
case ConfigFileDiagEvent:
|
|
183418
|
-
const { triggerFile, configFileName: configFile, diagnostics } = event.data;
|
|
183419
|
-
const bakedDiags = map(diagnostics, (diagnostic) => formatDiagnosticToProtocol(
|
|
183420
|
-
diagnostic,
|
|
183421
|
-
/*includeFileName*/
|
|
183422
|
-
true
|
|
183423
|
-
));
|
|
183424
183677
|
this.event({
|
|
183425
|
-
triggerFile,
|
|
183426
|
-
configFile,
|
|
183427
|
-
diagnostics:
|
|
183428
|
-
|
|
183678
|
+
triggerFile: event.data.triggerFile,
|
|
183679
|
+
configFile: event.data.configFileName,
|
|
183680
|
+
diagnostics: map(event.data.diagnostics, (diagnostic) => formatDiagnosticToProtocol(
|
|
183681
|
+
diagnostic,
|
|
183682
|
+
/*includeFileName*/
|
|
183683
|
+
true
|
|
183684
|
+
))
|
|
183685
|
+
}, event.eventName);
|
|
183429
183686
|
break;
|
|
183430
183687
|
case ProjectLanguageServiceStateEvent: {
|
|
183431
|
-
const eventName = ProjectLanguageServiceStateEvent;
|
|
183432
183688
|
this.event({
|
|
183433
183689
|
projectName: event.data.project.getProjectName(),
|
|
183434
183690
|
languageServiceEnabled: event.data.languageServiceEnabled
|
|
183435
|
-
}, eventName);
|
|
183691
|
+
}, event.eventName);
|
|
183436
183692
|
break;
|
|
183437
183693
|
}
|
|
183438
183694
|
case ProjectInfoTelemetryEvent: {
|
|
@@ -186227,9 +186483,12 @@ __export(ts_server_exports4, {
|
|
|
186227
186483
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
186228
186484
|
AuxiliaryProject: () => AuxiliaryProject,
|
|
186229
186485
|
CharRangeSection: () => CharRangeSection,
|
|
186486
|
+
CloseFileWatcherEvent: () => CloseFileWatcherEvent,
|
|
186230
186487
|
CommandNames: () => CommandNames,
|
|
186231
186488
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
186232
186489
|
ConfiguredProject: () => ConfiguredProject2,
|
|
186490
|
+
CreateDirectoryWatcherEvent: () => CreateDirectoryWatcherEvent,
|
|
186491
|
+
CreateFileWatcherEvent: () => CreateFileWatcherEvent,
|
|
186233
186492
|
Errors: () => Errors,
|
|
186234
186493
|
EventBeginInstallTypes: () => EventBeginInstallTypes,
|
|
186235
186494
|
EventEndInstallTypes: () => EventEndInstallTypes,
|
|
@@ -187046,6 +187305,7 @@ function start({ args, logger, cancellationToken, serverMode, unknownServerMode,
|
|
|
187046
187305
|
useInferredProjectPerProjectRoot: hasArgument("--useInferredProjectPerProjectRoot"),
|
|
187047
187306
|
suppressDiagnosticEvents: hasArgument("--suppressDiagnosticEvents"),
|
|
187048
187307
|
noGetErrOnBackgroundUpdate: hasArgument("--noGetErrOnBackgroundUpdate"),
|
|
187308
|
+
canUseWatchEvents: hasArgument("--canUseWatchEvents"),
|
|
187049
187309
|
serverMode
|
|
187050
187310
|
},
|
|
187051
187311
|
logger,
|
|
@@ -187123,6 +187383,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
187123
187383
|
InternalEmitFlags,
|
|
187124
187384
|
InternalSymbolName,
|
|
187125
187385
|
InvalidatedProjectKind,
|
|
187386
|
+
JSDocParsingMode,
|
|
187126
187387
|
JsDoc,
|
|
187127
187388
|
JsTyping,
|
|
187128
187389
|
JsxEmit,
|
|
@@ -187450,6 +187711,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
187450
187711
|
createModuleNotFoundChain,
|
|
187451
187712
|
createModuleResolutionCache,
|
|
187452
187713
|
createModuleResolutionLoader,
|
|
187714
|
+
createModuleResolutionLoaderUsingGlobalCache,
|
|
187453
187715
|
createModuleSpecifierResolutionHost,
|
|
187454
187716
|
createMultiMap,
|
|
187455
187717
|
createNodeConverters,
|
|
@@ -187878,6 +188140,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
187878
188140
|
getLeadingCommentRangesOfNode,
|
|
187879
188141
|
getLeftmostAccessExpression,
|
|
187880
188142
|
getLeftmostExpression,
|
|
188143
|
+
getLibraryNameFromLibFileName,
|
|
187881
188144
|
getLineAndCharacterOfPosition,
|
|
187882
188145
|
getLineInfo,
|
|
187883
188146
|
getLineOfLocalPosition,
|
|
@@ -188272,6 +188535,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
188272
188535
|
isClassDeclaration,
|
|
188273
188536
|
isClassElement,
|
|
188274
188537
|
isClassExpression,
|
|
188538
|
+
isClassFieldAndNotAutoAccessor,
|
|
188275
188539
|
isClassLike,
|
|
188276
188540
|
isClassMemberModifier,
|
|
188277
188541
|
isClassNamedEvaluationHelperBlock,
|