typescript 5.3.0-dev.20230920 → 5.3.0-dev.20230922
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/lib.dom.d.ts +4 -0
- package/lib/lib.webworker.d.ts +2 -0
- package/lib/tsc.js +180 -191
- package/lib/tsserver.js +278 -260
- package/lib/typescript.d.ts +37 -1
- package/lib/typescript.js +279 -257
- package/lib/typingsInstaller.js +53 -39
- 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,
|
|
@@ -994,8 +995,6 @@ __export(server_exports, {
|
|
|
994
995
|
getResolvePackageJsonExports: () => getResolvePackageJsonExports,
|
|
995
996
|
getResolvePackageJsonImports: () => getResolvePackageJsonImports,
|
|
996
997
|
getResolvedExternalModuleName: () => getResolvedExternalModuleName,
|
|
997
|
-
getResolvedModule: () => getResolvedModule,
|
|
998
|
-
getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
|
|
999
998
|
getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
|
|
1000
999
|
getRestParameterElementType: () => getRestParameterElementType,
|
|
1001
1000
|
getRightMostAssignedExpression: () => getRightMostAssignedExpression,
|
|
@@ -2093,8 +2092,6 @@ __export(server_exports, {
|
|
|
2093
2092
|
setParent: () => setParent,
|
|
2094
2093
|
setParentRecursive: () => setParentRecursive,
|
|
2095
2094
|
setPrivateIdentifier: () => setPrivateIdentifier,
|
|
2096
|
-
setResolvedModule: () => setResolvedModule,
|
|
2097
|
-
setResolvedTypeReferenceDirective: () => setResolvedTypeReferenceDirective,
|
|
2098
2095
|
setSnippetElement: () => setSnippetElement,
|
|
2099
2096
|
setSourceMapRange: () => setSourceMapRange,
|
|
2100
2097
|
setStackTraceLimit: () => setStackTraceLimit,
|
|
@@ -2321,14 +2318,13 @@ __export(server_exports, {
|
|
|
2321
2318
|
writeCommentRange: () => writeCommentRange,
|
|
2322
2319
|
writeFile: () => writeFile,
|
|
2323
2320
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
2324
|
-
zipToModeAwareCache: () => zipToModeAwareCache,
|
|
2325
2321
|
zipWith: () => zipWith
|
|
2326
2322
|
});
|
|
2327
2323
|
module.exports = __toCommonJS(server_exports);
|
|
2328
2324
|
|
|
2329
2325
|
// src/compiler/corePublic.ts
|
|
2330
2326
|
var versionMajorMinor = "5.3";
|
|
2331
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2327
|
+
var version = `${versionMajorMinor}.0-dev.20230922`;
|
|
2332
2328
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2333
2329
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2334
2330
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7422,6 +7418,13 @@ var commentPragmas = {
|
|
|
7422
7418
|
kind: 4 /* MultiLine */
|
|
7423
7419
|
}
|
|
7424
7420
|
};
|
|
7421
|
+
var JSDocParsingMode = /* @__PURE__ */ ((JSDocParsingMode7) => {
|
|
7422
|
+
JSDocParsingMode7[JSDocParsingMode7["ParseAll"] = 0] = "ParseAll";
|
|
7423
|
+
JSDocParsingMode7[JSDocParsingMode7["ParseNone"] = 1] = "ParseNone";
|
|
7424
|
+
JSDocParsingMode7[JSDocParsingMode7["ParseForTypeErrors"] = 2] = "ParseForTypeErrors";
|
|
7425
|
+
JSDocParsingMode7[JSDocParsingMode7["ParseForTypeInfo"] = 3] = "ParseForTypeInfo";
|
|
7426
|
+
return JSDocParsingMode7;
|
|
7427
|
+
})(JSDocParsingMode || {});
|
|
7425
7428
|
|
|
7426
7429
|
// src/compiler/sys.ts
|
|
7427
7430
|
function generateDjb2Hash(data) {
|
|
@@ -11209,7 +11212,7 @@ var Diagnostics = {
|
|
|
11209
11212
|
Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
|
|
11210
11213
|
Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
|
|
11211
11214
|
Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
|
|
11212
|
-
|
|
11215
|
+
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"),
|
|
11213
11216
|
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"),
|
|
11214
11217
|
Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
|
|
11215
11218
|
Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
|
|
@@ -11453,7 +11456,7 @@ var unicodeESNextIdentifierStart = [65, 90, 97, 122, 170, 170, 181, 181, 186, 18
|
|
|
11453
11456
|
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];
|
|
11454
11457
|
var commentDirectiveRegExSingleLine = /^\/\/\/?\s*@(ts-expect-error|ts-ignore)/;
|
|
11455
11458
|
var commentDirectiveRegExMultiLine = /^(?:\/|\*)*\s*@(ts-expect-error|ts-ignore)/;
|
|
11456
|
-
var
|
|
11459
|
+
var jsDocSeeOrLink = /@(?:see|link)/i;
|
|
11457
11460
|
function lookupInUnicodeMap(code, map2) {
|
|
11458
11461
|
if (code < map2[0]) {
|
|
11459
11462
|
return false;
|
|
@@ -11960,7 +11963,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
11960
11963
|
var tokenFlags;
|
|
11961
11964
|
var commentDirectives;
|
|
11962
11965
|
var inJSDocType = 0;
|
|
11963
|
-
var
|
|
11966
|
+
var scriptKind = 0 /* Unknown */;
|
|
11967
|
+
var jsDocParsingMode = 0 /* ParseAll */;
|
|
11964
11968
|
setText(text, start2, length2);
|
|
11965
11969
|
var scanner2 = {
|
|
11966
11970
|
getTokenFullStart: () => fullStartPos,
|
|
@@ -12004,14 +12008,15 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12004
12008
|
setText,
|
|
12005
12009
|
setScriptTarget,
|
|
12006
12010
|
setLanguageVariant,
|
|
12011
|
+
setScriptKind,
|
|
12012
|
+
setJSDocParsingMode,
|
|
12007
12013
|
setOnError,
|
|
12008
12014
|
resetTokenState,
|
|
12009
12015
|
setTextPos: resetTokenState,
|
|
12010
12016
|
setInJSDocType,
|
|
12011
12017
|
tryScan,
|
|
12012
12018
|
lookAhead,
|
|
12013
|
-
scanRange
|
|
12014
|
-
setSkipNonSemanticJSDoc
|
|
12019
|
+
scanRange
|
|
12015
12020
|
};
|
|
12016
12021
|
if (Debug.isDebugging) {
|
|
12017
12022
|
Object.defineProperty(scanner2, "__debugShowCurrentPositionInText", {
|
|
@@ -12799,7 +12804,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12799
12804
|
tokenFlags |= 1 /* PrecedingLineBreak */;
|
|
12800
12805
|
}
|
|
12801
12806
|
}
|
|
12802
|
-
if (isJSDoc2 && (
|
|
12807
|
+
if (isJSDoc2 && shouldParseJSDoc()) {
|
|
12803
12808
|
tokenFlags |= 2 /* PrecedingJSDocComment */;
|
|
12804
12809
|
}
|
|
12805
12810
|
commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart);
|
|
@@ -13058,6 +13063,21 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13058
13063
|
}
|
|
13059
13064
|
}
|
|
13060
13065
|
}
|
|
13066
|
+
function shouldParseJSDoc() {
|
|
13067
|
+
switch (jsDocParsingMode) {
|
|
13068
|
+
case 0 /* ParseAll */:
|
|
13069
|
+
return true;
|
|
13070
|
+
case 1 /* ParseNone */:
|
|
13071
|
+
return false;
|
|
13072
|
+
}
|
|
13073
|
+
if (scriptKind !== 3 /* TS */ && scriptKind !== 4 /* TSX */) {
|
|
13074
|
+
return true;
|
|
13075
|
+
}
|
|
13076
|
+
if (jsDocParsingMode === 3 /* ParseForTypeInfo */) {
|
|
13077
|
+
return false;
|
|
13078
|
+
}
|
|
13079
|
+
return jsDocSeeOrLink.test(text.slice(fullStartPos, pos));
|
|
13080
|
+
}
|
|
13061
13081
|
function reScanInvalidIdentifier() {
|
|
13062
13082
|
Debug.assert(token === 0 /* Unknown */, "'reScanInvalidIdentifier' should only be called when the current token is 'SyntaxKind.Unknown'.");
|
|
13063
13083
|
pos = tokenStart = fullStartPos;
|
|
@@ -13472,8 +13492,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13472
13492
|
function setLanguageVariant(variant) {
|
|
13473
13493
|
languageVariant = variant;
|
|
13474
13494
|
}
|
|
13475
|
-
function
|
|
13476
|
-
|
|
13495
|
+
function setScriptKind(kind) {
|
|
13496
|
+
scriptKind = kind;
|
|
13497
|
+
}
|
|
13498
|
+
function setJSDocParsingMode(kind) {
|
|
13499
|
+
jsDocParsingMode = kind;
|
|
13477
13500
|
}
|
|
13478
13501
|
function resetTokenState(position) {
|
|
13479
13502
|
Debug.assert(position >= 0);
|
|
@@ -15143,26 +15166,6 @@ function usingSingleLineStringWriter(action) {
|
|
|
15143
15166
|
function getFullWidth(node) {
|
|
15144
15167
|
return node.end - node.pos;
|
|
15145
15168
|
}
|
|
15146
|
-
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
15147
|
-
var _a, _b;
|
|
15148
|
-
return (_b = (_a = sourceFile == null ? void 0 : sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleNameText, mode)) == null ? void 0 : _b.resolvedModule;
|
|
15149
|
-
}
|
|
15150
|
-
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
15151
|
-
if (!sourceFile.resolvedModules) {
|
|
15152
|
-
sourceFile.resolvedModules = createModeAwareCache();
|
|
15153
|
-
}
|
|
15154
|
-
sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
|
|
15155
|
-
}
|
|
15156
|
-
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective, mode) {
|
|
15157
|
-
if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
15158
|
-
sourceFile.resolvedTypeReferenceDirectiveNames = createModeAwareCache();
|
|
15159
|
-
}
|
|
15160
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
|
|
15161
|
-
}
|
|
15162
|
-
function getResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, mode) {
|
|
15163
|
-
var _a, _b;
|
|
15164
|
-
return (_b = (_a = sourceFile == null ? void 0 : sourceFile.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(typeReferenceDirectiveName, mode)) == null ? void 0 : _b.resolvedTypeReferenceDirective;
|
|
15165
|
-
}
|
|
15166
15169
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
15167
15170
|
return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
|
|
15168
15171
|
}
|
|
@@ -15170,8 +15173,8 @@ function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
|
15170
15173
|
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;
|
|
15171
15174
|
}
|
|
15172
15175
|
function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
|
|
15173
|
-
var _a, _b;
|
|
15174
|
-
const node10Result = (_b = (_a =
|
|
15176
|
+
var _a, _b, _c;
|
|
15177
|
+
const node10Result = (_c = (_b = (_a = host.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(moduleReference, mode)) == null ? void 0 : _c.node10Result;
|
|
15175
15178
|
const result = node10Result ? chainDiagnosticMessages(
|
|
15176
15179
|
/*details*/
|
|
15177
15180
|
void 0,
|
|
@@ -20619,14 +20622,11 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
|
|
|
20619
20622
|
(symlinkedDirectories || (symlinkedDirectories = /* @__PURE__ */ new Map())).set(symlinkPath, real);
|
|
20620
20623
|
}
|
|
20621
20624
|
},
|
|
20622
|
-
setSymlinksFromResolutions(
|
|
20623
|
-
var _a, _b;
|
|
20625
|
+
setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, typeReferenceDirectives) {
|
|
20624
20626
|
Debug.assert(!hasProcessedResolutions);
|
|
20625
20627
|
hasProcessedResolutions = true;
|
|
20626
|
-
|
|
20627
|
-
|
|
20628
|
-
(_b = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _b.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
20629
|
-
}
|
|
20628
|
+
resolvedModules == null ? void 0 : resolvedModules.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedModule)));
|
|
20629
|
+
resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective)));
|
|
20630
20630
|
typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
|
|
20631
20631
|
},
|
|
20632
20632
|
hasProcessedResolutions: () => hasProcessedResolutions
|
|
@@ -25666,7 +25666,6 @@ function createNodeFactory(flags, baseFactory2) {
|
|
|
25666
25666
|
node.imports = void 0;
|
|
25667
25667
|
node.moduleAugmentations = void 0;
|
|
25668
25668
|
node.ambientModuleNames = void 0;
|
|
25669
|
-
node.resolvedModules = void 0;
|
|
25670
25669
|
node.classifiableNames = void 0;
|
|
25671
25670
|
node.impliedNodeFormat = void 0;
|
|
25672
25671
|
return node;
|
|
@@ -30668,7 +30667,7 @@ function gatherPossibleChildren(node) {
|
|
|
30668
30667
|
function setExternalModuleIndicator(sourceFile) {
|
|
30669
30668
|
sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile);
|
|
30670
30669
|
}
|
|
30671
|
-
function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind
|
|
30670
|
+
function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind) {
|
|
30672
30671
|
var _a, _b, _c, _d;
|
|
30673
30672
|
(_a = tracing) == null ? void 0 : _a.push(
|
|
30674
30673
|
tracing.Phase.Parse,
|
|
@@ -30683,7 +30682,8 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
|
|
|
30683
30682
|
const {
|
|
30684
30683
|
languageVersion,
|
|
30685
30684
|
setExternalModuleIndicator: overrideSetExternalModuleIndicator,
|
|
30686
|
-
impliedNodeFormat: format
|
|
30685
|
+
impliedNodeFormat: format,
|
|
30686
|
+
jsDocParsingMode
|
|
30687
30687
|
} = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : { languageVersion: languageVersionOrOptions };
|
|
30688
30688
|
if (languageVersion === 100 /* JSON */) {
|
|
30689
30689
|
result = Parser.parseSourceFile(
|
|
@@ -30695,7 +30695,7 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
|
|
|
30695
30695
|
setParentNodes,
|
|
30696
30696
|
6 /* JSON */,
|
|
30697
30697
|
noop,
|
|
30698
|
-
|
|
30698
|
+
jsDocParsingMode
|
|
30699
30699
|
);
|
|
30700
30700
|
} else {
|
|
30701
30701
|
const setIndicator = format === void 0 ? overrideSetExternalModuleIndicator : (file) => {
|
|
@@ -30711,7 +30711,7 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
|
|
|
30711
30711
|
setParentNodes,
|
|
30712
30712
|
scriptKind,
|
|
30713
30713
|
setIndicator,
|
|
30714
|
-
|
|
30714
|
+
jsDocParsingMode
|
|
30715
30715
|
);
|
|
30716
30716
|
}
|
|
30717
30717
|
(_c = perfLogger) == null ? void 0 : _c.logStopParseSourceFile();
|
|
@@ -30845,7 +30845,7 @@ var Parser;
|
|
|
30845
30845
|
var contextFlags;
|
|
30846
30846
|
var topLevel = true;
|
|
30847
30847
|
var parseErrorBeforeNextFinishedNode = false;
|
|
30848
|
-
function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride,
|
|
30848
|
+
function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride, jsDocParsingMode = 0 /* ParseAll */) {
|
|
30849
30849
|
var _a;
|
|
30850
30850
|
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
|
|
30851
30851
|
if (scriptKind2 === 6 /* JSON */) {
|
|
@@ -30867,9 +30867,8 @@ var Parser;
|
|
|
30867
30867
|
result2.pragmas = emptyMap;
|
|
30868
30868
|
return result2;
|
|
30869
30869
|
}
|
|
30870
|
-
|
|
30871
|
-
|
|
30872
|
-
const result = parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicatorOverride || setExternalModuleIndicator, skipNonSemanticJSDoc);
|
|
30870
|
+
initializeState(fileName2, sourceText2, languageVersion2, syntaxCursor2, scriptKind2, jsDocParsingMode);
|
|
30871
|
+
const result = parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicatorOverride || setExternalModuleIndicator, jsDocParsingMode);
|
|
30873
30872
|
clearState();
|
|
30874
30873
|
return result;
|
|
30875
30874
|
}
|
|
@@ -30882,8 +30881,7 @@ var Parser;
|
|
|
30882
30881
|
/*syntaxCursor*/
|
|
30883
30882
|
void 0,
|
|
30884
30883
|
1 /* JS */,
|
|
30885
|
-
/*
|
|
30886
|
-
false
|
|
30884
|
+
0 /* ParseAll */
|
|
30887
30885
|
);
|
|
30888
30886
|
nextToken();
|
|
30889
30887
|
const entityName = parseEntityName(
|
|
@@ -30896,15 +30894,7 @@ var Parser;
|
|
|
30896
30894
|
}
|
|
30897
30895
|
Parser2.parseIsolatedEntityName = parseIsolatedEntityName2;
|
|
30898
30896
|
function parseJsonText2(fileName2, sourceText2, languageVersion2 = 2 /* ES2015 */, syntaxCursor2, setParentNodes = false) {
|
|
30899
|
-
initializeState(
|
|
30900
|
-
fileName2,
|
|
30901
|
-
sourceText2,
|
|
30902
|
-
languageVersion2,
|
|
30903
|
-
syntaxCursor2,
|
|
30904
|
-
6 /* JSON */,
|
|
30905
|
-
/*skipNonSemanticJSDoc*/
|
|
30906
|
-
false
|
|
30907
|
-
);
|
|
30897
|
+
initializeState(fileName2, sourceText2, languageVersion2, syntaxCursor2, 6 /* JSON */, 0 /* ParseAll */);
|
|
30908
30898
|
sourceFlags = contextFlags;
|
|
30909
30899
|
nextToken();
|
|
30910
30900
|
const pos = getNodePos();
|
|
@@ -30985,7 +30975,7 @@ var Parser;
|
|
|
30985
30975
|
return result;
|
|
30986
30976
|
}
|
|
30987
30977
|
Parser2.parseJsonText = parseJsonText2;
|
|
30988
|
-
function initializeState(_fileName, _sourceText, _languageVersion, _syntaxCursor, _scriptKind,
|
|
30978
|
+
function initializeState(_fileName, _sourceText, _languageVersion, _syntaxCursor, _scriptKind, _jsDocParsingMode) {
|
|
30989
30979
|
NodeConstructor2 = objectAllocator.getNodeConstructor();
|
|
30990
30980
|
TokenConstructor2 = objectAllocator.getTokenConstructor();
|
|
30991
30981
|
IdentifierConstructor2 = objectAllocator.getIdentifierConstructor();
|
|
@@ -31021,13 +31011,15 @@ var Parser;
|
|
|
31021
31011
|
scanner2.setOnError(scanError);
|
|
31022
31012
|
scanner2.setScriptTarget(languageVersion);
|
|
31023
31013
|
scanner2.setLanguageVariant(languageVariant);
|
|
31024
|
-
scanner2.
|
|
31014
|
+
scanner2.setScriptKind(scriptKind);
|
|
31015
|
+
scanner2.setJSDocParsingMode(_jsDocParsingMode);
|
|
31025
31016
|
}
|
|
31026
31017
|
function clearState() {
|
|
31027
31018
|
scanner2.clearCommentDirectives();
|
|
31028
31019
|
scanner2.setText("");
|
|
31029
31020
|
scanner2.setOnError(void 0);
|
|
31030
|
-
scanner2.
|
|
31021
|
+
scanner2.setScriptKind(0 /* Unknown */);
|
|
31022
|
+
scanner2.setJSDocParsingMode(0 /* ParseAll */);
|
|
31031
31023
|
sourceText = void 0;
|
|
31032
31024
|
languageVersion = void 0;
|
|
31033
31025
|
syntaxCursor = void 0;
|
|
@@ -31041,7 +31033,7 @@ var Parser;
|
|
|
31041
31033
|
notParenthesizedArrow = void 0;
|
|
31042
31034
|
topLevel = true;
|
|
31043
31035
|
}
|
|
31044
|
-
function parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicator2,
|
|
31036
|
+
function parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicator2, jsDocParsingMode) {
|
|
31045
31037
|
const isDeclarationFile = isDeclarationFileName(fileName);
|
|
31046
31038
|
if (isDeclarationFile) {
|
|
31047
31039
|
contextFlags |= 33554432 /* Ambient */;
|
|
@@ -31060,7 +31052,7 @@ var Parser;
|
|
|
31060
31052
|
sourceFile.identifierCount = identifierCount;
|
|
31061
31053
|
sourceFile.identifiers = identifiers;
|
|
31062
31054
|
sourceFile.parseDiagnostics = attachFileToDiagnostics(parseDiagnostics, sourceFile);
|
|
31063
|
-
sourceFile.
|
|
31055
|
+
sourceFile.jsDocParsingMode = jsDocParsingMode;
|
|
31064
31056
|
if (jsDocDiagnostics) {
|
|
31065
31057
|
sourceFile.jsDocDiagnostics = attachFileToDiagnostics(jsDocDiagnostics, sourceFile);
|
|
31066
31058
|
}
|
|
@@ -36495,8 +36487,7 @@ var Parser;
|
|
|
36495
36487
|
/*syntaxCursor*/
|
|
36496
36488
|
void 0,
|
|
36497
36489
|
1 /* JS */,
|
|
36498
|
-
/*
|
|
36499
|
-
false
|
|
36490
|
+
0 /* ParseAll */
|
|
36500
36491
|
);
|
|
36501
36492
|
scanner2.setText(content, start2, length2);
|
|
36502
36493
|
currentToken = scanner2.scan();
|
|
@@ -36561,8 +36552,7 @@ var Parser;
|
|
|
36561
36552
|
/*syntaxCursor*/
|
|
36562
36553
|
void 0,
|
|
36563
36554
|
1 /* JS */,
|
|
36564
|
-
/*
|
|
36565
|
-
false
|
|
36555
|
+
0 /* ParseAll */
|
|
36566
36556
|
);
|
|
36567
36557
|
const jsDoc = doInsideOfContext(16777216 /* JSDoc */, () => parseJSDocCommentWorker(start2, length2));
|
|
36568
36558
|
const sourceFile = { languageVariant: 0 /* Standard */, text: content };
|
|
@@ -37519,7 +37509,7 @@ var IncrementalParser;
|
|
|
37519
37509
|
true,
|
|
37520
37510
|
sourceFile.scriptKind,
|
|
37521
37511
|
sourceFile.setExternalModuleIndicator,
|
|
37522
|
-
sourceFile.
|
|
37512
|
+
sourceFile.jsDocParsingMode
|
|
37523
37513
|
);
|
|
37524
37514
|
}
|
|
37525
37515
|
const incrementalSourceFile = sourceFile;
|
|
@@ -37544,7 +37534,7 @@ var IncrementalParser;
|
|
|
37544
37534
|
true,
|
|
37545
37535
|
sourceFile.scriptKind,
|
|
37546
37536
|
sourceFile.setExternalModuleIndicator,
|
|
37547
|
-
sourceFile.
|
|
37537
|
+
sourceFile.jsDocParsingMode
|
|
37548
37538
|
);
|
|
37549
37539
|
result.commentDirectives = getNewCommentDirectives(
|
|
37550
37540
|
sourceFile.commentDirectives,
|
|
@@ -38485,6 +38475,7 @@ var moduleOptionDeclaration = {
|
|
|
38485
38475
|
node16: 100 /* Node16 */,
|
|
38486
38476
|
nodenext: 199 /* NodeNext */
|
|
38487
38477
|
})),
|
|
38478
|
+
affectsSourceFile: true,
|
|
38488
38479
|
affectsModuleResolution: true,
|
|
38489
38480
|
affectsEmit: true,
|
|
38490
38481
|
affectsBuildInfo: true,
|
|
@@ -38921,6 +38912,7 @@ var commandOptionsWithoutBuild = [
|
|
|
38921
38912
|
bundler: 100 /* Bundler */
|
|
38922
38913
|
})),
|
|
38923
38914
|
deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
|
|
38915
|
+
affectsSourceFile: true,
|
|
38924
38916
|
affectsModuleResolution: true,
|
|
38925
38917
|
paramType: Diagnostics.STRATEGY,
|
|
38926
38918
|
category: Diagnostics.Modules,
|
|
@@ -39463,6 +39455,7 @@ var commandOptionsWithoutBuild = [
|
|
|
39463
39455
|
legacy: 1 /* Legacy */,
|
|
39464
39456
|
force: 3 /* Force */
|
|
39465
39457
|
})),
|
|
39458
|
+
affectsSourceFile: true,
|
|
39466
39459
|
affectsModuleResolution: true,
|
|
39467
39460
|
description: Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
39468
39461
|
category: Diagnostics.Language_and_Environment,
|
|
@@ -39482,7 +39475,7 @@ var semanticDiagnosticsOptionDeclarations = optionDeclarations.filter((option) =
|
|
|
39482
39475
|
var affectsEmitOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsEmit);
|
|
39483
39476
|
var affectsDeclarationPathOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsDeclarationPath);
|
|
39484
39477
|
var moduleResolutionOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsModuleResolution);
|
|
39485
|
-
var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.
|
|
39478
|
+
var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsBindDiagnostics);
|
|
39486
39479
|
var optionsAffectingProgramStructure = optionDeclarations.filter((option) => !!option.affectsProgramStructure);
|
|
39487
39480
|
var transpileOptionValueCompilerOptions = optionDeclarations.filter((option) => hasProperty(option, "transpileOptionValue"));
|
|
39488
39481
|
var optionsForBuild = [
|
|
@@ -41957,15 +41950,6 @@ function createModeAwareCache() {
|
|
|
41957
41950
|
return result;
|
|
41958
41951
|
}
|
|
41959
41952
|
}
|
|
41960
|
-
function zipToModeAwareCache(file, keys, values, nameAndModeGetter) {
|
|
41961
|
-
Debug.assert(keys.length === values.length);
|
|
41962
|
-
const map2 = createModeAwareCache();
|
|
41963
|
-
for (let i = 0; i < keys.length; ++i) {
|
|
41964
|
-
const entry = keys[i];
|
|
41965
|
-
map2.set(nameAndModeGetter.getName(entry), nameAndModeGetter.getMode(entry, file), values[i]);
|
|
41966
|
-
}
|
|
41967
|
-
return map2;
|
|
41968
|
-
}
|
|
41969
41953
|
function getOriginalOrResolvedModuleFileName(result) {
|
|
41970
41954
|
return result.resolvedModule && (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
41971
41955
|
}
|
|
@@ -42806,7 +42790,9 @@ function loadEntrypointsFromExportMap(scope, exports, state, extensions) {
|
|
|
42806
42790
|
extensionsToExtensionsArray(extensions),
|
|
42807
42791
|
/*excludes*/
|
|
42808
42792
|
void 0,
|
|
42809
|
-
[
|
|
42793
|
+
[
|
|
42794
|
+
isDeclarationFileName(target) ? target.replace("*", "**/*") : changeAnyExtension(target.replace("*", "**/*"), getDeclarationEmitExtensionForPath(target))
|
|
42795
|
+
]
|
|
42810
42796
|
).forEach((entry) => {
|
|
42811
42797
|
entrypoints = appendIfUnique(entrypoints, {
|
|
42812
42798
|
path: entry,
|
|
@@ -51013,7 +50999,7 @@ function createTypeChecker(host) {
|
|
|
51013
50999
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
51014
51000
|
}
|
|
51015
51001
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
51016
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
51002
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
51017
51003
|
if (startsWith(moduleReference, "@types/")) {
|
|
51018
51004
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
51019
51005
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -51031,7 +51017,7 @@ function createTypeChecker(host) {
|
|
|
51031
51017
|
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);
|
|
51032
51018
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
51033
51019
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
51034
|
-
const resolvedModule =
|
|
51020
|
+
const resolvedModule = (_i = (_h = (_g = host.resolvedModules) == null ? void 0 : _g.get(currentSourceFile.path)) == null ? void 0 : _h.get(moduleReference, mode)) == null ? void 0 : _i.resolvedModule;
|
|
51035
51021
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
51036
51022
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
51037
51023
|
if (sourceFile) {
|
|
@@ -51039,7 +51025,7 @@ function createTypeChecker(host) {
|
|
|
51039
51025
|
error2(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
51040
51026
|
}
|
|
51041
51027
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
51042
|
-
const importOrExport = ((
|
|
51028
|
+
const importOrExport = ((_j = findAncestor(location, isImportDeclaration)) == null ? void 0 : _j.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
51043
51029
|
if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
51044
51030
|
error2(
|
|
51045
51031
|
errorNode,
|
|
@@ -51048,7 +51034,7 @@ function createTypeChecker(host) {
|
|
|
51048
51034
|
);
|
|
51049
51035
|
}
|
|
51050
51036
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
51051
|
-
const importOrExport = ((
|
|
51037
|
+
const importOrExport = ((_k = findAncestor(location, isImportDeclaration)) == null ? void 0 : _k.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
51052
51038
|
if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
51053
51039
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
51054
51040
|
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
@@ -51069,7 +51055,7 @@ function createTypeChecker(host) {
|
|
|
51069
51055
|
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
51070
51056
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
51071
51057
|
const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
51072
|
-
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (
|
|
51058
|
+
const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_l = overrideClauseHost.assertions) == null ? void 0 : _l.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
|
|
51073
51059
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
|
|
51074
51060
|
if (findAncestor(location, isImportEqualsDeclaration)) {
|
|
51075
51061
|
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);
|
|
@@ -51176,7 +51162,7 @@ function createTypeChecker(host) {
|
|
|
51176
51162
|
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
51177
51163
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
51178
51164
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
51179
|
-
const suggestedExt = (
|
|
51165
|
+
const suggestedExt = (_m = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _m[1];
|
|
51180
51166
|
if (suggestedExt) {
|
|
51181
51167
|
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);
|
|
51182
51168
|
} else {
|
|
@@ -57934,7 +57920,28 @@ function createTypeChecker(host) {
|
|
|
57934
57920
|
}
|
|
57935
57921
|
}
|
|
57936
57922
|
}
|
|
57937
|
-
|
|
57923
|
+
let resolved = combineSymbolTables(earlySymbols, lateSymbols);
|
|
57924
|
+
if (symbol.flags & 33554432 /* Transient */ && links.cjsExportMerged && symbol.declarations) {
|
|
57925
|
+
for (const decl of symbol.declarations) {
|
|
57926
|
+
const original = getSymbolLinks(decl.symbol)[resolutionKind];
|
|
57927
|
+
if (!resolved) {
|
|
57928
|
+
resolved = original;
|
|
57929
|
+
continue;
|
|
57930
|
+
}
|
|
57931
|
+
if (!original)
|
|
57932
|
+
continue;
|
|
57933
|
+
original.forEach((s, name) => {
|
|
57934
|
+
const existing = resolved.get(name);
|
|
57935
|
+
if (!existing)
|
|
57936
|
+
resolved.set(name, s);
|
|
57937
|
+
else if (existing === s)
|
|
57938
|
+
return;
|
|
57939
|
+
else
|
|
57940
|
+
resolved.set(name, mergeSymbol(existing, s));
|
|
57941
|
+
});
|
|
57942
|
+
}
|
|
57943
|
+
}
|
|
57944
|
+
links[resolutionKind] = resolved || emptySymbols;
|
|
57938
57945
|
}
|
|
57939
57946
|
return links[resolutionKind];
|
|
57940
57947
|
}
|
|
@@ -119779,7 +119786,7 @@ function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, ge
|
|
|
119779
119786
|
function createCompilerHost(options, setParentNodes) {
|
|
119780
119787
|
return createCompilerHostWorker(options, setParentNodes);
|
|
119781
119788
|
}
|
|
119782
|
-
function createGetSourceFile(readFile, getCompilerOptions, setParentNodes
|
|
119789
|
+
function createGetSourceFile(readFile, getCompilerOptions, setParentNodes) {
|
|
119783
119790
|
return (fileName, languageVersionOrOptions, onError) => {
|
|
119784
119791
|
let text;
|
|
119785
119792
|
try {
|
|
@@ -119793,15 +119800,7 @@ function createGetSourceFile(readFile, getCompilerOptions, setParentNodes, skipN
|
|
|
119793
119800
|
}
|
|
119794
119801
|
text = "";
|
|
119795
119802
|
}
|
|
119796
|
-
return text !== void 0 ? createSourceFile(
|
|
119797
|
-
fileName,
|
|
119798
|
-
text,
|
|
119799
|
-
languageVersionOrOptions,
|
|
119800
|
-
setParentNodes,
|
|
119801
|
-
/*scriptKind*/
|
|
119802
|
-
void 0,
|
|
119803
|
-
skipNonSemanticJSDocParsing
|
|
119804
|
-
) : void 0;
|
|
119803
|
+
return text !== void 0 ? createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes) : void 0;
|
|
119805
119804
|
};
|
|
119806
119805
|
}
|
|
119807
119806
|
function createWriteFileMeasuringIO(actualWriteFile, createDirectory, directoryExists) {
|
|
@@ -119825,7 +119824,7 @@ function createWriteFileMeasuringIO(actualWriteFile, createDirectory, directoryE
|
|
|
119825
119824
|
}
|
|
119826
119825
|
};
|
|
119827
119826
|
}
|
|
119828
|
-
function createCompilerHostWorker(options, setParentNodes,
|
|
119827
|
+
function createCompilerHostWorker(options, setParentNodes, system = sys) {
|
|
119829
119828
|
const existingDirectories = /* @__PURE__ */ new Map();
|
|
119830
119829
|
const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames);
|
|
119831
119830
|
function directoryExists(directoryPath) {
|
|
@@ -119844,7 +119843,7 @@ function createCompilerHostWorker(options, setParentNodes, skipNonSemanticJSDocP
|
|
|
119844
119843
|
const newLine = getNewLineCharacter(options);
|
|
119845
119844
|
const realpath = system.realpath && ((path) => system.realpath(path));
|
|
119846
119845
|
const compilerHost = {
|
|
119847
|
-
getSourceFile: createGetSourceFile((fileName) => compilerHost.readFile(fileName), () => options, setParentNodes
|
|
119846
|
+
getSourceFile: createGetSourceFile((fileName) => compilerHost.readFile(fileName), () => options, setParentNodes),
|
|
119848
119847
|
getDefaultLibLocation,
|
|
119849
119848
|
getDefaultLibFileName: (options2) => combinePaths(getDefaultLibLocation(), getDefaultLibFileName(options2)),
|
|
119850
119849
|
writeFile: createWriteFileMeasuringIO(
|
|
@@ -120327,15 +120326,15 @@ function isReferencedFile(reason) {
|
|
|
120327
120326
|
function isReferenceFileLocation(location) {
|
|
120328
120327
|
return location.pos !== void 0;
|
|
120329
120328
|
}
|
|
120330
|
-
function getReferencedFileLocation(
|
|
120331
|
-
var _a, _b, _c, _d, _e, _f;
|
|
120332
|
-
const file = Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
120329
|
+
function getReferencedFileLocation(program, ref) {
|
|
120330
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
120331
|
+
const file = Debug.checkDefined(program.getSourceFileByPath(ref.file));
|
|
120333
120332
|
const { kind, index } = ref;
|
|
120334
120333
|
let pos, end, packageId, resolutionMode;
|
|
120335
120334
|
switch (kind) {
|
|
120336
120335
|
case 3 /* Import */:
|
|
120337
120336
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
120338
|
-
packageId = (_c = (_b = (_a =
|
|
120337
|
+
packageId = (_d = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(file.path)) == null ? void 0 : _b.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.packageId;
|
|
120339
120338
|
if (importLiteral.pos === -1)
|
|
120340
120339
|
return { file, packageId, text: importLiteral.text };
|
|
120341
120340
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -120346,7 +120345,7 @@ function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
|
120346
120345
|
break;
|
|
120347
120346
|
case 5 /* TypeReferenceDirective */:
|
|
120348
120347
|
({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
|
|
120349
|
-
packageId = (
|
|
120348
|
+
packageId = (_h = (_g = (_f = (_e = program.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _e.get(file.path)) == null ? void 0 : _f.get(toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) == null ? void 0 : _g.resolvedTypeReferenceDirective) == null ? void 0 : _h.packageId;
|
|
120350
120349
|
break;
|
|
120351
120350
|
case 7 /* LibReferenceDirective */:
|
|
120352
120351
|
({ pos, end } = file.libReferenceDirectives[index]);
|
|
@@ -120564,6 +120563,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120564
120563
|
let automaticTypeDirectiveResolutions;
|
|
120565
120564
|
let resolvedLibReferences;
|
|
120566
120565
|
let resolvedLibProcessing;
|
|
120566
|
+
let resolvedModules;
|
|
120567
|
+
let resolvedModulesProcessing;
|
|
120568
|
+
let resolvedTypeReferenceDirectiveNames;
|
|
120569
|
+
let resolvedTypeReferenceDirectiveNamesProcessing;
|
|
120567
120570
|
let packageMap;
|
|
120568
120571
|
const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
120569
120572
|
let currentNodeModulesDepth = 0;
|
|
@@ -120828,6 +120831,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120828
120831
|
}
|
|
120829
120832
|
oldProgram = void 0;
|
|
120830
120833
|
resolvedLibProcessing = void 0;
|
|
120834
|
+
resolvedModulesProcessing = void 0;
|
|
120835
|
+
resolvedTypeReferenceDirectiveNamesProcessing = void 0;
|
|
120831
120836
|
const program = {
|
|
120832
120837
|
getRootFileNames: () => rootNames,
|
|
120833
120838
|
getSourceFile,
|
|
@@ -120869,6 +120874,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120869
120874
|
sourceFileToPackageName,
|
|
120870
120875
|
redirectTargetsMap,
|
|
120871
120876
|
usesUriStyleNodeCoreModules,
|
|
120877
|
+
resolvedModules,
|
|
120878
|
+
resolvedTypeReferenceDirectiveNames,
|
|
120872
120879
|
resolvedLibReferences,
|
|
120873
120880
|
getCurrentPackagesMap: () => packageMap,
|
|
120874
120881
|
typesPackageExists,
|
|
@@ -120900,7 +120907,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120900
120907
|
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
|
120901
120908
|
return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray));
|
|
120902
120909
|
case 0 /* FilePreprocessingReferencedDiagnostic */:
|
|
120903
|
-
const { file, pos, end } = getReferencedFileLocation(
|
|
120910
|
+
const { file, pos, end } = getReferencedFileLocation(program, diagnostic.reason);
|
|
120904
120911
|
return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
|
|
120905
120912
|
case 2 /* ResolutionDiagnostics */:
|
|
120906
120913
|
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
|
@@ -120917,14 +120924,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120917
120924
|
if (packageMap)
|
|
120918
120925
|
return packageMap;
|
|
120919
120926
|
packageMap = /* @__PURE__ */ new Map();
|
|
120920
|
-
files.forEach(
|
|
120921
|
-
|
|
120922
|
-
|
|
120923
|
-
|
|
120924
|
-
|
|
120925
|
-
|
|
120926
|
-
|
|
120927
|
-
|
|
120927
|
+
files.forEach(
|
|
120928
|
+
(sf) => {
|
|
120929
|
+
var _a2;
|
|
120930
|
+
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(sf.path)) == null ? void 0 : _a2.forEach(({ resolvedModule }) => {
|
|
120931
|
+
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
120932
|
+
packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
|
|
120933
|
+
});
|
|
120934
|
+
}
|
|
120935
|
+
);
|
|
120928
120936
|
return packageMap;
|
|
120929
120937
|
}
|
|
120930
120938
|
function typesPackageExists(packageName) {
|
|
@@ -121056,7 +121064,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121056
121064
|
return classifiableNames;
|
|
121057
121065
|
}
|
|
121058
121066
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
121059
|
-
var _a2;
|
|
121067
|
+
var _a2, _b2;
|
|
121060
121068
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
121061
121069
|
return resolveModuleNamesWorker(
|
|
121062
121070
|
moduleNames,
|
|
@@ -121065,24 +121073,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121065
121073
|
void 0
|
|
121066
121074
|
);
|
|
121067
121075
|
}
|
|
121068
|
-
const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
121069
|
-
if (oldSourceFile !== file && file.resolvedModules) {
|
|
121070
|
-
const result2 = [];
|
|
121071
|
-
for (const moduleName of moduleNames) {
|
|
121072
|
-
const resolvedModule = file.resolvedModules.get(moduleName.text, getModeForUsageLocation(file, moduleName));
|
|
121073
|
-
result2.push(resolvedModule);
|
|
121074
|
-
}
|
|
121075
|
-
return result2;
|
|
121076
|
-
}
|
|
121077
121076
|
let unknownModuleNames;
|
|
121078
121077
|
let result;
|
|
121079
121078
|
let reusedNames;
|
|
121080
121079
|
const predictedToResolveToAmbientModuleMarker = emptyResolution;
|
|
121080
|
+
const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
121081
121081
|
for (let i = 0; i < moduleNames.length; i++) {
|
|
121082
121082
|
const moduleName = moduleNames[i];
|
|
121083
|
-
if (file === oldSourceFile && !hasInvalidatedResolutions(
|
|
121083
|
+
if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
|
|
121084
121084
|
const mode = getModeForUsageLocation(file, moduleName);
|
|
121085
|
-
const oldResolution = (_a2 =
|
|
121085
|
+
const oldResolution = (_b2 = (_a2 = oldProgram == null ? void 0 : oldProgram.resolvedModules) == null ? void 0 : _a2.get(file.path)) == null ? void 0 : _b2.get(moduleName.text, mode);
|
|
121086
121086
|
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
121087
121087
|
if (isTraceEnabled(options, host)) {
|
|
121088
121088
|
trace(
|
|
@@ -121129,7 +121129,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121129
121129
|
Debug.assert(j === resolutions.length);
|
|
121130
121130
|
return result;
|
|
121131
121131
|
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
121132
|
-
|
|
121132
|
+
var _a3, _b3, _c2;
|
|
121133
|
+
const resolutionToFile = (_c2 = (_b3 = (_a3 = oldProgram == null ? void 0 : oldProgram.resolvedModules) == null ? void 0 : _a3.get(file.path)) == null ? void 0 : _b3.get(moduleName.text, getModeForUsageLocation(file, moduleName))) == null ? void 0 : _c2.resolvedModule;
|
|
121133
121134
|
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
121134
121135
|
if (resolutionToFile && resolvedFile) {
|
|
121135
121136
|
return false;
|
|
@@ -121145,7 +121146,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121145
121146
|
}
|
|
121146
121147
|
}
|
|
121147
121148
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
121148
|
-
var _a2;
|
|
121149
|
+
var _a2, _b2;
|
|
121149
121150
|
if (structureIsReused === 0 /* Not */) {
|
|
121150
121151
|
return resolveTypeReferenceDirectiveNamesWorker(
|
|
121151
121152
|
typeDirectiveNames,
|
|
@@ -121154,28 +121155,18 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121154
121155
|
void 0
|
|
121155
121156
|
);
|
|
121156
121157
|
}
|
|
121157
|
-
const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
|
|
121158
|
-
if (!isString(containingFile)) {
|
|
121159
|
-
if (oldSourceFile !== containingFile && containingFile.resolvedTypeReferenceDirectiveNames) {
|
|
121160
|
-
const result2 = [];
|
|
121161
|
-
for (const typeDirectiveName of typeDirectiveNames) {
|
|
121162
|
-
const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getTypeReferenceResolutionName(typeDirectiveName), getModeForFileReference(typeDirectiveName, containingFile.impliedNodeFormat));
|
|
121163
|
-
result2.push(resolvedTypeReferenceDirective);
|
|
121164
|
-
}
|
|
121165
|
-
return result2;
|
|
121166
|
-
}
|
|
121167
|
-
}
|
|
121168
121158
|
let unknownTypeReferenceDirectiveNames;
|
|
121169
121159
|
let result;
|
|
121170
121160
|
let reusedNames;
|
|
121171
121161
|
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
121172
|
-
const
|
|
121162
|
+
const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
|
|
121163
|
+
const canReuseResolutions = !isString(containingFile) ? containingFile === oldSourceFile && !hasInvalidatedResolutions(containingFile.path) : !hasInvalidatedResolutions(toPath3(containingFile));
|
|
121173
121164
|
for (let i = 0; i < typeDirectiveNames.length; i++) {
|
|
121174
121165
|
const entry = typeDirectiveNames[i];
|
|
121175
121166
|
if (canReuseResolutions) {
|
|
121176
121167
|
const typeDirectiveName = getTypeReferenceResolutionName(entry);
|
|
121177
121168
|
const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
121178
|
-
const oldResolution = (
|
|
121169
|
+
const oldResolution = (_b2 = !isString(containingFile) ? (_a2 = oldProgram == null ? void 0 : oldProgram.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a2.get(containingFile.path) : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _b2.get(typeDirectiveName, mode);
|
|
121179
121170
|
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
121180
121171
|
if (isTraceEnabled(options, host)) {
|
|
121181
121172
|
trace(
|
|
@@ -121235,7 +121226,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121235
121226
|
);
|
|
121236
121227
|
}
|
|
121237
121228
|
function tryReuseStructureFromOldProgram() {
|
|
121238
|
-
var _a2;
|
|
121229
|
+
var _a2, _b2, _c2;
|
|
121239
121230
|
if (!oldProgram) {
|
|
121240
121231
|
return 0 /* Not */;
|
|
121241
121232
|
}
|
|
@@ -121337,42 +121328,37 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121337
121328
|
structureIsReused = 1 /* SafeModules */;
|
|
121338
121329
|
}
|
|
121339
121330
|
}
|
|
121340
|
-
modifiedSourceFiles.push(
|
|
121331
|
+
modifiedSourceFiles.push(newSourceFile);
|
|
121341
121332
|
} else if (hasInvalidatedResolutions(oldSourceFile.path)) {
|
|
121342
121333
|
structureIsReused = 1 /* SafeModules */;
|
|
121343
|
-
modifiedSourceFiles.push(
|
|
121334
|
+
modifiedSourceFiles.push(newSourceFile);
|
|
121335
|
+
} else {
|
|
121336
|
+
for (const moduleName of oldSourceFile.ambientModuleNames) {
|
|
121337
|
+
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldSourceFile.fileName);
|
|
121338
|
+
}
|
|
121344
121339
|
}
|
|
121345
121340
|
newSourceFiles.push(newSourceFile);
|
|
121346
121341
|
}
|
|
121347
121342
|
if (structureIsReused !== 2 /* Completely */) {
|
|
121348
121343
|
return structureIsReused;
|
|
121349
121344
|
}
|
|
121350
|
-
const
|
|
121351
|
-
for (const oldFile of oldSourceFiles) {
|
|
121352
|
-
if (!contains(modifiedFiles, oldFile)) {
|
|
121353
|
-
for (const moduleName of oldFile.ambientModuleNames) {
|
|
121354
|
-
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
121355
|
-
}
|
|
121356
|
-
}
|
|
121357
|
-
}
|
|
121358
|
-
for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
|
|
121345
|
+
for (const newSourceFile of modifiedSourceFiles) {
|
|
121359
121346
|
const moduleNames = getModuleNames(newSourceFile);
|
|
121360
121347
|
const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
121361
|
-
|
|
121362
|
-
|
|
121348
|
+
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
121349
|
+
const oldResolutions = (_b2 = oldProgram.resolvedModules) == null ? void 0 : _b2.get(newSourceFile.path);
|
|
121350
|
+
const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldResolutions, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
|
|
121351
|
+
if (resolutionsChanged)
|
|
121363
121352
|
structureIsReused = 1 /* SafeModules */;
|
|
121364
|
-
newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions, moduleResolutionNameAndModeGetter);
|
|
121365
|
-
} else {
|
|
121366
|
-
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
121367
|
-
}
|
|
121368
121353
|
const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
121369
121354
|
const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
121370
|
-
|
|
121355
|
+
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
|
|
121356
|
+
const oldTypeResolutions = (_c2 = oldProgram.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _c2.get(newSourceFile.path);
|
|
121357
|
+
const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldTypeResolutions, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
|
|
121371
121358
|
if (typeReferenceResolutionsChanged) {
|
|
121372
121359
|
structureIsReused = 1 /* SafeModules */;
|
|
121373
|
-
|
|
121374
|
-
|
|
121375
|
-
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
121360
|
+
} else if (oldTypeResolutions) {
|
|
121361
|
+
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, oldTypeResolutions);
|
|
121376
121362
|
}
|
|
121377
121363
|
}
|
|
121378
121364
|
if (structureIsReused !== 2 /* Completely */) {
|
|
@@ -121420,6 +121406,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121420
121406
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
121421
121407
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
121422
121408
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
121409
|
+
resolvedModules = oldProgram.resolvedModules;
|
|
121410
|
+
resolvedTypeReferenceDirectiveNames = oldProgram.resolvedTypeReferenceDirectiveNames;
|
|
121423
121411
|
resolvedLibReferences = oldProgram.resolvedLibReferences;
|
|
121424
121412
|
packageMap = oldProgram.getCurrentPackagesMap();
|
|
121425
121413
|
return 2 /* Completely */;
|
|
@@ -122241,7 +122229,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122241
122229
|
const result = getImpliedNodeFormatForFileWorker(getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache2 == null ? void 0 : moduleResolutionCache2.getPackageJsonInfoCache(), host2, options2);
|
|
122242
122230
|
const languageVersion = getEmitScriptTarget(options2);
|
|
122243
122231
|
const setExternalModuleIndicator2 = getSetExternalModuleIndicator(options2);
|
|
122244
|
-
return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2 } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2 };
|
|
122232
|
+
return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode };
|
|
122245
122233
|
}
|
|
122246
122234
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
122247
122235
|
var _a2;
|
|
@@ -122465,16 +122453,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122465
122453
|
}
|
|
122466
122454
|
function processTypeReferenceDirectives(file) {
|
|
122467
122455
|
const typeDirectives = file.typeReferenceDirectives;
|
|
122468
|
-
if (!typeDirectives.length)
|
|
122469
|
-
file.resolvedTypeReferenceDirectiveNames = void 0;
|
|
122456
|
+
if (!typeDirectives.length)
|
|
122470
122457
|
return;
|
|
122471
|
-
|
|
122472
|
-
const
|
|
122458
|
+
const resolutions = (resolvedTypeReferenceDirectiveNamesProcessing == null ? void 0 : resolvedTypeReferenceDirectiveNamesProcessing.get(file.path)) || resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
|
|
122459
|
+
const resolutionsInFile = createModeAwareCache();
|
|
122460
|
+
(resolvedTypeReferenceDirectiveNames ?? (resolvedTypeReferenceDirectiveNames = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
122473
122461
|
for (let index = 0; index < typeDirectives.length; index++) {
|
|
122474
122462
|
const ref = file.typeReferenceDirectives[index];
|
|
122475
122463
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
122476
122464
|
const fileName = toFileNameLowerCase(ref.fileName);
|
|
122477
|
-
|
|
122465
|
+
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
122478
122466
|
const mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
122479
122467
|
if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
|
|
122480
122468
|
(fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({
|
|
@@ -122638,14 +122626,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122638
122626
|
collectExternalModuleReferences(file);
|
|
122639
122627
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
122640
122628
|
const moduleNames = getModuleNames(file);
|
|
122641
|
-
const resolutions = resolveModuleNamesReusingOldState(moduleNames, file);
|
|
122629
|
+
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
122642
122630
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
122643
122631
|
const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options : void 0) || options;
|
|
122632
|
+
const resolutionsInFile = createModeAwareCache();
|
|
122633
|
+
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
122644
122634
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
122645
122635
|
const resolution = resolutions[index].resolvedModule;
|
|
122646
122636
|
const moduleName = moduleNames[index].text;
|
|
122647
122637
|
const mode = getModeForUsageLocation(file, moduleNames[index]);
|
|
122648
|
-
|
|
122638
|
+
resolutionsInFile.set(moduleName, mode, resolutions[index]);
|
|
122649
122639
|
addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
|
|
122650
122640
|
if (!resolution) {
|
|
122651
122641
|
continue;
|
|
@@ -122676,8 +122666,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122676
122666
|
currentNodeModulesDepth--;
|
|
122677
122667
|
}
|
|
122678
122668
|
}
|
|
122679
|
-
} else {
|
|
122680
|
-
file.resolvedModules = void 0;
|
|
122681
122669
|
}
|
|
122682
122670
|
}
|
|
122683
122671
|
function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {
|
|
@@ -123192,7 +123180,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123192
123180
|
processReason(fileProcessingReason);
|
|
123193
123181
|
if (locationReason && (fileIncludeReasons == null ? void 0 : fileIncludeReasons.length) === 1)
|
|
123194
123182
|
fileIncludeReasons = void 0;
|
|
123195
|
-
const location = locationReason && getReferencedFileLocation(
|
|
123183
|
+
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
|
123196
123184
|
const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
123197
123185
|
const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
|
|
123198
123186
|
const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
|
|
@@ -123228,7 +123216,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123228
123216
|
}
|
|
123229
123217
|
function fileIncludeReasonToRelatedInformation(reason) {
|
|
123230
123218
|
if (isReferencedFile(reason)) {
|
|
123231
|
-
const referenceLocation = getReferencedFileLocation(
|
|
123219
|
+
const referenceLocation = getReferencedFileLocation(program, reason);
|
|
123232
123220
|
let message2;
|
|
123233
123221
|
switch (reason.kind) {
|
|
123234
123222
|
case 3 /* Import */:
|
|
@@ -123517,8 +123505,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123517
123505
|
if (!symlinks) {
|
|
123518
123506
|
symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
123519
123507
|
}
|
|
123520
|
-
if (files &&
|
|
123521
|
-
symlinks.setSymlinksFromResolutions(
|
|
123508
|
+
if (files && !symlinks.hasProcessedResolutions()) {
|
|
123509
|
+
symlinks.setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, automaticTypeDirectiveResolutions);
|
|
123522
123510
|
}
|
|
123523
123511
|
return symlinks;
|
|
123524
123512
|
}
|
|
@@ -123880,6 +123868,7 @@ var BuilderState;
|
|
|
123880
123868
|
return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
|
|
123881
123869
|
}
|
|
123882
123870
|
function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
|
|
123871
|
+
var _a;
|
|
123883
123872
|
let referencedFiles;
|
|
123884
123873
|
if (sourceFile.imports && sourceFile.imports.length > 0) {
|
|
123885
123874
|
const checker = program.getTypeChecker();
|
|
@@ -123895,8 +123884,9 @@ var BuilderState;
|
|
|
123895
123884
|
addReferencedFile(referencedPath);
|
|
123896
123885
|
}
|
|
123897
123886
|
}
|
|
123898
|
-
|
|
123899
|
-
|
|
123887
|
+
const resolvedTypeReferenceDirectiveNames = (_a = program.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(sourceFile.path);
|
|
123888
|
+
if (resolvedTypeReferenceDirectiveNames) {
|
|
123889
|
+
resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
|
|
123900
123890
|
if (!resolvedTypeReferenceDirective) {
|
|
123901
123891
|
return;
|
|
123902
123892
|
}
|
|
@@ -125719,10 +125709,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125719
125709
|
clear: clear2,
|
|
125720
125710
|
onChangesAffectModuleResolution
|
|
125721
125711
|
};
|
|
125722
|
-
function
|
|
125712
|
+
function getResolvedModule(resolution) {
|
|
125723
125713
|
return resolution.resolvedModule;
|
|
125724
125714
|
}
|
|
125725
|
-
function
|
|
125715
|
+
function getResolvedTypeReferenceDirective(resolution) {
|
|
125726
125716
|
return resolution.resolvedTypeReferenceDirective;
|
|
125727
125717
|
}
|
|
125728
125718
|
function clear2() {
|
|
@@ -125798,7 +125788,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125798
125788
|
stopWatchFailedLookupLocationOfResolution(
|
|
125799
125789
|
resolution,
|
|
125800
125790
|
resolutionHost.toPath(getInferredLibraryNameResolveFrom(newProgram.getCompilerOptions(), getCurrentDirectory(), libFileName)),
|
|
125801
|
-
|
|
125791
|
+
getResolvedModule
|
|
125802
125792
|
);
|
|
125803
125793
|
resolvedLibraries.delete(libFileName);
|
|
125804
125794
|
}
|
|
@@ -126004,7 +125994,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126004
125994
|
((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost,
|
|
126005
125995
|
typeReferenceDirectiveResolutionCache
|
|
126006
125996
|
),
|
|
126007
|
-
getResolutionWithResolvedFileName:
|
|
125997
|
+
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
126008
125998
|
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
126009
125999
|
deferWatchingNonRelativeResolution: false
|
|
126010
126000
|
});
|
|
@@ -126023,7 +126013,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126023
126013
|
redirectedReference,
|
|
126024
126014
|
options
|
|
126025
126015
|
),
|
|
126026
|
-
getResolutionWithResolvedFileName:
|
|
126016
|
+
getResolutionWithResolvedFileName: getResolvedModule,
|
|
126027
126017
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
126028
126018
|
logChanges: logChangesWhenResolvingModule,
|
|
126029
126019
|
deferWatchingNonRelativeResolution: true
|
|
@@ -126042,17 +126032,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126042
126032
|
libraryName,
|
|
126043
126033
|
resolution,
|
|
126044
126034
|
path,
|
|
126045
|
-
|
|
126035
|
+
getResolvedModule,
|
|
126046
126036
|
/*deferWatchingNonRelativeResolution*/
|
|
126047
126037
|
false
|
|
126048
126038
|
);
|
|
126049
126039
|
resolvedLibraries.set(libFileName, resolution);
|
|
126050
126040
|
if (existingResolution) {
|
|
126051
|
-
stopWatchFailedLookupLocationOfResolution(existingResolution, path,
|
|
126041
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule);
|
|
126052
126042
|
}
|
|
126053
126043
|
} else {
|
|
126054
126044
|
if (isTraceEnabled(options, host)) {
|
|
126055
|
-
const resolved =
|
|
126045
|
+
const resolved = getResolvedModule(resolution);
|
|
126056
126046
|
trace(
|
|
126057
126047
|
host,
|
|
126058
126048
|
(resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved,
|
|
@@ -126329,8 +126319,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126329
126319
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
126330
126320
|
}
|
|
126331
126321
|
function removeResolutionsOfFile(filePath) {
|
|
126332
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath,
|
|
126333
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath,
|
|
126322
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
|
|
126323
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
126334
126324
|
}
|
|
126335
126325
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
126336
126326
|
if (!resolutions)
|
|
@@ -126756,7 +126746,7 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
|
|
|
126756
126746
|
var _a, _b;
|
|
126757
126747
|
const options = program.getCompilerOptions();
|
|
126758
126748
|
if (isReferencedFile(reason)) {
|
|
126759
|
-
const referenceLocation = getReferencedFileLocation(
|
|
126749
|
+
const referenceLocation = getReferencedFileLocation(program, reason);
|
|
126760
126750
|
const referenceText = isReferenceFileLocation(referenceLocation) ? referenceLocation.file.text.substring(referenceLocation.pos, referenceLocation.end) : `"${referenceLocation.text}"`;
|
|
126761
126751
|
let message;
|
|
126762
126752
|
Debug.assert(isReferenceFileLocation(referenceLocation) || reason.kind === 3 /* Import */, "Only synthetic references are imports");
|
|
@@ -126984,8 +126974,7 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
|
|
|
126984
126974
|
(fileName, encoding) => !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding),
|
|
126985
126975
|
getCompilerOptions,
|
|
126986
126976
|
/*setParentNodes*/
|
|
126987
|
-
void 0
|
|
126988
|
-
host.skipNonSemanticJSDocParsing
|
|
126977
|
+
void 0
|
|
126989
126978
|
),
|
|
126990
126979
|
getDefaultLibLocation: maybeBind(host, host.getDefaultLibLocation),
|
|
126991
126980
|
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
|
|
@@ -127007,7 +126996,8 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
|
|
|
127007
126996
|
getEnvironmentVariable: maybeBind(host, host.getEnvironmentVariable) || (() => ""),
|
|
127008
126997
|
createHash: maybeBind(host, host.createHash),
|
|
127009
126998
|
readDirectory: maybeBind(host, host.readDirectory),
|
|
127010
|
-
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
|
|
126999
|
+
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
127000
|
+
jsDocParsingMode: host.jsDocParsingMode
|
|
127011
127001
|
};
|
|
127012
127002
|
return compilerHost;
|
|
127013
127003
|
}
|
|
@@ -127171,12 +127161,11 @@ function readBuilderProgram(compilerOptions, host) {
|
|
|
127171
127161
|
return void 0;
|
|
127172
127162
|
return createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, host);
|
|
127173
127163
|
}
|
|
127174
|
-
function createIncrementalCompilerHost(options, system = sys
|
|
127164
|
+
function createIncrementalCompilerHost(options, system = sys) {
|
|
127175
127165
|
const host = createCompilerHostWorker(
|
|
127176
127166
|
options,
|
|
127177
127167
|
/*setParentNodes*/
|
|
127178
127168
|
void 0,
|
|
127179
|
-
skipNonSemanticJSDocParsing,
|
|
127180
127169
|
system
|
|
127181
127170
|
);
|
|
127182
127171
|
host.createHash = maybeBind(system, system.createHash);
|
|
@@ -135100,10 +135089,10 @@ var DocumentHighlights;
|
|
|
135100
135089
|
function isDocumentRegistryEntry(entry) {
|
|
135101
135090
|
return !!entry.sourceFile;
|
|
135102
135091
|
}
|
|
135103
|
-
function createDocumentRegistry(useCaseSensitiveFileNames2, currentDirectory) {
|
|
135104
|
-
return createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirectory);
|
|
135092
|
+
function createDocumentRegistry(useCaseSensitiveFileNames2, currentDirectory, jsDocParsingMode) {
|
|
135093
|
+
return createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirectory, jsDocParsingMode);
|
|
135105
135094
|
}
|
|
135106
|
-
function createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirectory = "", externalCache) {
|
|
135095
|
+
function createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirectory = "", jsDocParsingMode, externalCache) {
|
|
135107
135096
|
const buckets = /* @__PURE__ */ new Map();
|
|
135108
135097
|
const getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames2);
|
|
135109
135098
|
function reportStats() {
|
|
@@ -135187,9 +135176,11 @@ function createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirec
|
|
|
135187
135176
|
const sourceFileOptions = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : {
|
|
135188
135177
|
languageVersion: scriptTarget,
|
|
135189
135178
|
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),
|
|
135190
|
-
setExternalModuleIndicator: getSetExternalModuleIndicator(compilationSettings)
|
|
135179
|
+
setExternalModuleIndicator: getSetExternalModuleIndicator(compilationSettings),
|
|
135180
|
+
jsDocParsingMode
|
|
135191
135181
|
};
|
|
135192
135182
|
sourceFileOptions.languageVersion = scriptTarget;
|
|
135183
|
+
Debug.assertEqual(jsDocParsingMode, sourceFileOptions.jsDocParsingMode);
|
|
135193
135184
|
const oldBucketCount = buckets.size;
|
|
135194
135185
|
const keyWithMode = getDocumentRegistryBucketKeyWithMode(key, sourceFileOptions.impliedNodeFormat);
|
|
135195
135186
|
const bucket = getOrUpdate(buckets, keyWithMode, () => /* @__PURE__ */ new Map());
|
|
@@ -135441,14 +135432,14 @@ function combinePathsSafe(pathA, pathB) {
|
|
|
135441
135432
|
return ensurePathIsNonModuleName(combineNormal(pathA, pathB));
|
|
135442
135433
|
}
|
|
135443
135434
|
function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) {
|
|
135444
|
-
var _a;
|
|
135435
|
+
var _a, _b;
|
|
135445
135436
|
if (importedModuleSymbol) {
|
|
135446
135437
|
const oldFileName = find(importedModuleSymbol.declarations, isSourceFile).fileName;
|
|
135447
135438
|
const newFileName = oldToNew(oldFileName);
|
|
135448
135439
|
return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true };
|
|
135449
135440
|
} else {
|
|
135450
135441
|
const mode = getModeForUsageLocation(importingSourceFile, importLiteral);
|
|
135451
|
-
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? (_a =
|
|
135442
|
+
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(importingSourceFile.path)) == null ? void 0 : _b.get(importLiteral.text, mode) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
|
|
135452
135443
|
return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
|
|
135453
135444
|
}
|
|
135454
135445
|
}
|
|
@@ -136343,6 +136334,7 @@ function createSourceFileLike(text, lineMap) {
|
|
|
136343
136334
|
// src/services/suggestionDiagnostics.ts
|
|
136344
136335
|
var visitedNestedConvertibleFunctions = /* @__PURE__ */ new Map();
|
|
136345
136336
|
function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
136337
|
+
var _a, _b, _c;
|
|
136346
136338
|
program.getSemanticDiagnostics(sourceFile, cancellationToken);
|
|
136347
136339
|
const diags = [];
|
|
136348
136340
|
const checker = program.getTypeChecker();
|
|
@@ -136359,7 +136351,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
|
136359
136351
|
const name = importNameForConvertToDefaultImport(importNode);
|
|
136360
136352
|
if (!name)
|
|
136361
136353
|
continue;
|
|
136362
|
-
const module2 =
|
|
136354
|
+
const module2 = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))) == null ? void 0 : _c.resolvedModule;
|
|
136363
136355
|
const resolvedFile = module2 && program.getSourceFile(module2.resolvedFileName);
|
|
136364
136356
|
if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
|
|
136365
136357
|
diags.push(createDiagnosticForNode(name, Diagnostics.Import_may_be_converted_to_a_default_import));
|
|
@@ -136609,7 +136601,8 @@ function transpileModule(input, transpileOptions) {
|
|
|
136609
136601
|
compilerHost,
|
|
136610
136602
|
options
|
|
136611
136603
|
),
|
|
136612
|
-
setExternalModuleIndicator: getSetExternalModuleIndicator(options)
|
|
136604
|
+
setExternalModuleIndicator: getSetExternalModuleIndicator(options),
|
|
136605
|
+
jsDocParsingMode: 1 /* ParseNone */
|
|
136613
136606
|
}
|
|
136614
136607
|
);
|
|
136615
136608
|
if (transpileOptions.moduleName) {
|
|
@@ -138762,10 +138755,10 @@ function getTargetFileImportsAndAddExportInOldFile(oldFile, targetFile, importsT
|
|
|
138762
138755
|
const targetSourceFile = program.getSourceFile(targetFile);
|
|
138763
138756
|
for (const oldStatement of oldFile.statements) {
|
|
138764
138757
|
forEachImportInStatement(oldStatement, (i) => {
|
|
138765
|
-
var _a, _b;
|
|
138758
|
+
var _a, _b, _c;
|
|
138766
138759
|
const moduleSpecifier = moduleSpecifierFromImport(i);
|
|
138767
|
-
const resolved = (_a =
|
|
138768
|
-
const fileName = (
|
|
138760
|
+
const resolved = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(oldFile.path)) == null ? void 0 : _b.get(moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier));
|
|
138761
|
+
const fileName = (_c = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _c.resolvedFileName;
|
|
138769
138762
|
if (fileName && targetSourceFile) {
|
|
138770
138763
|
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.path, fileName, createModuleSpecifierResolutionHost(program, host));
|
|
138771
138764
|
append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
@@ -140690,12 +140683,16 @@ function getRefactorActionsToConvertToTemplateString(context) {
|
|
|
140690
140683
|
const { file, startPosition } = context;
|
|
140691
140684
|
const node = getNodeOrParentOfParentheses(file, startPosition);
|
|
140692
140685
|
const maybeBinary = getParentBinaryExpression(node);
|
|
140686
|
+
const nodeIsStringLiteral = isStringLiteral(maybeBinary);
|
|
140693
140687
|
const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
|
|
140694
|
-
if (
|
|
140688
|
+
if (nodeIsStringLiteral && context.triggerReason !== "invoked") {
|
|
140689
|
+
return emptyArray;
|
|
140690
|
+
}
|
|
140691
|
+
if (isExpressionNode(maybeBinary) && (nodeIsStringLiteral || isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation)) {
|
|
140695
140692
|
refactorInfo.actions.push(convertStringAction);
|
|
140696
140693
|
return [refactorInfo];
|
|
140697
140694
|
} else if (context.preferences.provideRefactorNotApplicableReason) {
|
|
140698
|
-
refactorInfo.actions.push({ ...convertStringAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.
|
|
140695
|
+
refactorInfo.actions.push({ ...convertStringAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenations_and_string_literals) });
|
|
140699
140696
|
return [refactorInfo];
|
|
140700
140697
|
}
|
|
140701
140698
|
return emptyArray;
|
|
@@ -143800,7 +143797,9 @@ var SyntaxTreeCache = class {
|
|
|
143800
143797
|
this.host,
|
|
143801
143798
|
this.host.getCompilationSettings()
|
|
143802
143799
|
),
|
|
143803
|
-
setExternalModuleIndicator: getSetExternalModuleIndicator(this.host.getCompilationSettings())
|
|
143800
|
+
setExternalModuleIndicator: getSetExternalModuleIndicator(this.host.getCompilationSettings()),
|
|
143801
|
+
// These files are used to produce syntax-based highlighting, which reads JSDoc, so we must use ParseAll.
|
|
143802
|
+
jsDocParsingMode: 0 /* ParseAll */
|
|
143804
143803
|
};
|
|
143805
143804
|
sourceFile = createLanguageServiceSourceFile(
|
|
143806
143805
|
fileName,
|
|
@@ -143860,7 +143859,8 @@ function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version2, t
|
|
|
143860
143859
|
const options = {
|
|
143861
143860
|
languageVersion: sourceFile.languageVersion,
|
|
143862
143861
|
impliedNodeFormat: sourceFile.impliedNodeFormat,
|
|
143863
|
-
setExternalModuleIndicator: sourceFile.setExternalModuleIndicator
|
|
143862
|
+
setExternalModuleIndicator: sourceFile.setExternalModuleIndicator,
|
|
143863
|
+
jsDocParsingMode: sourceFile.jsDocParsingMode
|
|
143864
143864
|
};
|
|
143865
143865
|
return createLanguageServiceSourceFile(
|
|
143866
143866
|
sourceFile.fileName,
|
|
@@ -144062,7 +144062,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
144062
144062
|
resolveTypeReferenceDirectiveReferences: maybeBind(host, host.resolveTypeReferenceDirectiveReferences),
|
|
144063
144063
|
resolveLibrary: maybeBind(host, host.resolveLibrary),
|
|
144064
144064
|
useSourceOfProjectReferenceRedirect: maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
144065
|
-
getParsedCommandLine
|
|
144065
|
+
getParsedCommandLine,
|
|
144066
|
+
jsDocParsingMode: host.jsDocParsingMode
|
|
144066
144067
|
};
|
|
144067
144068
|
const originalGetSourceFile = compilerHost.getSourceFile;
|
|
144068
144069
|
const { getSourceFileWithCache } = changeCompilerHostLikeToUseCache(
|
|
@@ -145306,6 +145307,9 @@ var LanguageServiceShimHostAdapter = class {
|
|
|
145306
145307
|
return map(typeDirectiveNames, (name) => getProperty(typeDirectivesForFile, isString(name) ? name : toFileNameLowerCase(name.fileName)));
|
|
145307
145308
|
};
|
|
145308
145309
|
}
|
|
145310
|
+
if ("jsDocParsingMode" in this.shimHost) {
|
|
145311
|
+
this.jsDocParsingMode = this.shimHost.jsDocParsingMode;
|
|
145312
|
+
}
|
|
145309
145313
|
}
|
|
145310
145314
|
log(s) {
|
|
145311
145315
|
if (this.loggingEnabled) {
|
|
@@ -149039,16 +149043,17 @@ registerCodeFix({
|
|
|
149039
149043
|
const moduleExportsChangedToDefault = convertFileToEsModule(sourceFile, program.getTypeChecker(), changes2, getEmitScriptTarget(program.getCompilerOptions()), getQuotePreference(sourceFile, preferences));
|
|
149040
149044
|
if (moduleExportsChangedToDefault) {
|
|
149041
149045
|
for (const importingFile of program.getSourceFiles()) {
|
|
149042
|
-
fixImportOfModuleExports(importingFile, sourceFile, changes2, getQuotePreference(importingFile, preferences));
|
|
149046
|
+
fixImportOfModuleExports(importingFile, sourceFile, program, changes2, getQuotePreference(importingFile, preferences));
|
|
149043
149047
|
}
|
|
149044
149048
|
}
|
|
149045
149049
|
});
|
|
149046
149050
|
return [createCodeFixActionWithoutFixAll("convertToEsModule", changes, Diagnostics.Convert_to_ES_module)];
|
|
149047
149051
|
}
|
|
149048
149052
|
});
|
|
149049
|
-
function fixImportOfModuleExports(importingFile, exportingFile, changes, quotePreference) {
|
|
149053
|
+
function fixImportOfModuleExports(importingFile, exportingFile, program, changes, quotePreference) {
|
|
149054
|
+
var _a, _b, _c;
|
|
149050
149055
|
for (const moduleSpecifier of importingFile.imports) {
|
|
149051
|
-
const imported =
|
|
149056
|
+
const imported = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(importingFile.path)) == null ? void 0 : _b.get(moduleSpecifier.text, getModeForUsageLocation(importingFile, moduleSpecifier))) == null ? void 0 : _c.resolvedModule;
|
|
149052
149057
|
if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
|
|
149053
149058
|
continue;
|
|
149054
149059
|
}
|
|
@@ -150201,7 +150206,7 @@ registerCodeFix({
|
|
|
150201
150206
|
fix,
|
|
150202
150207
|
/*includeSymbolNameInDescription*/
|
|
150203
150208
|
symbolName2 !== errorIdentifierText,
|
|
150204
|
-
program
|
|
150209
|
+
program,
|
|
150205
150210
|
preferences
|
|
150206
150211
|
)
|
|
150207
150212
|
);
|
|
@@ -150450,7 +150455,6 @@ function createImportSpecifierResolver(importingFile, program, host, preferences
|
|
|
150450
150455
|
}
|
|
150451
150456
|
}
|
|
150452
150457
|
function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sourceFile, symbolName2, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) {
|
|
150453
|
-
const compilerOptions = program.getCompilerOptions();
|
|
150454
150458
|
let exportInfos;
|
|
150455
150459
|
if (exportMapKey) {
|
|
150456
150460
|
exportInfos = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken).get(sourceFile.path, exportMapKey);
|
|
@@ -150471,7 +150475,7 @@ function getImportCompletionAction(targetSymbol, moduleSymbol, exportMapKey, sou
|
|
|
150471
150475
|
fix,
|
|
150472
150476
|
/*includeSymbolNameInDescription*/
|
|
150473
150477
|
false,
|
|
150474
|
-
|
|
150478
|
+
program,
|
|
150475
150479
|
preferences
|
|
150476
150480
|
))
|
|
150477
150481
|
};
|
|
@@ -150481,7 +150485,15 @@ function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, ho
|
|
|
150481
150485
|
const symbolName2 = single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions));
|
|
150482
150486
|
const fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName2, program);
|
|
150483
150487
|
const includeSymbolNameInDescription = symbolName2 !== symbolToken.text;
|
|
150484
|
-
return fix && codeFixActionToCodeAction(codeActionForFix(
|
|
150488
|
+
return fix && codeFixActionToCodeAction(codeActionForFix(
|
|
150489
|
+
{ host, formatContext, preferences },
|
|
150490
|
+
sourceFile,
|
|
150491
|
+
symbolName2,
|
|
150492
|
+
fix,
|
|
150493
|
+
includeSymbolNameInDescription,
|
|
150494
|
+
program,
|
|
150495
|
+
preferences
|
|
150496
|
+
));
|
|
150485
150497
|
}
|
|
150486
150498
|
function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
150487
150499
|
const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
@@ -151051,14 +151063,14 @@ function getExportEqualsImportKind(importingFile, compilerOptions, forceImportKe
|
|
|
151051
151063
|
}
|
|
151052
151064
|
return allowSyntheticDefaults ? 1 /* Default */ : 3 /* CommonJS */;
|
|
151053
151065
|
}
|
|
151054
|
-
function codeActionForFix(context, sourceFile, symbolName2, fix, includeSymbolNameInDescription,
|
|
151066
|
+
function codeActionForFix(context, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences) {
|
|
151055
151067
|
let diag2;
|
|
151056
151068
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
|
|
151057
|
-
diag2 = codeActionForFixWorker(tracker, sourceFile, symbolName2, fix, includeSymbolNameInDescription,
|
|
151069
|
+
diag2 = codeActionForFixWorker(tracker, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences);
|
|
151058
151070
|
});
|
|
151059
151071
|
return createCodeFixAction(importFixName, changes, diag2, importFixId, Diagnostics.Add_all_missing_imports);
|
|
151060
151072
|
}
|
|
151061
|
-
function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSymbolNameInDescription,
|
|
151073
|
+
function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSymbolNameInDescription, program, preferences) {
|
|
151062
151074
|
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
151063
151075
|
switch (fix.kind) {
|
|
151064
151076
|
case 0 /* UseNamespace */:
|
|
@@ -151095,7 +151107,7 @@ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSy
|
|
|
151095
151107
|
defaultImport,
|
|
151096
151108
|
namedImports,
|
|
151097
151109
|
namespaceLikeImport,
|
|
151098
|
-
|
|
151110
|
+
program.getCompilerOptions()
|
|
151099
151111
|
),
|
|
151100
151112
|
/*blankLineBetween*/
|
|
151101
151113
|
true,
|
|
@@ -151108,7 +151120,7 @@ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSy
|
|
|
151108
151120
|
}
|
|
151109
151121
|
case 4 /* PromoteTypeOnly */: {
|
|
151110
151122
|
const { typeOnlyAliasDeclaration } = fix;
|
|
151111
|
-
const promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration,
|
|
151123
|
+
const promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, program, sourceFile, preferences);
|
|
151112
151124
|
return promotedDeclaration.kind === 276 /* ImportSpecifier */ ? [Diagnostics.Remove_type_from_import_of_0_from_1, symbolName2, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)];
|
|
151113
151125
|
}
|
|
151114
151126
|
default:
|
|
@@ -151119,7 +151131,8 @@ function getModuleSpecifierText(promotedDeclaration) {
|
|
|
151119
151131
|
var _a, _b;
|
|
151120
151132
|
return promotedDeclaration.kind === 271 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text;
|
|
151121
151133
|
}
|
|
151122
|
-
function promoteFromTypeOnly(changes, aliasDeclaration,
|
|
151134
|
+
function promoteFromTypeOnly(changes, aliasDeclaration, program, sourceFile, preferences) {
|
|
151135
|
+
const compilerOptions = program.getCompilerOptions();
|
|
151123
151136
|
const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions);
|
|
151124
151137
|
switch (aliasDeclaration.kind) {
|
|
151125
151138
|
case 276 /* ImportSpecifier */:
|
|
@@ -151161,10 +151174,11 @@ function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceF
|
|
|
151161
151174
|
Debug.failBadSyntaxKind(aliasDeclaration);
|
|
151162
151175
|
}
|
|
151163
151176
|
function promoteImportClause(importClause) {
|
|
151177
|
+
var _a, _b, _c;
|
|
151164
151178
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
|
|
151165
151179
|
if (!compilerOptions.allowImportingTsExtensions) {
|
|
151166
151180
|
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
|
|
151167
|
-
const resolvedModule = moduleSpecifier &&
|
|
151181
|
+
const resolvedModule = moduleSpecifier && ((_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(moduleSpecifier.text, getModeForUsageLocation(sourceFile, moduleSpecifier))) == null ? void 0 : _c.resolvedModule);
|
|
151168
151182
|
if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
|
|
151169
151183
|
const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
|
|
151170
151184
|
changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
|
|
@@ -151832,7 +151846,7 @@ registerCodeFix({
|
|
|
151832
151846
|
}
|
|
151833
151847
|
});
|
|
151834
151848
|
function getInfo7(sourceFile, pos, program) {
|
|
151835
|
-
var _a;
|
|
151849
|
+
var _a, _b, _c, _d;
|
|
151836
151850
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
151837
151851
|
if (isIdentifier(token)) {
|
|
151838
151852
|
const importDeclaration = findAncestor(token, isImportDeclaration);
|
|
@@ -151841,19 +151855,18 @@ function getInfo7(sourceFile, pos, program) {
|
|
|
151841
151855
|
const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : void 0;
|
|
151842
151856
|
if (moduleSpecifier === void 0)
|
|
151843
151857
|
return void 0;
|
|
151844
|
-
const resolvedModule =
|
|
151845
|
-
sourceFile,
|
|
151858
|
+
const resolvedModule = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(
|
|
151846
151859
|
moduleSpecifier,
|
|
151847
151860
|
/*mode*/
|
|
151848
151861
|
void 0
|
|
151849
|
-
);
|
|
151862
|
+
)) == null ? void 0 : _c.resolvedModule;
|
|
151850
151863
|
if (resolvedModule === void 0)
|
|
151851
151864
|
return void 0;
|
|
151852
151865
|
const moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
|
|
151853
151866
|
if (moduleSourceFile === void 0 || isSourceFileFromLibrary(program, moduleSourceFile))
|
|
151854
151867
|
return void 0;
|
|
151855
151868
|
const moduleSymbol = moduleSourceFile.symbol;
|
|
151856
|
-
const locals = (
|
|
151869
|
+
const locals = (_d = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _d.locals;
|
|
151857
151870
|
if (locals === void 0)
|
|
151858
151871
|
return void 0;
|
|
151859
151872
|
const localSymbol = locals.get(token.escapedText);
|
|
@@ -152108,9 +152121,10 @@ function convertSemanticMeaningToSymbolFlags(meaning) {
|
|
|
152108
152121
|
return flags;
|
|
152109
152122
|
}
|
|
152110
152123
|
function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration) {
|
|
152124
|
+
var _a, _b, _c;
|
|
152111
152125
|
if (!importDeclaration || !isStringLiteralLike(importDeclaration.moduleSpecifier))
|
|
152112
152126
|
return void 0;
|
|
152113
|
-
const resolvedModule =
|
|
152127
|
+
const resolvedModule = (_c = (_b = (_a = context.program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(importDeclaration.moduleSpecifier.text, getModeForUsageLocation(sourceFile, importDeclaration.moduleSpecifier))) == null ? void 0 : _c.resolvedModule;
|
|
152114
152128
|
if (!resolvedModule)
|
|
152115
152129
|
return void 0;
|
|
152116
152130
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -161108,8 +161122,9 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
|
|
|
161108
161122
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
|
|
161109
161123
|
}
|
|
161110
161124
|
case 2 /* Types */: {
|
|
161125
|
+
const quoteChar = contextToken.kind === 15 /* NoSubstitutionTemplateLiteral */ ? 96 /* backtick */ : startsWith(getTextOfNode(contextToken), "'") ? 39 /* singleQuote */ : 34 /* doubleQuote */;
|
|
161111
161126
|
const entries = completion.types.map((type) => ({
|
|
161112
|
-
name: type.value,
|
|
161127
|
+
name: escapeString(type.value, quoteChar),
|
|
161113
161128
|
kindModifiers: "" /* none */,
|
|
161114
161129
|
kind: "string" /* string */,
|
|
161115
161130
|
sortText: SortText.LocationPriority,
|
|
@@ -162913,7 +162928,7 @@ function declarationIsWriteAccess(decl) {
|
|
|
162913
162928
|
var Core;
|
|
162914
162929
|
((Core2) => {
|
|
162915
162930
|
function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options = {}, sourceFilesSet = new Set(sourceFiles.map((f) => f.fileName))) {
|
|
162916
|
-
var _a, _b, _c;
|
|
162931
|
+
var _a, _b, _c, _d;
|
|
162917
162932
|
node = getAdjustedNode2(node, options);
|
|
162918
162933
|
if (isSourceFile(node)) {
|
|
162919
162934
|
const resolvedRef = ts_GoToDefinition_exports.getReferenceAtPosition(node, position, program);
|
|
@@ -162952,7 +162967,7 @@ var Core;
|
|
|
162952
162967
|
if (!options.implementations && isStringLiteralLike(node)) {
|
|
162953
162968
|
if (isModuleSpecifierLike(node)) {
|
|
162954
162969
|
const fileIncludeReasons = program.getFileIncludeReasons();
|
|
162955
|
-
const referencedFileName = (_c = (_b = (_a = node.getSourceFile().
|
|
162970
|
+
const referencedFileName = (_d = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(node.getSourceFile().path)) == null ? void 0 : _b.get(node.text, getModeForUsageLocation(node.getSourceFile(), node))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.resolvedFileName;
|
|
162956
162971
|
const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0;
|
|
162957
162972
|
if (referencedFile) {
|
|
162958
162973
|
return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }];
|
|
@@ -163015,7 +163030,7 @@ var Core;
|
|
|
163015
163030
|
for (const ref of references) {
|
|
163016
163031
|
if (isReferencedFile(ref)) {
|
|
163017
163032
|
const referencingFile = program.getSourceFileByPath(ref.file);
|
|
163018
|
-
const location = getReferencedFileLocation(program
|
|
163033
|
+
const location = getReferencedFileLocation(program, ref);
|
|
163019
163034
|
if (isReferenceFileLocation(location)) {
|
|
163020
163035
|
entries = append(entries, {
|
|
163021
163036
|
kind: 0 /* Span */,
|
|
@@ -164355,7 +164370,7 @@ __export(ts_GoToDefinition_exports, {
|
|
|
164355
164370
|
|
|
164356
164371
|
// src/services/goToDefinition.ts
|
|
164357
164372
|
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
164358
|
-
var _a, _b;
|
|
164373
|
+
var _a, _b, _c;
|
|
164359
164374
|
const resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
164360
164375
|
const fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || emptyArray;
|
|
164361
164376
|
if (resolvedRef == null ? void 0 : resolvedRef.file) {
|
|
@@ -164428,7 +164443,7 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
|
164428
164443
|
}
|
|
164429
164444
|
}
|
|
164430
164445
|
if (!symbol && isModuleSpecifierLike(fallbackNode)) {
|
|
164431
|
-
const ref = (_b = (_a =
|
|
164446
|
+
const ref = (_c = (_b = (_a = program.resolvedModules) == null ? void 0 : _a.get(sourceFile.path)) == null ? void 0 : _b.get(fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode))) == null ? void 0 : _c.resolvedModule;
|
|
164432
164447
|
if (ref) {
|
|
164433
164448
|
return [{
|
|
164434
164449
|
name: fallbackNode.text,
|
|
@@ -164540,10 +164555,11 @@ function getReferenceAtPosition(sourceFile, position, program) {
|
|
|
164540
164555
|
const file = program.getLibFileFromReference(libReferenceDirective);
|
|
164541
164556
|
return file && { reference: libReferenceDirective, fileName: file.fileName, file, unverified: false };
|
|
164542
164557
|
}
|
|
164543
|
-
|
|
164558
|
+
const resolvedModules = (_b = program.resolvedModules) == null ? void 0 : _b.get(sourceFile.path);
|
|
164559
|
+
if (resolvedModules == null ? void 0 : resolvedModules.size()) {
|
|
164544
164560
|
const node = getTouchingToken(sourceFile, position);
|
|
164545
|
-
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) &&
|
|
164546
|
-
const verifiedFileName = (_d = (_c =
|
|
164561
|
+
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && resolvedModules.has(node.text, getModeForUsageLocation(sourceFile, node))) {
|
|
164562
|
+
const verifiedFileName = (_d = (_c = resolvedModules.get(node.text, getModeForUsageLocation(sourceFile, node))) == null ? void 0 : _c.resolvedModule) == null ? void 0 : _d.resolvedFileName;
|
|
164547
164563
|
const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text);
|
|
164548
164564
|
return {
|
|
164549
164565
|
file: program.getSourceFile(fileName),
|
|
@@ -169305,7 +169321,7 @@ var changesToText;
|
|
|
169305
169321
|
const sourceFile = createSourceFile(
|
|
169306
169322
|
"any file name",
|
|
169307
169323
|
nonFormattedText,
|
|
169308
|
-
99 /* ESNext */,
|
|
169324
|
+
{ languageVersion: 99 /* ESNext */, jsDocParsingMode: 1 /* ParseNone */ },
|
|
169309
169325
|
/*setParentNodes*/
|
|
169310
169326
|
true,
|
|
169311
169327
|
scriptKind
|
|
@@ -172590,6 +172606,7 @@ __export(ts_exports2, {
|
|
|
172590
172606
|
InternalEmitFlags: () => InternalEmitFlags,
|
|
172591
172607
|
InternalSymbolName: () => InternalSymbolName,
|
|
172592
172608
|
InvalidatedProjectKind: () => InvalidatedProjectKind,
|
|
172609
|
+
JSDocParsingMode: () => JSDocParsingMode,
|
|
172593
172610
|
JsDoc: () => ts_JsDoc_exports,
|
|
172594
172611
|
JsTyping: () => ts_JsTyping_exports,
|
|
172595
172612
|
JsxEmit: () => JsxEmit,
|
|
@@ -173481,8 +173498,6 @@ __export(ts_exports2, {
|
|
|
173481
173498
|
getResolvePackageJsonExports: () => getResolvePackageJsonExports,
|
|
173482
173499
|
getResolvePackageJsonImports: () => getResolvePackageJsonImports,
|
|
173483
173500
|
getResolvedExternalModuleName: () => getResolvedExternalModuleName,
|
|
173484
|
-
getResolvedModule: () => getResolvedModule,
|
|
173485
|
-
getResolvedTypeReferenceDirective: () => getResolvedTypeReferenceDirective,
|
|
173486
173501
|
getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
|
|
173487
173502
|
getRestParameterElementType: () => getRestParameterElementType,
|
|
173488
173503
|
getRightMostAssignedExpression: () => getRightMostAssignedExpression,
|
|
@@ -174580,8 +174595,6 @@ __export(ts_exports2, {
|
|
|
174580
174595
|
setParent: () => setParent,
|
|
174581
174596
|
setParentRecursive: () => setParentRecursive,
|
|
174582
174597
|
setPrivateIdentifier: () => setPrivateIdentifier,
|
|
174583
|
-
setResolvedModule: () => setResolvedModule,
|
|
174584
|
-
setResolvedTypeReferenceDirective: () => setResolvedTypeReferenceDirective,
|
|
174585
174598
|
setSnippetElement: () => setSnippetElement,
|
|
174586
174599
|
setSourceMapRange: () => setSourceMapRange,
|
|
174587
174600
|
setStackTraceLimit: () => setStackTraceLimit,
|
|
@@ -174808,7 +174821,6 @@ __export(ts_exports2, {
|
|
|
174808
174821
|
writeCommentRange: () => writeCommentRange,
|
|
174809
174822
|
writeFile: () => writeFile,
|
|
174810
174823
|
writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
|
|
174811
|
-
zipToModeAwareCache: () => zipToModeAwareCache,
|
|
174812
174824
|
zipWith: () => zipWith
|
|
174813
174825
|
});
|
|
174814
174826
|
|
|
@@ -176558,6 +176570,7 @@ var Project3 = class _Project {
|
|
|
176558
176570
|
this.directoryStructureHost = directoryStructureHost;
|
|
176559
176571
|
this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory);
|
|
176560
176572
|
this.getCanonicalFileName = this.projectService.toCanonicalFileName;
|
|
176573
|
+
this.jsDocParsingMode = this.projectService.jsDocParsingMode;
|
|
176561
176574
|
this.cancellationToken = new ThrottledCancellationToken(this.projectService.cancellationToken, this.projectService.throttleWaitMilliseconds);
|
|
176562
176575
|
if (!this.compilerOptions) {
|
|
176563
176576
|
this.compilerOptions = getDefaultCompilerOptions2();
|
|
@@ -176682,7 +176695,8 @@ var Project3 = class _Project {
|
|
|
176682
176695
|
}
|
|
176683
176696
|
if (this.program && !this.symlinks.hasProcessedResolutions()) {
|
|
176684
176697
|
this.symlinks.setSymlinksFromResolutions(
|
|
176685
|
-
this.program.
|
|
176698
|
+
this.program.resolvedModules,
|
|
176699
|
+
this.program.resolvedTypeReferenceDirectiveNames,
|
|
176686
176700
|
this.program.getAutomaticTypeDirectiveResolutions()
|
|
176687
176701
|
);
|
|
176688
176702
|
}
|
|
@@ -178087,16 +178101,23 @@ function getUnresolvedImports(program, cachedUnresolvedImportsPerFile) {
|
|
|
178087
178101
|
const sourceFiles = program.getSourceFiles();
|
|
178088
178102
|
(_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "getUnresolvedImports", { count: sourceFiles.length });
|
|
178089
178103
|
const ambientModules = program.getTypeChecker().getAmbientModules().map((mod) => stripQuotes(mod.getName()));
|
|
178090
|
-
const result = sortAndDeduplicate(flatMap(sourceFiles, (sourceFile) => extractUnresolvedImportsFromSourceFile(
|
|
178104
|
+
const result = sortAndDeduplicate(flatMap(sourceFiles, (sourceFile) => extractUnresolvedImportsFromSourceFile(
|
|
178105
|
+
program,
|
|
178106
|
+
sourceFile,
|
|
178107
|
+
ambientModules,
|
|
178108
|
+
cachedUnresolvedImportsPerFile
|
|
178109
|
+
)));
|
|
178091
178110
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
178092
178111
|
return result;
|
|
178093
178112
|
}
|
|
178094
|
-
function extractUnresolvedImportsFromSourceFile(file, ambientModules, cachedUnresolvedImportsPerFile) {
|
|
178113
|
+
function extractUnresolvedImportsFromSourceFile(program, file, ambientModules, cachedUnresolvedImportsPerFile) {
|
|
178095
178114
|
return getOrUpdate(cachedUnresolvedImportsPerFile, file.path, () => {
|
|
178096
|
-
|
|
178115
|
+
var _a;
|
|
178116
|
+
const resolvedModules = (_a = program.resolvedModules) == null ? void 0 : _a.get(file.path);
|
|
178117
|
+
if (!resolvedModules)
|
|
178097
178118
|
return emptyArray2;
|
|
178098
178119
|
let unresolvedImports;
|
|
178099
|
-
|
|
178120
|
+
resolvedModules.forEach(({ resolvedModule }, name) => {
|
|
178100
178121
|
if ((!resolvedModule || !resolutionExtensionIsTSOrJson(resolvedModule.extension)) && !isExternalModuleNameRelative(name) && !ambientModules.some((m) => m === name)) {
|
|
178101
178122
|
unresolvedImports = append(unresolvedImports, parsePackageName(name).packageName);
|
|
178102
178123
|
}
|
|
@@ -179116,6 +179137,7 @@ var _ProjectService = class _ProjectService {
|
|
|
179116
179137
|
this.allowLocalPluginLoads = !!opts.allowLocalPluginLoads;
|
|
179117
179138
|
this.typesMapLocation = opts.typesMapLocation === void 0 ? combinePaths(getDirectoryPath(this.getExecutingFilePath()), "typesMap.json") : opts.typesMapLocation;
|
|
179118
179139
|
this.session = opts.session;
|
|
179140
|
+
this.jsDocParsingMode = opts.jsDocParsingMode;
|
|
179119
179141
|
if (opts.serverMode !== void 0) {
|
|
179120
179142
|
this.serverMode = opts.serverMode;
|
|
179121
179143
|
} else {
|
|
@@ -179141,7 +179163,7 @@ var _ProjectService = class _ProjectService {
|
|
|
179141
179163
|
hostInfo: "Unknown host",
|
|
179142
179164
|
extraFileExtensions: []
|
|
179143
179165
|
};
|
|
179144
|
-
this.documentRegistry = createDocumentRegistryInternal(this.host.useCaseSensitiveFileNames, this.currentDirectory, this);
|
|
179166
|
+
this.documentRegistry = createDocumentRegistryInternal(this.host.useCaseSensitiveFileNames, this.currentDirectory, this.jsDocParsingMode, this);
|
|
179145
179167
|
const watchLogLevel = this.logger.hasLevel(3 /* verbose */) ? 2 /* Verbose */ : this.logger.loggingEnabled() ? 1 /* TriggerOnly */ : 0 /* None */;
|
|
179146
179168
|
const log = watchLogLevel !== 0 /* None */ ? (s) => this.logger.info(s) : noop;
|
|
179147
179169
|
this.packageJsonCache = createPackageJsonCache(this);
|
|
@@ -187152,6 +187174,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
187152
187174
|
InternalEmitFlags,
|
|
187153
187175
|
InternalSymbolName,
|
|
187154
187176
|
InvalidatedProjectKind,
|
|
187177
|
+
JSDocParsingMode,
|
|
187155
187178
|
JsDoc,
|
|
187156
187179
|
JsTyping,
|
|
187157
187180
|
JsxEmit,
|
|
@@ -188043,8 +188066,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
188043
188066
|
getResolvePackageJsonExports,
|
|
188044
188067
|
getResolvePackageJsonImports,
|
|
188045
188068
|
getResolvedExternalModuleName,
|
|
188046
|
-
getResolvedModule,
|
|
188047
|
-
getResolvedTypeReferenceDirective,
|
|
188048
188069
|
getRestIndicatorOfBindingOrAssignmentElement,
|
|
188049
188070
|
getRestParameterElementType,
|
|
188050
188071
|
getRightMostAssignedExpression,
|
|
@@ -189142,8 +189163,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189142
189163
|
setParent,
|
|
189143
189164
|
setParentRecursive,
|
|
189144
189165
|
setPrivateIdentifier,
|
|
189145
|
-
setResolvedModule,
|
|
189146
|
-
setResolvedTypeReferenceDirective,
|
|
189147
189166
|
setSnippetElement,
|
|
189148
189167
|
setSourceMapRange,
|
|
189149
189168
|
setStackTraceLimit,
|
|
@@ -189370,7 +189389,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189370
189389
|
writeCommentRange,
|
|
189371
189390
|
writeFile,
|
|
189372
189391
|
writeFileEnsuringDirectories,
|
|
189373
|
-
zipToModeAwareCache,
|
|
189374
189392
|
zipWith
|
|
189375
189393
|
});
|
|
189376
189394
|
//# sourceMappingURL=tsserver.js.map
|