@typescript-deploys/pr-build 4.7.0-pr-48791-5 → 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 CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.7";
72
- ts.version = ts.versionMajorMinor + ".0-insiders.20220420";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220425";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -11209,7 +11209,7 @@ var ts;
11209
11209
  ts.getScriptTargetFeatures = getScriptTargetFeatures;
11210
11210
  function getLiteralText(node, sourceFile, flags) {
11211
11211
  var _a;
11212
- if (canUseOriginalText(node, flags)) {
11212
+ if (sourceFile && canUseOriginalText(node, flags)) {
11213
11213
  return getSourceTextOfNodeFromSourceFile(sourceFile, node);
11214
11214
  }
11215
11215
  switch (node.kind) {
@@ -13561,11 +13561,19 @@ var ts;
13561
13561
  return !!name && isDynamicName(name);
13562
13562
  }
13563
13563
  ts.hasDynamicName = hasDynamicName;
13564
+ function getComputedPropertyNameExpression(name) {
13565
+ return ts.isElementAccessExpression(name.expression)
13566
+ ? skipParentheses(name.expression.argumentExpression)
13567
+ : name.expression;
13568
+ }
13569
+ ts.getComputedPropertyNameExpression = getComputedPropertyNameExpression;
13564
13570
  function isDynamicName(name) {
13565
13571
  if (!(name.kind === 162 || name.kind === 207)) {
13566
13572
  return false;
13567
13573
  }
13568
- var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression;
13574
+ var expr = ts.isElementAccessExpression(name)
13575
+ ? skipParentheses(name.argumentExpression)
13576
+ : getComputedPropertyNameExpression(name);
13569
13577
  return !isStringOrNumericLiteralLike(expr) &&
13570
13578
  !isSignedNumericLiteral(expr);
13571
13579
  }
@@ -13579,7 +13587,7 @@ var ts;
13579
13587
  case 8:
13580
13588
  return ts.escapeLeadingUnderscores(name.text);
13581
13589
  case 162:
13582
- var nameExpression = name.expression;
13590
+ var nameExpression = getComputedPropertyNameExpression(name);
13583
13591
  if (isStringOrNumericLiteralLike(nameExpression)) {
13584
13592
  return ts.escapeLeadingUnderscores(nameExpression.text);
13585
13593
  }
@@ -14324,10 +14332,10 @@ var ts;
14324
14332
  return ts.combinePaths(newDirPath, sourceFilePath);
14325
14333
  }
14326
14334
  ts.getSourceFilePathInNewDirWorker = getSourceFilePathInNewDirWorker;
14327
- function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) {
14328
- host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) {
14335
+ function writeFile(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
14336
+ host.writeFile(fileName, text, writeByteOrderMark, function (hostErrorMessage) {
14329
14337
  diagnostics.add(createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
14330
- }, sourceFiles);
14338
+ }, sourceFiles, data);
14331
14339
  }
14332
14340
  ts.writeFile = writeFile;
14333
14341
  function ensureDirectoriesExist(directoryPath, createDirectory, directoryExists) {
@@ -27638,7 +27646,7 @@ var ts;
27638
27646
  return undefined;
27639
27647
  }
27640
27648
  return triState === 1 ?
27641
- parseParenthesizedArrowFunctionExpression(true, disallowReturnTypeInArrowFunction) :
27649
+ parseParenthesizedArrowFunctionExpression(true, false) :
27642
27650
  tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
27643
27651
  }
27644
27652
  function isParenthesizedArrowFunctionExpression() {
@@ -36337,7 +36345,7 @@ var ts;
36337
36345
  return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
36338
36346
  }
36339
36347
  if (name.kind === 162) {
36340
- var nameExpression = name.expression;
36348
+ var nameExpression = ts.getComputedPropertyNameExpression(name);
36341
36349
  if (ts.isStringOrNumericLiteralLike(nameExpression)) {
36342
36350
  return ts.escapeLeadingUnderscores(nameExpression.text);
36343
36351
  }
@@ -61316,6 +61324,7 @@ var ts;
61316
61324
  }
61317
61325
  }
61318
61326
  else {
61327
+ error(attributeDecl.expression, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types);
61319
61328
  typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
61320
61329
  }
61321
61330
  }
@@ -63206,6 +63215,7 @@ var ts;
63206
63215
  var args = getEffectiveCallArguments(node);
