typescript 4.7.0-dev.20220420 → 4.7.0-dev.20220423
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 +188 -113
- package/lib/tsserver.js +266 -161
- package/lib/tsserverlibrary.d.ts +3 -1
- package/lib/tsserverlibrary.js +266 -161
- package/lib/typescript.d.ts +3 -1
- package/lib/typescript.js +266 -161
- package/lib/typescriptServices.d.ts +3 -1
- package/lib/typescriptServices.js +266 -161
- package/lib/typingsInstaller.js +201 -129
- 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-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220423";
|
|
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,
|
|
@@ -18282,10 +18282,10 @@ var ts;
|
|
|
18282
18282
|
return ts.combinePaths(newDirPath, sourceFilePath);
|
|
18283
18283
|
}
|
|
18284
18284
|
ts.getSourceFilePathInNewDirWorker = getSourceFilePathInNewDirWorker;
|
|
18285
|
-
function writeFile(host, diagnostics, fileName,
|
|
18286
|
-
host.writeFile(fileName,
|
|
18285
|
+
function writeFile(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
|
|
18286
|
+
host.writeFile(fileName, text, writeByteOrderMark, function (hostErrorMessage) {
|
|
18287
18287
|
diagnostics.add(createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
|
|
18288
|
-
}, sourceFiles);
|
|
18288
|
+
}, sourceFiles, data);
|
|
18289
18289
|
}
|
|
18290
18290
|
ts.writeFile = writeFile;
|
|
18291
18291
|
function ensureDirectoriesExist(directoryPath, createDirectory, directoryExists) {
|
|
@@ -73421,6 +73421,7 @@ var ts;
|
|
|
73421
73421
|
}
|
|
73422
73422
|
}
|
|
73423
73423
|
else {
|
|
73424
|
+
error(attributeDecl.expression, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types);
|
|
73424
73425
|
typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
|
|
73425
73426
|
}
|
|
73426
73427
|
}
|
|
@@ -75658,6 +75659,7 @@ var ts;
|
|
|
75658
75659
|
// decorators are applied to a declaration by the emitter, and not to an expression.
|
|
75659
75660
|
var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
75660
75661
|
var argCheckMode = !isDecorator && !isSingleNonGenericCandidate && ts.some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
75662
|
+
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
75661
75663
|
// The following variables are captured and modified by calls to chooseOverload.
|
|
75662
75664
|
// If overload resolution or type argument inference fails, we want to report the
|
|
75663
75665
|
// best error possible. The best error is one which says that an argument was not
|
|
@@ -75873,7 +75875,7 @@ var ts;
|
|
|
75873
75875
|
// If one or more context sensitive arguments were excluded, we start including
|
|
75874
75876
|
// them now (and keeping do so for any subsequent candidates) and perform a second
|
|
75875
75877
|
// round of type inference and applicability checking for this particular candidate.
|
|
75876
|
-
argCheckMode =
|
|
75878
|
+
argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
75877
75879
|
if (inferenceContext) {
|
|
75878
75880
|
var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
75879
75881
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -94685,7 +94687,7 @@ var ts;
|
|
|
94685
94687
|
}
|
|
94686
94688
|
resumeLexicalEnvironment();
|
|
94687
94689
|
var needsSyntheticConstructor = !constructor && isDerivedClass;
|
|
94688
|
-
var
|
|
94690
|
+
var indexOfFirstStatementAfterSuperAndPrologue = 0;
|
|
94689
94691
|
var prologueStatementCount = 0;
|
|
94690
94692
|
var superStatementIndex = -1;
|
|
94691
94693
|
var statements = [];
|
|
@@ -94694,8 +94696,11 @@ var ts;
|
|
|
94694
94696
|
superStatementIndex = ts.findSuperStatementIndex(constructor.body.statements, prologueStatementCount);
|
|
94695
94697
|
// If there was a super call, visit existing statements up to and including it
|
|
94696
94698
|
if (superStatementIndex >= 0) {
|
|
94697
|
-
|
|
94698
|
-
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount,
|
|
94699
|
+
indexOfFirstStatementAfterSuperAndPrologue = superStatementIndex + 1;
|
|
94700
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount, indexOfFirstStatementAfterSuperAndPrologue - prologueStatementCount), true), statements.slice(prologueStatementCount), true);
|
|
94701
|
+
}
|
|
94702
|
+
else if (prologueStatementCount >= 0) {
|
|
94703
|
+
indexOfFirstStatementAfterSuperAndPrologue = prologueStatementCount;
|
|
94699
94704
|
}
|
|
94700
94705
|
}
|
|
94701
94706
|
if (needsSyntheticConstructor) {
|
|
@@ -94731,22 +94736,20 @@ var ts;
|
|
|
94731
94736
|
}
|
|
94732
94737
|
}
|
|
94733
94738
|
if (parameterPropertyDeclarationCount > 0) {
|
|
94734
|
-
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement,
|
|
94739
|
+
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue, parameterPropertyDeclarationCount);
|
|
94735
94740
|
// If there was a super() call found, add parameter properties immediately after it
|
|
94736
94741
|
if (superStatementIndex >= 0) {
|
|
94737
94742
|
ts.addRange(statements, parameterProperties);
|
|
94738
94743
|
}
|
|
94739
|
-
// If a synthetic super() call was added, add them just after it
|
|
94740
|
-
else if (needsSyntheticConstructor) {
|
|
94741
|
-
statements = __spreadArray(__spreadArray([
|
|
94742
|
-
statements[0]
|
|
94743
|
-
], parameterProperties, true), statements.slice(1), true);
|
|
94744
|
-
}
|
|
94745
|
-
// Since there wasn't a super() call, add them to the top of the constructor
|
|
94746
94744
|
else {
|
|
94747
|
-
|
|
94745
|
+
// Add add parameter properties to the top of the constructor after the prologue
|
|
94746
|
+
var superAndPrologueStatementCount = prologueStatementCount;
|
|
94747
|
+
// If a synthetic super() call was added, need to account for that
|
|
94748
|
+
if (needsSyntheticConstructor)
|
|
94749
|
+
superAndPrologueStatementCount++;
|
|
94750
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, superAndPrologueStatementCount), true), parameterProperties, true), statements.slice(superAndPrologueStatementCount), true);
|
|
94748
94751
|
}
|
|
94749
|
-
|
|
94752
|
+
indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount;
|
|
94750
94753
|
}
|
|
94751
94754
|
}
|
|
94752
94755
|
}
|
|
@@ -94756,7 +94759,7 @@ var ts;
|
|
|
94756
94759
|
addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
|
|
94757
94760
|
// Add existing statements after the initial prologues and super call
|
|
94758
94761
|
if (constructor) {
|
|
94759
|
-
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement,
|
|
94762
|
+
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue));
|
|
94760
94763
|
}
|
|
94761
94764
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
94762
94765
|
return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements),
|
|
@@ -109954,6 +109957,7 @@ var ts;
|
|
|
109954
109957
|
else {
|
|
109955
109958
|
printer.writeFile(sourceFile, writer, sourceMapGenerator);
|
|
109956
109959
|
}
|
|
109960
|
+
var sourceMapUrlPos;
|
|
109957
109961
|
if (sourceMapGenerator) {
|
|
109958
109962
|
if (sourceMapDataList) {
|
|
109959
109963
|
sourceMapDataList.push({
|
|
@@ -109965,6 +109969,7 @@ var ts;
|
|
|
109965
109969
|
if (sourceMappingURL) {
|
|
109966
109970
|
if (!writer.isAtStartOfLine())
|
|
109967
109971
|
writer.rawWrite(newLine);
|
|
109972
|
+
sourceMapUrlPos = writer.getTextPos();
|
|
109968
109973
|
writer.writeComment("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Tools can sometimes see this line as a source mapping url comment
|
|
109969
109974
|
}
|
|
109970
109975
|
// Write the source map
|
|
@@ -109977,7 +109982,7 @@ var ts;
|
|
|
109977
109982
|
writer.writeLine();
|
|
109978
109983
|
}
|
|
109979
109984
|
// Write the output file
|
|
109980
|
-
ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles);
|
|
109985
|
+
ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
|
|
109981
109986
|
// Reset state
|
|
109982
109987
|
writer.clear();
|
|
109983
109988
|
}
|
|
@@ -110499,7 +110504,7 @@ var ts;
|
|
|
110499
110504
|
setWriter(/*output*/ undefined, /*_sourceMapGenerator*/ undefined);
|
|
110500
110505
|
}
|
|
110501
110506
|
function getCurrentLineMap() {
|
|
110502
|
-
return currentLineMap || (currentLineMap = ts.getLineStarts(currentSourceFile));
|
|
110507
|
+
return currentLineMap || (currentLineMap = ts.getLineStarts(ts.Debug.checkDefined(currentSourceFile)));
|
|
110503
110508
|
}
|
|
110504
110509
|
function emit(node, parenthesizerRule) {
|
|
110505
110510
|
if (node === undefined)
|
|
@@ -111674,7 +111679,7 @@ var ts;
|
|
|
111674
111679
|
increaseIndent();
|
|
111675
111680
|
}
|
|
111676
111681
|
var preferNewLine = node.multiLine ? 65536 /* PreferNewLine */ : 0 /* None */;
|
|
111677
|
-
var allowTrailingComma = currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
|
|
111682
|
+
var allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
|
|
111678
111683
|
emitList(node, node.properties, 526226 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine);
|
|
111679
111684
|
if (indentedFlag) {
|
|
111680
111685
|
decreaseIndent();
|
|
@@ -112030,7 +112035,7 @@ var ts;
|
|
|
112030
112035
|
emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfExpressionStatement);
|
|
112031
112036
|
// Emit semicolon in non json files
|
|
112032
112037
|
// or if json file that created synthesized expression(eg.define expression statement when --out and amd code generation)
|
|
112033
|
-
if (!ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
|
|
112038
|
+
if (!currentSourceFile || !ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
|
|
112034
112039
|
writeTrailingSemicolon();
|
|
112035
112040
|
}
|
|
112036
112041
|
}
|
|
@@ -112323,7 +112328,7 @@ var ts;
|
|
|
112323
112328
|
if (body.multiLine) {
|
|
112324
112329
|
return false;
|
|
112325
112330
|
}
|
|
112326
|
-
if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
|
|
112331
|
+
if (!ts.nodeIsSynthesized(body) && currentSourceFile && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
|
|
112327
112332
|
return false;
|
|
112328
112333
|
}
|
|
112329
112334
|
if (getLeadingLineTerminatorCount(body, body.statements, 2 /* PreserveLines */)
|
|
@@ -112348,12 +112353,7 @@ var ts;
|
|
|
112348
112353
|
var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body)
|
|
112349
112354
|
? emitBlockFunctionBodyOnSingleLine
|
|
112350
112355
|
: emitBlockFunctionBodyWorker;
|
|
112351
|
-
|
|
112352
|
-
emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
|
|
112353
|
-
}
|
|
112354
|
-
else {
|
|
112355
|
-
emitBlockFunctionBody(body);
|
|
112356
|
-
}
|
|
112356
|
+
emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
|
|
112357
112357
|
decreaseIndent();
|
|
112358
112358
|
writeToken(19 /* CloseBraceToken */, body.statements.end, writePunctuation, body);
|
|
112359
112359
|
onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(body);
|
|
@@ -112750,7 +112750,8 @@ var ts;
|
|
|
112750
112750
|
var emitAsSingleStatement = statements.length === 1 &&
|
|
112751
112751
|
(
|
|
112752
112752
|
// treat synthesized nodes as located on the same line for emit purposes
|
|
112753
|
-
|
|
112753
|
+
!currentSourceFile ||
|
|
112754
|
+
ts.nodeIsSynthesized(parentNode) ||
|
|
112754
112755
|
ts.nodeIsSynthesized(statements[0]) ||
|
|
112755
112756
|
ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));
|
|
112756
112757
|
var format = 163969 /* CaseOrDefaultClauseStatements */;
|
|
@@ -112981,16 +112982,14 @@ var ts;
|
|
|
112981
112982
|
function emitSourceFile(node) {
|
|
112982
112983
|
writeLine();
|
|
112983
112984
|
var statements = node.statements;
|
|
112984
|
-
if
|
|
112985
|
-
|
|
112986
|
-
|
|
112987
|
-
|
|
112988
|
-
|
|
112989
|
-
|
|
112990
|
-
|
|
112991
|
-
|
|
112992
|
-
return;
|
|
112993
|
-
}
|
|
112985
|
+
// Emit detached comment if there are no prologue directives or if the first node is synthesized.
|
|
112986
|
+
// The synthesized node will have no leading comment so some comments may be missed.
|
|
112987
|
+
var shouldEmitDetachedComment = statements.length === 0 ||
|
|
112988
|
+
!ts.isPrologueDirective(statements[0]) ||
|
|
112989
|
+
ts.nodeIsSynthesized(statements[0]);
|
|
112990
|
+
if (shouldEmitDetachedComment) {
|
|
112991
|
+
emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
|
|
112992
|
+
return;
|
|
112994
112993
|
}
|
|
112995
112994
|
emitSourceFileWorker(node);
|
|
112996
112995
|
}
|
|
@@ -113379,7 +113378,7 @@ var ts;
|
|
|
113379
113378
|
}
|
|
113380
113379
|
if (isEmpty) {
|
|
113381
113380
|
// Write a line terminator if the parent node was multi-line
|
|
113382
|
-
if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
|
|
113381
|
+
if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
|
|
113383
113382
|
writeLine();
|
|
113384
113383
|
}
|
|
113385
113384
|
else if (format & 256 /* SpaceBetweenBraces */ && !(format & 524288 /* NoSpaceIfEmpty */)) {
|
|
@@ -113640,7 +113639,7 @@ var ts;
|
|
|
113640
113639
|
}
|
|
113641
113640
|
var firstChild_1 = children[0];
|
|
113642
113641
|
if (firstChild_1 === undefined) {
|
|
113643
|
-
return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113642
|
+
return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113644
113643
|
}
|
|
113645
113644
|
if (firstChild_1.pos === nextListElementPos) {
|
|
113646
113645
|
// If this child starts at the beginning of a list item in a parent list, its leading
|
|
@@ -113664,7 +113663,7 @@ var ts;
|
|
|
113664
113663
|
// JsxText will be written with its leading whitespace, so don't add more manually.
|
|
113665
113664
|
return 0;
|
|
113666
113665
|
}
|
|
113667
|
-
if (parentNode &&
|
|
113666
|
+
if (currentSourceFile && parentNode &&
|
|
113668
113667
|
!ts.positionIsSynthesized(parentNode.pos) &&
|
|
113669
113668
|
!ts.nodeIsSynthesized(firstChild_1) &&
|
|
113670
113669
|
(!firstChild_1.parent || ts.getOriginalNode(firstChild_1.parent) === ts.getOriginalNode(parentNode))) {
|
|
@@ -113688,7 +113687,7 @@ var ts;
|
|
|
113688
113687
|
// JsxText will be written with its leading whitespace, so don't add more manually.
|
|
113689
113688
|
return 0;
|
|
113690
113689
|
}
|
|
113691
|
-
else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
|
|
113690
|
+
else if (currentSourceFile && !ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
|
|
113692
113691
|
if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
|
|
113693
113692
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
|
|
113694
113693
|
}
|
|
@@ -113720,9 +113719,9 @@ var ts;
|
|
|
113720
113719
|
}
|
|
113721
113720
|
var lastChild = ts.lastOrUndefined(children);
|
|
113722
113721
|
if (lastChild === undefined) {
|
|
113723
|
-
return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113722
|
+
return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113724
113723
|
}
|
|
113725
|
-
if (parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
|
|
113724
|
+
if (currentSourceFile && parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
|
|
113726
113725
|
if (preserveSourceNewlines) {
|
|
113727
113726
|
var end_1 = ts.isNodeArray(children) && !ts.positionIsSynthesized(children.end) ? children.end : lastChild.end;
|
|
113728
113727
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter(end_1, parentNode.end, currentSourceFile, includeComments); });
|
|
@@ -113795,7 +113794,7 @@ var ts;
|
|
|
113795
113794
|
if (ts.getStartsOnNewLine(node2)) {
|
|
113796
113795
|
return 1;
|
|
113797
113796
|
}
|
|
113798
|
-
if (!ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
|
|
113797
|
+
if (currentSourceFile && !ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
|
|
113799
113798
|
if (preserveSourceNewlines) {
|
|
113800
113799
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(node1, node2, currentSourceFile, includeComments); });
|
|
113801
113800
|
}
|
|
@@ -113805,7 +113804,7 @@ var ts;
|
|
|
113805
113804
|
}
|
|
113806
113805
|
function isEmptyBlock(block) {
|
|
113807
113806
|
return block.statements.length === 0
|
|
113808
|
-
&& ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
|
|
113807
|
+
&& (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile));
|
|
113809
113808
|
}
|
|
113810
113809
|
function skipSynthesizedParentheses(node) {
|
|
113811
113810
|
while (node.kind === 212 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
|
|
@@ -113817,16 +113816,23 @@ var ts;
|
|
|
113817
113816
|
if (ts.isGeneratedIdentifier(node)) {
|
|
113818
113817
|
return generateName(node);
|
|
113819
113818
|
}
|
|
113820
|
-
|
|
113821
|
-
return ts.idText(node);
|
|
113822
|
-
}
|
|
113823
|
-
else if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
|
|
113819
|
+
if (ts.isStringLiteral(node) && node.textSourceNode) {
|
|
113824
113820
|
return getTextOfNode(node.textSourceNode, includeTrivia);
|
|
113825
113821
|
}
|
|
113826
|
-
|
|
113827
|
-
|
|
113822
|
+
var sourceFile = currentSourceFile; // const needed for control flow
|
|
113823
|
+
var canUseSourceFile = !!sourceFile && !!node.parent && !ts.nodeIsSynthesized(node);
|
|
113824
|
+
if (ts.isMemberName(node)) {
|
|
113825
|
+
if (!canUseSourceFile || ts.getSourceFileOfNode(node) !== ts.getOriginalNode(sourceFile)) {
|
|
113826
|
+
return ts.idText(node);
|
|
113827
|
+
}
|
|
113828
113828
|
}
|
|
113829
|
-
|
|
113829
|
+
else {
|
|
113830
|
+
ts.Debug.assertNode(node, ts.isLiteralExpression); // not strictly necessary
|
|
113831
|
+
if (!canUseSourceFile) {
|
|
113832
|
+
return node.text;
|
|
113833
|
+
}
|
|
113834
|
+
}
|
|
113835
|
+
return ts.getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
|
|
113830
113836
|
}
|
|
113831
113837
|
function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
|
|
113832
113838
|
if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
|
|
@@ -114405,7 +114411,7 @@ var ts;
|
|
|
114405
114411
|
return true;
|
|
114406
114412
|
}
|
|
114407
114413
|
function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
|
|
114408
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114414
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114409
114415
|
return;
|
|
114410
114416
|
if (!hasWrittenComment) {
|
|
114411
114417
|
ts.emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos);
|
|
@@ -114432,7 +114438,7 @@ var ts;
|
|
|
114432
114438
|
forEachTrailingCommentToEmit(pos, emitTrailingComment);
|
|
114433
114439
|
}
|
|
114434
114440
|
function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
|
|
114435
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114441
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114436
114442
|
return;
|
|
114437
114443
|
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment2*/
|
|
114438
114444
|
if (!writer.isAtStartOfLine()) {
|
|
@@ -114454,6 +114460,8 @@ var ts;
|
|
|
114454
114460
|
exitComment();
|
|
114455
114461
|
}
|
|
114456
114462
|
function emitTrailingCommentOfPositionNoNewline(commentPos, commentEnd, kind) {
|
|
114463
|
+
if (!currentSourceFile)
|
|
114464
|
+
return;
|
|
114457
114465
|
// trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
|
|
114458
114466
|
emitPos(commentPos);
|
|
114459
114467
|
ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
|
|
@@ -114463,6 +114471,8 @@ var ts;
|
|
|
114463
114471
|
}
|
|
114464
114472
|
}
|
|
114465
114473
|
function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
|
|
114474
|
+
if (!currentSourceFile)
|
|
114475
|
+
return;
|
|
114466
114476
|
// trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
|
|
114467
114477
|
emitPos(commentPos);
|
|
114468
114478
|
ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
|
|
@@ -114495,6 +114505,8 @@ var ts;
|
|
|
114495
114505
|
return detachedCommentsInfo !== undefined && ts.last(detachedCommentsInfo).nodePos === pos;
|
|
114496
114506
|
}
|
|
114497
114507
|
function forEachLeadingCommentWithoutDetachedComments(cb) {
|
|
114508
|
+
if (!currentSourceFile)
|
|
114509
|
+
return;
|
|
114498
114510
|
// get the leading comments from detachedPos
|
|
114499
114511
|
var pos = ts.last(detachedCommentsInfo).detachedCommentEndPos;
|
|
114500
114512
|
if (detachedCommentsInfo.length - 1) {
|
|
@@ -114506,7 +114518,7 @@ var ts;
|
|
|
114506
114518
|
ts.forEachLeadingCommentRange(currentSourceFile.text, pos, cb, /*state*/ pos);
|
|
114507
114519
|
}
|
|
114508
114520
|
function emitDetachedCommentsAndUpdateCommentsInfo(range) {
|
|
114509
|
-
var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
|
|
114521
|
+
var currentDetachedCommentInfo = currentSourceFile && ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
|
|
114510
114522
|
if (currentDetachedCommentInfo) {
|
|
114511
114523
|
if (detachedCommentsInfo) {
|
|
114512
114524
|
detachedCommentsInfo.push(currentDetachedCommentInfo);
|
|
@@ -114517,7 +114529,7 @@ var ts;
|
|
|
114517
114529
|
}
|
|
114518
114530
|
}
|
|
114519
114531
|
function emitComment(text, lineMap, writer, commentPos, commentEnd, newLine) {
|
|
114520
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114532
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114521
114533
|
return;
|
|
114522
114534
|
emitPos(commentPos);
|
|
114523
114535
|
ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);
|
|
@@ -114529,7 +114541,7 @@ var ts;
|
|
|
114529
114541
|
* @return true if the comment is a triple-slash comment else false
|
|
114530
114542
|
*/
|
|
114531
114543
|
function isTripleSlashComment(commentPos, commentEnd) {
|
|
114532
|
-
return ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
|
|
114544
|
+
return !!currentSourceFile && ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
|
|
114533
114545
|
}
|
|
114534
114546
|
// Source Maps
|
|
114535
114547
|
function getParsedSourceMap(node) {
|
|
@@ -115444,7 +115456,11 @@ var ts;
|
|
|
115444
115456
|
return newValue;
|
|
115445
115457
|
};
|
|
115446
115458
|
if (originalWriteFile) {
|
|
115447
|
-
host.writeFile = function (fileName, data
|
|
115459
|
+
host.writeFile = function (fileName, data) {
|
|
115460
|
+
var rest = [];
|
|
115461
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
115462
|
+
rest[_i - 2] = arguments[_i];
|
|
115463
|
+
}
|
|
115448
115464
|
var key = toPath(fileName);
|
|
115449
115465
|
fileExistsCache.delete(key);
|
|
115450
115466
|
var value = readFileCache.get(key);
|
|
@@ -115458,7 +115474,7 @@ var ts;
|
|
|
115458
115474
|
sourceFileCache.delete(key);
|
|
115459
115475
|
}
|
|
115460
115476
|
}
|
|
115461
|
-
originalWriteFile.call(host, fileName, data,
|
|
115477
|
+
originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false));
|
|
115462
115478
|
};
|
|
115463
115479
|
}
|
|
115464
115480
|
// directoryExists
|
|
@@ -116391,6 +116407,7 @@ var ts;
|
|
|
116391
116407
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
116392
116408
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
116393
116409
|
structureIsReused: structureIsReused,
|
|
116410
|
+
writeFile: writeFile,
|
|
116394
116411
|
};
|
|
116395
116412
|
onProgramCreateComplete();
|
|
116396
116413
|
// Add file processingDiagnostics
|
|
@@ -116888,7 +116905,7 @@ var ts;
|
|
|
116888
116905
|
getProjectReferenceRedirect: getProjectReferenceRedirect,
|
|
116889
116906
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
116890
116907
|
getSymlinkCache: getSymlinkCache,
|
|
116891
|
-
writeFile: writeFileCallback ||
|
|
116908
|
+
writeFile: writeFileCallback || writeFile,
|
|
116892
116909
|
isEmitBlocked: isEmitBlocked,
|
|
116893
116910
|
readFile: function (f) { return host.readFile(f); },
|
|
116894
116911
|
fileExists: function (f) {
|
|
@@ -116908,6 +116925,9 @@ var ts;
|
|
|
116908
116925
|
getFileIncludeReasons: program.getFileIncludeReasons,
|
|
116909
116926
|
};
|
|
116910
116927
|
}
|
|
116928
|
+
function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
116929
|
+
host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
116930
|
+
}
|
|
116911
116931
|
function emitBuildInfo(writeFileCallback) {
|
|
116912
116932
|
ts.Debug.assert(!ts.outFile(options));
|
|
116913
116933
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emitBuildInfo", {}, /*separateBeginAndEnd*/ true);
|
|
@@ -119350,6 +119370,7 @@ var ts;
|
|
|
119350
119370
|
}
|
|
119351
119371
|
}
|
|
119352
119372
|
}
|
|
119373
|
+
BuilderState.updateExportedModules = updateExportedModules;
|
|
119353
119374
|
/**
|
|
119354
119375
|
* Updates the exported modules from cache into state's exported modules map
|
|
119355
119376
|
* This should be called whenever it is safe to commit the state of the builder
|
|
@@ -119773,6 +119794,18 @@ var ts;
|
|
|
119773
119794
|
}
|
|
119774
119795
|
return undefined;
|
|
119775
119796
|
}
|
|
119797
|
+
function removeDiagnosticsOfLibraryFiles(state) {
|
|
119798
|
+
if (!state.cleanedDiagnosticsOfLibFiles) {
|
|
119799
|
+
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119800
|
+
var program_1 = ts.Debug.checkDefined(state.program);
|
|
119801
|
+
var options_2 = program_1.getCompilerOptions();
|
|
119802
|
+
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
119803
|
+
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
119804
|
+
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
119805
|
+
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
119806
|
+
});
|
|
119807
|
+
}
|
|
119808
|
+
}
|
|
119776
119809
|
/**
|
|
119777
119810
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119778
119811
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
@@ -119782,28 +119815,17 @@ var ts;
|
|
|
119782
119815
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119783
119816
|
// If affected files is everything except default library, then nothing more to do
|
|
119784
119817
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
119785
|
-
|
|
119786
|
-
state.cleanedDiagnosticsOfLibFiles = true;
|
|
119787
|
-
var program_1 = ts.Debug.checkDefined(state.program);
|
|
119788
|
-
var options_2 = program_1.getCompilerOptions();
|
|
119789
|
-
ts.forEach(program_1.getSourceFiles(), function (f) {
|
|
119790
|
-
return program_1.isSourceFileDefaultLibrary(f) &&
|
|
119791
|
-
!ts.skipTypeChecking(f, options_2, program_1) &&
|
|
119792
|
-
removeSemanticDiagnosticsOf(state, f.resolvedPath);
|
|
119793
|
-
});
|
|
119794
|
-
}
|
|
119818
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
119795
119819
|
// When a change affects the global scope, all files are considered to be affected without updating their signature
|
|
119796
119820
|
// That means when affected file is handled, its signature can be out of date
|
|
119797
119821
|
// To avoid this, ensure that we update the signature for any affected file in this scenario.
|
|
119798
119822
|
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
|
|
119799
119823
|
return;
|
|
119800
119824
|
}
|
|
119801
|
-
|
|
119802
|
-
|
|
119803
|
-
|
|
119804
|
-
|
|
119805
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
119806
|
-
}
|
|
119825
|
+
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);
|
|
119826
|
+
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
119827
|
+
return;
|
|
119828
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
119807
119829
|
}
|
|
119808
119830
|
/**
|
|
119809
119831
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
@@ -119845,16 +119867,41 @@ var ts;
|
|
|
119845
119867
|
var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
119846
119868
|
return newSignature !== oldSignature;
|
|
119847
119869
|
}
|
|
119870
|
+
function forEachKeyOfExportedModulesMap(state, filePath, fn) {
|
|
119871
|
+
// Go through exported modules from cache first
|
|
119872
|
+
var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
|
|
119873
|
+
var result = keys && ts.forEachKey(keys, fn);
|
|
119874
|
+
if (result)
|
|
119875
|
+
return result;
|
|
119876
|
+
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
119877
|
+
keys = state.exportedModulesMap.getKeys(filePath);
|
|
119878
|
+
return keys && ts.forEachKey(keys, function (exportedFromPath) {
|
|
119879
|
+
var _a;
|
|
119880
|
+
// If the cache had an updated value, skip
|
|
119881
|
+
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119882
|
+
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
|
|
119883
|
+
fn(exportedFromPath) :
|
|
119884
|
+
undefined;
|
|
119885
|
+
});
|
|
119886
|
+
}
|
|
119887
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
|
|
119888
|
+
var _a;
|
|
119889
|
+
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
119890
|
+
return false;
|
|
119891
|
+
// Every file needs to be handled
|
|
119892
|
+
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
|
|
119893
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
|
|
119894
|
+
removeDiagnosticsOfLibraryFiles(state);
|
|
119895
|
+
return true;
|
|
119896
|
+
}
|
|
119848
119897
|
/**
|
|
119849
|
-
* Iterate on referencing modules that export entities from affected file
|
|
119898
|
+
* Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
|
|
119850
119899
|
*/
|
|
119851
|
-
function
|
|
119852
|
-
var _a, _b;
|
|
119900
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
119853
119901
|
// If there was change in signature (dts output) for the changed file,
|
|
119854
119902
|
// then only we need to handle pending file emit
|
|
119855
|
-
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
119903
|
+
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
119856
119904
|
return;
|
|
119857
|
-
}
|
|
119858
119905
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
119859
119906
|
return;
|
|
119860
119907
|
// Since isolated modules dont change js files, files affected by change in signature is itself
|
|
@@ -119867,7 +119914,9 @@ var ts;
|
|
|
119867
119914
|
var currentPath = queue.pop();
|
|
119868
119915
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
119869
119916
|
seenFileNamesMap.set(currentPath, true);
|
|
119870
|
-
|
|
119917
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
|
|
119918
|
+
return;
|
|
119919
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
|
|
119871
119920
|
if (isChangedSignature(state, currentPath)) {
|
|
119872
119921
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
119873
119922
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -119879,56 +119928,38 @@ var ts;
|
|
|
119879
119928
|
var seenFileAndExportsOfFile = new ts.Set();
|
|
119880
119929
|
// Go through exported modules from cache first
|
|
119881
119930
|
// If exported modules has path, all files referencing file exported from are affected
|
|
119882
|
-
(
|
|
119883
|
-
|
|
119884
|
-
|
|
119885
|
-
|
|
119886
|
-
|
|
119887
|
-
|
|
119888
|
-
|
|
119889
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119890
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
119891
|
-
forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
119931
|
+
forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
|
|
119932
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
|
|
119933
|
+
return true;
|
|
119934
|
+
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
119935
|
+
return references && ts.forEachKey(references, function (filePath) {
|
|
119936
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
119937
|
+
});
|
|
119892
119938
|
});
|
|
119893
119939
|
}
|
|
119894
119940
|
/**
|
|
119895
|
-
*
|
|
119941
|
+
* handle dts and semantic diagnostics on file and iterate on anything that exports this file
|
|
119942
|
+
* return true when all work is done and we can exit handling dts emit and semantic diagnostics
|
|
119896
119943
|
*/
|
|
119897
|
-
function
|
|
119944
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
|
|
119898
119945
|
var _a;
|
|
119899
|
-
|
|
119900
|
-
return
|
|
119901
|
-
|
|
119902
|
-
|
|
119903
|
-
|
|
119904
|
-
* fn on file and iterate on anything that exports this file
|
|
119905
|
-
*/
|
|
119906
|
-
function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
|
|
119907
|
-
var _a, _b, _c;
|
|
119908
|
-
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath)) {
|
|
119909
|
-
return;
|
|
119910
|
-
}
|
|
119911
|
-
fn(state, filePath);
|
|
119946
|
+
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
119947
|
+
return undefined;
|
|
119948
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
|
|
119949
|
+
return true;
|
|
119950
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
|
|
119912
119951
|
ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
|
|
119913
|
-
// Go through exported modules from cache first
|
|
119914
119952
|
// If exported modules has path, all files referencing file exported from are affected
|
|
119915
|
-
(
|
|
119916
|
-
return
|
|
119917
|
-
});
|
|
119918
|
-
// If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
|
|
119919
|
-
(_b = state.exportedModulesMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
|
|
119920
|
-
var _a;
|
|
119921
|
-
// If the cache had an updated value, skip
|
|
119922
|
-
return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
|
|
119923
|
-
!((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
|
|
119924
|
-
forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
|
|
119953
|
+
forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
|
|
119954
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
|
|
119925
119955
|
});
|
|
119926
119956
|
// Remove diagnostics of files that import this file (without going to exports of referencing files)
|
|
119927
|
-
(
|
|
119957
|
+
(_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
|
|
119928
119958
|
return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
119929
|
-
|
|
119930
|
-
|
|
119931
|
-
);
|
|
119959
|
+
handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
|
|
119960
|
+
state, referencingFilePath, cancellationToken, computeHash, host);
|
|
119961
|
+
});
|
|
119962
|
+
return undefined;
|
|
119932
119963
|
}
|
|
119933
119964
|
/**
|
|
119934
119965
|
* This is called after completing operation on the next affected file.
|
|
@@ -120304,7 +120335,43 @@ var ts;
|
|
|
120304
120335
|
return toAffectedFileEmitResult(state,
|
|
120305
120336
|
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
|
120306
120337
|
// Otherwise just affected file
|
|
120307
|
-
ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected,
|
|
120338
|
+
ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
|
|
120339
|
+
getWriteFileUpdatingSignatureCallback(writeFile) :
|
|
120340
|
+
writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
|
|
120341
|
+
}
|
|
120342
|
+
function getWriteFileUpdatingSignatureCallback(writeFile) {
|
|
120343
|
+
return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
120344
|
+
var _a;
|
|
120345
|
+
if (ts.isDeclarationFileName(fileName)) {
|
|
120346
|
+
ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
|
|
120347
|
+
var file = sourceFiles[0];
|
|
120348
|
+
var info = state.fileInfos.get(file.resolvedPath);
|
|
120349
|
+
var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
|
|
120350
|
+
if (signature === file.version) {
|
|
120351
|
+
var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
|
|
120352
|
+
if (newSignature !== file.version) { // Update it
|
|
120353
|
+
if (host.storeFilesChangingSignatureDuringEmit)
|
|
120354
|
+
(state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
|
|
120355
|
+
if (state.exportedModulesMap)
|
|
120356
|
+
ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
|
|
120357
|
+
if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
|
|
120358
|
+
state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
|
|
120359
|
+
}
|
|
120360
|
+
else {
|
|
120361
|
+
info.signature = newSignature;
|
|
120362
|
+
if (state.exportedModulesMap)
|
|
120363
|
+
ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
|
|
120364
|
+
}
|
|
120365
|
+
}
|
|
120366
|
+
}
|
|
120367
|
+
}
|
|
120368
|
+
if (writeFile)
|
|
120369
|
+
writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
120370
|
+
else if (host.writeFile)
|
|
120371
|
+
host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
120372
|
+
else
|
|
120373
|
+
state.program.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
120374
|
+
};
|
|
120308
120375
|
}
|
|
120309
120376
|
/**
|
|
120310
120377
|
* Emits the JavaScript and declaration files.
|
|
@@ -120361,7 +120428,9 @@ var ts;
|
|
|
120361
120428
|
}
|
|
120362
120429
|
}
|
|
120363
120430
|
}
|
|
120364
|
-
return ts.Debug.checkDefined(state.program).emit(targetSourceFile,
|
|
120431
|
+
return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
|
|
120432
|
+
getWriteFileUpdatingSignatureCallback(writeFile) :
|
|
120433
|
+
writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
120365
120434
|
}
|
|
120366
120435
|
/**
|
|
120367
120436
|
* Return the semantic diagnostics for the next affected file or undefined if iteration is complete
|
|
@@ -122553,6 +122622,7 @@ var ts;
|
|
|
122553
122622
|
createHash: ts.maybeBind(host, host.createHash),
|
|
122554
122623
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
122555
122624
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
122625
|
+
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
122556
122626
|
};
|
|
122557
122627
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
122558
122628
|
try {
|
|
@@ -122612,6 +122682,7 @@ var ts;
|
|
|
122612
122682
|
createHash: ts.maybeBind(system, system.createHash),
|
|
122613
122683
|
createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
|
|
122614
122684
|
disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
|
|
122685
|
+
storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
|
|
122615
122686
|
};
|
|
122616
122687
|
}
|
|
122617
122688
|
ts.createProgramHost = createProgramHost;
|
|
@@ -122700,6 +122771,7 @@ var ts;
|
|
|
122700
122771
|
var host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, system);
|
|
122701
122772
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
122702
122773
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
122774
|
+
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
122703
122775
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
122704
122776
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
122705
122777
|
return host;
|