typescript 5.5.0-dev.20240524 → 5.5.0-dev.20240525
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 +192 -139
- package/lib/typescript.js +194 -141
- package/package.json +2 -2
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.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240525`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -9693,25 +9693,19 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9693
9693
|
}
|
|
9694
9694
|
function reScanSlashToken(reportErrors2) {
|
|
9695
9695
|
if (token === 44 /* SlashToken */ || token === 69 /* SlashEqualsToken */) {
|
|
9696
|
-
|
|
9696
|
+
const startOfRegExpBody = tokenStart + 1;
|
|
9697
|
+
pos = startOfRegExpBody;
|
|
9697
9698
|
let inEscape = false;
|
|
9698
9699
|
let inCharacterClass = false;
|
|
9699
9700
|
while (true) {
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
error(Diagnostics.Unterminated_regular_expression_literal);
|
|
9703
|
-
break;
|
|
9704
|
-
}
|
|
9705
|
-
const ch = charCodeUnchecked(p);
|
|
9706
|
-
if (isLineBreak(ch)) {
|
|
9701
|
+
const ch = charCodeChecked(pos);
|
|
9702
|
+
if (ch === -1 /* EOF */ || isLineBreak(ch)) {
|
|
9707
9703
|
tokenFlags |= 4 /* Unterminated */;
|
|
9708
|
-
error(Diagnostics.Unterminated_regular_expression_literal);
|
|
9709
9704
|
break;
|
|
9710
9705
|
}
|
|
9711
9706
|
if (inEscape) {
|
|
9712
9707
|
inEscape = false;
|
|
9713
9708
|
} else if (ch === 47 /* slash */ && !inCharacterClass) {
|
|
9714
|
-
p++;
|
|
9715
9709
|
break;
|
|
9716
9710
|
} else if (ch === 91 /* openBracket */) {
|
|
9717
9711
|
inCharacterClass = true;
|
|
@@ -9720,59 +9714,86 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9720
9714
|
} else if (ch === 93 /* closeBracket */) {
|
|
9721
9715
|
inCharacterClass = false;
|
|
9722
9716
|
}
|
|
9723
|
-
|
|
9717
|
+
pos++;
|
|
9724
9718
|
}
|
|
9725
|
-
const
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9719
|
+
const endOfRegExpBody = pos;
|
|
9720
|
+
if (tokenFlags & 4 /* Unterminated */) {
|
|
9721
|
+
pos = startOfRegExpBody;
|
|
9722
|
+
inEscape = false;
|
|
9723
|
+
let characterClassDepth = 0;
|
|
9724
|
+
let inDecimalQuantifier = false;
|
|
9725
|
+
let groupDepth = 0;
|
|
9726
|
+
while (pos < endOfRegExpBody) {
|
|
9727
|
+
const ch = charCodeUnchecked(pos);
|
|
9728
|
+
if (inEscape) {
|
|
9729
|
+
inEscape = false;
|
|
9730
|
+
} else if (ch === 92 /* backslash */) {
|
|
9731
|
+
inEscape = true;
|
|
9732
|
+
} else if (ch === 91 /* openBracket */) {
|
|
9733
|
+
characterClassDepth++;
|
|
9734
|
+
} else if (ch === 93 /* closeBracket */ && characterClassDepth) {
|
|
9735
|
+
characterClassDepth--;
|
|
9736
|
+
} else if (!characterClassDepth) {
|
|
9737
|
+
if (ch === 123 /* openBrace */) {
|
|
9738
|
+
inDecimalQuantifier = true;
|
|
9739
|
+
} else if (ch === 125 /* closeBrace */ && inDecimalQuantifier) {
|
|
9740
|
+
inDecimalQuantifier = false;
|
|
9741
|
+
} else if (!inDecimalQuantifier) {
|
|
9742
|
+
if (ch === 40 /* openParen */) {
|
|
9743
|
+
groupDepth++;
|
|
9744
|
+
} else if (ch === 41 /* closeParen */ && groupDepth) {
|
|
9745
|
+
groupDepth--;
|
|
9746
|
+
} else if (ch === 41 /* closeParen */ || ch === 93 /* closeBracket */ || ch === 125 /* closeBrace */) {
|
|
9747
|
+
break;
|
|
9748
|
+
}
|
|
9749
|
+
}
|
|
9750
|
+
}
|
|
9751
|
+
pos++;
|
|
9732
9752
|
}
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9753
|
+
while (isWhiteSpaceLike(charCodeChecked(pos - 1)) || charCodeChecked(pos - 1) === 59 /* semicolon */) pos--;
|
|
9754
|
+
error(Diagnostics.Unterminated_regular_expression_literal, tokenStart, pos - tokenStart);
|
|
9755
|
+
} else {
|
|
9756
|
+
pos++;
|
|
9757
|
+
let regExpFlags = 0 /* None */;
|
|
9758
|
+
while (true) {
|
|
9759
|
+
const ch = codePointChecked(pos);
|
|
9760
|
+
if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
|
|
9761
|
+
break;
|
|
9762
|
+
}
|
|
9763
|
+
if (reportErrors2) {
|
|
9764
|
+
const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
|
|
9765
|
+
if (flag === void 0) {
|
|
9766
|
+
error(Diagnostics.Unknown_regular_expression_flag, pos, 1);
|
|
9767
|
+
} else if (regExpFlags & flag) {
|
|
9768
|
+
error(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
|
|
9769
|
+
} else if (((regExpFlags | flag) & 96 /* AnyUnicodeMode */) === 96 /* AnyUnicodeMode */) {
|
|
9770
|
+
error(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, pos, 1);
|
|
9771
|
+
} else {
|
|
9772
|
+
regExpFlags |= flag;
|
|
9773
|
+
checkRegularExpressionFlagAvailable(flag, pos);
|
|
9774
|
+
}
|
|
9744
9775
|
}
|
|
9776
|
+
pos++;
|
|
9777
|
+
}
|
|
9778
|
+
if (reportErrors2) {
|
|
9779
|
+
scanRange(startOfRegExpBody, endOfRegExpBody - startOfRegExpBody, () => {
|
|
9780
|
+
scanRegularExpressionWorker(
|
|
9781
|
+
regExpFlags,
|
|
9782
|
+
/*annexB*/
|
|
9783
|
+
true
|
|
9784
|
+
);
|
|
9785
|
+
});
|
|
9745
9786
|
}
|
|
9746
|
-
p++;
|
|
9747
|
-
}
|
|
9748
|
-
pos = p;
|
|
9749
|
-
if (reportErrors2) {
|
|
9750
|
-
const saveTokenStart = tokenStart;
|
|
9751
|
-
const saveTokenFlags = tokenFlags;
|
|
9752
|
-
const savePos = pos;
|
|
9753
|
-
const saveEnd = end;
|
|
9754
|
-
pos = tokenStart + 1;
|
|
9755
|
-
end = endOfBody;
|
|
9756
|
-
scanRegularExpressionWorker(
|
|
9757
|
-
regExpFlags,
|
|
9758
|
-
isUnterminated,
|
|
9759
|
-
/*annexB*/
|
|
9760
|
-
true
|
|
9761
|
-
);
|
|
9762
|
-
tokenStart = saveTokenStart;
|
|
9763
|
-
tokenFlags = saveTokenFlags;
|
|
9764
|
-
pos = savePos;
|
|
9765
|
-
end = saveEnd;
|
|
9766
9787
|
}
|
|
9767
9788
|
tokenValue = text.substring(tokenStart, pos);
|
|
9768
9789
|
token = 14 /* RegularExpressionLiteral */;
|
|
9769
9790
|
}
|
|
9770
9791
|
return token;
|
|
9771
9792
|
}
|
|
9772
|
-
function scanRegularExpressionWorker(regExpFlags,
|
|
9793
|
+
function scanRegularExpressionWorker(regExpFlags, annexB) {
|
|
9773
9794
|
var unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
|
|
9774
|
-
var
|
|
9775
|
-
if (
|
|
9795
|
+
var anyUnicodeMode = !!(regExpFlags & 96 /* AnyUnicodeMode */);
|
|
9796
|
+
if (anyUnicodeMode) {
|
|
9776
9797
|
annexB = false;
|
|
9777
9798
|
}
|
|
9778
9799
|
var mayContainStrings = false;
|
|
@@ -9891,7 +9912,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9891
9912
|
if (max || charCodeChecked(pos) === 125 /* closeBrace */) {
|
|
9892
9913
|
error(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
|
|
9893
9914
|
} else {
|
|
9894
|
-
if (
|
|
9915
|
+
if (anyUnicodeMode) {
|
|
9895
9916
|
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
9896
9917
|
}
|
|
9897
9918
|
isPreviousTermQuantifiable = true;
|
|
@@ -9902,7 +9923,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9902
9923
|
error(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
|
|
9903
9924
|
}
|
|
9904
9925
|
} else if (!min2) {
|
|
9905
|
-
if (
|
|
9926
|
+
if (anyUnicodeMode) {
|
|
9906
9927
|
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
|
|
9907
9928
|
}
|
|
9908
9929
|
isPreviousTermQuantifiable = true;
|
|
@@ -9942,10 +9963,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9942
9963
|
}
|
|
9943
9964
|
case 93 /* closeBracket */:
|
|
9944
9965
|
case 125 /* closeBrace */:
|
|
9945
|
-
if (
|
|
9946
|
-
return;
|
|
9947
|
-
}
|
|
9948
|
-
if (unicodeMode || ch === 41 /* closeParen */) {
|
|
9966
|
+
if (anyUnicodeMode || ch === 41 /* closeParen */) {
|
|
9949
9967
|
error(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
|
|
9950
9968
|
}
|
|
9951
9969
|
pos++;
|
|
@@ -9994,7 +10012,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
9994
10012
|
true
|
|
9995
10013
|
);
|
|
9996
10014
|
scanExpectedChar(62 /* greaterThan */);
|
|
9997
|
-
} else if (
|
|
10015
|
+
} else if (anyUnicodeMode) {
|
|
9998
10016
|
error(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
|
|
9999
10017
|
}
|
|
10000
10018
|
break;
|
|
@@ -10027,6 +10045,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10027
10045
|
Debug.assertEqual(charCodeUnchecked(pos - 1), 92 /* backslash */);
|
|
10028
10046
|
let ch = charCodeChecked(pos);
|
|
10029
10047
|
switch (ch) {
|
|
10048
|
+
case -1 /* EOF */:
|
|
10049
|
+
error(Diagnostics.Undetermined_character_escape, pos - 1, 1);
|
|
10050
|
+
return "\\";
|
|
10030
10051
|
case 99 /* c */:
|
|
10031
10052
|
pos++;
|
|
10032
10053
|
ch = charCodeChecked(pos);
|
|
@@ -10034,7 +10055,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10034
10055
|
pos++;
|
|
10035
10056
|
return String.fromCharCode(ch & 31);
|
|
10036
10057
|
}
|
|
10037
|
-
if (
|
|
10058
|
+
if (anyUnicodeMode) {
|
|
10038
10059
|
error(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
|
|
10039
10060
|
} else if (atomEscape && annexB) {
|
|
10040
10061
|
pos--;
|
|
@@ -10059,14 +10080,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10059
10080
|
pos++;
|
|
10060
10081
|
return String.fromCharCode(ch);
|
|
10061
10082
|
default:
|
|
10062
|
-
if (pos >= end) {
|
|
10063
|
-
error(Diagnostics.Undetermined_character_escape, pos - 1, 1);
|
|
10064
|
-
return "\\";
|
|
10065
|
-
}
|
|
10066
10083
|
pos--;
|
|
10067
10084
|
return scanEscapeSequence(
|
|
10068
10085
|
/*shouldEmitInvalidEscapeError*/
|
|
10069
|
-
|
|
10086
|
+
anyUnicodeMode,
|
|
10070
10087
|
/*isRegularExpression*/
|
|
10071
10088
|
annexB ? "annex-b" : true
|
|
10072
10089
|
);
|
|
@@ -10542,10 +10559,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10542
10559
|
}
|
|
10543
10560
|
}
|
|
10544
10561
|
scanExpectedChar(125 /* closeBrace */);
|
|
10545
|
-
if (!
|
|
10562
|
+
if (!anyUnicodeMode) {
|
|
10546
10563
|
error(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
|
|
10547
10564
|
}
|
|
10548
|
-
} else if (
|
|
10565
|
+
} else if (anyUnicodeMode) {
|
|
10549
10566
|
error(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
|
|
10550
10567
|
}
|
|
10551
10568
|
return true;
|
|
@@ -10565,7 +10582,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
10565
10582
|
return value;
|
|
10566
10583
|
}
|
|
10567
10584
|
function scanSourceCharacter() {
|
|
10568
|
-
const size =
|
|
10585
|
+
const size = anyUnicodeMode ? charSize(charCodeChecked(pos)) : 1;
|
|
10569
10586
|
pos += size;
|
|
10570
10587
|
return size > 0 ? text.substring(pos - size, pos) : "";
|
|
10571
10588
|
}
|
|
@@ -28415,10 +28432,7 @@ var Parser;
|
|
|
28415
28432
|
function parseErrorAtPosition(start, length2, message, ...args) {
|
|
28416
28433
|
const lastError = lastOrUndefined(parseDiagnostics);
|
|
28417
28434
|
let result;
|
|
28418
|
-
if (
|
|
28419
|
-
result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
|
|
28420
|
-
addRelatedInfo(lastError, result);
|
|
28421
|
-
} else if (!lastError || start !== lastError.start) {
|
|
28435
|
+
if (!lastError || start !== lastError.start) {
|
|
28422
28436
|
result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
|
|
28423
28437
|
parseDiagnostics.push(result);
|
|
28424
28438
|
}
|
|
@@ -49253,7 +49267,6 @@ function createTypeChecker(host) {
|
|
|
49253
49267
|
return result;
|
|
49254
49268
|
}
|
|
49255
49269
|
}
|
|
49256
|
-
context.tracker.reportInferenceFallback(existing);
|
|
49257
49270
|
return void 0;
|
|
49258
49271
|
}
|
|
49259
49272
|
function symbolToNode(symbol, context, meaning) {
|
|
@@ -51169,26 +51182,27 @@ function createTypeChecker(host) {
|
|
|
51169
51182
|
var _a;
|
|
51170
51183
|
const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
51171
51184
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
51185
|
+
const oldFlags = context.flags;
|
|
51186
|
+
if (declaration && hasInferredType(declaration) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
|
|
51187
|
+
syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, context);
|
|
51188
|
+
}
|
|
51189
|
+
context.flags |= -2147483648 /* NoSyntacticPrinter */;
|
|
51172
51190
|
if (enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
|
|
51173
51191
|
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
|
|
51174
51192
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
51175
51193
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
51176
51194
|
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
51177
51195
|
if (result2) {
|
|
51196
|
+
context.flags = oldFlags;
|
|
51178
51197
|
return result2;
|
|
51179
51198
|
}
|
|
51180
51199
|
}
|
|
51181
51200
|
}
|
|
51182
|
-
const oldFlags = context.flags;
|
|
51183
51201
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
51184
51202
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
51185
51203
|
}
|
|
51186
51204
|
const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
|
51187
51205
|
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
51188
|
-
if (decl && hasInferredType(decl) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
|
|
51189
|
-
syntacticNodeBuilder.serializeTypeOfDeclaration(decl, context);
|
|
51190
|
-
}
|
|
51191
|
-
context.flags |= -2147483648 /* NoSyntacticPrinter */;
|
|
51192
51206
|
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
|
|
51193
51207
|
context.flags = oldFlags;
|
|
51194
51208
|
return result;
|
|
@@ -110953,13 +110967,18 @@ function transformDeclarations(context) {
|
|
|
110953
110967
|
if (isDeclaration(input)) {
|
|
110954
110968
|
if (isDeclarationAndNotVisible(input)) return;
|
|
110955
110969
|
if (hasDynamicName(input)) {
|
|
110956
|
-
if (isolatedDeclarations
|
|
110957
|
-
|
|
110958
|
-
|
|
110959
|
-
|
|
110960
|
-
|
|
110961
|
-
|
|
110962
|
-
|
|
110970
|
+
if (isolatedDeclarations) {
|
|
110971
|
+
if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
|
|
110972
|
+
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
|
|
110973
|
+
return;
|
|
110974
|
+
} else if (
|
|
110975
|
+
// Type declarations just need to double-check that the input computed name is an entity name expression
|
|
110976
|
+
(isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
|
|
110977
|
+
) {
|
|
110978
|
+
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
|
|
110979
|
+
return;
|
|
110980
|
+
}
|
|
110981
|
+
} else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
|
|
110963
110982
|
return;
|
|
110964
110983
|
}
|
|
110965
110984
|
}
|
|
@@ -121851,6 +121870,7 @@ var BuilderState;
|
|
|
121851
121870
|
getKeys: (v) => reverse.get(v),
|
|
121852
121871
|
getValues: (k) => forward.get(k),
|
|
121853
121872
|
keys: () => forward.keys(),
|
|
121873
|
+
size: () => forward.size,
|
|
121854
121874
|
deleteKey: (k) => {
|
|
121855
121875
|
(deleted || (deleted = /* @__PURE__ */ new Set())).add(k);
|
|
121856
121876
|
const set = forward.get(k);
|
|
@@ -121977,12 +121997,15 @@ var BuilderState;
|
|
|
121977
121997
|
return oldState && !oldState.referencedMap === !newReferencedMap;
|
|
121978
121998
|
}
|
|
121979
121999
|
BuilderState2.canReuseOldState = canReuseOldState;
|
|
122000
|
+
function createReferencedMap(options) {
|
|
122001
|
+
return options.module !== 0 /* None */ && !options.outFile ? createManyToManyPathMap() : void 0;
|
|
122002
|
+
}
|
|
122003
|
+
BuilderState2.createReferencedMap = createReferencedMap;
|
|
121980
122004
|
function create(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
121981
122005
|
var _a, _b;
|
|
121982
122006
|
const fileInfos = /* @__PURE__ */ new Map();
|
|
121983
122007
|
const options = newProgram.getCompilerOptions();
|
|
121984
|
-
const
|
|
121985
|
-
const referencedMap = options.module !== 0 /* None */ && !isOutFile ? createManyToManyPathMap() : void 0;
|
|
122008
|
+
const referencedMap = createReferencedMap(options);
|
|
121986
122009
|
const useOldState = canReuseOldState(referencedMap, oldState);
|
|
121987
122010
|
newProgram.getTypeChecker();
|
|
121988
122011
|
for (const sourceFile of newProgram.getSourceFiles()) {
|
|
@@ -121999,7 +122022,7 @@ var BuilderState;
|
|
|
121999
122022
|
version: version2,
|
|
122000
122023
|
signature,
|
|
122001
122024
|
// No need to calculate affectsGlobalScope with --out since its not used at all
|
|
122002
|
-
affectsGlobalScope: !
|
|
122025
|
+
affectsGlobalScope: !options.outFile ? isFileAffectingGlobalScope(sourceFile) || void 0 : void 0,
|
|
122003
122026
|
impliedFormat: sourceFile.impliedNodeFormat
|
|
122004
122027
|
});
|
|
122005
122028
|
}
|
|
@@ -122276,7 +122299,7 @@ function createBuilderProgramState(newProgram, oldState) {
|
|
|
122276
122299
|
if (emitDiagnostics) {
|
|
122277
122300
|
(state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
|
|
122278
122301
|
sourceFilePath,
|
|
122279
|
-
oldState.hasReusableDiagnostic ? convertToDiagnostics(emitDiagnostics, newProgram) : repopulateDiagnostics(emitDiagnostics, newProgram)
|
|
122302
|
+
oldState.hasReusableDiagnostic ? convertToDiagnostics(emitDiagnostics, sourceFilePath, newProgram) : repopulateDiagnostics(emitDiagnostics, newProgram)
|
|
122280
122303
|
);
|
|
122281
122304
|
}
|
|
122282
122305
|
if (canCopySemanticDiagnostics) {
|
|
@@ -122286,7 +122309,7 @@ function createBuilderProgramState(newProgram, oldState) {
|
|
|
122286
122309
|
if (diagnostics) {
|
|
122287
122310
|
state.semanticDiagnosticsPerFile.set(
|
|
122288
122311
|
sourceFilePath,
|
|
122289
|
-
oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
|
|
122312
|
+
oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, sourceFilePath, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
|
|
122290
122313
|
);
|
|
122291
122314
|
(state.semanticDiagnosticsFromOldState ?? (state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set())).add(sourceFilePath);
|
|
122292
122315
|
}
|
|
@@ -122373,17 +122396,17 @@ function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram
|
|
|
122373
122396
|
function convertOrRepopulateDiagnosticMessageChainArray(array, sourceFile, newProgram, repopulateInfo) {
|
|
122374
122397
|
return sameMap(array, (chain) => convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo));
|
|
122375
122398
|
}
|
|
122376
|
-
function convertToDiagnostics(diagnostics, newProgram) {
|
|
122399
|
+
function convertToDiagnostics(diagnostics, diagnosticFilePath, newProgram) {
|
|
122377
122400
|
if (!diagnostics.length) return emptyArray;
|
|
122378
122401
|
let buildInfoDirectory;
|
|
122379
122402
|
return diagnostics.map((diagnostic) => {
|
|
122380
|
-
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPathInBuildInfoDirectory);
|
|
122403
|
+
const result = convertToDiagnosticRelatedInformation(diagnostic, diagnosticFilePath, newProgram, toPathInBuildInfoDirectory);
|
|
122381
122404
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
122382
122405
|
result.reportsDeprecated = diagnostic.reportDeprecated;
|
|
122383
122406
|
result.source = diagnostic.source;
|
|
122384
122407
|
result.skippedOn = diagnostic.skippedOn;
|
|
122385
122408
|
const { relatedInformation } = diagnostic;
|
|
122386
|
-
result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPathInBuildInfoDirectory)) : [] : void 0;
|
|
122409
|
+
result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, diagnosticFilePath, newProgram, toPathInBuildInfoDirectory)) : [] : void 0;
|
|
122387
122410
|
return result;
|
|
122388
122411
|
});
|
|
122389
122412
|
function toPathInBuildInfoDirectory(path) {
|
|
@@ -122391,9 +122414,9 @@ function convertToDiagnostics(diagnostics, newProgram) {
|
|
|
122391
122414
|
return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName);
|
|
122392
122415
|
}
|
|
122393
122416
|
}
|
|
122394
|
-
function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3) {
|
|
122417
|
+
function convertToDiagnosticRelatedInformation(diagnostic, diagnosticFilePath, newProgram, toPath3) {
|
|
122395
122418
|
const { file } = diagnostic;
|
|
122396
|
-
const sourceFile = file ? newProgram.getSourceFileByPath(toPath3(file)) : void 0;
|
|
122419
|
+
const sourceFile = file !== false ? newProgram.getSourceFileByPath(file ? toPath3(file) : diagnosticFilePath) : void 0;
|
|
122397
122420
|
return {
|
|
122398
122421
|
...diagnostic,
|
|
122399
122422
|
file: sourceFile,
|
|
@@ -122709,7 +122732,7 @@ function isProgramBundleEmitBuildInfo(info) {
|
|
|
122709
122732
|
return !!((_a = info.options) == null ? void 0 : _a.outFile);
|
|
122710
122733
|
}
|
|
122711
122734
|
function getBuildInfo2(state) {
|
|
122712
|
-
var _a;
|
|
122735
|
+
var _a, _b;
|
|
122713
122736
|
const currentDirectory = Debug.checkDefined(state.program).getCurrentDirectory();
|
|
122714
122737
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
122715
122738
|
const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
|
|
@@ -122746,7 +122769,7 @@ function getBuildInfo2(state) {
|
|
|
122746
122769
|
let fileNamesToFileIdListId;
|
|
122747
122770
|
let emitSignatures;
|
|
122748
122771
|
const fileInfos = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
|
|
122749
|
-
var _a2,
|
|
122772
|
+
var _a2, _b2;
|
|
122750
122773
|
const fileId = toFileId(key);
|
|
122751
122774
|
tryAddRoot(key, fileId);
|
|
122752
122775
|
Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
|
|
@@ -122755,7 +122778,7 @@ function getBuildInfo2(state) {
|
|
|
122755
122778
|
if (state.compilerOptions.composite) {
|
|
122756
122779
|
const file = state.program.getSourceFileByPath(key);
|
|
122757
122780
|
if (!isJsonSourceFile(file) && sourceFileMayBeEmitted(file, state.program)) {
|
|
122758
|
-
const emitSignature = (
|
|
122781
|
+
const emitSignature = (_b2 = state.emitSignatures) == null ? void 0 : _b2.get(key);
|
|
122759
122782
|
if (emitSignature !== actualSignature) {
|
|
122760
122783
|
emitSignatures = append(
|
|
122761
122784
|
emitSignatures,
|
|
@@ -122789,15 +122812,15 @@ function getBuildInfo2(state) {
|
|
|
122789
122812
|
);
|
|
122790
122813
|
});
|
|
122791
122814
|
let referencedMap;
|
|
122792
|
-
if (state.referencedMap) {
|
|
122815
|
+
if ((_a = state.referencedMap) == null ? void 0 : _a.size()) {
|
|
122793
122816
|
referencedMap = arrayFrom(state.referencedMap.keys()).sort(compareStringsCaseSensitive).map((key) => [
|
|
122794
122817
|
toFileId(key),
|
|
122795
122818
|
toFileIdListId(state.referencedMap.getValues(key))
|
|
122796
122819
|
]);
|
|
122797
122820
|
}
|
|
122798
|
-
const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(
|
|
122821
|
+
const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics();
|
|
122799
122822
|
let affectedFilesPendingEmit;
|
|
122800
|
-
if ((
|
|
122823
|
+
if ((_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.size) {
|
|
122801
122824
|
const fullEmitForOptions = getBuilderFileEmit(state.compilerOptions);
|
|
122802
122825
|
const seenFiles = /* @__PURE__ */ new Set();
|
|
122803
122826
|
for (const path of arrayFrom(state.affectedFilesPendingEmit.keys()).sort(compareStringsCaseSensitive)) {
|
|
@@ -122825,7 +122848,7 @@ function getBuildInfo2(state) {
|
|
|
122825
122848
|
changeFileSet = append(changeFileSet, toFileId(path));
|
|
122826
122849
|
}
|
|
122827
122850
|
}
|
|
122828
|
-
const emitDiagnosticsPerFile =
|
|
122851
|
+
const emitDiagnosticsPerFile = convertToProgramBuildInfoEmitDiagnostics();
|
|
122829
122852
|
const program = {
|
|
122830
122853
|
fileNames,
|
|
122831
122854
|
fileInfos,
|
|
@@ -122917,40 +122940,53 @@ function getBuildInfo2(state) {
|
|
|
122917
122940
|
}
|
|
122918
122941
|
return value;
|
|
122919
122942
|
}
|
|
122920
|
-
function convertToProgramBuildInfoDiagnostics(
|
|
122943
|
+
function convertToProgramBuildInfoDiagnostics() {
|
|
122921
122944
|
let result;
|
|
122922
|
-
|
|
122923
|
-
|
|
122924
|
-
|
|
122925
|
-
|
|
122926
|
-
|
|
122927
|
-
|
|
122928
|
-
|
|
122929
|
-
|
|
122930
|
-
|
|
122931
|
-
);
|
|
122945
|
+
state.fileInfos.forEach((_value, key) => {
|
|
122946
|
+
var _a2;
|
|
122947
|
+
const value = (_a2 = state.semanticDiagnosticsPerFile) == null ? void 0 : _a2.get(key);
|
|
122948
|
+
if (!value) {
|
|
122949
|
+
if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
|
|
122950
|
+
} else if (value.length) {
|
|
122951
|
+
result = append(result, [
|
|
122952
|
+
toFileId(key),
|
|
122953
|
+
convertToReusableDiagnostics(value, key)
|
|
122954
|
+
]);
|
|
122932
122955
|
}
|
|
122956
|
+
});
|
|
122957
|
+
return result;
|
|
122958
|
+
}
|
|
122959
|
+
function convertToProgramBuildInfoEmitDiagnostics() {
|
|
122960
|
+
var _a2;
|
|
122961
|
+
let result;
|
|
122962
|
+
if (!((_a2 = state.emitDiagnosticsPerFile) == null ? void 0 : _a2.size)) return result;
|
|
122963
|
+
for (const key of arrayFrom(state.emitDiagnosticsPerFile.keys()).sort(compareStringsCaseSensitive)) {
|
|
122964
|
+
const value = state.emitDiagnosticsPerFile.get(key);
|
|
122965
|
+
result = append(result, [
|
|
122966
|
+
toFileId(key),
|
|
122967
|
+
convertToReusableDiagnostics(value, key)
|
|
122968
|
+
]);
|
|
122933
122969
|
}
|
|
122934
122970
|
return result;
|
|
122935
122971
|
}
|
|
122936
|
-
function convertToReusableDiagnostics(diagnostics) {
|
|
122972
|
+
function convertToReusableDiagnostics(diagnostics, diagnosticFilePath) {
|
|
122937
122973
|
Debug.assert(!!diagnostics.length);
|
|
122938
122974
|
return diagnostics.map((diagnostic) => {
|
|
122939
|
-
const result = convertToReusableDiagnosticRelatedInformation(diagnostic);
|
|
122975
|
+
const result = convertToReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath);
|
|
122940
122976
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
122941
122977
|
result.reportDeprecated = diagnostic.reportsDeprecated;
|
|
122942
122978
|
result.source = diagnostic.source;
|
|
122943
122979
|
result.skippedOn = diagnostic.skippedOn;
|
|
122944
122980
|
const { relatedInformation } = diagnostic;
|
|
122945
|
-
result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r)) : [] : void 0;
|
|
122981
|
+
result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r, diagnosticFilePath)) : [] : void 0;
|
|
122946
122982
|
return result;
|
|
122947
122983
|
});
|
|
122948
122984
|
}
|
|
122949
|
-
function convertToReusableDiagnosticRelatedInformation(diagnostic) {
|
|
122985
|
+
function convertToReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath) {
|
|
122950
122986
|
const { file } = diagnostic;
|
|
122951
122987
|
return {
|
|
122952
122988
|
...diagnostic,
|
|
122953
|
-
file: file ? relativeToBuildInfo(file.resolvedPath) :
|
|
122989
|
+
file: file ? file.resolvedPath === diagnosticFilePath ? void 0 : relativeToBuildInfo(file.resolvedPath) : false,
|
|
122954
122990
|
messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
|
|
122955
122991
|
};
|
|
122956
122992
|
}
|
|
@@ -123344,16 +123380,17 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
123344
123380
|
);
|
|
123345
123381
|
}
|
|
123346
123382
|
});
|
|
123383
|
+
const changedFilesSet = new Set(map(program.changeFileSet, toFilePath));
|
|
123347
123384
|
const fullEmitForOptions = program.affectedFilesPendingEmit ? getBuilderFileEmit(program.options || {}) : void 0;
|
|
123348
123385
|
state = {
|
|
123349
123386
|
fileInfos,
|
|
123350
123387
|
compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
123351
|
-
referencedMap: toManyToManyPathMap(program.referencedMap),
|
|
123352
|
-
semanticDiagnosticsPerFile:
|
|
123353
|
-
emitDiagnosticsPerFile:
|
|
123388
|
+
referencedMap: toManyToManyPathMap(program.referencedMap, program.options ?? {}),
|
|
123389
|
+
semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile, fileInfos, changedFilesSet),
|
|
123390
|
+
emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
|
|
123354
123391
|
hasReusableDiagnostic: true,
|
|
123355
123392
|
affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
|
|
123356
|
-
changedFilesSet
|
|
123393
|
+
changedFilesSet,
|
|
123357
123394
|
latestChangedDtsFile,
|
|
123358
123395
|
emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0
|
|
123359
123396
|
};
|
|
@@ -123395,16 +123432,27 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
123395
123432
|
function toFilePathsSet(fileIdsListId) {
|
|
123396
123433
|
return filePathsSetList[fileIdsListId - 1];
|
|
123397
123434
|
}
|
|
123398
|
-
function toManyToManyPathMap(referenceMap) {
|
|
123399
|
-
|
|
123400
|
-
|
|
123401
|
-
}
|
|
123402
|
-
const map2 = BuilderState.createManyToManyPathMap();
|
|
123435
|
+
function toManyToManyPathMap(referenceMap, options) {
|
|
123436
|
+
const map2 = BuilderState.createReferencedMap(options);
|
|
123437
|
+
if (!map2 || !referenceMap) return map2;
|
|
123403
123438
|
referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
|
|
123404
123439
|
return map2;
|
|
123405
123440
|
}
|
|
123406
|
-
function
|
|
123407
|
-
|
|
123441
|
+
function toPerFileSemanticDiagnostics(diagnostics, fileInfos, changedFilesSet) {
|
|
123442
|
+
const semanticDiagnostics = new Map(
|
|
123443
|
+
mapDefinedIterator(
|
|
123444
|
+
fileInfos.keys(),
|
|
123445
|
+
(key) => !changedFilesSet.has(key) ? [key, emptyArray] : void 0
|
|
123446
|
+
)
|
|
123447
|
+
);
|
|
123448
|
+
diagnostics == null ? void 0 : diagnostics.forEach((value) => {
|
|
123449
|
+
if (isNumber(value)) semanticDiagnostics.delete(toFilePath(value));
|
|
123450
|
+
else semanticDiagnostics.set(toFilePath(value[0]), value[1]);
|
|
123451
|
+
});
|
|
123452
|
+
return semanticDiagnostics.size ? semanticDiagnostics : void 0;
|
|
123453
|
+
}
|
|
123454
|
+
function toPerFileEmitDiagnostics(diagnostics) {
|
|
123455
|
+
return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(value[0]), (value) => value[1]);
|
|
123408
123456
|
}
|
|
123409
123457
|
}
|
|
123410
123458
|
function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
|
|
@@ -126935,7 +126983,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
|
|
|
126935
126983
|
}
|
|
126936
126984
|
}
|
|
126937
126985
|
function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
126938
|
-
var _a, _b, _c;
|
|
126986
|
+
var _a, _b, _c, _d;
|
|
126939
126987
|
if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
|
|
126940
126988
|
return {
|
|
126941
126989
|
type: 15 /* ContainerOnly */
|
|
@@ -127007,7 +127055,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
127007
127055
|
};
|
|
127008
127056
|
}
|
|
127009
127057
|
if (buildInfo.program) {
|
|
127010
|
-
if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.program.emitDiagnosticsPerFile) == null ? void 0 : _c.length) :
|
|
127058
|
+
if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.program.emitDiagnosticsPerFile) == null ? void 0 : _c.length) : (_d = buildInfo.program.semanticDiagnosticsPerFile) == null ? void 0 : _d.length)) {
|
|
127011
127059
|
return {
|
|
127012
127060
|
type: 7 /* OutOfDateBuildInfo */,
|
|
127013
127061
|
buildInfoFile: buildInfoPath
|
|
@@ -128873,8 +128921,8 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
|
128873
128921
|
serializeReturnTypeForSignature,
|
|
128874
128922
|
serializeTypeOfExpression
|
|
128875
128923
|
};
|
|
128876
|
-
function serializeExistingTypeAnnotation(type) {
|
|
128877
|
-
return type
|
|
128924
|
+
function serializeExistingTypeAnnotation(type, addUndefined) {
|
|
128925
|
+
return type !== void 0 && (!addUndefined || type && canAddUndefined(type)) ? true : void 0;
|
|
128878
128926
|
}
|
|
128879
128927
|
function serializeTypeOfExpression(expr, context, addUndefined, preserveLiterals) {
|
|
128880
128928
|
return typeFromExpression(
|
|
@@ -128995,12 +129043,17 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
|
128995
129043
|
const declaredType = getEffectiveTypeAnnotationNode(node);
|
|
128996
129044
|
const addUndefined = resolver.requiresAddingImplicitUndefined(node);
|
|
128997
129045
|
let resultType;
|
|
128998
|
-
if (
|
|
128999
|
-
|
|
129000
|
-
|
|
129001
|
-
}
|
|
129046
|
+
if (declaredType) {
|
|
129047
|
+
resultType = serializeExistingTypeAnnotation(declaredType, addUndefined);
|
|
129048
|
+
} else {
|
|
129002
129049
|
if (node.initializer && isIdentifier(node.name)) {
|
|
129003
|
-
resultType = typeFromExpression(
|
|
129050
|
+
resultType = typeFromExpression(
|
|
129051
|
+
node.initializer,
|
|
129052
|
+
context,
|
|
129053
|
+
/*isConstContext*/
|
|
129054
|
+
void 0,
|
|
129055
|
+
addUndefined
|
|
129056
|
+
);
|
|
129004
129057
|
}
|
|
129005
129058
|
}
|
|
129006
129059
|
return resultType ?? inferTypeOfDeclaration(node, context);
|