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 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-dev.20220421";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220424";
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) {
@@ -14324,10 +14324,10 @@ var ts;
14324
14324
  return ts.combinePaths(newDirPath, sourceFilePath);
14325
14325
  }
14326
14326
  ts.getSourceFilePathInNewDirWorker = getSourceFilePathInNewDirWorker;
14327
- function writeFile(host, diagnostics, fileName, data, writeByteOrderMark, sourceFiles) {
14328
- host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) {
14327
+ function writeFile(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
14328
+ host.writeFile(fileName, text, writeByteOrderMark, function (hostErrorMessage) {
14329
14329
  diagnostics.add(createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
14330
- }, sourceFiles);
14330
+ }, sourceFiles, data);
14331
14331
  }
14332
14332
  ts.writeFile = writeFile;
14333
14333
  function ensureDirectoriesExist(directoryPath, createDirectory, directoryExists) {
@@ -61316,6 +61316,7 @@ var ts;
61316
61316
  }
61317
61317
  }
61318
61318
  else {
61319
+ error(attributeDecl.expression, ts.Diagnostics.Spread_types_may_only_be_created_from_object_types);
61319
61320
  typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
61320
61321
  }
61321
61322
  }
@@ -63206,6 +63207,7 @@ var ts;
63206
63207
  var args = getEffectiveCallArguments(node);
63207
63208
  var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
63208
63209
  var argCheckMode = !isDecorator && !isSingleNonGenericCandidate && ts.some(args, isContextSensitive) ? 4 : 0;
63210
+ argCheckMode |= checkMode & 32;
63209
63211
  var candidatesForArgumentError;
63210
63212
  var candidateForArgumentArityError;
63211
63213
  var candidateForTypeArgumentError;
@@ -63376,7 +63378,7 @@ var ts;
63376
63378
  continue;
63377
63379
  }
