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/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.3";
21
- var version = `${versionMajorMinor}.0-dev.20230920`;
21
+ var version = `${versionMajorMinor}.0-dev.20230922`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -7689,7 +7689,7 @@ var Diagnostics = {
7689
7689
  Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
7690
7690
  Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
7691
7691
  Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
7692
- Can_only_convert_string_concatenation: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_95154", "Can only convert string concatenation"),
7692
+ 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"),
7693
7693
  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"),
7694
7694
  Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
7695
7695
  Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
@@ -7933,7 +7933,7 @@ var unicodeESNextIdentifierStart = [65, 90, 97, 122, 170, 170, 181, 181, 186, 18
7933
7933
  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];
7934
7934
  var commentDirectiveRegExSingleLine = /^\/\/\/?\s*@(ts-expect-error|ts-ignore)/;
7935
7935
  var commentDirectiveRegExMultiLine = /^(?:\/|\*)*\s*@(ts-expect-error|ts-ignore)/;
7936
- var semanticJSDocTagRegEx = /@(?:see|link)/i;
7936
+ var jsDocSeeOrLink = /@(?:see|link)/i;
7937
7937
  function lookupInUnicodeMap(code, map2) {
7938
7938
  if (code < map2[0]) {
7939
7939
  return false;
@@ -8419,7 +8419,8 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8419
8419
  var tokenFlags;
8420
8420
  var commentDirectives;
8421
8421
  var inJSDocType = 0;
8422
- var skipNonSemanticJSDoc = false;
8422
+ var scriptKind = 0 /* Unknown */;
8423
+ var jsDocParsingMode = 0 /* ParseAll */;
8423
8424
  setText(text, start, length2);
8424
8425
  var scanner = {
8425
8426
  getTokenFullStart: () => fullStartPos,
@@ -8463,14 +8464,15 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
8463
8464
  setText,
8464
8465
  setScriptTarget,
8465
8466
  setLanguageVariant,
8467
+ setScriptKind,
8468
+ setJSDocParsingMode,
8466
8469
  setOnError,
8467
8470
  resetTokenState,
8468
8471
  setTextPos: resetTokenState,
8469
8472
  setInJSDocType,
8470
8473
  tryScan,
8471
8474
  lookAhead,
8472
- scanRange,
8473
- setSkipNonSemanticJSDoc
8475
+ scanRange
8474
8476
  };
8475
8477
  if (Debug.isDebugging) {
8476
8478
  Object.defineProperty(scanner, "__debugShowCurrentPositionInText", {
@@ -9258,7 +9260,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9258
9260
  tokenFlags |= 1 /* PrecedingLineBreak */;
9259
9261
  }
9260
9262
  }
9261
- if (isJSDoc2 && (!skipNonSemanticJSDoc || semanticJSDocTagRegEx.test(text.slice(fullStartPos, pos)))) {
9263
+ if (isJSDoc2 && shouldParseJSDoc()) {
9262
9264
  tokenFlags |= 2 /* PrecedingJSDocComment */;
9263
9265
  }
9264
9266
  commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart);
@@ -9517,6 +9519,21 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9517
9519
  }
9518
9520
  }
9519
9521
  }
9522
+ function shouldParseJSDoc() {
9523
+ switch (jsDocParsingMode) {
9524
+ case 0 /* ParseAll */:
9525
+ return true;
9526
+ case 1 /* ParseNone */:
9527
+ return false;
9528
+ }
9529
+ if (scriptKind !== 3 /* TS */ && scriptKind !== 4 /* TSX */) {
9530
+ return true;
9531
+ }
9532
+ if (jsDocParsingMode === 3 /* ParseForTypeInfo */) {
9533
+ return false;
9534
+ }
9535
+ return jsDocSeeOrLink.test(text.slice(fullStartPos, pos));
9536
+ }
9520
9537
  function reScanInvalidIdentifier() {
9521
9538
  Debug.assert(token === 0 /* Unknown */, "'reScanInvalidIdentifier' should only be called when the current token is 'SyntaxKind.Unknown'.");
9522
9539
  pos = tokenStart = fullStartPos;
@@ -9931,8 +9948,11 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
9931
9948
  function setLanguageVariant(variant) {
9932
9949
  languageVariant = variant;
9933
9950
  }
9934
- function setSkipNonSemanticJSDoc(skip) {
9935
- skipNonSemanticJSDoc = skip;
9951
+ function setScriptKind(kind) {
9952
+ scriptKind = kind;
9953
+ }
9954
+ function setJSDocParsingMode(kind) {
9955
+ jsDocParsingMode = kind;
9936
9956
  }
9937
9957
  function resetTokenState(position) {
9938
9958
  Debug.assert(position >= 0);
@@ -11431,22 +11451,6 @@ function usingSingleLineStringWriter(action) {
11431
11451
  function getFullWidth(node) {
11432
11452
  return node.end - node.pos;
11433
11453
  }
11434
- function getResolvedModule(sourceFile, moduleNameText, mode) {
11435
- var _a, _b;
11436
- return (_b = (_a = sourceFile == null ? void 0 : sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleNameText, mode)) == null ? void 0 : _b.resolvedModule;
11437
- }
11438
- function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
11439
- if (!sourceFile.resolvedModules) {
11440
- sourceFile.resolvedModules = createModeAwareCache();
11441
- }
11442
- sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
11443
- }
11444
- function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective, mode) {
11445
- if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
11446
- sourceFile.resolvedTypeReferenceDirectiveNames = createModeAwareCache();
11447
- }
11448
- sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
11449
- }
11450
11454
  function projectReferenceIsEqualTo(oldRef, newRef) {
11451
11455
  return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
11452
11456
  }
@@ -11454,8 +11458,8 @@ function moduleResolutionIsEqualTo(oldResolution, newResolution) {
11454
11458
  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;
11455
11459
  }
11456
11460
  function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
11457
- var _a, _b;
11458
- const node10Result = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleReference, mode)) == null ? void 0 : _b.node10Result;
11461
+ var _a, _b, _c;
11462
+ 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;
11459
11463
  const result = node10Result ? chainDiagnosticMessages(
11460
11464
  /*details*/
11461
11465
  void 0,
@@ -16470,14 +16474,11 @@ function createSymlinkCache(cwd, getCanonicalFileName) {
16470
16474
  (symlinkedDirectories || (symlinkedDirectories = /* @__PURE__ */ new Map())).set(symlinkPath, real);
16471
16475
  }
16472
16476
  },
16473
- setSymlinksFromResolutions(files, typeReferenceDirectives) {
16474
- var _a, _b;
16477
+ setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, typeReferenceDirectives) {
16475
16478
  Debug.assert(!hasProcessedResolutions);
16476
16479
  hasProcessedResolutions = true;
16477
- for (const file of files) {
16478
- (_a = file.resolvedModules) == null ? void 0 : _a.forEach((resolution) => processResolution(this, resolution.resolvedModule));
16479
- (_b = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _b.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
16480
- }
16480
+ resolvedModules == null ? void 0 : resolvedModules.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedModule)));
16481
+ resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.forEach((cache) => cache.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective)));
16481
16482
  typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective));