63207
63216
  var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
63208
63217
  var argCheckMode = !isDecorator && !isSingleNonGenericCandidate && ts.some(args, isContextSensitive) ? 4 : 0;
63218
+ argCheckMode |= checkMode & 32;
63209
63219
  var candidatesForArgumentError;
63210
63220
  var candidateForArgumentArityError;
63211
63221
  var candidateForTypeArgumentError;
@@ -63376,7 +63386,7 @@ var ts;
63376
63386
  continue;
63377
63387
  }
63378
63388
  if (argCheckMode) {
63379
- argCheckMode = 0;
63389
+ argCheckMode = checkMode & 32;
63380
63390
  if (inferenceContext) {
63381
63391
  var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
63382
63392
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
@@ -90213,6 +90223,7 @@ var ts;
90213
90223
  else {
90214
90224
  printer.writeFile(sourceFile, writer, sourceMapGenerator);
90215
90225
  }
90226
+ var sourceMapUrlPos;
90216
90227
  if (sourceMapGenerator) {
90217
90228
  if (sourceMapDataList) {
90218
90229
  sourceMapDataList.push({
@@ -90224,6 +90235,7 @@ var ts;
90224
90235
  if (sourceMappingURL) {
90225
90236
  if (!writer.isAtStartOfLine())
90226
90237
  writer.rawWrite(newLine);
90238
+ sourceMapUrlPos = writer.getTextPos();
90227
90239
  writer.writeComment("//# " + "sourceMappingURL" + "=" + sourceMappingURL);
90228
90240
  }
90229
90241
  if (sourceMapFilePath) {
@@ -90234,7 +90246,7 @@ var ts;
90234
90246
  else {
90235
90247
  writer.writeLine();
90236
90248
  }
90237
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles);
90249
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
90238
90250
  writer.clear();
90239
90251
  }
90240
90252
  function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
@@ -90718,7 +90730,7 @@ var ts;
90718
90730
  setWriter(undefined, undefined);
90719
90731
  }
90720
90732
  function getCurrentLineMap() {
90721
- return currentLineMap || (currentLineMap = ts.getLineStarts(currentSourceFile));
90733
+ return currentLineMap || (currentLineMap = ts.getLineStarts(ts.Debug.checkDefined(currentSourceFile)));
90722
90734
  }
90723
90735
  function emit(node, parenthesizerRule) {
90724
90736
  if (node === undefined)
@@ -91802,7 +91814,7 @@ var ts;
91802
91814
  increaseIndent();
91803
91815
  }
91804
91816
  var preferNewLine = node.multiLine ? 65536 : 0;
91805
- var allowTrailingComma = currentSourceFile.languageVersion >= 1 && !ts.isJsonSourceFile(currentSourceFile) ? 64 : 0;
91817
+ var allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= 1 && !ts.isJsonSourceFile(currentSourceFile) ? 64 : 0;
91806
91818
  emitList(node, node.properties, 526226 | allowTrailingComma | preferNewLine);
91807
91819
  if (indentedFlag) {
91808
91820
  decreaseIndent();
@@ -92129,7 +92141,7 @@ var ts;
92129
92141
  }
92130
92142
  function emitExpressionStatement(node) {
92131
92143
  emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfExpressionStatement);
92132
- if (!ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
92144
+ if (!currentSourceFile || !ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
92133
92145
  writeTrailingSemicolon();
92134
92146
  }
92135
92147
  }
@@ -92408,7 +92420,7 @@ var ts;
92408
92420
  if (body.multiLine) {
92409
92421
  return false;
92410
92422
  }
92411
- if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
92423
+ if (!ts.nodeIsSynthesized(body) && currentSourceFile && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
92412
92424
  return false;
92413
92425
  }
92414
92426
  if (getLeadingLineTerminatorCount(body, body.statements, 2)
@@ -92433,12 +92445,7 @@ var ts;
92433
92445
  var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body)
92434
92446
  ? emitBlockFunctionBodyOnSingleLine
92435
92447
  : emitBlockFunctionBodyWorker;
92436
- if (emitBodyWithDetachedComments) {
92437
- emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
92438
- }
92439
- else {
92440
- emitBlockFunctionBody(body);
92441
- }
92448
+ emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
92442
92449
  decreaseIndent();
92443
92450
  writeToken(19, body.statements.end, writePunctuation, body);
92444
92451
  onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(body);
@@ -92822,7 +92829,8 @@ var ts;
92822
92829
  }
92823
92830
  function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) {
92824
92831
  var emitAsSingleStatement = statements.length === 1 &&
92825
- (ts.nodeIsSynthesized(parentNode) ||
92832
+ (!currentSourceFile ||
92833
+ ts.nodeIsSynthesized(parentNode) ||
92826
92834
  ts.nodeIsSynthesized(statements[0]) ||
92827
92835
  ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));
92828
92836
  var format = 163969;
@@ -93034,14 +93042,12 @@ var ts;
93034
93042
  function emitSourceFile(node) {
93035
93043
  writeLine();
93036
93044
  var statements = node.statements;
93037
- if (emitBodyWithDetachedComments) {
93038
- var shouldEmitDetachedComment = statements.length === 0 ||
93039
- !ts.isPrologueDirective(statements[0]) ||
93040
- ts.nodeIsSynthesized(statements[0]);
93041
- if (shouldEmitDetachedComment) {
93042
- emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
93043
- return;
93044
- }
93045
+ var shouldEmitDetachedComment = statements.length === 0 ||
93046
+ !ts.isPrologueDirective(statements[0]) ||
93047
+ ts.nodeIsSynthesized(statements[0]);
93048
+ if (shouldEmitDetachedComment) {
93049
+ emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
93050
+ return;
93045
93051
  }
93046
93052
  emitSourceFileWorker(node);
93047
93053
  }
@@ -93419,7 +93425,7 @@ var ts;
93419
93425
  onBeforeEmitNodeArray(children);
93420
93426
  }
93421
93427
  if (isEmpty) {
93422
- if (format & 1 && !(preserveSourceNewlines && (!parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
93428
+ if (format & 1 && !(preserveSourceNewlines && (!parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
93423
93429
  writeLine();
93424
93430
  }
93425
93431
  else if (format & 256 && !(format & 524288)) {
@@ -93650,7 +93656,7 @@ var ts;
93650
93656
  }
93651
93657
  var firstChild_1 = children[0];
93652
93658
  if (firstChild_1 === undefined) {
93653
- return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
93659
+ return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
93654
93660
  }
93655
93661
  if (firstChild_1.pos === nextListElementPos) {
93656
93662
  return 0;
@@ -93658,7 +93664,7 @@ var ts;
93658
93664
  if (firstChild_1.kind === 11) {
93659
93665
  return 0;
93660
93666
  }
93661
- if (parentNode &&
93667
+ if (currentSourceFile && parentNode &&
93662
93668
  !ts.positionIsSynthesized(parentNode.pos) &&
93663
93669
  !ts.nodeIsSynthesized(firstChild_1) &&
93664
93670
  (!firstChild_1.parent || ts.getOriginalNode(firstChild_1.parent) === ts.getOriginalNode(parentNode))) {
@@ -93681,7 +93687,7 @@ var ts;
93681
93687
  if (nextNode.kind === 11) {
93682
93688
  return 0;
93683
93689
  }
93684
- else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
93690
+ else if (currentSourceFile && !ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
93685
93691
  if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
93686
93692
  return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
93687
93693
  }
@@ -93706,9 +93712,9 @@ var ts;
93706
93712
  }
93707
93713
  var lastChild = ts.lastOrUndefined(children);
93708
93714
  if (lastChild === undefined) {
93709
- return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
93715
+ return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
93710
93716
  }
93711
- if (parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
93717
+ if (currentSourceFile && parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
93712
93718
  if (preserveSourceNewlines) {
93713
93719
  var end_1 = ts.isNodeArray(children) && !ts.positionIsSynthesized(children.end) ? children.end : lastChild.end;
93714
93720
  return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter(end_1, parentNode.end, currentSourceFile, includeComments); });
@@ -93765,7 +93771,7 @@ var ts;
93765
93771
  if (ts.getStartsOnNewLine(node2)) {
93766
93772
  return 1;
93767
93773
  }
93768
- if (!ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
93774
+ if (currentSourceFile && !ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
93769
93775
  if (preserveSourceNewlines) {
93770
93776
  return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(node1, node2, currentSourceFile, includeComments); });
93771
93777
  }
@@ -93775,7 +93781,7 @@ var ts;
93775
93781
  }
93776
93782
  function isEmptyBlock(block) {
93777
93783
  return block.statements.length === 0
93778
- && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
93784
+ && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile));
93779
93785
  }
93780
93786
  function skipSynthesizedParentheses(node) {
93781
93787
  while (node.kind === 212 && ts.nodeIsSynthesized(node)) {
@@ -93787,16 +93793,23 @@ var ts;
93787
93793
  if (ts.isGeneratedIdentifier(node)) {
93788
93794
  return generateName(node);
93789
93795
  }
93790
- else if ((ts.isIdentifier(node) || ts.isPrivateIdentifier(node)) && (ts.nodeIsSynthesized(node) || !node.parent || !currentSourceFile || (node.parent && currentSourceFile && ts.getSourceFileOfNode(node) !== ts.getOriginalNode(currentSourceFile)))) {
93791
- return ts.idText(node);
93792
- }
93793
- else if (node.kind === 10 && node.textSourceNode) {
93796
+ if (ts.isStringLiteral(node) && node.textSourceNode) {
93794
93797
  return getTextOfNode(node.textSourceNode, includeTrivia);
93795
93798
  }
93796
- else if (ts.isLiteralExpression(node) && (ts.nodeIsSynthesized(node) || !node.parent)) {
93797
- return node.text;
93799
+ var sourceFile = currentSourceFile;
93800
+ var canUseSourceFile = !!sourceFile && !!node.parent && !ts.nodeIsSynthesized(node);
93801
+ if (ts.isMemberName(node)) {
93802
+ if (!canUseSourceFile || ts.getSourceFileOfNode(node) !== ts.getOriginalNode(sourceFile)) {
93803
+ return ts.idText(node);
93804
+ }
93798
93805
  }
93799
- return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node, includeTrivia);
93806
+ else {
93807
+ ts.Debug.assertNode(node, ts.isLiteralExpression);
93808
+ if (!canUseSourceFile) {
93809
+ return node.text;
93810
+ }
93811
+ }
93812
+ return ts.getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
93800
93813
  }
93801
93814
  function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
93802
93815
  if (node.kind === 10 && node.textSourceNode) {
@@ -94287,7 +94300,7 @@ var ts;
94287
94300
  return true;
94288
94301
  }
94289
94302
  function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
94290
- if (!shouldWriteComment(currentSourceFile.text, commentPos))
94303
+ if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
94291
94304
  return;
94292
94305
  if (!hasWrittenComment) {
94293
94306
  ts.emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos);
@@ -94313,7 +94326,7 @@ var ts;
94313
94326
  forEachTrailingCommentToEmit(pos, emitTrailingComment);
94314
94327
  }
94315
94328
  function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
94316
- if (!shouldWriteComment(currentSourceFile.text, commentPos))
94329
+ if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
94317
94330
  return;
94318
94331
  if (!writer.isAtStartOfLine()) {
94319
94332
  writer.writeSpace(" ");
@@ -94334,6 +94347,8 @@ var ts;
94334
94347
  exitComment();
94335
94348
  }
94336
94349
  function emitTrailingCommentOfPositionNoNewline(commentPos, commentEnd, kind) {
94350
+ if (!currentSourceFile)
94351
+ return;
94337
94352
  emitPos(commentPos);
94338
94353
  ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
94339
94354
  emitPos(commentEnd);
@@ -94342,6 +94357,8 @@ var ts;
94342
94357
  }
94343
94358
  }
94344
94359
  function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
94360
+ if (!currentSourceFile)
94361
+ return;
94345
94362
  emitPos(commentPos);
94346
94363
  ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
94347
94364
  emitPos(commentEnd);
@@ -94371,6 +94388,8 @@ var ts;
94371
94388
  return detachedCommentsInfo !== undefined && ts.last(detachedCommentsInfo).nodePos === pos;
94372
94389
  }
94373
94390
  function forEachLeadingCommentWithoutDetachedComments(cb) {
94391
+ if (!currentSourceFile)
94392
+ return;
94374
94393
  var pos = ts.last(detachedCommentsInfo).detachedCommentEndPos;
94375
94394
  if (detachedCommentsInfo.length - 1) {
94376
94395
  detachedCommentsInfo.pop();
@@ -94381,7 +94400,7 @@ var ts;
94381
94400
  ts.forEachLeadingCommentRange(currentSourceFile.text, pos, cb, pos);
94382
94401
  }
94383
94402
  function emitDetachedCommentsAndUpdateCommentsInfo(range) {
94384
- var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
94403
+ var currentDetachedCommentInfo = currentSourceFile && ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
94385
94404
  if (currentDetachedCommentInfo) {
94386
94405
  if (detachedCommentsInfo) {
94387
94406
  detachedCommentsInfo.push(currentDetachedCommentInfo);
@@ -94392,14 +94411,14 @@ var ts;
94392
94411
  }
94393
94412
  }
94394
94413
  function emitComment(text, lineMap, writer, commentPos, commentEnd, newLine) {
94395
- if (!shouldWriteComment(currentSourceFile.text, commentPos))
94414
+ if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
94396
94415
  return;
94397
94416
  emitPos(commentPos);
94398
94417
  ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);
94399
94418
  emitPos(commentEnd);
94400
94419
  }
94401
94420
  function isTripleSlashComment(commentPos, commentEnd) {
94402
- return ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
94421
+ return !!currentSourceFile && ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
94403
94422
  }
94404
94423
  function getParsedSourceMap(node) {
94405
94424
  if (node.parsedSourceMap === undefined && node.sourceMapText !== undefined) {
@@ -95206,7 +95225,11 @@ var ts;
95206
95225
  return newValue;
95207
95226
  };
95208
95227
  if (originalWriteFile) {
95209
- host.writeFile = function (fileName, data, writeByteOrderMark, onError, sourceFiles) {
95228
+ host.writeFile = function (fileName, data) {
95229
+ var rest = [];
95230
+ for (var _i = 2; _i < arguments.length; _i++) {
95231
+ rest[_i - 2] = arguments[_i];
95232
+ }
95210
95233
  var key = toPath(fileName);
95211
95234
  fileExistsCache.delete(key);
95212
95235
  var value = readFileCache.get(key);
@@ -95220,7 +95243,7 @@ var ts;
95220
95243
  sourceFileCache.delete(key);
95221
95244
  }
95222
95245
  }
95223
- originalWriteFile.call(host, fileName, data, writeByteOrderMark, onError, sourceFiles);
95246
+ originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false));
95224
95247
  };
95225
95248
  }
95226
95249
  if (originalDirectoryExists && originalCreateDirectory) {
@@ -96042,6 +96065,7 @@ var ts;
96042
96065
  useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
96043
96066
  getFileIncludeReasons: function () { return fileReasons; },
96044
96067
  structureIsReused: structureIsReused,
96068
+ writeFile: writeFile,
96045
96069
  };
96046
96070
  onProgramCreateComplete();
96047
96071
  fileProcessingDiagnostics === null || fileProcessingDiagnostics === void 0 ? void 0 : fileProcessingDiagnostics.forEach(function (diagnostic) {
@@ -96445,7 +96469,7 @@ var ts;
96445
96469
  getProjectReferenceRedirect: getProjectReferenceRedirect,
96446
96470
  isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
96447
96471
  getSymlinkCache: getSymlinkCache,
96448
- writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),
96472
+ writeFile: writeFileCallback || writeFile,
96449
96473
  isEmitBlocked: isEmitBlocked,
96450
96474
  readFile: function (f) { return host.readFile(f); },
96451
96475
  fileExists: function (f) {
@@ -96463,6 +96487,9 @@ var ts;
96463
96487
  getFileIncludeReasons: program.getFileIncludeReasons,
96464
96488
  };
96465
96489
  }
96490
+ function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
96491
+ host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
96492
+ }
96466
96493
  function emitBuildInfo(writeFileCallback) {
96467
96494
  ts.Debug.assert(!ts.outFile(options));
96468
96495
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "emitBuildInfo", {}, true);
@@ -98640,6 +98667,7 @@ var ts;
98640
98667
  }
98641
98668
  }
98642
98669
  }
98670
+ BuilderState.updateExportedModules = updateExportedModules;
98643
98671
  function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
98644
98672
  var _a;
98645
98673
  if (exportedModulesMapCache) {
@@ -98966,29 +98994,30 @@ var ts;
98966
98994
  }
98967
98995
  return undefined;
98968
98996
  }
98997
+ function removeDiagnosticsOfLibraryFiles(state) {
98998
+ if (!state.cleanedDiagnosticsOfLibFiles) {
98999
+ state.cleanedDiagnosticsOfLibFiles = true;
99000
+ var program_1 = ts.Debug.checkDefined(state.program);
99001
+ var options_2 = program_1.getCompilerOptions();
99002
+ ts.forEach(program_1.getSourceFiles(), function (f) {
99003
+ return program_1.isSourceFileDefaultLibrary(f) &&
99004
+ !ts.skipTypeChecking(f, options_2, program_1) &&
99005
+ removeSemanticDiagnosticsOf(state, f.resolvedPath);
99006
+ });
99007
+ }
99008
+ }
98969
99009
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
98970
99010
  var _a;
98971
99011
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
98972
99012
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
98973
- if (!state.cleanedDiagnosticsOfLibFiles) {
98974
- state.cleanedDiagnosticsOfLibFiles = true;
98975
- var program_1 = ts.Debug.checkDefined(state.program);
98976
- var options_2 = program_1.getCompilerOptions();
98977
- ts.forEach(program_1.getSourceFiles(), function (f) {
98978
- return program_1.isSourceFileDefaultLibrary(f) &&
98979
- !ts.skipTypeChecking(f, options_2, program_1) &&
98980
- removeSemanticDiagnosticsOf(state, f.resolvedPath);
98981
- });
98982
- }
99013
+ removeDiagnosticsOfLibraryFiles(state);
98983
99014
  ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
98984
99015
  return;
98985
99016
  }
98986
- else {
98987
- 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);
98988
- }
98989
- if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
98990
- forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
98991
- }
99017
+ 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);
99018
+ if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
99019
+ return;
99020
+ handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
98992
99021
  }