63378
63380
  if (argCheckMode) {
63379
- argCheckMode = 0;
63381
+ argCheckMode = checkMode & 32;
63380
63382
  if (inferenceContext) {
63381
63383
  var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
63382
63384
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
@@ -90213,6 +90215,7 @@ var ts;
90213
90215
  else {
90214
90216
  printer.writeFile(sourceFile, writer, sourceMapGenerator);
90215
90217
  }
90218
+ var sourceMapUrlPos;
90216
90219
  if (sourceMapGenerator) {
90217
90220
  if (sourceMapDataList) {
90218
90221
  sourceMapDataList.push({
@@ -90224,6 +90227,7 @@ var ts;
90224
90227
  if (sourceMappingURL) {
90225
90228
  if (!writer.isAtStartOfLine())
90226
90229
  writer.rawWrite(newLine);
90230
+ sourceMapUrlPos = writer.getTextPos();
90227
90231
  writer.writeComment("//# " + "sourceMappingURL" + "=" + sourceMappingURL);
90228
90232
  }
90229
90233
  if (sourceMapFilePath) {
@@ -90234,7 +90238,7 @@ var ts;
90234
90238
  else {
90235
90239
  writer.writeLine();
90236
90240
  }
90237
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles);
90241
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
90238
90242
  writer.clear();
90239
90243
  }
90240
90244
  function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
@@ -90718,7 +90722,7 @@ var ts;
90718
90722
  setWriter(undefined, undefined);
90719
90723
  }
90720
90724
  function getCurrentLineMap() {
90721
- return currentLineMap || (currentLineMap = ts.getLineStarts(currentSourceFile));
90725
+ return currentLineMap || (currentLineMap = ts.getLineStarts(ts.Debug.checkDefined(currentSourceFile)));
90722
90726
  }
90723
90727
  function emit(node, parenthesizerRule) {
90724
90728
  if (node === undefined)
@@ -91802,7 +91806,7 @@ var ts;
91802
91806
  increaseIndent();
91803
91807
  }
91804
91808
  var preferNewLine = node.multiLine ? 65536 : 0;
91805
- var allowTrailingComma = currentSourceFile.languageVersion >= 1 && !ts.isJsonSourceFile(currentSourceFile) ? 64 : 0;
91809
+ var allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= 1 && !ts.isJsonSourceFile(currentSourceFile) ? 64 : 0;
91806
91810
  emitList(node, node.properties, 526226 | allowTrailingComma | preferNewLine);
91807
91811
  if (indentedFlag) {
91808
91812
  decreaseIndent();
@@ -92129,7 +92133,7 @@ var ts;
92129
92133
  }
92130
92134
  function emitExpressionStatement(node) {
92131
92135
  emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfExpressionStatement);
92132
- if (!ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
92136
+ if (!currentSourceFile || !ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
92133
92137
  writeTrailingSemicolon();
92134
92138
  }
92135
92139
  }
@@ -92408,7 +92412,7 @@ var ts;
92408
92412
  if (body.multiLine) {
92409
92413
  return false;
92410
92414
  }
92411
- if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
92415
+ if (!ts.nodeIsSynthesized(body) && currentSourceFile && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
92412
92416
  return false;
92413
92417
  }
92414
92418
  if (getLeadingLineTerminatorCount(body, body.statements, 2)
@@ -92433,12 +92437,7 @@ var ts;
92433
92437
  var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body)
92434
92438
  ? emitBlockFunctionBodyOnSingleLine
92435
92439
  : emitBlockFunctionBodyWorker;
92436
- if (emitBodyWithDetachedComments) {
92437
- emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
92438
- }
92439
- else {
92440
- emitBlockFunctionBody(body);
92441
- }
92440
+ emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
92442
92441
  decreaseIndent();
92443
92442
  writeToken(19, body.statements.end, writePunctuation, body);
92444
92443
  onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(body);
@@ -92822,7 +92821,8 @@ var ts;
92822
92821
  }
92823
92822
  function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) {
92824
92823
  var emitAsSingleStatement = statements.length === 1 &&
92825
- (ts.nodeIsSynthesized(parentNode) ||
92824
+ (!currentSourceFile ||
92825
+ ts.nodeIsSynthesized(parentNode) ||
92826
92826
  ts.nodeIsSynthesized(statements[0]) ||
92827
92827
  ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));
92828
92828
  var format = 163969;
@@ -93034,14 +93034,12 @@ var ts;
93034
93034
  function emitSourceFile(node) {
93035
93035
  writeLine();
93036
93036
  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
- }
93037
+ var shouldEmitDetachedComment = statements.length === 0 ||
93038
+ !ts.isPrologueDirective(statements[0]) ||
93039
+ ts.nodeIsSynthesized(statements[0]);
93040
+ if (shouldEmitDetachedComment) {
93041
+ emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
93042
+ return;
93045
93043
  }
93046
93044
  emitSourceFileWorker(node);
93047
93045
  }
@@ -93419,7 +93417,7 @@ var ts;
93419
93417
  onBeforeEmitNodeArray(children);
93420
93418
  }
93421
93419
  if (isEmpty) {
93422
- if (format & 1 && !(preserveSourceNewlines && (!parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
93420
+ if (format & 1 && !(preserveSourceNewlines && (!parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
93423
93421
  writeLine();
93424
93422
  }
93425
93423
  else if (format & 256 && !(format & 524288)) {
@@ -93650,7 +93648,7 @@ var ts;
93650
93648
  }
93651
93649
  var firstChild_1 = children[0];
93652
93650
  if (firstChild_1 === undefined) {
93653
- return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
93651
+ return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
93654
93652
  }
93655
93653
  if (firstChild_1.pos === nextListElementPos) {
93656
93654
  return 0;
@@ -93658,7 +93656,7 @@ var ts;
93658
93656
  if (firstChild_1.kind === 11) {
93659
93657
  return 0;
93660
93658
  }
93661
- if (parentNode &&
93659
+ if (currentSourceFile && parentNode &&
93662
93660
  !ts.positionIsSynthesized(parentNode.pos) &&
93663
93661
  !ts.nodeIsSynthesized(firstChild_1) &&
93664
93662
  (!firstChild_1.parent || ts.getOriginalNode(firstChild_1.parent) === ts.getOriginalNode(parentNode))) {
@@ -93681,7 +93679,7 @@ var ts;
93681
93679
  if (nextNode.kind === 11) {
93682
93680
  return 0;
93683
93681
  }
93684
- else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
93682
+ else if (currentSourceFile && !ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
93685
93683
  if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
93686
93684
  return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
93687
93685
  }
@@ -93706,9 +93704,9 @@ var ts;
93706
93704
  }
93707
93705
  var lastChild = ts.lastOrUndefined(children);
93708
93706
  if (lastChild === undefined) {
93709
- return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
93707
+ return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
93710
93708
  }
93711
- if (parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
93709
+ if (currentSourceFile && parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
93712
93710
  if (preserveSourceNewlines) {
93713
93711
  var end_1 = ts.isNodeArray(children) && !ts.positionIsSynthesized(children.end) ? children.end : lastChild.end;
93714
93712
  return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter(end_1, parentNode.end, currentSourceFile, includeComments); });
@@ -93765,7 +93763,7 @@ var ts;
93765
93763
  if (ts.getStartsOnNewLine(node2)) {
93766
93764
  return 1;
93767
93765
  }
93768
- if (!ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
93766
+ if (currentSourceFile && !ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
93769
93767
  if (preserveSourceNewlines) {
93770
93768
  return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(node1, node2, currentSourceFile, includeComments); });
93771
93769
  }
@@ -93775,7 +93773,7 @@ var ts;
93775
93773
  }
93776
93774
  function isEmptyBlock(block) {
93777
93775
  return block.statements.length === 0
93778
- && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
93776
+ && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile));
93779
93777
  }
93780
93778
  function skipSynthesizedParentheses(node) {
93781
93779
  while (node.kind === 212 && ts.nodeIsSynthesized(node)) {
@@ -93787,16 +93785,23 @@ var ts;
93787
93785
  if (ts.isGeneratedIdentifier(node)) {
93788
93786
  return generateName(node);
93789
93787
  }
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) {
93788
+ if (ts.isStringLiteral(node) && node.textSourceNode) {
93794
93789
  return getTextOfNode(node.textSourceNode, includeTrivia);
93795
93790
  }
93796
- else if (ts.isLiteralExpression(node) && (ts.nodeIsSynthesized(node) || !node.parent)) {
93797
- return node.text;
93791
+ var sourceFile = currentSourceFile;
93792
+ var canUseSourceFile = !!sourceFile && !!node.parent && !ts.nodeIsSynthesized(node);
93793
+ if (ts.isMemberName(node)) {
93794
+ if (!canUseSourceFile || ts.getSourceFileOfNode(node) !== ts.getOriginalNode(sourceFile)) {
93795
+ return ts.idText(node);
93796
+ }
93797
+ }
93798
+ else {
93799
+ ts.Debug.assertNode(node, ts.isLiteralExpression);
93800
+ if (!canUseSourceFile) {
93801
+ return node.text;
93802
+ }
93798
93803
  }
93799
- return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node, includeTrivia);
93804
+ return ts.getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
93800
93805
  }
93801
93806
  function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
93802
93807
  if (node.kind === 10 && node.textSourceNode) {
@@ -94287,7 +94292,7 @@ var ts;
94287
94292
  return true;
94288
94293
  }
94289
94294
  function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
94290
- if (!shouldWriteComment(currentSourceFile.text, commentPos))
94295
+ if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
94291
94296
  return;
94292
94297
  if (!hasWrittenComment) {
94293
94298
  ts.emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos);
@@ -94313,7 +94318,7 @@ var ts;
94313
94318
  forEachTrailingCommentToEmit(pos, emitTrailingComment);
94314
94319
  }
94315
94320
  function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
94316
- if (!shouldWriteComment(currentSourceFile.text, commentPos))
94321
+ if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
94317
94322
  return;
94318
94323
  if (!writer.isAtStartOfLine()) {
94319
94324
  writer.writeSpace(" ");
@@ -94334,6 +94339,8 @@ var ts;
94334
94339
  exitComment();
94335
94340
  }
94336
94341
  function emitTrailingCommentOfPositionNoNewline(commentPos, commentEnd, kind) {
94342
+ if (!currentSourceFile)
94343
+ return;
94337
94344
  emitPos(commentPos);
94338
94345
  ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
94339
94346
  emitPos(commentEnd);
@@ -94342,6 +94349,8 @@ var ts;
94342
94349
  }
94343
94350
  }
94344
94351
  function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
94352
+ if (!currentSourceFile)
94353
+ return;
94345
94354
  emitPos(commentPos);
94346
94355
  ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
94347
94356
  emitPos(commentEnd);
@@ -94371,6 +94380,8 @@ var ts;
94371
94380
  return detachedCommentsInfo !== undefined && ts.last(detachedCommentsInfo).nodePos === pos;
94372
94381
  }
94373
94382
  function forEachLeadingCommentWithoutDetachedComments(cb) {
94383
+ if (!currentSourceFile)
94384
+ return;
94374
94385
  var pos = ts.last(detachedCommentsInfo).detachedCommentEndPos;
94375
94386
  if (detachedCommentsInfo.length - 1) {
94376
94387
  detachedCommentsInfo.pop();
@@ -94381,7 +94392,7 @@ var ts;
94381
94392
  ts.forEachLeadingCommentRange(currentSourceFile.text, pos, cb, pos);
94382
94393
  }
94383
94394
  function emitDetachedCommentsAndUpdateCommentsInfo(range) {
94384
- var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
94395
+ var currentDetachedCommentInfo = currentSourceFile && ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
94385
94396
  if (currentDetachedCommentInfo) {
94386
94397
  if (detachedCommentsInfo) {
94387
94398
  detachedCommentsInfo.push(currentDetachedCommentInfo);
@@ -94392,14 +94403,14 @@ var ts;
94392
94403
  }
94393
94404
  }
94394
94405
  function emitComment(text, lineMap, writer, commentPos, commentEnd, newLine) {
94395
- if (!shouldWriteComment(currentSourceFile.text, commentPos))
94406
+ if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
94396
94407
  return;
94397
94408
  emitPos(commentPos);
94398
94409
  ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);
94399
94410
  emitPos(commentEnd);
94400
94411
  }
94401
94412
  function isTripleSlashComment(commentPos, commentEnd) {
94402
- return ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
94413
+ return !!currentSourceFile && ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
94403
94414
  }
94404
94415
  function getParsedSourceMap(node) {
94405
94416
  if (node.parsedSourceMap === undefined && node.sourceMapText !== undefined) {
@@ -95206,7 +95217,11 @@ var ts;
95206
95217
  return newValue;
95207
95218
  };
95208
95219
  if (originalWriteFile) {
95209
- host.writeFile = function (fileName, data, writeByteOrderMark, onError, sourceFiles) {
95220
+ host.writeFile = function (fileName, data) {
95221
+ var rest = [];
95222
+ for (var _i = 2; _i < arguments.length; _i++) {
95223
+ rest[_i - 2] = arguments[_i];
95224
+ }
95210
95225
  var key = toPath(fileName);
95211
95226
  fileExistsCache.delete(key);
95212
95227
  var value = readFileCache.get(key);
@@ -95220,7 +95235,7 @@ var ts;
95220
95235
  sourceFileCache.delete(key);
95221
95236
  }
95222
95237
  }
95223
- originalWriteFile.call(host, fileName, data, writeByteOrderMark, onError, sourceFiles);
95238
+ originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false));
95224
95239
  };
95225
95240
  }
95226
95241
  if (originalDirectoryExists && originalCreateDirectory) {
@@ -96042,6 +96057,7 @@ var ts;
96042
96057
  useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
96043
96058
  getFileIncludeReasons: function () { return fileReasons; },
96044
96059
  structureIsReused: structureIsReused,
96060
+ writeFile: writeFile,
96045
96061
  };
96046
96062
  onProgramCreateComplete();
96047
96063
  fileProcessingDiagnostics === null || fileProcessingDiagnostics === void 0 ? void 0 : fileProcessingDiagnostics.forEach(function (diagnostic) {
@@ -96445,7 +96461,7 @@ var ts;
96445
96461
  getProjectReferenceRedirect: getProjectReferenceRedirect,
96446
96462
  isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
96447
96463
  getSymlinkCache: getSymlinkCache,
96448
- writeFile: writeFileCallback || (function (fileName, data, writeByteOrderMark, onError, sourceFiles) { return host.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles); }),
96464
+ writeFile: writeFileCallback || writeFile,
96449
96465
  isEmitBlocked: isEmitBlocked,
96450
96466
  readFile: function (f) { return host.readFile(f); },
96451
96467
  fileExists: function (f) {
@@ -96463,6 +96479,9 @@ var ts;
96463
96479
  getFileIncludeReasons: program.getFileIncludeReasons,
96464
96480
  };
96465
96481
  }
96482
+ function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
96483
+ host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
96484
+ }
96466
96485
  function emitBuildInfo(writeFileCallback) {
96467
96486
  ts.Debug.assert(!ts.outFile(options));
96468
96487
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "emitBuildInfo", {}, true);
@@ -98640,6 +98659,7 @@ var ts;
98640
98659
  }
98641
98660
  }
98642
98661
  }
