@typescript-deploys/pr-build 4.7.0-pr-48792-4 → 4.7.0-pr-47461-10
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 +195 -117
- package/lib/tsserver.js +277 -165
- package/lib/tsserverlibrary.d.ts +3 -1
- package/lib/tsserverlibrary.js +277 -165
- package/lib/typescript.d.ts +3 -1
- package/lib/typescript.js +277 -165
- package/lib/typescriptServices.d.ts +3 -1
- package/lib/typescriptServices.js +277 -165
- package/lib/typingsInstaller.js +212 -133
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220425";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -14691,7 +14691,7 @@ var ts;
|
|
|
14691
14691
|
var _a;
|
|
14692
14692
|
// If we don't need to downlevel and we can reach the original source text using
|
|
14693
14693
|
// the node's parent reference, then simply get the text as it was originally written.
|
|
14694
|
-
if (canUseOriginalText(node, flags)) {
|
|
14694
|
+
if (sourceFile && canUseOriginalText(node, flags)) {
|
|
14695
14695
|
return getSourceTextOfNodeFromSourceFile(sourceFile, node);
|
|
14696
14696
|
}
|
|
14697
14697
|
// If we can't reach the original source text, use the canonical form if it's a number,
|
|
@@ -17296,11 +17296,19 @@ var ts;
|
|
|
17296
17296
|
return !!name && isDynamicName(name);
|
|
17297
17297
|
}
|
|
17298
17298
|
ts.hasDynamicName = hasDynamicName;
|
|
17299
|
+
function getComputedPropertyNameExpression(name) {
|
|
17300
|
+
return ts.isElementAccessExpression(name.expression)
|
|
17301
|
+
? skipParentheses(name.expression.argumentExpression)
|
|
17302
|
+
: name.expression;
|
|
17303
|
+
}
|
|
17304
|
+
ts.getComputedPropertyNameExpression = getComputedPropertyNameExpression;
|
|
17299
17305
|
function isDynamicName(name) {
|
|
17300
17306
|
if (!(name.kind === 162 /* ComputedPropertyName */ || name.kind === 207 /* ElementAccessExpression */)) {
|
|
17301
17307
|
return false;
|
|
17302
17308
|
}
|
|
17303
|
-
var expr = ts.isElementAccessExpression(name)
|
|
17309
|
+
var expr = ts.isElementAccessExpression(name)
|
|
17310
|
+
? skipParentheses(name.argumentExpression)
|
|
17311
|
+
: getComputedPropertyNameExpression(name);
|
|
17304
17312
|
return !isStringOrNumericLiteralLike(expr) &&
|
|
17305
17313
|
!isSignedNumericLiteral(expr);
|
|
17306
17314
|
}
|
|
@@ -17314,7 +17322,7 @@ var ts;
|
|
|
17314
17322
|
case 8 /* NumericLiteral */:
|
|
17315
17323
|
return ts.escapeLeadingUnderscores(name.text);
|
|
17316
17324
|
case 162 /* ComputedPropertyName */:
|
|
17317
|
-
var nameExpression = name
|
|
17325
|
+
var nameExpression = getComputedPropertyNameExpression(name);
|
|
17318
17326
|
if (isStringOrNumericLiteralLike(nameExpression)) {
|
|
17319
17327
|
return ts.escapeLeadingUnderscores(nameExpression.text);
|
|
17320
17328
|
}
|
|
@@ -18282,10 +18290,10 @@ var ts;
|
|
|
18282
18290
|
return ts.combinePaths(newDirPath, sourceFilePath);
|
|
18283
18291
|
}
|
|
18284
18292
|
ts.getSourceFilePathInNewDirWorker = getSourceFilePathInNewDirWorker;
|
|
18285
|
-
function writeFile(host, diagnostics, fileName,
|
|
18286
|
-
host.writeFile(fileName,
|
|
18293
|
+
function writeFile(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
|
|
18294
|
+
host.writeFile(fileName, text, writeByteOrderMark, function (hostErrorMessage) {
|
|
18287
18295
|
diagnostics.add(createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
|
|
18288
|
-
}, sourceFiles);
|
|
18296
|
+
}, sourceFiles, data);
|
|
18289
18297
|
}
|
|
18290
18298
|
ts.writeFile = writeFile;
|
|
18291
18299
|
function ensureDirectoriesExist(directoryPath, createDirectory, directoryExists) {
|
|
@@ -34212,7 +34220,7 @@ var ts;
|
|
|
34212
34220
|
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
|
|
34213
34221
|
}
|
|
34214
34222
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34215
|
-
return parseConditionalExpressionRest(expr, pos
|
|
34223
|
+
return parseConditionalExpressionRest(expr, pos);
|
|
34216
34224
|
}
|
|
34217
34225
|
function isYieldExpression() {
|
|
34218
34226
|
if (token() === 125 /* YieldKeyword */) {
|
|
@@ -34277,7 +34285,7 @@ var ts;
|
|
|
34277
34285
|
return addJSDocComment(finishNode(node, pos));
|
|
34278
34286
|
}
|
|
34279
34287
|
function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34280
|
-
var triState = isParenthesizedArrowFunctionExpression(
|
|
34288
|
+
var triState = isParenthesizedArrowFunctionExpression();
|
|
34281
34289
|
if (triState === 0 /* False */) {
|
|
34282
34290
|
// It's definitely not a parenthesized arrow function expression.
|
|
34283
34291
|
return undefined;
|
|
@@ -34287,16 +34295,16 @@ var ts;
|
|
|
34287
34295
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34288
34296
|
// expression instead.
|
|
34289
34297
|
return triState === 1 /* True */ ?
|
|
34290
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, disallowReturnTypeInArrowFunction) :
|
|
34298
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, /*disallowReturnTypeInArrowFunction*/ false) :
|
|
34291
34299
|
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
|
|
34292
34300
|
}
|
|
34293
34301
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
34294
34302
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
34295
34303
|
// Unknown -> There *might* be a parenthesized arrow function here.
|
|
34296
34304
|
// Speculatively look ahead to be sure, and rollback if not.
|
|
34297
|
-
function isParenthesizedArrowFunctionExpression(
|
|
34305
|
+
function isParenthesizedArrowFunctionExpression() {
|
|
34298
34306
|
if (token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */ || token() === 131 /* AsyncKeyword */) {
|
|
34299
|
-
return lookAhead(
|
|
34307
|
+
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
|
|
34300
34308
|
}
|
|
34301
34309
|
if (token() === 38 /* EqualsGreaterThanToken */) {
|
|
34302
34310
|
// ERROR RECOVERY TWEAK:
|
|
@@ -34307,7 +34315,7 @@ var ts;
|
|
|
34307
34315
|
// Definitely not a parenthesized arrow function.
|
|
34308
34316
|
return 0 /* False */;
|
|
34309
34317
|
}
|
|
34310
|
-
function isParenthesizedArrowFunctionExpressionWorker(
|
|
34318
|
+
function isParenthesizedArrowFunctionExpressionWorker() {
|
|
34311
34319
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34312
34320
|
nextToken();
|
|
34313
34321
|
if (scanner.hasPrecedingLineBreak()) {
|
|
@@ -34327,13 +34335,8 @@ var ts;
|
|
|
34327
34335
|
// but this is probably what the user intended.
|
|
34328
34336
|
var third = nextToken();
|
|
34329
34337
|
switch (third) {
|
|
34330
|
-
case 58 /* ColonToken */:
|
|
34331
|
-
if (disallowReturnTypeInArrowFunction) {
|
|
34332
|
-
// "a ? () : ..."
|
|
34333
|
-
return 0 /* False */;
|
|
34334
|
-
}
|
|
34335
|
-
return 1 /* True */;
|
|
34336
34338
|
case 38 /* EqualsGreaterThanToken */:
|
|
34339
|
+
case 58 /* ColonToken */:
|
|
34337
34340
|
case 18 /* OpenBraceToken */:
|
|
34338
34341
|
return 1 /* True */;
|
|
34339
34342
|
default:
|
|
@@ -34507,8 +34510,13 @@ var ts;
|
|
|
34507
34510
|
// This is a valid arrow function with "z" as the return type.
|
|
34508
34511
|
//
|
|
34509
34512
|
// But, if we're in the true side of a conditional expression, this colon
|
|
34510
|
-
// terminates the expression, so we cannot allow a return type
|
|
34513
|
+
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34511
34514
|
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34515
|
+
//
|
|
34516
|
+
// For example,
|
|
34517
|
+
// a() ? (b: number, c?: string): void => d() : e
|
|
34518
|
+
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34519
|
+
// be an arrow expression, so we allow a return type.
|
|
34512
34520
|
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34513
34521
|
return undefined;
|
|
34514
34522
|
}
|
|
@@ -34578,7 +34586,7 @@ var ts;
|
|
|
34578
34586
|
topLevel = savedTopLevel;
|
|
34579
34587
|
return node;
|
|
34580
34588
|
}
|
|
34581
|
-
function parseConditionalExpressionRest(leftOperand, pos
|
|
34589
|
+
function parseConditionalExpressionRest(leftOperand, pos) {
|
|
34582
34590
|
// Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
|
|
34583
34591
|
var questionToken = parseOptionalToken(57 /* QuestionToken */);
|
|
34584
34592
|
if (!questionToken) {
|
|
@@ -34588,7 +34596,7 @@ var ts;
|
|
|
34588
34596
|
// we do not that for the 'whenFalse' part.
|
|
34589
34597
|
var colonToken;
|
|
34590
34598
|
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34591
|
-
? parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction)
|
|
34599
|
+
? parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true)
|
|
34592
34600
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34593
34601
|
}
|
|
34594
34602
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -44436,7 +44444,7 @@ var ts;
|
|
|
44436
44444
|
return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
|
|
44437
44445
|
}
|
|
44438
44446
|
if (name.kind === 162 /* ComputedPropertyName */) {
|
|
44439
|
-
var nameExpression = name
|
|
44447
|
+
var nameExpression = ts.getComputedPropertyNameExpression(name);
|
|
44440
44448
|
// treat computed property names where expression is string/numeric literal as just string/numeric literal
|
|
44441
44449
|
if (ts.isStringOrNumericLiteralLike(nameExpression)) {
|
|
44442
44450
|
return ts.escapeLeadingUnderscores(nameExpression.text);
|
|
@@ -73421,6 +73429,7 @@ var ts;
|
|
|
73421
73429
|
}
|
|
73422
73430
|
}
|
|
73423
73431
|
else {
|
|
73432
|
+
error(attributeDecl.expression, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
73424
73433
|
typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
|
|
73425
73434
|
}
|
|
73426
73435
|
}
|
|
@@ -75658,6 +75667,7 @@ var ts;
|
|
|
75658
75667
|
// decorators are applied to a declaration by the emitter, and not to an expression.
|
|
75659
75668
|
var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
75660
75669
|
var argCheckMode = !isDecorator && !isSingleNonGenericCandidate && ts.some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
75670
|
+
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
75661
75671
|
// The following variables are captured and modified by calls to chooseOverload.
|
|
75662
75672
|
// If overload resolution or type argument inference fails, we want to report the
|
|
75663
75673
|
// best error possible. The best error is one which says that an argument was not
|
|
@@ -75873,7 +75883,7 @@ var ts;
|
|
|
75873
75883
|
// If one or more context sensitive arguments were excluded, we start including
|
|
75874
75884
|
// them now (and keeping do so for any subsequent candidates) and perform a second
|
|
75875
75885
|
// round of type inference and applicability checking for this particular candidate.
|
|
75876
|
-
argCheckMode =
|
|
75886
|
+
argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
75877
75887
|
if (inferenceContext) {
|
|
75878
75888
|
var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
75879
75889
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -109955,6 +109965,7 @@ var ts;
|
|
|
109955
109965
|
else {
|
|
109956
109966
|
printer.writeFile(sourceFile, writer, sourceMapGenerator);
|
|
109957
109967
|
}
|
|
109968
|
+
var sourceMapUrlPos;
|
|
109958
109969
|
if (sourceMapGenerator) {
|
|
109959
109970
|
if (sourceMapDataList) {
|
|
109960
109971
|
sourceMapDataList.push({
|
|
@@ -109966,6 +109977,7 @@ var ts;
|
|
|
109966
109977
|
if (sourceMappingURL) {
|
|
109967
109978
|
if (!writer.isAtStartOfLine())
|
|
109968
109979
|
writer.rawWrite(newLine);
|
|
109980
|
+
sourceMapUrlPos = writer.getTextPos();
|
|
109969
109981
|
writer.writeComment("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Tools can sometimes see this line as a source mapping url comment
|
|
109970
109982
|
}
|
|
109971
109983
|
// Write the source map
|
|
@@ -109978,7 +109990,7 @@ var ts;
|
|
|
109978
109990
|
writer.writeLine();
|
|
109979
109991
|
}
|
|
109980
109992
|
// Write the output file
|
|
109981
|
-
ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles);
|
|
109993
|
+
ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
|
|
109982
109994
|
// Reset state
|
|
109983
109995
|
writer.clear();
|
|
109984
109996
|
}
|
|
@@ -110500,7 +110512,7 @@ var ts;
|
|
|
110500
110512
|
setWriter(/*output*/ undefined, /*_sourceMapGenerator*/ undefined);
|
|
110501
110513
|
}
|
|
110502
110514
|
function getCurrentLineMap() {
|
|
110503
|
-
return currentLineMap || (currentLineMap = ts.getLineStarts(currentSourceFile));
|
|
110515
|
+
return currentLineMap || (currentLineMap = ts.getLineStarts(ts.Debug.checkDefined(currentSourceFile)));
|
|
110504
110516
|
}
|
|
110505
110517
|
function emit(node, parenthesizerRule) {
|
|
110506
110518
|
if (node === undefined)
|
|
@@ -111675,7 +111687,7 @@ var ts;
|
|
|
111675
111687
|
increaseIndent();
|
|
111676
111688
|
}
|
|
111677
111689
|
var preferNewLine = node.multiLine ? 65536 /* PreferNewLine */ : 0 /* None */;
|
|
111678
|
-
var allowTrailingComma = currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
|
|
111690
|
+
var allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
|
|
111679
111691
|
emitList(node, node.properties, 526226 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine);
|
|
111680
111692
|
if (indentedFlag) {
|
|
111681
111693
|
decreaseIndent();
|
|
@@ -112031,7 +112043,7 @@ var ts;
|
|
|
112031
112043
|
emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfExpressionStatement);
|
|
112032
112044
|
// Emit semicolon in non json files
|
|
112033
112045
|
// or if json file that created synthesized expression(eg.define expression statement when --out and amd code generation)
|
|
112034
|
-
if (!ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
|
|
112046
|
+
if (!currentSourceFile || !ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
|
|
112035
112047
|
writeTrailingSemicolon();
|
|
112036
112048
|
}
|
|
112037
112049
|
}
|
|
@@ -112324,7 +112336,7 @@ var ts;
|
|
|
112324
112336
|
if (body.multiLine) {
|
|
112325
112337
|
return false;
|
|
112326
112338
|
}
|
|
112327
|
-
if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
|
|
112339
|
+
if (!ts.nodeIsSynthesized(body) && currentSourceFile && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
|
|
112328
112340
|
return false;
|
|
112329
112341
|
}
|
|
112330
112342
|
if (getLeadingLineTerminatorCount(body, body.statements, 2 /* PreserveLines */)
|
|
@@ -112349,12 +112361,7 @@ var ts;
|
|
|
112349
112361
|
var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body)
|
|
112350
112362
|
? emitBlockFunctionBodyOnSingleLine
|
|
112351
112363
|
: emitBlockFunctionBodyWorker;
|
|
112352
|
-
|
|
112353
|
-
emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
|
|
112354
|
-
}
|
|
112355
|
-
else {
|
|
112356
|
-
emitBlockFunctionBody(body);
|
|
112357
|
-
}
|
|
112364
|
+
emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
|
|
112358
112365
|
decreaseIndent();
|
|
112359
112366
|
writeToken(19 /* CloseBraceToken */, body.statements.end, writePunctuation, body);
|
|
112360
112367
|
onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(body);
|
|
@@ -112751,7 +112758,8 @@ var ts;
|
|
|
112751
112758
|
var emitAsSingleStatement = statements.length === 1 &&
|
|
112752
112759
|
(
|
|
112753
112760
|
// treat synthesized nodes as located on the same line for emit purposes
|
|
112754
|
-
|
|
112761
|
+
!currentSourceFile ||
|
|
112762
|
+
ts.nodeIsSynthesized(parentNode) ||
|
|
112755
112763
|
ts.nodeIsSynthesized(statements[0]) ||
|
|
112756
112764
|
ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));
|
|
112757
112765
|
var format = 163969 /* CaseOrDefaultClauseStatements */;
|
|
@@ -112982,16 +112990,14 @@ var ts;
|
|
|
112982
112990
|
function emitSourceFile(node) {
|
|
112983
112991
|
writeLine();
|
|
112984
112992
|
var statements = node.statements;
|
|
112985
|
-
if
|
|
112986
|
-
|
|
112987
|
-
|
|
112988
|
-
|
|
112989
|
-
|
|
112990
|
-
|
|
112991
|
-
|
|
112992
|
-
|
|
112993
|
-
return;
|
|
112994
|
-
}
|
|
112993
|
+
// Emit detached comment if there are no prologue directives or if the first node is synthesized.
|
|
112994
|
+
// The synthesized node will have no leading comment so some comments may be missed.
|
|
112995
|
+
var shouldEmitDetachedComment = statements.length === 0 ||
|
|
112996
|
+
!ts.isPrologueDirective(statements[0]) ||
|
|
112997
|
+
ts.nodeIsSynthesized(statements[0]);
|
|
112998
|
+
if (shouldEmitDetachedComment) {
|
|
112999
|
+
emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
|
|
113000
|
+
return;
|
|
112995
113001
|
}
|
|
112996
113002
|
emitSourceFileWorker(node);
|
|
112997
113003
|
}
|
|
@@ -113380,7 +113386,7 @@ var ts;
|
|
|
113380
113386
|
}
|
|
113381
113387
|
if (isEmpty) {
|
|
113382
113388
|
// Write a line terminator if the parent node was multi-line
|
|
113383
|
-
if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
|
|
113389
|
+
if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
|
|
113384
113390
|
writeLine();
|
|
113385
113391
|
}
|
|
113386
113392
|
else if (format & 256 /* SpaceBetweenBraces */ && !(format & 524288 /* NoSpaceIfEmpty */)) {
|
|
@@ -113641,7 +113647,7 @@ var ts;
|
|
|
113641
113647
|
}
|
|
113642
113648
|
var firstChild_1 = children[0];
|
|
113643
113649
|
if (firstChild_1 === undefined) {
|
|
113644
|
-
return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113650
|
+
return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113645
113651
|
}
|
|
113646
113652
|
if (firstChild_1.pos === nextListElementPos) {
|
|
113647
113653
|
// If this child starts at the beginning of a list item in a parent list, its leading
|
|
@@ -113665,7 +113671,7 @@ var ts;
|
|
|
113665
113671
|
// JsxText will be written with its leading whitespace, so don't add more manually.
|
|
113666
113672
|
return 0;
|
|
113667
113673
|
}
|
|
113668
|
-
if (parentNode &&
|
|
113674
|
+
if (currentSourceFile && parentNode &&
|
|
113669
113675
|
!ts.positionIsSynthesized(parentNode.pos) &&
|
|
113670
113676
|
!ts.nodeIsSynthesized(firstChild_1) &&
|
|
113671
113677
|
(!firstChild_1.parent || ts.getOriginalNode(firstChild_1.parent) === ts.getOriginalNode(parentNode))) {
|
|
@@ -113689,7 +113695,7 @@ var ts;
|
|
|
113689
113695
|
// JsxText will be written with its leading whitespace, so don't add more manually.
|
|
113690
113696
|
return 0;
|
|
113691
113697
|
}
|
|
113692
|
-
else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
|
|
113698
|
+
else if (currentSourceFile && !ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
|
|
113693
113699
|
if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
|
|
113694
113700
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
|
|
113695
113701
|
}
|
|
@@ -113721,9 +113727,9 @@ var ts;
|
|
|
113721
113727
|
}
|
|
113722
113728
|
var lastChild = ts.lastOrUndefined(children);
|
|
113723
113729
|
if (lastChild === undefined) {
|
|
113724
|
-
return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113730
|
+
return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113725
113731
|
}
|
|
113726
|
-
if (parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
|
|
113732
|
+
if (currentSourceFile && parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
|
|
113727
113733
|
if (preserveSourceNewlines) {
|
|
113728
113734
|
var end_1 = ts.isNodeArray(children) && !ts.positionIsSynthesized(children.end) ? children.end : lastChild.end;
|
|
113729
113735
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter(end_1, parentNode.end, currentSourceFile, includeComments); });
|
|
@@ -113796,7 +113802,7 @@ var ts;
|
|
|
113796
113802
|
if (ts.getStartsOnNewLine(node2)) {
|
|
113797
113803
|
return 1;
|
|
113798
113804
|
}
|
|
113799
|
-
if (!ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
|
|
113805
|
+
if (currentSourceFile && !ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
|
|
113800
113806
|
if (preserveSourceNewlines) {
|
|
113801
113807
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(node1, node2, currentSourceFile, includeComments); });
|
|
113802
113808
|
}
|
|
@@ -113806,7 +113812,7 @@ var ts;
|
|
|
113806
113812
|
}
|
|
113807
113813
|
function isEmptyBlock(block) {
|
|
113808
113814
|
return block.statements.length === 0
|
|
113809
|
-
&& ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
|
|
113815
|
+
&& (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile));
|
|
113810
113816
|
}
|
|
113811
113817
|
function skipSynthesizedParentheses(node) {
|
|
113812
113818
|
while (node.kind === 212 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
|
|
@@ -113818,16 +113824,23 @@ var ts;
|
|
|
113818
113824
|
if (ts.isGeneratedIdentifier(node)) {
|
|
113819
113825
|
return generateName(node);
|
|
113820
113826
|
}
|
|
113821
|
-
|
|
113822
|
-
return ts.idText(node);
|
|
113823
|
-
}
|
|
113824
|
-
else if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
|
|
113827
|
+
if (ts.isStringLiteral(node) && node.textSourceNode) {
|
|
113825
113828
|
return getTextOfNode(node.textSourceNode, includeTrivia);
|
|
113826
113829
|
}
|
|
113827
|
-
|
|
113828
|
-
|
|
113830
|
+
var sourceFile = currentSourceFile; // const needed for control flow
|
|
113831
|
+
var canUseSourceFile = !!sourceFile && !!node.parent && !ts.nodeIsSynthesized(node);
|
|
113832
|
+
if (ts.isMemberName(node)) {
|
|
113833
|
+
if (!canUseSourceFile || ts.getSourceFileOfNode(node) !== ts.getOriginalNode(sourceFile)) {
|
|
113834
|
+
return ts.idText(node);
|
|
113835
|
+
}
|
|
113829
113836
|
}
|
|
113830
|
-
|
|
113837
|
+
else {
|
|
113838
|
+
ts.Debug.assertNode(node, ts.isLiteralExpression); // not strictly necessary
|
|
113839
|
+
if (!canUseSourceFile) {
|
|
113840
|
+
return node.text;
|
|
113841
|
+
}
|
|
113842
|
+
}
|
|
113843
|
+
return ts.getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
|
|
113831
113844
|
}
|
|
113832
113845
|
function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
|
|
113833
113846
|
if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
|
|
@@ -114406,7 +114419,7 @@ var ts;
|
|
|
114406
114419
|
return true;
|
|
114407
114420
|
}
|
|
114408
114421
|
function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
|
|
114409
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114422
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114410
114423
|
return;
|
|
114411
114424
|
if (!hasWrittenComment) {
|
|
114412
114425
|
ts.emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos);
|
|
@@ -114433,7 +114446,7 @@ var ts;
|
|
|
114433
114446
|
forEachTrailingCommentToEmit(pos, emitTrailingComment);
|
|
114434
114447
|
}
|
|
114435
114448
|
function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
|
|
114436
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114449
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114437
114450
|
return;
|
|
114438
114451
|
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment2*/
|
|
114439
114452
|
if (!writer.isAtStartOfLine()) {
|
|
@@ -114455,6 +114468,8 @@ var ts;
|
|
|
114455
114468
|
exitComment();
|
|
114456
114469
|
}
|
|
114457
114470
|
function emitTrailingCommentOfPositionNoNewline(commentPos, commentEnd, kind) {
|
|
114471
|
+
if (!currentSourceFile)
|
|
114472
|
+
return;
|
|
114458
114473
|
// trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
|
|
114459
114474
|
emitPos(commentPos);
|
|
114460
114475
|
ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
|
|
@@ -114464,6 +114479,8 @@ var ts;
|
|
|
114464
114479
|
}
|
|
114465
114480
|
}
|
|
114466
114481
|
function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
|
|
114482
|
+
if (!currentSourceFile)
|
|
114483
|
+
return;
|
|
114467
114484
|
// trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
|
|
114468
114485
|
emitPos(commentPos);
|
|
114469
114486
|
ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
|
|
@@ -114496,6 +114513,8 @@ var ts;
|
|
|
114496
114513
|
return detachedCommentsInfo !== undefined && ts.last(detachedCommentsInfo).nodePos === pos;
|
|
114497
114514
|
}
|
|
114498
114515
|
function forEachLeadingCommentWithoutDetachedComments(cb) {
|
|
114516
|
+
if (!currentSourceFile)
|
|
114517
|
+
return;
|
|
114499
114518
|
// get the leading comments from detachedPos
|
|
114500
114519
|
var pos = ts.last(detachedCommentsInfo).detachedCommentEndPos;
|
|
114501
114520
|
if (detachedCommentsInfo.length - 1) {
|
|
@@ -114507,7 +114526,7 @@ var ts;
|
|
|
114507
114526
|
ts.forEachLeadingCommentRange(currentSourceFile.text, pos, cb, /*state*/ pos);
|
|
114508
114527
|
}
|
|
114509
114528
|
function emitDetachedCommentsAndUpdateCommentsInfo(range) {
|
|
114510
|
-
var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
|
|
114529
|
+
var currentDetachedCommentInfo = currentSourceFile && ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
|
|
114511
114530
|
if (currentDetachedCommentInfo) {
|
|
114512
114531
|
if (detachedCommentsInfo) {
|
|
114513
114532
|
detachedCommentsInfo.push(currentDetachedCommentInfo);
|
|
@@ -114518,7 +114537,7 @@ var ts;
|
|
|
114518
114537
|
}
|
|
114519
114538
|
}
|
|
114520
114539
|
function emitComment(text, lineMap, writer, commentPos, commentEnd, newLine) {
|
|
114521
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114540
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114522
114541
|
return;
|
|
114523
114542
|
emitPos(commentPos);
|
|
114524
114543
|
ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);
|
|
@@ -114530,7 +114549,7 @@ var ts;
|
|
|
114530
114549
|
* @return true if the comment is a triple-slash comment else false
|
|
114531
114550
|
*/
|
|
114532
114551
|
function isTripleSlashComment(commentPos, commentEnd) {
|
|
114533
|
-
return ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
|
|
114552
|
+
return !!currentSourceFile && ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
|
|
114534
114553
|
}
|
|
114535
114554
|
// Source Maps
|
|
114536
114555
|
function getParsedSourceMap(node) {
|
|
@@ -115445,7 +115464,11 @@ var ts;
|
|
|
115445
115464
|
return newValue;
|
|
115446
115465
|
};
|
|
115447
115466
|
if (originalWriteFile) {
|
|
115448
|
-
host.writeFile = function (fileName, data
|
|
115467
|
+
host.writeFile = function (fileName, data) {
|
|
115468
|
+
var rest = [];
|
|
115469
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
115470
|
+
rest[_i - 2] = arguments[_i];
|
|
115471
|
+
}
|
|
115449
115472
|
var key = toPath(fileName);
|
|
115450
115473
|
fileExistsCache.delete(key);
|
|
115451
115474
|
var value = readFileCache.get(key);
|
|
@@ -115459,7 +115482,7 @@ var ts;
|
|
|
115459
115482
|
sourceFileCache.delete(key);
|
|
115460
115483
|
}
|
|
115461
115484
|
}
|
|
115462
|
-
originalWriteFile.call(host, fileName, data,
|
|
115485
|
+
originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false));
|
|
115463
115486
|
};
|
|
115464
115487
|
}
|
|
115465
115488
|
// directoryExists
|
|
@@ -116392,6 +116415,7 @@ var ts;
|
|
|
116392
116415
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
116393
116416
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
116394
116417
|
structureIsReused: structureIsReused,
|
|
116418
|
+
writeFile: writeFile,
|
|
116395
116419
|
};
|
|
116396
116420
|
onProgramCreateComplete();
|
|
116397
116421
|
// Add file processingDiagnostics
|
|
@@ -116889,7 +116913,7 @@ var ts;
|
|
|
116889
116913
|
getProjectReferenceRedirect: getProjectReferenceRedirect,
|
|
116890
116914
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
116891
116915
|
getSymlinkCache: getSymlinkCache,
|
|
116892
|
-
writeFile: writeFileCallback ||
|
|
116916
|
+
writeFile: writeFileCallback || writeFile,
|
|
116893
116917
|
isEmitBlocked: isEmitBlocked,
|
|
116894
116918
|
readFile: function (f) { return host.readFile(f); },
|
|
116895
116919
|
fileExists: function (f) {
|
|
@@ -116909,6 +116933,9 @@ var ts;
|
|
|
116909
116933
|
getFileIncludeReasons: program.getFileIncludeReasons,
|
|
116910
116934
|
};
|
|
116911
116935
|
}
|
|
116936
|
+
function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
116937
|
+
host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
116938
|
+
}
|
|
116912
116939
|
function emitBuildInfo(writeFileCallback) {
|
|
116913
116940
|
ts.Debug.assert(!ts.outFile(options));
|
|
116914
116941
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emitBuildInfo", {}, /*separateBeginAndEnd*/ true);
|
|
@@ -119351,6 +119378,7 @@ var ts;
|
|
|
119351
119378
|
}
|
|
119352
119379
|
}
|
|
119353
119380
|
}
|
|
119381
|
+
BuilderState.updateExportedModules = updateExportedModules;
|
|
119354
119382
|
/**
|
|
119355
119383
|
* Updates the exported modules from cache into state's exported modules map
|
|
119356
119384
|
* This should be called whenever it is safe to commit the state of the builder
|
|
@@ -119774,6 +119802,18 @@ var ts;
|
|
|
119774
119802
|
}
|
|
119775
119803
|
return undefined;
|
|
119776
119804
|
}
|
|
119805
|
+
function removeDiagnosticsOfLibraryFiles(state) {
|
|
119806
|
+
if (!state.cleanedDiagnosticsOfLibFiles) {
|
|
119807
|
+
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119808
|
+
var program_1 = ts.Debug.checkDefined(state.program);
|
|
119809
|
+
var options_2 = program_1.getCompilerOptions();
|
|
119810
|
+
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
119811
|
+
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
119812
|
+
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
119813
|
+
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
119814
|
+
});
|
|
119815
|
+
}
|
|
119816
|
+
}
|
|
119777
119817
|
/**
|
|
119778
119818
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119779
119819
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
@@ -119783,28 +119823,17 @@ var ts;
|
|
|
119783
119823
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119784
119824
|
// If affected files is everything except default library, then nothing more to do
|
|
119785
119825
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
119786
|
-
|
|
119787
|
-
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119788
|
-
var program_1 = ts.Debug.checkDefined(state.program);
|
|
119789
|
-
var options_2 = program_1.getCompilerOptions();
|
|
119790
|
-
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
119791
|
-
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
119792
|
-
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
119793
|
-
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
119794
|
-
});
|
|
119795
|
-
}
|
|
119826
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
119796
119827
|
// When a change affects the global scope, all files are considered to be affected without updating their signature
|
|
119797
119828
|
// That means when affected file is handled, its signature can be out of date
|
|
119798
119829
|
// To avoid this, ensure that we update the signature for any affected file in this scenario.
|
|
119799
119830
|
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
|
|
119800
119831
|
return;
|
|
119801
119832
|
}
|
|
119802
|
-
|
|
119803
|
-
|
|
119804
|
-
|
|
119805
|
-
|
|
119806
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
119807
|
-
}
|
|
119833
|
+
ts.Debug.assert(state.hasCalledUpdateShapeSignature.has(affectedFile.resolvedPath) || ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.has(affectedFile.resolvedPath)), "Signature not updated for affected file: " + affectedFile.fileName);
|
|
119834
|
+
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
119835
|
+
return;
|
|
119836
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
119808
119837
|
}
|
|
119809
119838
|
/**
|
|
119810
119839
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
@@ -119846,16 +119875,41 @@ var ts;
|
|
|
119846
119875
|
var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
119847
119876
|
return newSignature !== oldSignature;
|
|
119848
119877
|
}
|
|
119878
|
+
function forEachKeyOfExportedModulesMap(state, filePath, fn) {
|
|
119879
|
+
// Go through exported modules from cache first
|
|
119880
|
+
var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
|
|
119881
|
+
var result = keys && ts.forEachKey(keys, fn);
|
|
119882
|
+
if (result)
|
|
119883
|
+
return result;
|
|
119884
|
+
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
119885
|
+
keys = state.exportedModulesMap.getKeys(filePath);
|
|
119886
|
+
return keys && ts.forEachKey(keys, function (exportedFromPath) {
|
|
119887
|
+
var _a;
|
|
119888
|
+
// If the cache had an updated value, skip
|
|
119889
|
+
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119890
|
+
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
|
|
119891
|
+
fn(exportedFromPath) :
|
|
119892
|
+
undefined;
|
|
119893
|
+
});
|
|
119894
|
+
}
|
|
119895
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
|
|
119896
|
+
var _a;
|
|
119897
|
+
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
119898
|
+
return false;
|
|
119899
|
+
// Every file needs to be handled
|
|
119900
|
+
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
|
|
119901
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
|
|
119902
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
119903
|
+
return true;
|
|
119904
|
+
}
|
|
119849
119905
|
/**
|
|
119850
|
-
* Iterate on referencing modules that export entities from affected file
|
|
119906
|
+
* Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
|
|
119851
119907
|
*/
|
|
119852
|
-
function
|
|
119853
|
-
var _a, _b;
|
|
119908
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
119854
119909
|
// If there was change in signature (dts output) for the changed file,
|
|
119855
119910
|
// then only we need to handle pending file emit
|
|
119856
|
-
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
119911
|
+
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
119857
119912
|
return;
|
|
119858
|
-
}
|
|
119859
119913
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
119860
119914
|
return;
|
|
119861
119915
|
// Since isolated modules dont change js files, files affected by change in signature is itself
|
|
@@ -119868,7 +119922,9 @@ var ts;
|
|
|
119868
119922
|
var currentPath = queue.pop();
|
|
119869
119923
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
119870
119924
|
seenFileNamesMap.set(currentPath, true);
|
|
119871
|
-
|
|
119925
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
|
|
119926
|
+
return;
|
|
119927
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
|
|
119872
119928
|
if (isChangedSignature(state, currentPath)) {
|
|
119873
119929
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
119874
119930
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -119880,56 +119936,38 @@ var ts;
|
|
|
119880
119936
|
var seenFileAndExportsOfFile = new ts.Set();
|
|
119881
119937
|
// Go through exported modules from cache first
|
|
119882
119938
|
// If exported modules has path, all files referencing file exported from are affected
|
|
119883
|
-
(
|
|
119884
|
-
|
|
119885
|
-
|
|
119886
|
-
|
|
119887
|
-
|
|
119888
|
-
|
|
119889
|
-
|
|
119890
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119891
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
119892
|
-
forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
119939
|
+
forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
|
|
119940
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
|
|
119941
|
+
return true;
|
|
119942
|
+
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
119943
|
+
return references && ts.forEachKey(references, function (filePath) {
|
|
119944
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
119945
|
+
});
|
|
119893
119946
|
});
|
|
119894
119947
|
}
|
|
119895
119948
|
/**
|
|
119896
|
-
*
|
|
119949
|
+
* handle dts and semantic diagnostics on file and iterate on anything that exports this file
|
|
119950
|
+
* return true when all work is done and we can exit handling dts emit and semantic diagnostics
|
|
119897
119951
|
*/
|
|
119898
|
-
function
|
|
119952
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
|
|
119899
119953
|
var _a;
|
|
119900
|
-
|
|
119901
|
-
return
|
|
119902
|
-
|
|
119903
|
-
|
|
119904
|
-
|
|
119905
|
-
* fn on file and iterate on anything that exports this file
|
|
119906
|
-
*/
|
|
119907
|
-
function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
|
|
119908
|
-
var _a, _b, _c;
|
|
119909
|
-
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath)) {
|
|
119910
|
-
return;
|
|
119911
|
-
}
|
|
119912
|
-
fn(state, filePath);
|
|
119954
|
+
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
119955
|
+
return undefined;
|
|
119956
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
|
|
119957
|
+
return true;
|
|
119958
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
|
|
119913
119959
|
ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
|
|
119914
|
-
// Go through exported modules from cache first
|
|
119915
119960
|
// If exported modules has path, all files referencing file exported from are affected
|
|
119916
|
-
(
|
|
119917
|
-
return
|
|
119918
|
-
});
|
|
119919
|
-
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
119920
|
-
(_b = state.exportedModulesMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
|
|
119921
|
-
var _a;
|
|
119922
|
-
// If the cache had an updated value, skip
|
|
119923
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119924
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
119925
|
-
forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
119961
|
+
forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
|
|
119962
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
119926
119963
|
});
|
|
119927
119964
|
// Remove diagnostics of files that import this file (without going to exports of referencing files)
|
|
119928
|
-
(
|
|
119965
|
+
(_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
|
|
119929
119966
|
return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
119930
|
-
|
|
119931
|
-
|
|
119932
|
-
);
|
|
119967
|
+
handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
|
|
119968
|
+
state, referencingFilePath, cancellationToken, computeHash, host);
|
|
119969
|
+
});
|
|
119970
|
+
return undefined;
|
|
119933
119971
|
}
|
|
119934
119972
|
/**
|
|
119935
119973
|
* This is called after completing operation on the next affected file.
|
|
@@ -120305,7 +120343,43 @@ var ts;
|
|
|
120305
120343
|
return toAffectedFileEmitResult(state,
|
|
120306
120344
|
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
|
120307
120345
|
// Otherwise just affected file
|
|
120308
|
-
ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected,
|
|
120346
|
+
ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
|
|
120347
|
+
getWriteFileUpdatingSignatureCallback(writeFile) :
|
|
120348
|
+
writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
|
|
120349
|
+
}
|
|
120350
|
+
function getWriteFileUpdatingSignatureCallback(writeFile) {
|
|
120351
|
+
return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
120352
|
+
var _a;
|
|
120353
|
+
if (ts.isDeclarationFileName(fileName)) {
|
|
120354
|
+
ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
|
|
120355
|
+
var file = sourceFiles[0];
|
|
120356
|
+
var info = state.fileInfos.get(file.resolvedPath);
|
|
120357
|
+
var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
|
|
120358
|
+
if (signature === file.version) {
|
|
120359
|
+
var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
|
|
120360
|
+
if (newSignature !== file.version) { // Update it
|
|
120361
|
+
if (host.storeFilesChangingSignatureDuringEmit)
|
|
120362
|
+
(state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
|
|
120363
|
+
if (state.exportedModulesMap)
|
|
120364
|
+
ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
|
|
120365
|
+
if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
|
|
120366
|
+
state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
|
|
120367
|
+
}
|
|
120368
|
+
else {
|
|
120369
|
+
info.signature = newSignature;
|
|
120370
|
+
if (state.exportedModulesMap)
|
|
120371
|
+
ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
|
|
120372
|
+
}
|
|
120373
|
+
}
|
|
120374
|
+
}
|
|
120375
|
+
}
|
|
120376
|
+
if (writeFile)
|
|
120377
|
+
writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
120378
|
+
else if (host.writeFile)
|
|
120379
|
+
host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
120380
|
+
else
|
|
120381
|
+
state.program.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
120382
|
+
};
|
|
120309
120383
|
}
|
|
120310
120384
|
/**
|
|
120311
120385
|
* Emits the JavaScript and declaration files.
|
|
@@ -120362,7 +120436,9 @@ var ts;
|
|
|
120362
120436
|
}
|
|
120363
120437
|
}
|
|
120364
120438
|
}
|
|
120365
|
-
return ts.Debug.checkDefined(state.program).emit(targetSourceFile,
|
|
120439
|
+
return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
|
|
120440
|
+
getWriteFileUpdatingSignatureCallback(writeFile) :
|
|
120441
|
+
writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
120366
120442
|
}
|
|
120367
120443
|
/**
|
|
120368
120444
|
* Return the semantic diagnostics for the next affected file or undefined if iteration is complete
|
|
@@ -122554,6 +122630,7 @@ var ts;
|
|
|
122554
122630
|
createHash: ts.maybeBind(host, host.createHash),
|
|
122555
122631
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
122556
122632
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
122633
|
+
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
122557
122634
|
};
|
|
122558
122635
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
122559
122636
|
try {
|
|
@@ -122613,6 +122690,7 @@ var ts;
|
|
|
122613
122690
|
createHash: ts.maybeBind(system, system.createHash),
|
|
122614
122691
|
createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
|
|
122615
122692
|
disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
|
|
122693
|
+
storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
|
|
122616
122694
|
};
|
|
122617
122695
|
}
|
|
122618
122696
|
ts.createProgramHost = createProgramHost;
|
|
@@ -122701,6 +122779,7 @@ var ts;
|
|
|
122701
122779
|
var host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, system);
|
|
122702
122780
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
122703
122781
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
122782
|
+
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
122704
122783
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
122705
122784
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
122706
122785
|
return host;
|