98993
99022
  function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
98994
99023
  removeSemanticDiagnosticsOf(state, path);
@@ -99016,11 +99045,32 @@ var ts;
99016
99045
  var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
99017
99046
  return newSignature !== oldSignature;
99018
99047
  }
99019
- function forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, fn) {
99020
- var _a, _b;
99021
- if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath)) {
99048
+ function forEachKeyOfExportedModulesMap(state, filePath, fn) {
99049
+ var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
99050
+ var result = keys && ts.forEachKey(keys, fn);
99051
+ if (result)
99052
+ return result;
99053
+ keys = state.exportedModulesMap.getKeys(filePath);
99054
+ return keys && ts.forEachKey(keys, function (exportedFromPath) {
99055
+ var _a;
99056
+ return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
99057
+ !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
99058
+ fn(exportedFromPath) :
99059
+ undefined;
99060
+ });
99061
+ }
99062
+ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
99063
+ var _a;
99064
+ if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
99065
+ return false;
99066
+ ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, undefined)
99067
+ .forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
99068
+ removeDiagnosticsOfLibraryFiles(state);
99069
+ return true;
99070
+ }
99071
+ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
99072
+ if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
99022
99073
  return;
99023
- }
99024
99074
  if (!isChangedSignature(state, affectedFile.resolvedPath))