98662
+ BuilderState.updateExportedModules = updateExportedModules;
98643
98663
  function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
98644
98664
  var _a;
98645
98665
  if (exportedModulesMapCache) {
@@ -99411,7 +99431,43 @@ var ts;
99411
99431
  affected = program;
99412
99432
  }
99413
99433
  }
99414
- 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);
99434
+ return toAffectedFileEmitResult(state, ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
99435
+ getWriteFileUpdatingSignatureCallback(writeFile) :
99436
+ writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0, customTransformers), affected, emitKind, isPendingEmitFile);
99437
+ }
99438
+ function getWriteFileUpdatingSignatureCallback(writeFile) {
99439
+ return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
99440
+ var _a;
99441
+ if (ts.isDeclarationFileName(fileName)) {
99442
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
99443
+ var file = sourceFiles[0];
99444
+ var info = state.fileInfos.get(file.resolvedPath);
99445
+ var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
99446
+ if (signature === file.version) {
99447
+ var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
99448
+ if (newSignature !== file.version) {
99449
+ if (host.storeFilesChangingSignatureDuringEmit)
99450
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
99451
+ if (state.exportedModulesMap)
99452
+ ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
99453
+ if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
99454
+ state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
99455
+ }
99456
+ else {
99457
+ info.signature = newSignature;
99458
+ if (state.exportedModulesMap)
99459
+ ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
99460
+ }
99461
+ }
99462
+ }
99463
+ }
99464
+ if (writeFile)
99465
+ writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
99466
+ else if (host.writeFile)
99467
+ host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
99468
+ else
99469
+ state.program.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
99470
+ };
99415
99471
  }