16482
16483
  },
16483
16484
  hasProcessedResolutions: () => hasProcessedResolutions
@@ -21462,7 +21463,6 @@ function createNodeFactory(flags, baseFactory2) {
21462
21463
  node.imports = void 0;
21463
21464
  node.moduleAugmentations = void 0;
21464
21465
  node.ambientModuleNames = void 0;
21465
- node.resolvedModules = void 0;
21466
21466
  node.classifiableNames = void 0;
21467
21467
  node.impliedNodeFormat = void 0;
21468
21468
  return node;
@@ -26289,7 +26289,7 @@ function gatherPossibleChildren(node) {
26289
26289
  function setExternalModuleIndicator(sourceFile) {
26290
26290
  sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile);
26291
26291
  }
26292
- function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind, skipNonSemanticJSDoc) {
26292
+ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind) {
26293
26293
  var _a, _b, _c, _d;
26294
26294
  (_a = tracing) == null ? void 0 : _a.push(
26295
26295
  tracing.Phase.Parse,
@@ -26304,7 +26304,8 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
26304
26304
  const {
26305
26305
  languageVersion,
26306
26306
  setExternalModuleIndicator: overrideSetExternalModuleIndicator,
26307
- impliedNodeFormat: format
26307
+ impliedNodeFormat: format,
26308
+ jsDocParsingMode
26308
26309
  } = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : { languageVersion: languageVersionOrOptions };
26309
26310
  if (languageVersion === 100 /* JSON */) {
26310
26311
  result = Parser.parseSourceFile(
@@ -26316,7 +26317,7 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
26316
26317
  setParentNodes,
26317
26318
  6 /* JSON */,
26318
26319
  noop,
26319
- skipNonSemanticJSDoc
26320
+ jsDocParsingMode
26320
26321
  );
26321
26322
  } else {
26322
26323
  const setIndicator = format === void 0 ? overrideSetExternalModuleIndicator : (file) => {
@@ -26332,7 +26333,7 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
26332
26333
  setParentNodes,
26333
26334
  scriptKind,
26334
26335
  setIndicator,
26335
- skipNonSemanticJSDoc
26336
+ jsDocParsingMode
26336
26337
  );
26337
26338
  }
26338
26339
  (_c = perfLogger) == null ? void 0 : _c.logStopParseSourceFile();
@@ -26451,7 +26452,7 @@ var Parser;
26451
26452
  var contextFlags;
26452
26453
  var topLevel = true;
26453
26454
  var parseErrorBeforeNextFinishedNode = false;
26454
- function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride, skipNonSemanticJSDoc) {
26455
+ function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride, jsDocParsingMode = 0 /* ParseAll */) {
26455
26456
  var _a;
26456
26457
  scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
26457
26458
  if (scriptKind2 === 6 /* JSON */) {
@@ -26473,9 +26474,8 @@ var Parser;
26473
26474
  result2.pragmas = emptyMap;
26474
26475
  return result2;
26475
26476
  }
26476
- skipNonSemanticJSDoc = !!skipNonSemanticJSDoc && scriptKind2 !== 1 /* JS */ && scriptKind2 !== 2 /* JSX */;
26477
- initializeState(fileName2, sourceText2, languageVersion2, syntaxCursor2, scriptKind2, skipNonSemanticJSDoc);
26478
- const result = parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicatorOverride || setExternalModuleIndicator, skipNonSemanticJSDoc);
26477
+ initializeState(fileName2, sourceText2, languageVersion2, syntaxCursor2, scriptKind2, jsDocParsingMode);
26478
+ const result = parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicatorOverride || setExternalModuleIndicator, jsDocParsingMode);
26479
26479
  clearState();
26480
26480
  return result;
26481
26481
  }
@@ -26488,8 +26488,7 @@ var Parser;
26488
26488
  /*syntaxCursor*/
26489
26489
  void 0,
26490
26490
  1 /* JS */,
26491
- /*skipNonSemanticJSDoc*/
26492
- false
26491
+ 0 /* ParseAll */
26493
26492
  );
26494
26493
  nextToken();
26495
26494
  const entityName = parseEntityName(
@@ -26502,15 +26501,7 @@ var Parser;
26502
26501
  }
26503
26502
  Parser2.parseIsolatedEntityName = parseIsolatedEntityName2;
26504
26503
  function parseJsonText2(fileName2, sourceText2, languageVersion2 = 2 /* ES2015 */, syntaxCursor2, setParentNodes = false) {
26505
- initializeState(
26506
- fileName2,
26507
- sourceText2,
26508
- languageVersion2,
26509
- syntaxCursor2,
26510
- 6 /* JSON */,
26511
- /*skipNonSemanticJSDoc*/
26512
- false
26513
- );
26504
+ initializeState(fileName2, sourceText2, languageVersion2, syntaxCursor2, 6 /* JSON */, 0 /* ParseAll */);
26514
26505
  sourceFlags = contextFlags;
26515
26506
  nextToken();
26516
26507
  const pos = getNodePos();
@@ -26591,7 +26582,7 @@ var Parser;
26591
26582
  return result;
26592
26583
  }
26593
26584
  Parser2.parseJsonText = parseJsonText2;