99025
99075
  return;
99026
99076
  if (state.compilerOptions.isolatedModules) {
@@ -99031,7 +99081,9 @@ var ts;
99031
99081
  var currentPath = queue.pop();
99032
99082
  if (!seenFileNamesMap.has(currentPath)) {
99033
99083
  seenFileNamesMap.set(currentPath, true);
99034
- fn(state, currentPath);
99084
+ if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
99085
+ return;
99086
+ handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
99035
99087
  if (isChangedSignature(state, currentPath)) {
99036
99088
  var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
99037
99089
  queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
@@ -99041,42 +99093,31 @@ var ts;
99041
99093
  }
99042
99094
  ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
99043
99095
  var seenFileAndExportsOfFile = new ts.Set();
99044
- (_a = state.currentAffectedFilesExportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
99045
- return forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
99046
- });
99047
- (_b = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
99048
- var _a;
99049
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
99050
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
99051
- forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
99096
+ forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
99097
+ if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
99098
+ return true;
99099
+ var references = state.referencedMap.getKeys(exportedFromPath);
99100
+ return references && ts.forEachKey(references, function (filePath) {
99101
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
99102
+ });
99052
99103
  });
99053
99104
  }
99054
- function forEachFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile, fn) {
99105
+ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
99055
99106
  var _a;
99056
- (_a = state.referencedMap.getKeys(referencedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (filePath) {
99057
- return forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn);
99058
- });
99059
- }
99060
- function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
99061
- var _a, _b, _c;
99062
- if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath)) {
99063
- return;
99064
- }
99065
- fn(state, filePath);
99107
+ if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
99108
+ return undefined;
99109
+ if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
99110
+ return true;
99111
+ handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
99066
99112
  ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