99416
99472
  function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
99417
99473
  var _a;
@@ -99452,7 +99508,9 @@ var ts;
99452
99508
  }
99453
99509
  }
99454
99510
  }
99455
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
99511
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
99512
+ getWriteFileUpdatingSignatureCallback(writeFile) :
99513
+ writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
99456
99514
  }
99457
99515
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
99458
99516
  while (true) {
@@ -101375,6 +101433,7 @@ var ts;
101375
101433
  createHash: ts.maybeBind(host, host.createHash),
101376
101434
  readDirectory: ts.maybeBind(host, host.readDirectory),
101377
101435
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
101436
+ storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
101378
101437
  };
101379
101438
  function writeFile(fileName, text, writeByteOrderMark, onError) {
101380
101439
  try {
@@ -101428,6 +101487,7 @@ var ts;
101428
101487
  createHash: ts.maybeBind(system, system.createHash),
101429
101488
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
101430
101489
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
101490
+ storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
101431
101491
  };
101432
101492
  }
101433
101493
  ts.createProgramHost = createProgramHost;
@@ -101504,6 +101564,7 @@ var ts;
101504
101564
  var host = ts.createCompilerHostWorker(options, undefined, system);
101505
101565
  host.createHash = ts.maybeBind(system, system.createHash);
101506
101566
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
101567
+ host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
101507
101568
  ts.setGetSourceFileAsHashVersioned(host, system);
101508
101569
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
101509
101570
  return host;