26594
- function initializeState(_fileName, _sourceText, _languageVersion, _syntaxCursor, _scriptKind, _skipNonSemanticJSDoc) {
26585
+ function initializeState(_fileName, _sourceText, _languageVersion, _syntaxCursor, _scriptKind, _jsDocParsingMode) {
26595
26586
  NodeConstructor2 = objectAllocator.getNodeConstructor();
26596
26587
  TokenConstructor2 = objectAllocator.getTokenConstructor();
26597
26588
  IdentifierConstructor2 = objectAllocator.getIdentifierConstructor();
@@ -26627,13 +26618,15 @@ var Parser;
26627
26618
  scanner.setOnError(scanError);
26628
26619
  scanner.setScriptTarget(languageVersion);
26629
26620
  scanner.setLanguageVariant(languageVariant);
26630
- scanner.setSkipNonSemanticJSDoc(_skipNonSemanticJSDoc);
26621
+ scanner.setScriptKind(scriptKind);
26622
+ scanner.setJSDocParsingMode(_jsDocParsingMode);
26631
26623
  }
26632
26624
  function clearState() {
26633
26625
  scanner.clearCommentDirectives();
26634
26626
  scanner.setText("");
26635
26627
  scanner.setOnError(void 0);
26636
- scanner.setSkipNonSemanticJSDoc(false);
26628
+ scanner.setScriptKind(0 /* Unknown */);
26629
+ scanner.setJSDocParsingMode(0 /* ParseAll */);
26637
26630
  sourceText = void 0;
26638
26631
  languageVersion = void 0;
26639
26632
  syntaxCursor = void 0;
@@ -26647,7 +26640,7 @@ var Parser;
26647
26640
  notParenthesizedArrow = void 0;
26648
26641
  topLevel = true;
26649
26642
  }
26650
- function parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicator2, skipNonSemanticJSDoc) {
26643
+ function parseSourceFileWorker(languageVersion2, setParentNodes, scriptKind2, setExternalModuleIndicator2, jsDocParsingMode) {
26651
26644
  const isDeclarationFile = isDeclarationFileName(fileName);
26652
26645
  if (isDeclarationFile) {
26653
26646
  contextFlags |= 33554432 /* Ambient */;
@@ -26666,7 +26659,7 @@ var Parser;
26666
26659
  sourceFile.identifierCount = identifierCount;
26667
26660
  sourceFile.identifiers = identifiers;
26668
26661
  sourceFile.parseDiagnostics = attachFileToDiagnostics(parseDiagnostics, sourceFile);
26669
- sourceFile.skipNonSemanticJSDoc = skipNonSemanticJSDoc;
26662
+ sourceFile.jsDocParsingMode = jsDocParsingMode;
26670
26663
  if (jsDocDiagnostics) {
26671
26664
  sourceFile.jsDocDiagnostics = attachFileToDiagnostics(jsDocDiagnostics, sourceFile);
26672
26665
  }
@@ -32101,8 +32094,7 @@ var Parser;
32101
32094
  /*syntaxCursor*/
32102
32095
  void 0,
32103
32096
  1 /* JS */,
32104
- /*skipNonSemanticJSDoc*/
32105
- false
32097
+ 0 /* ParseAll */
32106
32098
  );
32107
32099
  scanner.setText(content, start, length2);
32108
32100
  currentToken = scanner.scan();
@@ -32167,8 +32159,7 @@ var Parser;
32167
32159
  /*syntaxCursor*/
32168
32160
  void 0,
32169
32161
  1 /* JS */,
32170
- /*skipNonSemanticJSDoc*/
32171
- false
32162
+ 0 /* ParseAll */
32172
32163
  );
32173
32164
  const jsDoc = doInsideOfContext(16777216 /* JSDoc */, () => parseJSDocCommentWorker(start, length2));
32174
32165
  const sourceFile = { languageVariant: 0 /* Standard */, text: content };
@@ -33125,7 +33116,7 @@ var IncrementalParser;
33125
33116
  true,
33126
33117
  sourceFile.scriptKind,
33127
33118
  sourceFile.setExternalModuleIndicator,
33128
- sourceFile.skipNonSemanticJSDoc
33119
+ sourceFile.jsDocParsingMode
33129
33120
  );
33130
33121
  }
33131
33122
  const incrementalSourceFile = sourceFile;
@@ -33150,7 +33141,7 @@ var IncrementalParser;
33150
33141
  true,
33151
33142
  sourceFile.scriptKind,
33152
33143
  sourceFile.setExternalModuleIndicator,
33153
- sourceFile.skipNonSemanticJSDoc
33144
+ sourceFile.jsDocParsingMode
33154
33145
  );
33155
33146
  result.commentDirectives = getNewCommentDirectives(
33156
33147
  sourceFile.commentDirectives,
@@ -34091,6 +34082,7 @@ var moduleOptionDeclaration = {
34091
34082
  node16: 100 /* Node16 */,
34092
34083
  nodenext: 199 /* NodeNext */
34093
34084
  })),
34085
+ affectsSourceFile: true,
34094
34086
  affectsModuleResolution: true,
34095
34087
  affectsEmit: true,
34096
34088
  affectsBuildInfo: true,
@@ -34527,6 +34519,7 @@ var commandOptionsWithoutBuild = [
34527
34519
  bundler: 100 /* Bundler */
34528
34520
  })),
34529
34521
  deprecatedKeys: /* @__PURE__ */ new Set(["node"]),
34522
+ affectsSourceFile: true,
34530
34523
  affectsModuleResolution: true,
34531
34524
  paramType: Diagnostics.STRATEGY,
34532
34525
  category: Diagnostics.Modules,
@@ -35069,6 +35062,7 @@ var commandOptionsWithoutBuild = [
35069
35062
  legacy: 1 /* Legacy */,
35070
35063
  force: 3 /* Force */
35071
35064
  })),
35065
+ affectsSourceFile: true,
35072
35066
  affectsModuleResolution: true,
35073
35067
  description: Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
35074
35068
  category: Diagnostics.Language_and_Environment,
@@ -35088,7 +35082,7 @@ var semanticDiagnosticsOptionDeclarations = optionDeclarations.filter((option) =
35088
35082
  var affectsEmitOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsEmit);
35089
35083
  var affectsDeclarationPathOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsDeclarationPath);
35090
35084
  var moduleResolutionOptionDeclarations = optionDeclarations.filter((option) => !!option.affectsModuleResolution);
35091
- var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics);
35085
+ var sourceFileAffectingCompilerOptions = optionDeclarations.filter((option) => !!option.affectsSourceFile || !!option.affectsBindDiagnostics);
35092
35086
  var optionsAffectingProgramStructure = optionDeclarations.filter((option) => !!option.affectsProgramStructure);
35093
35087
  var transpileOptionValueCompilerOptions = optionDeclarations.filter((option) => hasProperty(option, "transpileOptionValue"));
35094
35088
  var optionsForBuild = [
@@ -37463,15 +37457,6 @@ function createModeAwareCache() {
37463
37457
  return result;
37464
37458
  }
37465
37459
  }