99067
- (_a = state.currentAffectedFilesExportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
99068
- return forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
99113
+ forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
99114
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
99069
99115
  });
99070
- (_b = state.exportedModulesMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (exportedFromPath) {
99071
- var _a;
99072
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
99073
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) &&
99074
- forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
99075
- });
99076
- (_c = state.referencedMap.getKeys(filePath)) === null || _c === void 0 ? void 0 : _c.forEach(function (referencingFilePath) {
99116
+ (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
99077
99117
  return !seenFileAndExportsOfFile.has(referencingFilePath) &&
99078
- fn(state, referencingFilePath);
99118
+ handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, computeHash, host);
99079
99119
  });
99120
+ return undefined;
99080
99121
  }
99081
99122
  function doneWithAffectedFile(state, affected, emitKind, isPendingEmit, isBuildInfoEmit) {
99082
99123
  if (isBuildInfoEmit) {
@@ -99398,7 +99439,43 @@ var ts;
99398
99439
  affected = program;
99399
99440
  }
99400
99441
  }
99401
- return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0, customTransformers), affected, emitKind, isPendingEmitFile);
99442
+ return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
99443
+ getWriteFileUpdatingSignatureCallback(writeFile) :
99444
+ writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0, customTransformers), affected, emitKind, isPendingEmitFile);
99445
+ }
99446
+ function getWriteFileUpdatingSignatureCallback(writeFile) {
99447
+ return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
99448
+ var _a;
99449
+ if (ts.isDeclarationFileName(fileName)) {
99450
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
99451
+ var file = sourceFiles[0];
99452
+ var info = state.fileInfos.get(file.resolvedPath);
99453
+ var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
99454
+ if (signature === file.version) {
99455
+ var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
99456
+ if (newSignature !== file.version) {
99457
+ if (host.storeFilesChangingSignatureDuringEmit)
99458
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
99459
+ if (state.exportedModulesMap)
99460
+ ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
99461
+ if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
99462
+ state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
99463
+ }
99464
+ else {
99465
+ info.signature = newSignature;
99466
+ if (state.exportedModulesMap)
99467
+ ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
99468
+ }
99469
+ }
99470
+ }
99471
+ }
99472
+ if (writeFile)
99473
+ writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
99474
+ else if (host.writeFile)
99475
+ host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
99476
+ else
99477
+ state.program.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
99478
+ };
99402
99479
  }
