typescript 4.7.0-dev.20220421 → 4.7.0-dev.20220424
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 +112 -51
- package/lib/tsserver.js +179 -85
- package/lib/tsserverlibrary.d.ts +3 -1
- package/lib/tsserverlibrary.js +179 -85
- package/lib/typescript.d.ts +3 -1
- package/lib/typescript.js +179 -85
- package/lib/typescriptServices.d.ts +3 -1
- package/lib/typescriptServices.js +179 -85
- package/lib/typingsInstaller.js +114 -53
- 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.20220424";
|
|
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);
|
|
@@ -109955,6 +109957,7 @@ var ts;
|
|
|
109955
109957
|
else {
|
|
109956
109958
|
printer.writeFile(sourceFile, writer, sourceMapGenerator);
|
|
109957
109959
|
}
|
|
109960
|
+
var sourceMapUrlPos;
|
|
109958
109961
|
if (sourceMapGenerator) {
|
|
109959
109962
|
if (sourceMapDataList) {
|
|
109960
109963
|
sourceMapDataList.push({
|
|
@@ -109966,6 +109969,7 @@ var ts;
|
|
|
109966
109969
|
if (sourceMappingURL) {
|
|
109967
109970
|
if (!writer.isAtStartOfLine())
|
|
109968
109971
|
writer.rawWrite(newLine);
|
|
109972
|
+
sourceMapUrlPos = writer.getTextPos();
|
|
109969
109973
|
writer.writeComment("//# " + "sourceMappingURL" + "=" + sourceMappingURL); // Tools can sometimes see this line as a source mapping url comment
|
|
109970
109974
|
}
|
|
109971
109975
|
// Write the source map
|
|
@@ -109978,7 +109982,7 @@ var ts;
|
|
|
109978
109982
|
writer.writeLine();
|
|
109979
109983
|
}
|
|
109980
109984
|
// Write the output file
|
|
109981
|
-
ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles);
|
|
109985
|
+
ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
|
|
109982
109986
|
// Reset state
|
|
109983
109987
|
writer.clear();
|
|
109984
109988
|
}
|
|
@@ -110500,7 +110504,7 @@ var ts;
|
|
|
110500
110504
|
setWriter(/*output*/ undefined, /*_sourceMapGenerator*/ undefined);
|
|
110501
110505
|
}
|
|
110502
110506
|
function getCurrentLineMap() {
|
|
110503
|
-
return currentLineMap || (currentLineMap = ts.getLineStarts(currentSourceFile));
|
|
110507
|
+
return currentLineMap || (currentLineMap = ts.getLineStarts(ts.Debug.checkDefined(currentSourceFile)));
|
|
110504
110508
|
}
|
|
110505
110509
|
function emit(node, parenthesizerRule) {
|
|
110506
110510
|
if (node === undefined)
|
|
@@ -111675,7 +111679,7 @@ var ts;
|
|
|
111675
111679
|
increaseIndent();
|
|
111676
111680
|
}
|
|
111677
111681
|
var preferNewLine = node.multiLine ? 65536 /* PreferNewLine */ : 0 /* None */;
|
|
111678
|
-
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 */;
|
|
111679
111683
|
emitList(node, node.properties, 526226 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine);
|
|
111680
111684
|
if (indentedFlag) {
|
|
111681
111685
|
decreaseIndent();
|
|
@@ -112031,7 +112035,7 @@ var ts;
|
|
|
112031
112035
|
emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfExpressionStatement);
|
|
112032
112036
|
// Emit semicolon in non json files
|
|
112033
112037
|
// 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)) {
|
|
112038
|
+
if (!currentSourceFile || !ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
|
|
112035
112039
|
writeTrailingSemicolon();
|
|
112036
112040
|
}
|
|
112037
112041
|
}
|
|
@@ -112324,7 +112328,7 @@ var ts;
|
|
|
112324
112328
|
if (body.multiLine) {
|
|
112325
112329
|
return false;
|
|
112326
112330
|
}
|
|
112327
|
-
if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
|
|
112331
|
+
if (!ts.nodeIsSynthesized(body) && currentSourceFile && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
|
|
112328
112332
|
return false;
|
|
112329
112333
|
}
|
|
112330
112334
|
if (getLeadingLineTerminatorCount(body, body.statements, 2 /* PreserveLines */)
|
|
@@ -112349,12 +112353,7 @@ var ts;
|
|
|
112349
112353
|
var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body)
|
|
112350
112354
|
? emitBlockFunctionBodyOnSingleLine
|
|
112351
112355
|
: emitBlockFunctionBodyWorker;
|
|
112352
|
-
|
|
112353
|
-
emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
|
|
112354
|
-
}
|
|
112355
|
-
else {
|
|
112356
|
-
emitBlockFunctionBody(body);
|
|
112357
|
-
}
|
|
112356
|
+
emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
|
|
112358
112357
|
decreaseIndent();
|
|
112359
112358
|
writeToken(19 /* CloseBraceToken */, body.statements.end, writePunctuation, body);
|
|
112360
112359
|
onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(body);
|
|
@@ -112751,7 +112750,8 @@ var ts;
|
|
|
112751
112750
|
var emitAsSingleStatement = statements.length === 1 &&
|
|
112752
112751
|
(
|
|
112753
112752
|
// treat synthesized nodes as located on the same line for emit purposes
|
|
112754
|
-
|
|
112753
|
+
!currentSourceFile ||
|
|
112754
|
+
ts.nodeIsSynthesized(parentNode) ||
|
|
112755
112755
|
ts.nodeIsSynthesized(statements[0]) ||
|
|
112756
112756
|
ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));
|
|
112757
112757
|
var format = 163969 /* CaseOrDefaultClauseStatements */;
|
|
@@ -112982,16 +112982,14 @@ var ts;
|
|
|
112982
112982
|
function emitSourceFile(node) {
|
|
112983
112983
|
writeLine();
|
|
112984
112984
|
var statements = node.statements;
|
|
112985
|
-
if
|
|
112986
|
-
|
|
112987
|
-
|
|
112988
|
-
|
|
112989
|
-
|
|
112990
|
-
|
|
112991
|
-
|
|
112992
|
-
|
|
112993
|
-
return;
|
|
112994
|
-
}
|
|
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;
|
|
112995
112993
|
}
|
|
112996
112994
|
emitSourceFileWorker(node);
|
|
112997
112995
|
}
|
|
@@ -113380,7 +113378,7 @@ var ts;
|
|
|
113380
113378
|
}
|
|
113381
113379
|
if (isEmpty) {
|
|
113382
113380
|
// Write a line terminator if the parent node was multi-line
|
|
113383
|
-
if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
|
|
113381
|
+
if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
|
|
113384
113382
|
writeLine();
|
|
113385
113383
|
}
|
|
113386
113384
|
else if (format & 256 /* SpaceBetweenBraces */ && !(format & 524288 /* NoSpaceIfEmpty */)) {
|
|
@@ -113641,7 +113639,7 @@ var ts;
|
|
|
113641
113639
|
}
|
|
113642
113640
|
var firstChild_1 = children[0];
|
|
113643
113641
|
if (firstChild_1 === undefined) {
|
|
113644
|
-
return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113642
|
+
return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113645
113643
|
}
|
|
113646
113644
|
if (firstChild_1.pos === nextListElementPos) {
|
|
113647
113645
|
// If this child starts at the beginning of a list item in a parent list, its leading
|
|
@@ -113665,7 +113663,7 @@ var ts;
|
|
|
113665
113663
|
// JsxText will be written with its leading whitespace, so don't add more manually.
|
|
113666
113664
|
return 0;
|
|
113667
113665
|
}
|
|
113668
|
-
if (parentNode &&
|
|
113666
|
+
if (currentSourceFile && parentNode &&
|
|
113669
113667
|
!ts.positionIsSynthesized(parentNode.pos) &&
|
|
113670
113668
|
!ts.nodeIsSynthesized(firstChild_1) &&
|
|
113671
113669
|
(!firstChild_1.parent || ts.getOriginalNode(firstChild_1.parent) === ts.getOriginalNode(parentNode))) {
|
|
@@ -113689,7 +113687,7 @@ var ts;
|
|
|
113689
113687
|
// JsxText will be written with its leading whitespace, so don't add more manually.
|
|
113690
113688
|
return 0;
|
|
113691
113689
|
}
|
|
113692
|
-
else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
|
|
113690
|
+
else if (currentSourceFile && !ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
|
|
113693
113691
|
if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
|
|
113694
113692
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
|
|
113695
113693
|
}
|
|
@@ -113721,9 +113719,9 @@ var ts;
|
|
|
113721
113719
|
}
|
|
113722
113720
|
var lastChild = ts.lastOrUndefined(children);
|
|
113723
113721
|
if (lastChild === undefined) {
|
|
113724
|
-
return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113722
|
+
return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113725
113723
|
}
|
|
113726
|
-
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)) {
|
|
113727
113725
|
if (preserveSourceNewlines) {
|
|
113728
113726
|
var end_1 = ts.isNodeArray(children) && !ts.positionIsSynthesized(children.end) ? children.end : lastChild.end;
|
|
113729
113727
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter(end_1, parentNode.end, currentSourceFile, includeComments); });
|
|
@@ -113796,7 +113794,7 @@ var ts;
|
|
|
113796
113794
|
if (ts.getStartsOnNewLine(node2)) {
|
|
113797
113795
|
return 1;
|
|
113798
113796
|
}
|
|
113799
|
-
if (!ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
|
|
113797
|
+
if (currentSourceFile && !ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
|
|
113800
113798
|
if (preserveSourceNewlines) {
|
|
113801
113799
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(node1, node2, currentSourceFile, includeComments); });
|
|
113802
113800
|
}
|
|
@@ -113806,7 +113804,7 @@ var ts;
|
|
|
113806
113804
|
}
|
|
113807
113805
|
function isEmptyBlock(block) {
|
|
113808
113806
|
return block.statements.length === 0
|
|
113809
|
-
&& ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
|
|
113807
|
+
&& (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile));
|
|
113810
113808
|
}
|
|
113811
113809
|
function skipSynthesizedParentheses(node) {
|
|
113812
113810
|
while (node.kind === 212 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
|
|
@@ -113818,16 +113816,23 @@ var ts;
|
|
|
113818
113816
|
if (ts.isGeneratedIdentifier(node)) {
|
|
113819
113817
|
return generateName(node);
|
|
113820
113818
|
}
|
|
113821
|
-
|
|
113822
|
-
return ts.idText(node);
|
|
113823
|
-
}
|
|
113824
|
-
else if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
|
|
113819
|
+
if (ts.isStringLiteral(node) && node.textSourceNode) {
|
|
113825
113820
|
return getTextOfNode(node.textSourceNode, includeTrivia);
|
|
113826
113821
|
}
|
|
113827
|
-
|
|
113828
|
-
|
|
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
|
+
}
|
|
113829
|
+
else {
|
|
113830
|
+
ts.Debug.assertNode(node, ts.isLiteralExpression); // not strictly necessary
|
|
113831
|
+
if (!canUseSourceFile) {
|
|
113832
|
+
return node.text;
|
|
113833
|
+
}
|
|
113829
113834
|
}
|
|
113830
|
-
return ts.getSourceTextOfNodeFromSourceFile(
|
|
113835
|
+
return ts.getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
|
|
113831
113836
|
}
|
|
113832
113837
|
function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
|
|
113833
113838
|
if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
|
|
@@ -114406,7 +114411,7 @@ var ts;
|
|
|
114406
114411
|
return true;
|
|
114407
114412
|
}
|
|
114408
114413
|
function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
|
|
114409
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114414
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114410
114415
|
return;
|
|
114411
114416
|
if (!hasWrittenComment) {
|
|
114412
114417
|
ts.emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos);
|
|
@@ -114433,7 +114438,7 @@ var ts;
|
|
|
114433
114438
|
forEachTrailingCommentToEmit(pos, emitTrailingComment);
|
|
114434
114439
|
}
|
|
114435
114440
|
function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
|
|
114436
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114441
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114437
114442
|
return;
|
|
114438
114443
|
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment2*/
|
|
114439
114444
|
if (!writer.isAtStartOfLine()) {
|
|
@@ -114455,6 +114460,8 @@ var ts;
|
|
|
114455
114460
|
exitComment();
|
|
114456
114461
|
}
|
|
114457
114462
|
function emitTrailingCommentOfPositionNoNewline(commentPos, commentEnd, kind) {
|
|
114463
|
+
if (!currentSourceFile)
|
|
114464
|
+
return;
|
|
114458
114465
|
// trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
|
|
114459
114466
|
emitPos(commentPos);
|
|
114460
114467
|
ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
|
|
@@ -114464,6 +114471,8 @@ var ts;
|
|
|
114464
114471
|
}
|
|
114465
114472
|
}
|
|
114466
114473
|
function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
|
|
114474
|
+
if (!currentSourceFile)
|
|
114475
|
+
return;
|
|
114467
114476
|
// trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
|
|
114468
114477
|
emitPos(commentPos);
|
|
114469
114478
|
ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
|
|
@@ -114496,6 +114505,8 @@ var ts;
|
|
|
114496
114505
|
return detachedCommentsInfo !== undefined && ts.last(detachedCommentsInfo).nodePos === pos;
|
|
114497
114506
|
}
|
|
114498
114507
|
function forEachLeadingCommentWithoutDetachedComments(cb) {
|
|
114508
|
+
if (!currentSourceFile)
|
|
114509
|
+
return;
|
|
114499
114510
|
// get the leading comments from detachedPos
|
|
114500
114511
|
var pos = ts.last(detachedCommentsInfo).detachedCommentEndPos;
|
|
114501
114512
|
if (detachedCommentsInfo.length - 1) {
|
|
@@ -114507,7 +114518,7 @@ var ts;
|
|
|
114507
114518
|
ts.forEachLeadingCommentRange(currentSourceFile.text, pos, cb, /*state*/ pos);
|
|
114508
114519
|
}
|
|
114509
114520
|
function emitDetachedCommentsAndUpdateCommentsInfo(range) {
|
|
114510
|
-
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);
|
|
114511
114522
|
if (currentDetachedCommentInfo) {
|
|
114512
114523
|
if (detachedCommentsInfo) {
|
|
114513
114524
|
detachedCommentsInfo.push(currentDetachedCommentInfo);
|
|
@@ -114518,7 +114529,7 @@ var ts;
|
|
|
114518
114529
|
}
|
|
114519
114530
|
}
|
|
114520
114531
|
function emitComment(text, lineMap, writer, commentPos, commentEnd, newLine) {
|
|
114521
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114532
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114522
114533
|
return;
|
|
114523
114534
|
emitPos(commentPos);
|
|
114524
114535
|
ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);
|
|
@@ -114530,7 +114541,7 @@ var ts;
|
|
|
114530
114541
|
* @return true if the comment is a triple-slash comment else false
|
|
114531
114542
|
*/
|
|
114532
114543
|
function isTripleSlashComment(commentPos, commentEnd) {
|
|
114533
|
-
return ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
|
|
114544
|
+
return !!currentSourceFile && ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
|
|
114534
114545
|
}
|
|
114535
114546
|
// Source Maps
|
|
114536
114547
|
function getParsedSourceMap(node) {
|
|
@@ -115445,7 +115456,11 @@ var ts;
|
|
|
115445
115456
|
return newValue;
|
|
115446
115457
|
};
|
|
115447
115458
|
if (originalWriteFile) {
|
|
115448
|
-
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
|
+
}
|
|
115449
115464
|
var key = toPath(fileName);
|
|
115450
115465
|
fileExistsCache.delete(key);
|
|
115451
115466
|
var value = readFileCache.get(key);
|
|
@@ -115459,7 +115474,7 @@ var ts;
|
|
|
115459
115474
|
sourceFileCache.delete(key);
|
|
115460
115475
|
}
|
|
115461
115476
|
}
|
|
115462
|
-
originalWriteFile.call(host, fileName, data,
|
|
115477
|
+
originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false));
|
|
115463
115478
|
};
|
|
115464
115479
|
}
|
|
115465
115480
|
// directoryExists
|
|
@@ -116392,6 +116407,7 @@ var ts;
|
|
|
116392
116407
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
116393
116408
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
116394
116409
|
structureIsReused: structureIsReused,
|
|
116410
|
+
writeFile: writeFile,
|
|
116395
116411
|
};
|
|
116396
116412
|
onProgramCreateComplete();
|
|
116397
116413
|
// Add file processingDiagnostics
|
|
@@ -116889,7 +116905,7 @@ var ts;
|
|
|
116889
116905
|
getProjectReferenceRedirect: getProjectReferenceRedirect,
|
|
116890
116906
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
116891
116907
|
getSymlinkCache: getSymlinkCache,
|
|
116892
|
-
writeFile: writeFileCallback ||
|
|
116908
|
+
writeFile: writeFileCallback || writeFile,
|
|
116893
116909
|
isEmitBlocked: isEmitBlocked,
|
|
116894
116910
|
readFile: function (f) { return host.readFile(f); },
|
|
116895
116911
|
fileExists: function (f) {
|
|
@@ -116909,6 +116925,9 @@ var ts;
|
|
|
116909
116925
|
getFileIncludeReasons: program.getFileIncludeReasons,
|
|
116910
116926
|
};
|
|
116911
116927
|
}
|
|
116928
|
+
function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
|
|
116929
|
+
host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
116930
|
+
}
|
|
116912
116931
|
function emitBuildInfo(writeFileCallback) {
|
|
116913
116932
|
ts.Debug.assert(!ts.outFile(options));
|
|
116914
116933
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* Emit */, "emitBuildInfo", {}, /*separateBeginAndEnd*/ true);
|
|
@@ -119351,6 +119370,7 @@ var ts;
|
|
|
119351
119370
|
}
|
|
119352
119371
|
}
|
|
119353
119372
|
}
|
|
119373
|
+
BuilderState.updateExportedModules = updateExportedModules;
|
|
119354
119374
|
/**
|
|
119355
119375
|
* Updates the exported modules from cache into state's exported modules map
|
|
119356
119376
|
* This should be called whenever it is safe to commit the state of the builder
|
|
@@ -120315,7 +120335,43 @@ var ts;
|
|
|
120315
120335
|
return toAffectedFileEmitResult(state,
|
|
120316
120336
|
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
|
120317
120337
|
// Otherwise just affected file
|
|
120318
|
-
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
|
+
};
|
|
120319
120375
|
}
|
|
120320
120376
|
/**
|
|
120321
120377
|
* Emits the JavaScript and declaration files.
|
|
@@ -120372,7 +120428,9 @@ var ts;
|
|
|
120372
120428
|
}
|
|
120373
120429
|
}
|
|
120374
120430
|
}
|
|
120375
|
-
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);
|
|
120376
120434
|
}
|
|
120377
120435
|
/**
|
|
120378
120436
|
* Return the semantic diagnostics for the next affected file or undefined if iteration is complete
|
|
@@ -122564,6 +122622,7 @@ var ts;
|
|
|
122564
122622
|
createHash: ts.maybeBind(host, host.createHash),
|
|
122565
122623
|
readDirectory: ts.maybeBind(host, host.readDirectory),
|
|
122566
122624
|
disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
|
|
122625
|
+
storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
|
|
122567
122626
|
};
|
|
122568
122627
|
function writeFile(fileName, text, writeByteOrderMark, onError) {
|
|
122569
122628
|
try {
|
|
@@ -122623,6 +122682,7 @@ var ts;
|
|
|
122623
122682
|
createHash: ts.maybeBind(system, system.createHash),
|
|
122624
122683
|
createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
|
|
122625
122684
|
disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
|
|
122685
|
+
storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
|
|
122626
122686
|
};
|
|
122627
122687
|
}
|
|
122628
122688
|
ts.createProgramHost = createProgramHost;
|
|
@@ -122711,6 +122771,7 @@ var ts;
|
|
|
122711
122771
|
var host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, system);
|
|
122712
122772
|
host.createHash = ts.maybeBind(system, system.createHash);
|
|
122713
122773
|
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
|
|
122774
|
+
host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
|
|
122714
122775
|
ts.setGetSourceFileAsHashVersioned(host, system);
|
|
122715
122776
|
ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
|
|
122716
122777
|
return host;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.7.0-dev.
|
|
5
|
+
"version": "4.7.0-dev.20220424",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|