37466
- function zipToModeAwareCache(file, keys, values, nameAndModeGetter) {
37467
- Debug.assert(keys.length === values.length);
37468
- const map2 = createModeAwareCache();
37469
- for (let i = 0; i < keys.length; ++i) {
37470
- const entry = keys[i];
37471
- map2.set(nameAndModeGetter.getName(entry), nameAndModeGetter.getMode(entry, file), values[i]);
37472
- }
37473
- return map2;
37474
- }
37475
37460
  function getOriginalOrResolvedModuleFileName(result) {
37476
37461
  return result.resolvedModule && (result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
37477
37462
  }
@@ -46313,7 +46298,7 @@ function createTypeChecker(host) {
46313
46298
  return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
46314
46299
  }
46315
46300
  function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
46316
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
46301
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
46317
46302
  if (startsWith(moduleReference, "@types/")) {
46318
46303
  const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
46319
46304
  const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
@@ -46331,7 +46316,7 @@ function createTypeChecker(host) {
46331
46316
  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);
46332
46317
  const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
46333
46318
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
46334
- const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode);
46319
+ 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;
46335
46320
  const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
46336
46321
  const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
46337
46322
  if (sourceFile) {
@@ -46339,7 +46324,7 @@ function createTypeChecker(host) {
46339
46324
  error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
46340
46325
  }
46341
46326
  if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
46342
- const importOrExport = ((_g = findAncestor(location, isImportDeclaration)) == null ? void 0 : _g.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
46327
+ const importOrExport = ((_j = findAncestor(location, isImportDeclaration)) == null ? void 0 : _j.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
46343
46328
  if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
46344
46329
  error(
46345
46330
  errorNode,
@@ -46348,7 +46333,7 @@ function createTypeChecker(host) {
46348
46333
  );
46349
46334
  }
46350
46335
  } else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
46351
- const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
46336
+ const importOrExport = ((_k = findAncestor(location, isImportDeclaration)) == null ? void 0 : _k.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
46352
46337
  if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
46353
46338
  const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
46354
46339
  error(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
@@ -46369,7 +46354,7 @@ function createTypeChecker(host) {
46369
46354
  if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
46370
46355
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
46371
46356
  const overrideClauseHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
46372
- const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_i = overrideClauseHost.assertions) == null ? void 0 : _i.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
46357
+ const overrideClause = overrideClauseHost && isImportTypeNode(overrideClauseHost) ? (_l = overrideClauseHost.assertions) == null ? void 0 : _l.assertClause : overrideClauseHost == null ? void 0 : overrideClauseHost.assertClause;
46373
46358
  if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !getResolutionModeOverrideForClause(overrideClause)) {
46374
46359
  if (findAncestor(location, isImportEqualsDeclaration)) {
46375
46360
  error(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);
@@ -46476,7 +46461,7 @@ function createTypeChecker(host) {
46476
46461
  error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
46477
46462
  } else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
46478
46463
  const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
46479
- const suggestedExt = (_j = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _j[1];
46464
+ const suggestedExt = (_m = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _m[1];
46480
46465
  if (suggestedExt) {
46481
46466
  error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
46482
46467
  } else {
@@ -53234,7 +53219,28 @@ function createTypeChecker(host) {
53234
53219
  }
53235
53220
  }
53236
53221
  }
53237
- links[resolutionKind] = combineSymbolTables(earlySymbols, lateSymbols) || emptySymbols;
53222
+ let resolved = combineSymbolTables(earlySymbols, lateSymbols);
53223
+ if (symbol.flags & 33554432 /* Transient */ && links.cjsExportMerged && symbol.declarations) {
53224
+ for (const decl of symbol.declarations) {
53225
+ const original = getSymbolLinks(decl.symbol)[resolutionKind];
53226
+ if (!resolved) {
53227
+ resolved = original;
53228
+ continue;
53229
+ }
53230
+ if (!original)
53231
+ continue;
53232
+ original.forEach((s, name) => {
53233
+ const existing = resolved.get(name);
53234
+ if (!existing)
53235
+ resolved.set(name, s);
53236
+ else if (existing === s)
53237
+ return;
53238
+ else
53239
+ resolved.set(name, mergeSymbol(existing, s));
53240
+ });
53241
+ }
53242
+ }
53243
+ links[resolutionKind] = resolved || emptySymbols;
53238
53244
  }
53239
53245
  return links[resolutionKind];
53240
53246
  }
@@ -114874,7 +114880,7 @@ function computeCommonSourceDirectoryOfFilenames(fileNames, currentDirectory, ge
114874
114880
  function createCompilerHost(options, setParentNodes) {
114875
114881
  return createCompilerHostWorker(options, setParentNodes);
114876
114882
  }
114877
- function createGetSourceFile(readFile, getCompilerOptions, setParentNodes, skipNonSemanticJSDocParsing2) {
114883
+ function createGetSourceFile(readFile, getCompilerOptions, setParentNodes) {
114878
114884
  return (fileName, languageVersionOrOptions, onError) => {
114879
114885
  let text;
114880
114886
  try {
@@ -114888,15 +114894,7 @@ function createGetSourceFile(readFile, getCompilerOptions, setParentNodes, skipN
114888
114894
  }
114889
114895
  text = "";
114890
114896
  }
114891
- return text !== void 0 ? createSourceFile(
114892
- fileName,
114893
- text,
114894
- languageVersionOrOptions,
114895
- setParentNodes,
114896
- /*scriptKind*/
114897
- void 0,
114898
- skipNonSemanticJSDocParsing2
114899
- ) : void 0;
114897
+ return text !== void 0 ? createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes) : void 0;
114900
114898
  };
114901
114899
  }
114902
114900
  function createWriteFileMeasuringIO(actualWriteFile, createDirectory, directoryExists) {
@@ -114920,7 +114918,7 @@ function createWriteFileMeasuringIO(actualWriteFile, createDirectory, directoryE
114920
114918
  }
114921
114919
  };
114922
114920
  }
114923
- function createCompilerHostWorker(options, setParentNodes, skipNonSemanticJSDocParsing2, system = sys) {
114921
+ function createCompilerHostWorker(options, setParentNodes, system = sys) {
114924
114922
  const existingDirectories = /* @__PURE__ */ new Map();
114925
114923
  const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames);
114926
114924
  function directoryExists(directoryPath) {
@@ -114939,7 +114937,7 @@ function createCompilerHostWorker(options, setParentNodes, skipNonSemanticJSDocP
114939
114937
  const newLine = getNewLineCharacter(options);
114940
114938
  const realpath = system.realpath && ((path) => system.realpath(path));
114941
114939
  const compilerHost = {
114942
- getSourceFile: createGetSourceFile((fileName) => compilerHost.readFile(fileName), () => options, setParentNodes, skipNonSemanticJSDocParsing2),
114940
+ getSourceFile: createGetSourceFile((fileName) => compilerHost.readFile(fileName), () => options, setParentNodes),
114943
114941
  getDefaultLibLocation,
114944
114942
  getDefaultLibFileName: (options2) => combinePaths(getDefaultLibLocation(), getDefaultLibFileName(options2)),
114945
114943
  writeFile: createWriteFileMeasuringIO(
@@ -115395,15 +115393,15 @@ function isReferencedFile(reason) {
115395
115393
  function isReferenceFileLocation(location) {
115396
115394
  return location.pos !== void 0;
115397
115395
  }
115398
- function getReferencedFileLocation(getSourceFileByPath, ref) {
115399
- var _a, _b, _c, _d, _e, _f;
115400
- const file = Debug.checkDefined(getSourceFileByPath(ref.file));
115396
+ function getReferencedFileLocation(program, ref) {
115397
+ var _a, _b, _c, _d, _e, _f, _g, _h;
115398
+ const file = Debug.checkDefined(program.getSourceFileByPath(ref.file));
115401
115399
  const { kind, index } = ref;
115402
115400
  let pos, end, packageId, resolutionMode;
115403
115401
  switch (kind) {
115404
115402
  case 3 /* Import */:
115405
115403
  const importLiteral = getModuleNameStringLiteralAt(file, index);
115406
- packageId = (_c = (_b = (_a = file.resolvedModules) == null ? void 0 : _a.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _b.resolvedModule) == null ? void 0 : _c.packageId;
115404
+ 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;
115407
115405
  if (importLiteral.pos === -1)
115408
115406
  return { file, packageId, text: importLiteral.text };
115409
115407
  pos = skipTrivia(file.text, importLiteral.pos);
@@ -115414,7 +115412,7 @@ function getReferencedFileLocation(getSourceFileByPath, ref) {
115414
115412
  break;
115415
115413
  case 5 /* TypeReferenceDirective */:
115416
115414
  ({ pos, end, resolutionMode } = file.typeReferenceDirectives[index]);
115417
- packageId = (_f = (_e = (_d = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _d.get(toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) == null ? void 0 : _e.resolvedTypeReferenceDirective) == null ? void 0 : _f.packageId;
115415
+ 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;
115418
115416
  break;
115419
115417
  case 7 /* LibReferenceDirective */:
115420
115418
  ({ pos, end } = file.libReferenceDirectives[index]);
@@ -115628,6 +115626,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115628
115626
  let automaticTypeDirectiveResolutions;
115629
115627
  let resolvedLibReferences;
115630
115628
  let resolvedLibProcessing;
115629
+ let resolvedModules;
115630
+ let resolvedModulesProcessing;
115631
+ let resolvedTypeReferenceDirectiveNames;
115632
+ let resolvedTypeReferenceDirectiveNamesProcessing;
115631
115633
  let packageMap;
115632
115634
  const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
115633
115635
  let currentNodeModulesDepth = 0;
@@ -115892,6 +115894,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115892
115894
  }
115893
115895
  oldProgram = void 0;
115894
115896
  resolvedLibProcessing = void 0;
115897
+ resolvedModulesProcessing = void 0;
115898
+ resolvedTypeReferenceDirectiveNamesProcessing = void 0;
115895
115899
  const program = {
115896
115900
  getRootFileNames: () => rootNames,
115897
115901
  getSourceFile,
@@ -115933,6 +115937,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115933
115937
  sourceFileToPackageName,
115934
115938
  redirectTargetsMap,
115935
115939
  usesUriStyleNodeCoreModules,
115940
+ resolvedModules,
115941
+ resolvedTypeReferenceDirectiveNames,
115936
115942
  resolvedLibReferences,
115937
115943
  getCurrentPackagesMap: () => packageMap,
115938
115944
  typesPackageExists,
@@ -115964,7 +115970,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115964
115970
  case 1 /* FilePreprocessingFileExplainingDiagnostic */:
115965
115971
  return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray));
115966
115972
  case 0 /* FilePreprocessingReferencedDiagnostic */:
115967
- const { file, pos, end } = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason);
115973
+ const { file, pos, end } = getReferencedFileLocation(program, diagnostic.reason);
115968
115974
  return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
115969
115975
  case 2 /* ResolutionDiagnostics */:
115970
115976
  return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
@@ -115981,14 +115987,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115981
115987
  if (packageMap)
115982
115988
  return packageMap;
115983
115989
  packageMap = /* @__PURE__ */ new Map();
115984
- files.forEach((sf) => {
115985
- if (!sf.resolvedModules)
115986
- return;
115987
- sf.resolvedModules.forEach(({ resolvedModule }) => {
115988
- if (resolvedModule == null ? void 0 : resolvedModule.packageId)
115989
- packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
115990
- });
115991
- });
115990
+ files.forEach(
115991
+ (sf) => {
115992
+ var _a2;
115993
+ return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(sf.path)) == null ? void 0 : _a2.forEach(({ resolvedModule }) => {
115994
+ if (resolvedModule == null ? void 0 : resolvedModule.packageId)
115995
+ packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
115996
+ });
115997
+ }
115998
+ );
115992
115999
  return packageMap;
115993
116000
  }
115994
116001
  function typesPackageExists(packageName) {
@@ -116120,7 +116127,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116120
116127
  return classifiableNames;
116121
116128
  }
116122
116129
  function resolveModuleNamesReusingOldState(moduleNames, file) {
116123
- var _a2;
116130
+ var _a2, _b2;
116124
116131
  if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
116125
116132
  return resolveModuleNamesWorker(
116126
116133
  moduleNames,
@@ -116129,24 +116136,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116129
116136
  void 0
116130
116137
  );
116131
116138
  }
116132
- const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
116133
- if (oldSourceFile !== file && file.resolvedModules) {
116134
- const result2 = [];
116135
- for (const moduleName of moduleNames) {
116136
- const resolvedModule = file.resolvedModules.get(moduleName.text, getModeForUsageLocation(file, moduleName));
116137
- result2.push(resolvedModule);
116138
- }
116139
- return result2;
116140
- }
116141
116139
  let unknownModuleNames;
116142
116140
  let result;
116143
116141
  let reusedNames;
116144
116142
  const predictedToResolveToAmbientModuleMarker = emptyResolution;
116143
+ const oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
116145
116144
  for (let i = 0; i < moduleNames.length; i++) {
116146
116145
  const moduleName = moduleNames[i];
116147
- if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) {
116146
+ if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
116148
116147
  const mode = getModeForUsageLocation(file, moduleName);
116149
- const oldResolution = (_a2 = oldSourceFile.resolvedModules) == null ? void 0 : _a2.get(moduleName.text, mode);
116148
+ 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);
116150
116149
  if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
116151
116150
  if (isTraceEnabled(options, host)) {
116152
116151
  trace(
@@ -116193,7 +116192,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116193
116192
  Debug.assert(j === resolutions.length);
116194
116193
  return result;
116195
116194
  function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
116196
- const resolutionToFile = getResolvedModule(oldSourceFile, moduleName.text, getModeForUsageLocation(file, moduleName));
116195
+ var _a3, _b3, _c2;
116196
+ 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;
116197
116197
  const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
116198
116198
  if (resolutionToFile && resolvedFile) {
116199
116199
  return false;
@@ -116209,7 +116209,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116209
116209
  }
116210
116210
  }
116211
116211
  function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
116212
- var _a2;
116212
+ var _a2, _b2;
116213
116213
  if (structureIsReused === 0 /* Not */) {
116214
116214
  return resolveTypeReferenceDirectiveNamesWorker(
116215
116215
  typeDirectiveNames,
@@ -116218,28 +116218,18 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116218
116218
  void 0
116219
116219
  );
116220
116220
  }
116221
- const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
116222
- if (!isString(containingFile)) {
116223
- if (oldSourceFile !== containingFile && containingFile.resolvedTypeReferenceDirectiveNames) {
116224
- const result2 = [];
116225
- for (const typeDirectiveName of typeDirectiveNames) {
116226
- const resolvedTypeReferenceDirective = containingFile.resolvedTypeReferenceDirectiveNames.get(getTypeReferenceResolutionName(typeDirectiveName), getModeForFileReference(typeDirectiveName, containingFile.impliedNodeFormat));
116227
- result2.push(resolvedTypeReferenceDirective);
116228
- }
116229
- return result2;
116230
- }
116231
- }
116232
116221
  let unknownTypeReferenceDirectiveNames;
116233
116222
  let result;
116234
116223
  let reusedNames;
116235
116224
  const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
116236
- const canReuseResolutions = !isString(containingFile) ? containingFile === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path) : !hasInvalidatedResolutions(toPath3(containingFile));
116225
+ const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : void 0;
116226
+ const canReuseResolutions = !isString(containingFile) ? containingFile === oldSourceFile && !hasInvalidatedResolutions(containingFile.path) : !hasInvalidatedResolutions(toPath3(containingFile));
116237
116227
  for (let i = 0; i < typeDirectiveNames.length; i++) {
116238
116228
  const entry = typeDirectiveNames[i];
116239
116229
  if (canReuseResolutions) {
116240
116230
  const typeDirectiveName = getTypeReferenceResolutionName(entry);
116241
116231
  const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat);
116242
- const oldResolution = (_a2 = !isString(containingFile) ? oldSourceFile == null ? void 0 : oldSourceFile.resolvedTypeReferenceDirectiveNames : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a2.get(typeDirectiveName, mode);
116232
+ 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);
116243
116233
  if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
116244
116234
  if (isTraceEnabled(options, host)) {
116245
116235
  trace(
@@ -116299,7 +116289,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116299
116289
  );
116300
116290
  }
116301
116291
  function tryReuseStructureFromOldProgram() {
116302
- var _a2;
116292
+ var _a2, _b2, _c2;
116303
116293
  if (!oldProgram) {
116304
116294
  return 0 /* Not */;
116305
116295
  }
@@ -116401,42 +116391,37 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116401
116391
  structureIsReused = 1 /* SafeModules */;
116402
116392
  }
116403
116393
  }
116404
- modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
116394
+ modifiedSourceFiles.push(newSourceFile);
116405
116395
  } else if (hasInvalidatedResolutions(oldSourceFile.path)) {
116406
116396
  structureIsReused = 1 /* SafeModules */;
116407
- modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
116397
+ modifiedSourceFiles.push(newSourceFile);
116398
+ } else {
116399
+ for (const moduleName of oldSourceFile.ambientModuleNames) {
116400
+ ambientModuleNameToUnmodifiedFileName.set(moduleName, oldSourceFile.fileName);
116401
+ }
116408
116402
  }
116409
116403
  newSourceFiles.push(newSourceFile);
116410
116404
  }
116411
116405
  if (structureIsReused !== 2 /* Completely */) {
116412
116406
  return structureIsReused;
116413
116407
  }
116414
- const modifiedFiles = modifiedSourceFiles.map((f) => f.oldFile);
116415
- for (const oldFile of oldSourceFiles) {
116416
- if (!contains(modifiedFiles, oldFile)) {
116417
- for (const moduleName of oldFile.ambientModuleNames) {
116418
- ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
116419
- }
116420
- }
116421
- }
116422
- for (const { oldFile: oldSourceFile, newFile: newSourceFile } of modifiedSourceFiles) {
116408
+ for (const newSourceFile of modifiedSourceFiles) {
116423
116409
  const moduleNames = getModuleNames(newSourceFile);
116424
116410
  const resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
116425
- const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldSourceFile.resolvedModules, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
116426
- if (resolutionsChanged) {
116411
+ (resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
116412
+ const oldResolutions = (_b2 = oldProgram.resolvedModules) == null ? void 0 : _b2.get(newSourceFile.path);
116413
+ const resolutionsChanged = hasChangesInResolutions(moduleNames, newSourceFile, resolutions, oldResolutions, moduleResolutionIsEqualTo, moduleResolutionNameAndModeGetter);
116414
+ if (resolutionsChanged)
116427
116415
  structureIsReused = 1 /* SafeModules */;
116428
- newSourceFile.resolvedModules = zipToModeAwareCache(newSourceFile, moduleNames, resolutions, moduleResolutionNameAndModeGetter);
116429
- } else {
116430
- newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
116431
- }
116432
116416
  const typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
116433
116417
  const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
116434
- const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
116418
+ (resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
116419
+ const oldTypeResolutions = (_c2 = oldProgram.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _c2.get(newSourceFile.path);
116420
+ const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, newSourceFile, typeReferenceResolutions, oldTypeResolutions, typeDirectiveIsEqualTo, typeReferenceResolutionNameAndModeGetter);
116435
116421
  if (typeReferenceResolutionsChanged) {
116436
116422
  structureIsReused = 1 /* SafeModules */;
116437
- newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions, typeReferenceResolutionNameAndModeGetter);
116438
- } else {
116439
- newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
116423
+ } else if (oldTypeResolutions) {
116424
+ (resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, oldTypeResolutions);
116440
116425
  }
116441
116426
  }
116442
116427
  if (structureIsReused !== 2 /* Completely */) {
@@ -116484,6 +116469,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116484
116469
  sourceFileToPackageName = oldProgram.sourceFileToPackageName;
116485
116470
  redirectTargetsMap = oldProgram.redirectTargetsMap;
116486
116471
  usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
116472
+ resolvedModules = oldProgram.resolvedModules;
116473
+ resolvedTypeReferenceDirectiveNames = oldProgram.resolvedTypeReferenceDirectiveNames;
116487
116474
  resolvedLibReferences = oldProgram.resolvedLibReferences;
116488
116475
  packageMap = oldProgram.getCurrentPackagesMap();
116489
116476
  return 2 /* Completely */;
@@ -117305,7 +117292,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117305
117292
  const result = getImpliedNodeFormatForFileWorker(getNormalizedAbsolutePath(fileName, currentDirectory), moduleResolutionCache2 == null ? void 0 : moduleResolutionCache2.getPackageJsonInfoCache(), host2, options2);
117306
117293
  const languageVersion = getEmitScriptTarget(options2);
117307
117294
  const setExternalModuleIndicator2 = getSetExternalModuleIndicator(options2);
117308
- return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2 } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2 };
117295
+ return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode };
117309
117296
  }
117310
117297
  function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
117311
117298
  var _a2;
@@ -117529,16 +117516,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117529
117516
  }
117530
117517
  function processTypeReferenceDirectives(file) {
117531
117518
  const typeDirectives = file.typeReferenceDirectives;
117532
- if (!typeDirectives.length) {
117533
- file.resolvedTypeReferenceDirectiveNames = void 0;
117519
+ if (!typeDirectives.length)
117534
117520
  return;
117535
- }
117536
- const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
117521
+ const resolutions = (resolvedTypeReferenceDirectiveNamesProcessing == null ? void 0 : resolvedTypeReferenceDirectiveNamesProcessing.get(file.path)) || resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
117522
+ const resolutionsInFile = createModeAwareCache();
117523
+ (resolvedTypeReferenceDirectiveNames ?? (resolvedTypeReferenceDirectiveNames = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
117537
117524
  for (let index = 0; index < typeDirectives.length; index++) {
117538
117525
  const ref = file.typeReferenceDirectives[index];
117539
117526
  const resolvedTypeReferenceDirective = resolutions[index];
117540
117527
  const fileName = toFileNameLowerCase(ref.fileName);
117541
- setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective, getModeForFileReference(ref, file.impliedNodeFormat));
117528
+ resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
117542
117529
  const mode = ref.resolutionMode || file.impliedNodeFormat;
117543
117530
  if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) {
117544
117531
  (fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({
@@ -117702,14 +117689,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117702
117689
  collectExternalModuleReferences(file);
117703
117690
  if (file.imports.length || file.moduleAugmentations.length) {
117704
117691
  const moduleNames = getModuleNames(file);
117705
- const resolutions = resolveModuleNamesReusingOldState(moduleNames, file);
117692
+ const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
117706
117693
  Debug.assert(resolutions.length === moduleNames.length);
117707
117694
  const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options : void 0) || options;
117695
+ const resolutionsInFile = createModeAwareCache();
117696
+ (resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
117708
117697
  for (let index = 0; index < moduleNames.length; index++) {
117709
117698
  const resolution = resolutions[index].resolvedModule;
117710
117699
  const moduleName = moduleNames[index].text;
117711
117700
  const mode = getModeForUsageLocation(file, moduleNames[index]);
117712
- setResolvedModule(file, moduleName, resolutions[index], mode);
117701
+ resolutionsInFile.set(moduleName, mode, resolutions[index]);
117713
117702
  addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
117714
117703
  if (!resolution) {
117715
117704
  continue;
@@ -117740,8 +117729,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117740
117729
  currentNodeModulesDepth--;
117741
117730
  }
117742
117731
  }
117743
- } else {
117744
- file.resolvedModules = void 0;
117745
117732
  }
117746
117733
  }
117747
117734
  function checkSourceFilesBelongToPath(sourceFiles, rootDirectory) {
@@ -118256,7 +118243,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118256
118243
  processReason(fileProcessingReason);
118257
118244
  if (locationReason && (fileIncludeReasons == null ? void 0 : fileIncludeReasons.length) === 1)
118258
118245
  fileIncludeReasons = void 0;
118259
- const location = locationReason && getReferencedFileLocation(getSourceFileByPath, locationReason);
118246
+ const location = locationReason && getReferencedFileLocation(program, locationReason);
118260
118247
  const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
118261
118248
  const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
118262
118249
  const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
@@ -118292,7 +118279,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118292
118279
  }
118293
118280
  function fileIncludeReasonToRelatedInformation(reason) {
118294
118281
  if (isReferencedFile(reason)) {
118295
- const referenceLocation = getReferencedFileLocation(getSourceFileByPath, reason);
118282
+ const referenceLocation = getReferencedFileLocation(program, reason);
118296
118283
  let message2;
118297
118284
  switch (reason.kind) {
118298
118285
  case 3 /* Import */:
@@ -118581,8 +118568,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118581
118568
  if (!symlinks) {
118582
118569
  symlinks = createSymlinkCache(currentDirectory, getCanonicalFileName);
118583
118570
  }
118584
- if (files && automaticTypeDirectiveResolutions && !symlinks.hasProcessedResolutions()) {
118585
- symlinks.setSymlinksFromResolutions(files, automaticTypeDirectiveResolutions);
118571
+ if (files && !symlinks.hasProcessedResolutions()) {
118572
+ symlinks.setSymlinksFromResolutions(resolvedModules, resolvedTypeReferenceDirectiveNames, automaticTypeDirectiveResolutions);
118586
118573
  }
118587
118574
  return symlinks;
118588
118575
  }
@@ -118936,6 +118923,7 @@ var BuilderState;
118936
118923
  return toPath(program.getProjectReferenceRedirect(fileName) || fileName, sourceFileDirectory, getCanonicalFileName);
118937
118924
  }
118938
118925
  function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
118926
+ var _a;
118939
118927
  let referencedFiles;
118940
118928
  if (sourceFile.imports && sourceFile.imports.length > 0) {
118941
118929
  const checker = program.getTypeChecker();
@@ -118951,8 +118939,9 @@ var BuilderState;
118951
118939
  addReferencedFile(referencedPath);
118952
118940
  }
118953
118941
  }
118954
- if (sourceFile.resolvedTypeReferenceDirectiveNames) {
118955
- sourceFile.resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
118942
+ const resolvedTypeReferenceDirectiveNames = (_a = program.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(sourceFile.path);
118943
+ if (resolvedTypeReferenceDirectiveNames) {
118944
+ resolvedTypeReferenceDirectiveNames.forEach(({ resolvedTypeReferenceDirective }) => {
118956
118945
  if (!resolvedTypeReferenceDirective) {
118957
118946
  return;
118958
118947
  }
@@ -120748,7 +120737,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
120748
120737
  clear: clear2,
120749
120738
  onChangesAffectModuleResolution
120750
120739
  };
120751
- function getResolvedModule2(resolution) {
120740
+ function getResolvedModule(resolution) {
120752
120741
  return resolution.resolvedModule;
120753
120742
  }
120754
120743
  function getResolvedTypeReferenceDirective(resolution) {
@@ -120827,7 +120816,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
120827
120816
  stopWatchFailedLookupLocationOfResolution(
120828
120817
  resolution,
120829
120818
  resolutionHost.toPath(getInferredLibraryNameResolveFrom(newProgram.getCompilerOptions(), getCurrentDirectory(), libFileName)),
120830
- getResolvedModule2
120819
+ getResolvedModule
120831
120820
  );
120832
120821
  resolvedLibraries.delete(libFileName);
120833
120822
  }
@@ -121052,7 +121041,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
121052
121041
  redirectedReference,
121053
121042
  options
121054
121043
  ),
121055
- getResolutionWithResolvedFileName: getResolvedModule2,
121044
+ getResolutionWithResolvedFileName: getResolvedModule,
121056
121045
  shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
121057
121046
  logChanges: logChangesWhenResolvingModule,
121058
121047
  deferWatchingNonRelativeResolution: true
@@ -121071,17 +121060,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
121071
121060
  libraryName,
121072
121061
  resolution,
121073
121062
  path,
121074
- getResolvedModule2,
121063
+ getResolvedModule,
121075
121064
  /*deferWatchingNonRelativeResolution*/
121076
121065
  false
121077
121066
  );
121078
121067
  resolvedLibraries.set(libFileName, resolution);
121079
121068
  if (existingResolution) {
121080
- stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule2);
121069
+ stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule);
121081
121070
  }
121082
121071
  } else {
121083
121072
  if (isTraceEnabled(options, host)) {
121084
- const resolved = getResolvedModule2(resolution);
121073
+ const resolved = getResolvedModule(resolution);
121085
121074
  trace(
121086
121075
  host,
121087
121076
  (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,
@@ -121358,7 +121347,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
121358
121347
  resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
121359
121348
  }
121360
121349
  function removeResolutionsOfFile(filePath) {
121361
- removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule2);
121350
+ removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
121362
121351
  removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
121363
121352
  }
121364
121353
  function invalidateResolutions(resolutions, canInvalidate) {
@@ -121785,7 +121774,7 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
121785
121774
  var _a, _b;
121786
121775
  const options = program.getCompilerOptions();
121787
121776
  if (isReferencedFile(reason)) {
121788
- const referenceLocation = getReferencedFileLocation((path) => program.getSourceFileByPath(path), reason);
121777
+ const referenceLocation = getReferencedFileLocation(program, reason);
121789
121778
  const referenceText = isReferenceFileLocation(referenceLocation) ? referenceLocation.file.text.substring(referenceLocation.pos, referenceLocation.end) : `"${referenceLocation.text}"`;
121790
121779
  let message;
121791
121780
  Debug.assert(isReferenceFileLocation(referenceLocation) || reason.kind === 3 /* Import */, "Only synthetic references are imports");
@@ -122013,8 +122002,7 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
122013
122002
  (fileName, encoding) => !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding),
122014
122003
  getCompilerOptions,
122015
122004
  /*setParentNodes*/
122016
- void 0,
122017
- host.skipNonSemanticJSDocParsing
122005
+ void 0
122018
122006
  ),
122019
122007
  getDefaultLibLocation: maybeBind(host, host.getDefaultLibLocation),
122020
122008
  getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
@@ -122036,7 +122024,8 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
122036
122024
  getEnvironmentVariable: maybeBind(host, host.getEnvironmentVariable) || (() => ""),
122037
122025
  createHash: maybeBind(host, host.createHash),
122038
122026
  readDirectory: maybeBind(host, host.readDirectory),
122039
- storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
122027
+ storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
122028
+ jsDocParsingMode: host.jsDocParsingMode
122040
122029
  };
122041
122030
  return compilerHost;
122042
122031
  }
@@ -122200,12 +122189,11 @@ function readBuilderProgram(compilerOptions, host) {
122200
122189
  return void 0;
122201
122190
  return createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, host);
122202
122191
  }
122203
- function createIncrementalCompilerHost(options, system = sys, skipNonSemanticJSDocParsing2) {
122192
+ function createIncrementalCompilerHost(options, system = sys) {
122204
122193
  const host = createCompilerHostWorker(
122205
122194
  options,
122206
122195
  /*setParentNodes*/
122207
122196
  void 0,
122208
- skipNonSemanticJSDocParsing2,
122209
122197
  system
122210
122198
  );
122211
122199
  host.createHash = maybeBind(system, system.createHash);
@@ -125535,7 +125523,7 @@ function reportWatchModeWithoutSysSupport(sys2, reportDiagnostic) {
125535
125523
  }
125536
125524
  return false;
125537
125525
  }
125538
- var skipNonSemanticJSDocParsing = true;
125526
+ var defaultJSDocParsingMode = 2 /* ParseForTypeErrors */;
125539
125527
  function performBuild(sys2, cb, buildOptions, watchOptions, projects, errors) {
125540
125528
  const reportDiagnostic = updateReportDiagnostic(
125541
125529
  sys2,
@@ -125574,7 +125562,7 @@ function performBuild(sys2, cb, buildOptions, watchOptions, projects, errors) {
125574
125562
  createBuilderStatusReporter(sys2, shouldBePretty(sys2, buildOptions)),
125575
125563
  createWatchStatusReporter2(sys2, buildOptions)
125576
125564
  );
125577
- buildHost2.skipNonSemanticJSDocParsing = skipNonSemanticJSDocParsing;
125565
+ buildHost2.jsDocParsingMode = defaultJSDocParsingMode;
125578
125566
  const solutionPerformance2 = enableSolutionPerformance(sys2, buildOptions);
125579
125567
  updateSolutionBuilderHost(sys2, cb, buildHost2, solutionPerformance2);
125580
125568
  const onWatchStatusChange = buildHost2.onWatchStatusChange;
@@ -125599,7 +125587,7 @@ function performBuild(sys2, cb, buildOptions, watchOptions, projects, errors) {
125599
125587
  createBuilderStatusReporter(sys2, shouldBePretty(sys2, buildOptions)),
125600
125588
  createReportErrorSummary(sys2, buildOptions)
125601
125589
  );
125602
- buildHost.skipNonSemanticJSDocParsing = skipNonSemanticJSDocParsing;
125590
+ buildHost.jsDocParsingMode = defaultJSDocParsingMode;
125603
125591
  const solutionPerformance = enableSolutionPerformance(sys2, buildOptions);
125604
125592
  updateSolutionBuilderHost(sys2, cb, buildHost, solutionPerformance);
125605
125593
  const builder = createSolutionBuilder(buildHost, projects, buildOptions);
@@ -125617,9 +125605,9 @@ function performCompilation(sys2, cb, reportDiagnostic, config) {
125617
125605
  options,
125618
125606
  /*setParentNodes*/
125619
125607
  void 0,
125620
- skipNonSemanticJSDocParsing,
125621
125608
  sys2
125622
125609
  );
125610
+ host.jsDocParsingMode = defaultJSDocParsingMode;
125623
125611
  const currentDirectory = host.getCurrentDirectory();
125624
125612
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
125625
125613
  changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, currentDirectory, getCanonicalFileName));
@@ -125660,7 +125648,8 @@ function performIncrementalCompilation2(sys2, cb, reportDiagnostic, config) {
125660
125648
  /*isBuildMode*/
125661
125649
  false
125662
125650
  );
125663
- const host = createIncrementalCompilerHost(options, sys2, skipNonSemanticJSDocParsing);
125651
+ const host = createIncrementalCompilerHost(options, sys2);
125652
+ host.jsDocParsingMode = defaultJSDocParsingMode;
125664
125653
  const exitStatus = performIncrementalCompilation({
125665
125654
  host,
125666
125655
  system: sys2,
@@ -125715,7 +125704,7 @@ function updateCreateProgram(sys2, host, isBuildMode) {
125715
125704
  };
125716
125705
  }
125717
125706
  function updateWatchCompilationHost(sys2, cb, watchCompilerHost) {
125718
- watchCompilerHost.skipNonSemanticJSDocParsing = skipNonSemanticJSDocParsing;
125707
+ watchCompilerHost.jsDocParsingMode = defaultJSDocParsingMode;
125719
125708
  updateCreateProgram(
125720
125709
  sys2,
125721
125710
  watchCompilerHost,