99403
99480
  function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
99404
99481
  var _a;
@@ -99439,7 +99516,9 @@ var ts;
99439
99516
  }
99440
99517
  }
99441
99518
  }
99442
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
99519
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
99520
+ getWriteFileUpdatingSignatureCallback(writeFile) :
99521
+ writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
99443
99522
  }
99444
99523
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
99445
99524
  while (true) {
@@ -101362,6 +101441,7 @@ var ts;
101362
101441
  createHash: ts.maybeBind(host, host.createHash),
101363
101442
  readDirectory: ts.maybeBind(host, host.readDirectory),
101364
101443
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
101444
+ storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
101365
101445
  };
101366
101446
  function writeFile(fileName, text, writeByteOrderMark, onError) {
101367
101447
  try {
@@ -101415,6 +101495,7 @@ var ts;
101415
101495
  createHash: ts.maybeBind(system, system.createHash),
101416
101496
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
101417
101497
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
101498
+ storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
101418
101499
  };
101419
101500
  }
101420
101501
  ts.createProgramHost = createProgramHost;
@@ -101491,6 +101572,7 @@ var ts;
101491
101572
  var host = ts.createCompilerHostWorker(options, undefined, system);
101492
101573
  host.createHash = ts.maybeBind(system, system.createHash);
101493
101574
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
101575
+ host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
101494
101576
  ts.setGetSourceFileAsHashVersioned(host, system);
101495
101577
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
101496
101578
  return host;