@typescript-deploys/pr-build 4.7.0-pr-47461-10 → 4.7.0-pr-48784-4

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.
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-insiders.20220425";
297
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220427";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -6384,7 +6384,7 @@ var ts;
6384
6384
  };
6385
6385
  }
6386
6386
  function createDirectoryWatcher(dirName, dirPath, fallbackOptions) {
6387
- var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName) {
6387
+ var watcher = fsWatch(dirName, 1 /* Directory */, function (_eventName, relativeFileName, modifiedTime) {
6388
6388
  // When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
6389
6389
  if (!ts.isString(relativeFileName))
6390
6390
  return;
@@ -6394,7 +6394,7 @@ var ts;
6394
6394
  if (callbacks) {
6395
6395
  for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
6396
6396
  var fileCallback = callbacks_1[_i];
6397
- fileCallback(fileName, FileWatcherEventKind.Changed);
6397
+ fileCallback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6398
6398
  }
6399
6399
  }
6400
6400
  },
@@ -6448,7 +6448,7 @@ var ts;
6448
6448
  }
6449
6449
  else {
6450
6450
  cache.set(path, {
6451
- watcher: watchFile(fileName, function (fileName, eventKind) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind); }); }, pollingInterval, options),
6451
+ watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6452
6452
  refCount: 1
6453
6453
  });
6454
6454
  }
@@ -6476,7 +6476,7 @@ var ts;
6476
6476
  var newTime = modifiedTime.getTime();
6477
6477
  if (oldTime !== newTime) {
6478
6478
  watchedFile.mtime = modifiedTime;
6479
- watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime));
6479
+ watchedFile.callback(watchedFile.fileName, getFileWatcherEventKind(oldTime, newTime), modifiedTime);
6480
6480
  return true;
6481
6481
  }
6482
6482
  return false;
@@ -6727,17 +6727,18 @@ var ts;
6727
6727
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6728
6728
  /*@internal*/
6729
6729
  function createFileWatcherCallback(callback) {
6730
- return function (_fileName, eventKind) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", ""); };
6730
+ return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6731
6731
  }
6732
6732
  ts.createFileWatcherCallback = createFileWatcherCallback;
6733
- function createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists) {
6734
- return function (eventName) {
6733
+ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6734
+ return function (eventName, _relativeFileName, modifiedTime) {
6735
6735
  if (eventName === "rename") {
6736
- callback(fileName, fileExists(fileName) ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted);
6736
+ modifiedTime || (modifiedTime = getModifiedTime(fileName) || ts.missingFileModifiedTime);
6737
+ callback(fileName, modifiedTime !== ts.missingFileModifiedTime ? FileWatcherEventKind.Created : FileWatcherEventKind.Deleted, modifiedTime);
6737
6738
  }
6738
6739
  else {
6739
6740
  // Change
6740
- callback(fileName, FileWatcherEventKind.Changed);
6741
+ callback(fileName, FileWatcherEventKind.Changed, modifiedTime);
6741
6742
  }
6742
6743
  };
6743
6744
  }
@@ -6761,7 +6762,7 @@ var ts;
6761
6762
  }
6762
6763
  /*@internal*/
6763
6764
  function createSystemWatchFunctions(_a) {
6764
- var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatch = _a.fsWatch, fileExists = _a.fileExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, directoryExists = _a.directoryExists, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind;
6765
+ var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatch = _a.fsWatch, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, directoryExists = _a.directoryExists, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind;
6765
6766
  var dynamicPollingWatchFile;
6766
6767
  var fixedChunkSizePollingWatchFile;
6767
6768
  var nonPollingWatchFile;
@@ -6783,7 +6784,7 @@ var ts;
6783
6784
  case ts.WatchFileKind.FixedChunkSizePolling:
6784
6785
  return ensureFixedChunkSizePollingWatchFile()(fileName, callback, /* pollingInterval */ undefined, /*options*/ undefined);
6785
6786
  case ts.WatchFileKind.UseFsEvents:
6786
- return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, fileExists),
6787
+ return fsWatch(fileName, 0 /* File */, createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime),
6787
6788
  /*recursive*/ false, pollingInterval, ts.getFallbackOptions(options));
6788
6789
  case ts.WatchFileKind.UseFsEventsOnParentDirectory:
6789
6790
  if (!nonPollingWatchFile) {
@@ -6965,7 +6966,6 @@ var ts;
6965
6966
  fsWatch: fsWatch,
6966
6967
  useCaseSensitiveFileNames: useCaseSensitiveFileNames,
6967
6968
  getCurrentDirectory: getCurrentDirectory,
6968
- fileExists: fileExists,
6969
6969
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
6970
6970
  // (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
6971
6971
  fsSupportsRecursiveFsWatch: fsSupportsRecursiveFsWatch,
@@ -7225,7 +7225,7 @@ var ts;
7225
7225
  // File changed
7226
7226
  eventKind = FileWatcherEventKind.Changed;
7227
7227
  }
7228
- callback(fileName, eventKind);
7228
+ callback(fileName, eventKind, curr.mtime);
7229
7229
  }
7230
7230
  }
7231
7231
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
@@ -7251,10 +7251,10 @@ var ts;
7251
7251
  * Invoke the callback with rename and update the watcher if not closed
7252
7252
  * @param createWatcher
7253
7253
  */
7254
- function invokeCallbackAndUpdateWatcher(createWatcher) {
7254
+ function invokeCallbackAndUpdateWatcher(createWatcher, modifiedTime) {
7255
7255
  sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
7256
7256
  // Call the callback for current directory
7257
- callback("rename", "");
7257
+ callback("rename", "", modifiedTime);
7258
7258
  // If watcher is not closed, update it
7259
7259
  if (watcher) {
7260
7260
  watcher.close();
@@ -7300,13 +7300,14 @@ var ts;
7300
7300
  function callbackChangingToMissingFileSystemEntry(event, relativeName) {
7301
7301
  // because relativeName is not guaranteed to be correct we need to check on each rename with few combinations
7302
7302
  // Eg on ubuntu while watching app/node_modules the relativeName is "node_modules" which is neither relative nor full path
7303
+ var modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime;
7303
7304
  return event === "rename" &&
7304
7305
  (!relativeName ||
7305
7306
  relativeName === lastDirectoryPart ||
7306
7307
  (relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) !== -1 && relativeName.lastIndexOf(lastDirectoryPartWithDirectorySeparator) === relativeName.length - lastDirectoryPartWithDirectorySeparator.length)) &&
7307
- !fileSystemEntryExists(fileOrDirectory, entryKind) ?
7308
- invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry) :
7309
- callback(event, relativeName);
7308
+ modifiedTime === ts.missingFileModifiedTime ?
7309
+ invokeCallbackAndUpdateWatcher(watchMissingFileSystemEntry, modifiedTime) :
7310
+ callback(event, relativeName, modifiedTime);
7310
7311
  }
7311
7312
  /**
7312
7313
  * Watch the file or directory using fs.watchFile since fs.watch threw exception
@@ -7320,12 +7321,15 @@ var ts;
7320
7321
  * and switch to existing file or directory when the missing filesystem entry is created
7321
7322
  */
7322
7323
  function watchMissingFileSystemEntry() {
7323
- return watchFile(fileOrDirectory, function (_fileName, eventKind) {
7324
- if (eventKind === FileWatcherEventKind.Created && fileSystemEntryExists(fileOrDirectory, entryKind)) {
7325
- // Call the callback for current file or directory
7326
- // For now it could be callback for the inner directory creation,
7327
- // but just return current directory, better than current no-op
7328
- invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry);
7324
+ return watchFile(fileOrDirectory, function (_fileName, eventKind, modifiedTime) {
7325
+ if (eventKind === FileWatcherEventKind.Created) {
7326
+ modifiedTime || (modifiedTime = getModifiedTime(fileOrDirectory) || ts.missingFileModifiedTime);
7327
+ if (modifiedTime !== ts.missingFileModifiedTime) {
7328
+ // Call the callback for current file or directory
7329
+ // For now it could be callback for the inner directory creation,
7330
+ // but just return current directory, better than current no-op
7331
+ invokeCallbackAndUpdateWatcher(watchPresentFileSystemEntry, modifiedTime);
7332
+ }
7329
7333
  }
7330
7334
  }, fallbackPollingInterval, fallbackOptions);
7331
7335
  }
@@ -7475,12 +7479,19 @@ var ts;
7475
7479
  }
7476
7480
  function getModifiedTime(path) {
7477
7481
  var _a;
7482
+ // Since the error thrown by fs.statSync isn't used, we can avoid collecting a stack trace to improve
7483
+ // the CPU time performance.
7484
+ var originalStackTraceLimit = Error.stackTraceLimit;
7485
+ Error.stackTraceLimit = 0;
7478
7486
  try {
7479
7487
  return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime;
7480
7488
  }
7481
7489
  catch (e) {
7482
7490
  return undefined;
7483
7491
  }
7492
+ finally {
7493
+ Error.stackTraceLimit = originalStackTraceLimit;
7494
+ }
7484
7495
  }
7485
7496
  function setModifiedTime(path, time) {
7486
7497
  try {
@@ -9066,6 +9077,7 @@ var ts;
9066
9077
  This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_one_in_0_Consider_upgrading_your_version_of_0: diag(2807, ts.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807", "This syntax requires an imported helper named '{1}' with {2} parameters, which is not compatible with the one in '{0}'. Consider upgrading your version of '{0}'."),
9067
9078
  A_get_accessor_must_be_at_least_as_accessible_as_the_setter: diag(2808, ts.DiagnosticCategory.Error, "A_get_accessor_must_be_at_least_as_accessible_as_the_setter_2808", "A get accessor must be at least as accessible as the setter"),
9068
9079
  Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses: diag(2809, ts.DiagnosticCategory.Error, "Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_d_2809", "Declaration or statement expected. This '=' follows a block of statements, so if you intended to write a destructuring assignment, you might need to wrap the the whole assignment in parentheses."),
9080
+ Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments: diag(2810, ts.DiagnosticCategory.Error, "Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_2810", "Expected 1 argument, but got 0. 'new Promise()' needs a JSDoc hint to produce a 'resolve' that can be called without arguments."),
9069
9081
  Initializer_for_property_0: diag(2811, ts.DiagnosticCategory.Error, "Initializer_for_property_0_2811", "Initializer for property '{0}'"),
9070
9082
  Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom: diag(2812, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Try_changing_the_lib_compiler_option_to_include_dom_2812", "Property '{0}' does not exist on type '{1}'. Try changing the 'lib' compiler option to include 'dom'."),
9071
9083
  Class_declaration_cannot_implement_overload_list_for_0: diag(2813, ts.DiagnosticCategory.Error, "Class_declaration_cannot_implement_overload_list_for_0_2813", "Class declaration cannot implement overload list for '{0}'."),
@@ -9493,8 +9505,8 @@ var ts;
9493
9505
  Cannot_prepend_project_0_because_it_does_not_have_outFile_set: diag(6308, ts.DiagnosticCategory.Error, "Cannot_prepend_project_0_because_it_does_not_have_outFile_set_6308", "Cannot prepend project '{0}' because it does not have 'outFile' set"),
9494
9506
  Output_file_0_from_project_1_does_not_exist: diag(6309, ts.DiagnosticCategory.Error, "Output_file_0_from_project_1_does_not_exist_6309", "Output file '{0}' from project '{1}' does not exist"),
9495
9507
  Referenced_project_0_may_not_disable_emit: diag(6310, ts.DiagnosticCategory.Error, "Referenced_project_0_may_not_disable_emit_6310", "Referenced project '{0}' may not disable emit."),
9496
- Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2: diag(6350, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350", "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'"),
9497
- Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2: diag(6351, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351", "Project '{0}' is up to date because newest input '{1}' is older than oldest output '{2}'"),
9508
+ Project_0_is_out_of_date_because_output_1_is_older_than_input_2: diag(6350, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_1_is_older_than_input_2_6350", "Project '{0}' is out of date because output '{1}' is older than input '{2}'"),
9509
+ Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2: diag(6351, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351", "Project '{0}' is up to date because newest input '{1}' is older than output '{2}'"),
9498
9510
  Project_0_is_out_of_date_because_output_file_1_does_not_exist: diag(6352, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352", "Project '{0}' is out of date because output file '{1}' does not exist"),
9499
9511
  Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date: diag(6353, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353", "Project '{0}' is out of date because its dependency '{1}' is out of date"),
9500
9512
  Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies: diag(6354, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354", "Project '{0}' is up to date with .d.ts files from its dependencies"),
@@ -9538,6 +9550,7 @@ var ts;
9538
9550
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3: diag(6396, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6396", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}'."),
9539
9551
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4: diag(6397, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6397", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."),
9540
9552
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),
9553
+ Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_are_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_are_not_emitted_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes are not emitted"),
9541
9554
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
9542
9555
  The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
9543
9556
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -17501,19 +17514,11 @@ var ts;
17501
17514
  return !!name && isDynamicName(name);
17502
17515
  }
17503
17516
  ts.hasDynamicName = hasDynamicName;
17504
- function getComputedPropertyNameExpression(name) {
17505
- return ts.isElementAccessExpression(name.expression)
17506
- ? skipParentheses(name.expression.argumentExpression)
17507
- : name.expression;
17508
- }
17509
- ts.getComputedPropertyNameExpression = getComputedPropertyNameExpression;
17510
17517
  function isDynamicName(name) {
17511
17518
  if (!(name.kind === 162 /* ComputedPropertyName */ || name.kind === 207 /* ElementAccessExpression */)) {
17512
17519
  return false;
17513
17520
  }
17514
- var expr = ts.isElementAccessExpression(name)
17515
- ? skipParentheses(name.argumentExpression)
17516
- : getComputedPropertyNameExpression(name);
17521
+ var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression;
17517
17522
  return !isStringOrNumericLiteralLike(expr) &&
17518
17523
  !isSignedNumericLiteral(expr);
17519
17524
  }
@@ -17527,7 +17532,7 @@ var ts;
17527
17532
  case 8 /* NumericLiteral */:
17528
17533
  return ts.escapeLeadingUnderscores(name.text);
17529
17534
  case 162 /* ComputedPropertyName */:
17530
- var nameExpression = getComputedPropertyNameExpression(name);
17535
+ var nameExpression = name.expression;
17531
17536
  if (isStringOrNumericLiteralLike(nameExpression)) {
17532
17537
  return ts.escapeLeadingUnderscores(nameExpression.text);
17533
17538
  }
@@ -20350,6 +20355,10 @@ var ts;
20350
20355
  return optionsHaveChanges(oldOptions, newOptions, ts.affectsEmitOptionDeclarations);
20351
20356
  }
20352
20357
  ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
20358
+ function compilerOptionsAffectDeclarationPath(newOptions, oldOptions) {
20359
+ return optionsHaveChanges(oldOptions, newOptions, ts.affectsDeclarationPathOptionDeclarations);
20360
+ }
20361
+ ts.compilerOptionsAffectDeclarationPath = compilerOptionsAffectDeclarationPath;
20353
20362
  function getCompilerOptionValue(options, option) {
20354
20363
  return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
20355
20364
  }
@@ -38164,7 +38173,8 @@ var ts;
38164
38173
  if (!comment) {
38165
38174
  comment = parseTrailingTagComments(start, getNodePos(), indent, indentText);
38166
38175
  }
38167
- return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start);
38176
+ var end = comment !== undefined ? getNodePos() : typeExpression.end;
38177
+ return finishNode(factory.createJSDocCallbackTag(tagName, typeExpression, fullName, comment), start, end);
38168
38178
  }
38169
38179
  function escapedTextsEqual(a, b) {
38170
38180
  while (!ts.isIdentifier(a) || !ts.isIdentifier(b)) {
@@ -39387,6 +39397,7 @@ var ts;
39387
39397
  type: "boolean",
39388
39398
  affectsSemanticDiagnostics: true,
39389
39399
  affectsEmit: true,
39400
+ affectsMultiFileEmitBuildInfo: true,
39390
39401
  category: ts.Diagnostics.Watch_and_Build_Modes,
39391
39402
  description: ts.Diagnostics.Have_recompiles_in_projects_that_use_incremental_and_watch_mode_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it,
39392
39403
  defaultValueDescription: false,
@@ -39421,12 +39432,40 @@ var ts;
39421
39432
  affectsSourceFile: true,
39422
39433
  affectsModuleResolution: true,
39423
39434
  affectsEmit: true,
39435
+ affectsMultiFileEmitBuildInfo: true,
39424
39436
  paramType: ts.Diagnostics.VERSION,
39425
39437
  showInSimplifiedHelpView: true,
39426
39438
  category: ts.Diagnostics.Language_and_Environment,
39427
39439
  description: ts.Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
39428
39440
  defaultValueDescription: 0 /* ES3 */,
39429
39441
  };
39442
+ /*@internal*/
39443
+ ts.moduleOptionDeclaration = {
39444
+ name: "module",
39445
+ shortName: "m",
39446
+ type: new ts.Map(ts.getEntries({
39447
+ none: ts.ModuleKind.None,
39448
+ commonjs: ts.ModuleKind.CommonJS,
39449
+ amd: ts.ModuleKind.AMD,
39450
+ system: ts.ModuleKind.System,
39451
+ umd: ts.ModuleKind.UMD,
39452
+ es6: ts.ModuleKind.ES2015,
39453
+ es2015: ts.ModuleKind.ES2015,
39454
+ es2020: ts.ModuleKind.ES2020,
39455
+ es2022: ts.ModuleKind.ES2022,
39456
+ esnext: ts.ModuleKind.ESNext,
39457
+ node12: ts.ModuleKind.Node12,
39458
+ nodenext: ts.ModuleKind.NodeNext,
39459
+ })),
39460
+ affectsModuleResolution: true,
39461
+ affectsEmit: true,
39462
+ affectsMultiFileEmitBuildInfo: true,
39463
+ paramType: ts.Diagnostics.KIND,
39464
+ showInSimplifiedHelpView: true,
39465
+ category: ts.Diagnostics.Modules,
39466
+ description: ts.Diagnostics.Specify_what_module_code_is_generated,
39467
+ defaultValueDescription: undefined,
39468
+ };
39430
39469
  var commandOptionsWithoutBuild = [
39431
39470
  // CommandLine only options
39432
39471
  {
@@ -39488,37 +39527,14 @@ var ts;
39488
39527
  category: ts.Diagnostics.Command_line_Options,
39489
39528
  affectsSemanticDiagnostics: true,
39490
39529
  affectsEmit: true,
39530
+ affectsMultiFileEmitBuildInfo: true,
39491
39531
  isCommandLineOnly: true,
39492
39532
  description: ts.Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing,
39493
39533
  defaultValueDescription: false,
39494
39534
  },
39495
39535
  // Basic
39496
39536
  ts.targetOptionDeclaration,
39497
- {
39498
- name: "module",
39499
- shortName: "m",
39500
- type: new ts.Map(ts.getEntries({
39501
- none: ts.ModuleKind.None,
39502
- commonjs: ts.ModuleKind.CommonJS,
39503
- amd: ts.ModuleKind.AMD,
39504
- system: ts.ModuleKind.System,
39505
- umd: ts.ModuleKind.UMD,
39506
- es6: ts.ModuleKind.ES2015,
39507
- es2015: ts.ModuleKind.ES2015,
39508
- es2020: ts.ModuleKind.ES2020,
39509
- es2022: ts.ModuleKind.ES2022,
39510
- esnext: ts.ModuleKind.ESNext,
39511
- node12: ts.ModuleKind.Node12,
39512
- nodenext: ts.ModuleKind.NodeNext,
39513
- })),
39514
- affectsModuleResolution: true,
39515
- affectsEmit: true,
39516
- paramType: ts.Diagnostics.KIND,
39517
- showInSimplifiedHelpView: true,
39518
- category: ts.Diagnostics.Modules,
39519
- description: ts.Diagnostics.Specify_what_module_code_is_generated,
39520
- defaultValueDescription: undefined,
39521
- },
39537
+ ts.moduleOptionDeclaration,
39522
39538
  {
39523
39539
  name: "lib",
39524
39540
  type: "list",
@@ -39555,6 +39571,7 @@ var ts;
39555
39571
  type: jsxOptionMap,
39556
39572
  affectsSourceFile: true,
39557
39573
  affectsEmit: true,
39574
+ affectsMultiFileEmitBuildInfo: true,
39558
39575
  affectsModuleResolution: true,
39559
39576
  paramType: ts.Diagnostics.KIND,
39560
39577
  showInSimplifiedHelpView: true,
@@ -39567,6 +39584,7 @@ var ts;
39567
39584
  shortName: "d",
39568
39585
  type: "boolean",
39569
39586
  affectsEmit: true,
39587
+ affectsMultiFileEmitBuildInfo: true,
39570
39588
  showInSimplifiedHelpView: true,
39571
39589
  category: ts.Diagnostics.Emit,
39572
39590
  transpileOptionValue: undefined,
@@ -39577,6 +39595,7 @@ var ts;
39577
39595
  name: "declarationMap",
39578
39596
  type: "boolean",
39579
39597
  affectsEmit: true,
39598
+ affectsMultiFileEmitBuildInfo: true,
39580
39599
  showInSimplifiedHelpView: true,
39581
39600
  category: ts.Diagnostics.Emit,
39582
39601
  transpileOptionValue: undefined,
@@ -39587,6 +39606,7 @@ var ts;
39587
39606
  name: "emitDeclarationOnly",
39588
39607
  type: "boolean",
39589
39608
  affectsEmit: true,
39609
+ affectsMultiFileEmitBuildInfo: true,
39590
39610
  showInSimplifiedHelpView: true,
39591
39611
  category: ts.Diagnostics.Emit,
39592
39612
  description: ts.Diagnostics.Only_output_d_ts_files_and_not_JavaScript_files,
@@ -39597,6 +39617,7 @@ var ts;
39597
39617
  name: "sourceMap",
39598
39618
  type: "boolean",
39599
39619
  affectsEmit: true,
39620
+ affectsMultiFileEmitBuildInfo: true,
39600
39621
  showInSimplifiedHelpView: true,
39601
39622
  category: ts.Diagnostics.Emit,
39602
39623
  defaultValueDescription: false,
@@ -39606,6 +39627,9 @@ var ts;
39606
39627
  name: "outFile",
39607
39628
  type: "string",
39608
39629
  affectsEmit: true,
39630
+ affectsMultiFileEmitBuildInfo: true,
39631
+ affectsDeclarationPath: true,
39632
+ affectsBundleEmitBuildInfo: true,
39609
39633
  isFilePath: true,
39610
39634
  paramType: ts.Diagnostics.FILE,
39611
39635
  showInSimplifiedHelpView: true,
@@ -39617,6 +39641,8 @@ var ts;
39617
39641
  name: "outDir",
39618
39642
  type: "string",
39619
39643
  affectsEmit: true,
39644
+ affectsMultiFileEmitBuildInfo: true,
39645
+ affectsDeclarationPath: true,
39620
39646
  isFilePath: true,
39621
39647
  paramType: ts.Diagnostics.DIRECTORY,
39622
39648
  showInSimplifiedHelpView: true,
@@ -39627,6 +39653,8 @@ var ts;
39627
39653
  name: "rootDir",
39628
39654
  type: "string",
39629
39655
  affectsEmit: true,
39656
+ affectsMultiFileEmitBuildInfo: true,
39657
+ affectsDeclarationPath: true,
39630
39658
  isFilePath: true,
39631
39659
  paramType: ts.Diagnostics.LOCATION,
39632
39660
  category: ts.Diagnostics.Modules,
@@ -39637,6 +39665,8 @@ var ts;
39637
39665
  name: "composite",
39638
39666
  type: "boolean",
39639
39667
  affectsEmit: true,
39668
+ affectsMultiFileEmitBuildInfo: true,
39669
+ affectsBundleEmitBuildInfo: true,
39640
39670
  isTSConfigOnly: true,
39641
39671
  category: ts.Diagnostics.Projects,
39642
39672
  transpileOptionValue: undefined,
@@ -39647,6 +39677,8 @@ var ts;
39647
39677
  name: "tsBuildInfoFile",
39648
39678
  type: "string",
39649
39679
  affectsEmit: true,
39680
+ affectsMultiFileEmitBuildInfo: true,
39681
+ affectsBundleEmitBuildInfo: true,
39650
39682
  isFilePath: true,
39651
39683
  paramType: ts.Diagnostics.FILE,
39652
39684
  category: ts.Diagnostics.Projects,
@@ -39658,6 +39690,7 @@ var ts;
39658
39690
  name: "removeComments",
39659
39691
  type: "boolean",
39660
39692
  affectsEmit: true,
39693
+ affectsMultiFileEmitBuildInfo: true,
39661
39694
  showInSimplifiedHelpView: true,
39662
39695
  category: ts.Diagnostics.Emit,
39663
39696
  defaultValueDescription: false,
@@ -39676,6 +39709,7 @@ var ts;
39676
39709
  name: "importHelpers",
39677
39710
  type: "boolean",
39678
39711
  affectsEmit: true,
39712
+ affectsMultiFileEmitBuildInfo: true,
39679
39713
  category: ts.Diagnostics.Emit,
39680
39714
  description: ts.Diagnostics.Allow_importing_helper_functions_from_tslib_once_per_project_instead_of_including_them_per_file,
39681
39715
  defaultValueDescription: false,
@@ -39689,6 +39723,7 @@ var ts;
39689
39723
  })),
39690
39724
  affectsEmit: true,
39691
39725
  affectsSemanticDiagnostics: true,
39726
+ affectsMultiFileEmitBuildInfo: true,
39692
39727
  category: ts.Diagnostics.Emit,
39693
39728
  description: ts.Diagnostics.Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types,
39694
39729
  defaultValueDescription: 0 /* Remove */,
@@ -39697,6 +39732,7 @@ var ts;
39697
39732
  name: "downlevelIteration",
39698
39733
  type: "boolean",
39699
39734
  affectsEmit: true,
39735
+ affectsMultiFileEmitBuildInfo: true,
39700
39736
  category: ts.Diagnostics.Emit,
39701
39737
  description: ts.Diagnostics.Emit_more_compliant_but_verbose_and_less_performant_JavaScript_for_iteration,
39702
39738
  defaultValueDescription: false,
@@ -39715,6 +39751,9 @@ var ts;
39715
39751
  type: "boolean",
39716
39752
  // Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
39717
39753
  // The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
39754
+ // But we need to store `strict` in builf info, even though it won't be examined directly, so that the
39755
+ // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly
39756
+ affectsMultiFileEmitBuildInfo: true,
39718
39757
  showInSimplifiedHelpView: true,
39719
39758
  category: ts.Diagnostics.Type_Checking,
39720
39759
  description: ts.Diagnostics.Enable_all_strict_type_checking_options,
@@ -39724,6 +39763,7 @@ var ts;
39724
39763
  name: "noImplicitAny",
39725
39764
  type: "boolean",
39726
39765
  affectsSemanticDiagnostics: true,
39766
+ affectsMultiFileEmitBuildInfo: true,
39727
39767
  strictFlag: true,
39728
39768
  category: ts.Diagnostics.Type_Checking,
39729
39769
  description: ts.Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type,
@@ -39733,6 +39773,7 @@ var ts;
39733
39773
  name: "strictNullChecks",
39734
39774
  type: "boolean",
39735
39775
  affectsSemanticDiagnostics: true,
39776
+ affectsMultiFileEmitBuildInfo: true,
39736
39777
  strictFlag: true,
39737
39778
  category: ts.Diagnostics.Type_Checking,
39738
39779
  description: ts.Diagnostics.When_type_checking_take_into_account_null_and_undefined,
@@ -39741,6 +39782,8 @@ var ts;
39741
39782
  {
39742
39783
  name: "strictFunctionTypes",
39743
39784
  type: "boolean",
39785
+ affectsSemanticDiagnostics: true,
39786
+ affectsMultiFileEmitBuildInfo: true,
39744
39787
  strictFlag: true,
39745
39788
  category: ts.Diagnostics.Type_Checking,
39746
39789
  description: ts.Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible,
@@ -39749,6 +39792,8 @@ var ts;
39749
39792
  {
39750
39793
  name: "strictBindCallApply",
39751
39794
  type: "boolean",
39795
+ affectsSemanticDiagnostics: true,
39796
+ affectsMultiFileEmitBuildInfo: true,
39752
39797
  strictFlag: true,
39753
39798
  category: ts.Diagnostics.Type_Checking,
39754
39799
  description: ts.Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function,
@@ -39758,6 +39803,7 @@ var ts;
39758
39803
  name: "strictPropertyInitialization",
39759
39804
  type: "boolean",
39760
39805
  affectsSemanticDiagnostics: true,
39806
+ affectsMultiFileEmitBuildInfo: true,
39761
39807
  strictFlag: true,
39762
39808
  category: ts.Diagnostics.Type_Checking,
39763
39809
  description: ts.Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor,
@@ -39767,6 +39813,7 @@ var ts;
39767
39813
  name: "noImplicitThis",
39768
39814
  type: "boolean",
39769
39815
  affectsSemanticDiagnostics: true,
39816
+ affectsMultiFileEmitBuildInfo: true,
39770
39817
  strictFlag: true,
39771
39818
  category: ts.Diagnostics.Type_Checking,
39772
39819
  description: ts.Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any,
@@ -39776,6 +39823,7 @@ var ts;
39776
39823
  name: "useUnknownInCatchVariables",
39777
39824
  type: "boolean",
39778
39825
  affectsSemanticDiagnostics: true,
39826
+ affectsMultiFileEmitBuildInfo: true,
39779
39827
  strictFlag: true,
39780
39828
  category: ts.Diagnostics.Type_Checking,
39781
39829
  description: ts.Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any,
@@ -39785,6 +39833,8 @@ var ts;
39785
39833
  name: "alwaysStrict",
39786
39834
  type: "boolean",
39787
39835
  affectsSourceFile: true,
39836
+ affectsEmit: true,
39837
+ affectsMultiFileEmitBuildInfo: true,
39788
39838
  strictFlag: true,
39789
39839
  category: ts.Diagnostics.Type_Checking,
39790
39840
  description: ts.Diagnostics.Ensure_use_strict_is_always_emitted,
@@ -39795,6 +39845,7 @@ var ts;
39795
39845
  name: "noUnusedLocals",
39796
39846
  type: "boolean",
39797
39847
  affectsSemanticDiagnostics: true,
39848
+ affectsMultiFileEmitBuildInfo: true,
39798
39849
  category: ts.Diagnostics.Type_Checking,
39799
39850
  description: ts.Diagnostics.Enable_error_reporting_when_local_variables_aren_t_read,
39800
39851
  defaultValueDescription: false,
@@ -39803,6 +39854,7 @@ var ts;
39803
39854
  name: "noUnusedParameters",
39804
39855
  type: "boolean",
39805
39856
  affectsSemanticDiagnostics: true,
39857
+ affectsMultiFileEmitBuildInfo: true,
39806
39858
  category: ts.Diagnostics.Type_Checking,
39807
39859
  description: ts.Diagnostics.Raise_an_error_when_a_function_parameter_isn_t_read,
39808
39860
  defaultValueDescription: false,
@@ -39811,6 +39863,7 @@ var ts;
39811
39863
  name: "exactOptionalPropertyTypes",
39812
39864
  type: "boolean",
39813
39865
  affectsSemanticDiagnostics: true,
39866
+ affectsMultiFileEmitBuildInfo: true,
39814
39867
  category: ts.Diagnostics.Type_Checking,
39815
39868
  description: ts.Diagnostics.Interpret_optional_property_types_as_written_rather_than_adding_undefined,
39816
39869
  defaultValueDescription: false,
@@ -39819,6 +39872,7 @@ var ts;
39819
39872
  name: "noImplicitReturns",
39820
39873
  type: "boolean",
39821
39874
  affectsSemanticDiagnostics: true,
39875
+ affectsMultiFileEmitBuildInfo: true,
39822
39876
  category: ts.Diagnostics.Type_Checking,
39823
39877
  description: ts.Diagnostics.Enable_error_reporting_for_codepaths_that_do_not_explicitly_return_in_a_function,
39824
39878
  defaultValueDescription: false,
@@ -39828,6 +39882,7 @@ var ts;
39828
39882
  type: "boolean",
39829
39883
  affectsBindDiagnostics: true,
39830
39884
  affectsSemanticDiagnostics: true,
39885
+ affectsMultiFileEmitBuildInfo: true,
39831
39886
  category: ts.Diagnostics.Type_Checking,
39832
39887
  description: ts.Diagnostics.Enable_error_reporting_for_fallthrough_cases_in_switch_statements,
39833
39888
  defaultValueDescription: false,
@@ -39836,6 +39891,7 @@ var ts;
39836
39891
  name: "noUncheckedIndexedAccess",
39837
39892
  type: "boolean",
39838
39893
  affectsSemanticDiagnostics: true,
39894
+ affectsMultiFileEmitBuildInfo: true,
39839
39895
  category: ts.Diagnostics.Type_Checking,
39840
39896
  description: ts.Diagnostics.Add_undefined_to_a_type_when_accessed_using_an_index,
39841
39897
  defaultValueDescription: false,
@@ -39844,6 +39900,7 @@ var ts;
39844
39900
  name: "noImplicitOverride",
39845
39901
  type: "boolean",
39846
39902
  affectsSemanticDiagnostics: true,
39903
+ affectsMultiFileEmitBuildInfo: true,
39847
39904
  category: ts.Diagnostics.Type_Checking,
39848
39905
  description: ts.Diagnostics.Ensure_overriding_members_in_derived_classes_are_marked_with_an_override_modifier,
39849
39906
  defaultValueDescription: false,
@@ -39851,6 +39908,8 @@ var ts;
39851
39908
  {
39852
39909
  name: "noPropertyAccessFromIndexSignature",
39853
39910
  type: "boolean",
39911
+ affectsSemanticDiagnostics: true,
39912
+ affectsMultiFileEmitBuildInfo: true,
39854
39913
  showInSimplifiedHelpView: false,
39855
39914
  category: ts.Diagnostics.Type_Checking,
39856
39915
  description: ts.Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
@@ -39936,6 +39995,7 @@ var ts;
39936
39995
  name: "allowSyntheticDefaultImports",
39937
39996
  type: "boolean",
39938
39997
  affectsSemanticDiagnostics: true,
39998
+ affectsMultiFileEmitBuildInfo: true,
39939
39999
  category: ts.Diagnostics.Interop_Constraints,
39940
40000
  description: ts.Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export,
39941
40001
  defaultValueDescription: ts.Diagnostics.module_system_or_esModuleInterop
@@ -39945,6 +40005,7 @@ var ts;
39945
40005
  type: "boolean",
39946
40006
  affectsSemanticDiagnostics: true,
39947
40007
  affectsEmit: true,
40008
+ affectsMultiFileEmitBuildInfo: true,
39948
40009
  showInSimplifiedHelpView: true,
39949
40010
  category: ts.Diagnostics.Interop_Constraints,
39950
40011
  description: ts.Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility,
@@ -39961,6 +40022,7 @@ var ts;
39961
40022
  name: "allowUmdGlobalAccess",
39962
40023
  type: "boolean",
39963
40024
  affectsSemanticDiagnostics: true,
40025
+ affectsMultiFileEmitBuildInfo: true,
39964
40026
  category: ts.Diagnostics.Modules,
39965
40027
  description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
39966
40028
  defaultValueDescription: false,
@@ -39982,6 +40044,7 @@ var ts;
39982
40044
  name: "sourceRoot",
39983
40045
  type: "string",
39984
40046
  affectsEmit: true,
40047
+ affectsMultiFileEmitBuildInfo: true,
39985
40048
  paramType: ts.Diagnostics.LOCATION,
39986
40049
  category: ts.Diagnostics.Emit,
39987
40050
  description: ts.Diagnostics.Specify_the_root_path_for_debuggers_to_find_the_reference_source_code,
@@ -39990,6 +40053,7 @@ var ts;
39990
40053
  name: "mapRoot",
39991
40054
  type: "string",
39992
40055
  affectsEmit: true,
40056
+ affectsMultiFileEmitBuildInfo: true,
39993
40057
  paramType: ts.Diagnostics.LOCATION,
39994
40058
  category: ts.Diagnostics.Emit,
39995
40059
  description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -39998,6 +40062,7 @@ var ts;
39998
40062
  name: "inlineSourceMap",
39999
40063
  type: "boolean",
40000
40064
  affectsEmit: true,
40065
+ affectsMultiFileEmitBuildInfo: true,
40001
40066
  category: ts.Diagnostics.Emit,
40002
40067
  description: ts.Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
40003
40068
  defaultValueDescription: false,
@@ -40006,6 +40071,7 @@ var ts;
40006
40071
  name: "inlineSources",
40007
40072
  type: "boolean",
40008
40073
  affectsEmit: true,
40074
+ affectsMultiFileEmitBuildInfo: true,
40009
40075
  category: ts.Diagnostics.Emit,
40010
40076
  description: ts.Diagnostics.Include_source_code_in_the_sourcemaps_inside_the_emitted_JavaScript,
40011
40077
  defaultValueDescription: false,
@@ -40015,6 +40081,7 @@ var ts;
40015
40081
  name: "experimentalDecorators",
40016
40082
  type: "boolean",
40017
40083
  affectsSemanticDiagnostics: true,
40084
+ affectsMultiFileEmitBuildInfo: true,
40018
40085
  category: ts.Diagnostics.Language_and_Environment,
40019
40086
  description: ts.Diagnostics.Enable_experimental_support_for_TC39_stage_2_draft_decorators,
40020
40087
  defaultValueDescription: false,
@@ -40024,6 +40091,7 @@ var ts;
40024
40091
  type: "boolean",
40025
40092
  affectsSemanticDiagnostics: true,
40026
40093
  affectsEmit: true,
40094
+ affectsMultiFileEmitBuildInfo: true,
40027
40095
  category: ts.Diagnostics.Language_and_Environment,
40028
40096
  description: ts.Diagnostics.Emit_design_type_metadata_for_decorated_declarations_in_source_files,
40029
40097
  defaultValueDescription: false,
@@ -40048,6 +40116,7 @@ var ts;
40048
40116
  type: "string",
40049
40117
  affectsSemanticDiagnostics: true,
40050
40118
  affectsEmit: true,
40119
+ affectsMultiFileEmitBuildInfo: true,
40051
40120
  affectsModuleResolution: true,
40052
40121
  category: ts.Diagnostics.Language_and_Environment,
40053
40122
  description: ts.Diagnostics.Specify_module_specifier_used_to_import_the_JSX_factory_functions_when_using_jsx_Colon_react_jsx_Asterisk,
@@ -40065,6 +40134,9 @@ var ts;
40065
40134
  name: "out",
40066
40135
  type: "string",
40067
40136
  affectsEmit: true,
40137
+ affectsMultiFileEmitBuildInfo: true,
40138
+ affectsDeclarationPath: true,
40139
+ affectsBundleEmitBuildInfo: true,
40068
40140
  isFilePath: false,
40069
40141
  // for correct behaviour, please use outFile
40070
40142
  category: ts.Diagnostics.Backwards_Compatibility,
@@ -40076,6 +40148,7 @@ var ts;
40076
40148
  name: "reactNamespace",
40077
40149
  type: "string",
40078
40150
  affectsEmit: true,
40151
+ affectsMultiFileEmitBuildInfo: true,
40079
40152
  category: ts.Diagnostics.Language_and_Environment,
40080
40153
  description: ts.Diagnostics.Specify_the_object_invoked_for_createElement_This_only_applies_when_targeting_react_JSX_emit,
40081
40154
  defaultValueDescription: "`React`",
@@ -40083,6 +40156,8 @@ var ts;
40083
40156
  {
40084
40157
  name: "skipDefaultLibCheck",
40085
40158
  type: "boolean",
40159
+ // We need to store these to determine whether `lib` files need to be rechecked
40160
+ affectsMultiFileEmitBuildInfo: true,
40086
40161
  category: ts.Diagnostics.Completeness,
40087
40162
  description: ts.Diagnostics.Skip_type_checking_d_ts_files_that_are_included_with_TypeScript,
40088
40163
  defaultValueDescription: false,
@@ -40098,6 +40173,7 @@ var ts;
40098
40173
  name: "emitBOM",
40099
40174
  type: "boolean",
40100
40175
  affectsEmit: true,
40176
+ affectsMultiFileEmitBuildInfo: true,
40101
40177
  category: ts.Diagnostics.Emit,
40102
40178
  description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files,
40103
40179
  defaultValueDescription: false,
@@ -40109,6 +40185,7 @@ var ts;
40109
40185
  lf: 1 /* LineFeed */
40110
40186
  })),
40111
40187
  affectsEmit: true,
40188
+ affectsMultiFileEmitBuildInfo: true,
40112
40189
  paramType: ts.Diagnostics.NEWLINE,
40113
40190
  category: ts.Diagnostics.Emit,
40114
40191
  description: ts.Diagnostics.Set_the_newline_character_for_emitting_files,
@@ -40118,6 +40195,7 @@ var ts;
40118
40195
  name: "noErrorTruncation",
40119
40196
  type: "boolean",
40120
40197
  affectsSemanticDiagnostics: true,
40198
+ affectsMultiFileEmitBuildInfo: true,
40121
40199
  category: ts.Diagnostics.Output_Formatting,
40122
40200
  description: ts.Diagnostics.Disable_truncating_types_in_error_messages,
40123
40201
  defaultValueDescription: false,
@@ -40148,6 +40226,7 @@ var ts;
40148
40226
  name: "stripInternal",
40149
40227
  type: "boolean",
40150
40228
  affectsEmit: true,
40229
+ affectsMultiFileEmitBuildInfo: true,
40151
40230
  category: ts.Diagnostics.Emit,
40152
40231
  description: ts.Diagnostics.Disable_emitting_declarations_that_have_internal_in_their_JSDoc_comments,
40153
40232
  defaultValueDescription: false,
@@ -40188,6 +40267,7 @@ var ts;
40188
40267
  name: "noImplicitUseStrict",
40189
40268
  type: "boolean",
40190
40269
  affectsSemanticDiagnostics: true,
40270
+ affectsMultiFileEmitBuildInfo: true,
40191
40271
  category: ts.Diagnostics.Backwards_Compatibility,
40192
40272
  description: ts.Diagnostics.Disable_adding_use_strict_directives_in_emitted_JavaScript_files,
40193
40273
  defaultValueDescription: false,
@@ -40196,6 +40276,7 @@ var ts;
40196
40276
  name: "noEmitHelpers",
40197
40277
  type: "boolean",
40198
40278
  affectsEmit: true,
40279
+ affectsMultiFileEmitBuildInfo: true,
40199
40280
  category: ts.Diagnostics.Emit,
40200
40281
  description: ts.Diagnostics.Disable_generating_custom_helper_functions_like_extends_in_compiled_output,
40201
40282
  defaultValueDescription: false,
@@ -40204,6 +40285,7 @@ var ts;
40204
40285
  name: "noEmitOnError",
40205
40286
  type: "boolean",
40206
40287
  affectsEmit: true,
40288
+ affectsMultiFileEmitBuildInfo: true,
40207
40289
  category: ts.Diagnostics.Emit,
40208
40290
  transpileOptionValue: undefined,
40209
40291
  description: ts.Diagnostics.Disable_emitting_files_if_any_type_checking_errors_are_reported,
@@ -40213,6 +40295,7 @@ var ts;
40213
40295
  name: "preserveConstEnums",
40214
40296
  type: "boolean",
40215
40297
  affectsEmit: true,
40298
+ affectsMultiFileEmitBuildInfo: true,
40216
40299
  category: ts.Diagnostics.Emit,
40217
40300
  description: ts.Diagnostics.Disable_erasing_const_enum_declarations_in_generated_code,
40218
40301
  defaultValueDescription: false,
@@ -40221,6 +40304,8 @@ var ts;
40221
40304
  name: "declarationDir",
40222
40305
  type: "string",
40223
40306
  affectsEmit: true,
40307
+ affectsMultiFileEmitBuildInfo: true,
40308
+ affectsDeclarationPath: true,
40224
40309
  isFilePath: true,
40225
40310
  paramType: ts.Diagnostics.DIRECTORY,
40226
40311
  category: ts.Diagnostics.Emit,
@@ -40230,6 +40315,8 @@ var ts;
40230
40315
  {
40231
40316
  name: "skipLibCheck",
40232
40317
  type: "boolean",
40318
+ // We need to store these to determine whether `lib` files need to be rechecked
40319
+ affectsMultiFileEmitBuildInfo: true,
40233
40320
  category: ts.Diagnostics.Completeness,
40234
40321
  description: ts.Diagnostics.Skip_type_checking_all_d_ts_files,
40235
40322
  defaultValueDescription: false,
@@ -40239,6 +40326,7 @@ var ts;
40239
40326
  type: "boolean",
40240
40327
  affectsBindDiagnostics: true,
40241
40328
  affectsSemanticDiagnostics: true,
40329
+ affectsMultiFileEmitBuildInfo: true,
40242
40330
  category: ts.Diagnostics.Type_Checking,
40243
40331
  description: ts.Diagnostics.Disable_error_reporting_for_unused_labels,
40244
40332
  defaultValueDescription: undefined,
@@ -40248,6 +40336,7 @@ var ts;
40248
40336
  type: "boolean",
40249
40337
  affectsBindDiagnostics: true,
40250
40338
  affectsSemanticDiagnostics: true,
40339
+ affectsMultiFileEmitBuildInfo: true,
40251
40340
  category: ts.Diagnostics.Type_Checking,
40252
40341
  description: ts.Diagnostics.Disable_error_reporting_for_unreachable_code,
40253
40342
  defaultValueDescription: undefined,
@@ -40256,6 +40345,7 @@ var ts;
40256
40345
  name: "suppressExcessPropertyErrors",
40257
40346
  type: "boolean",
40258
40347
  affectsSemanticDiagnostics: true,
40348
+ affectsMultiFileEmitBuildInfo: true,
40259
40349
  category: ts.Diagnostics.Backwards_Compatibility,
40260
40350
  description: ts.Diagnostics.Disable_reporting_of_excess_property_errors_during_the_creation_of_object_literals,
40261
40351
  defaultValueDescription: false,
@@ -40264,6 +40354,7 @@ var ts;
40264
40354
  name: "suppressImplicitAnyIndexErrors",
40265
40355
  type: "boolean",
40266
40356
  affectsSemanticDiagnostics: true,
40357
+ affectsMultiFileEmitBuildInfo: true,
40267
40358
  category: ts.Diagnostics.Backwards_Compatibility,
40268
40359
  description: ts.Diagnostics.Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures,
40269
40360
  defaultValueDescription: false,
@@ -40288,6 +40379,7 @@ var ts;
40288
40379
  name: "noStrictGenericChecks",
40289
40380
  type: "boolean",
40290
40381
  affectsSemanticDiagnostics: true,
40382
+ affectsMultiFileEmitBuildInfo: true,
40291
40383
  category: ts.Diagnostics.Backwards_Compatibility,
40292
40384
  description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types,
40293
40385
  defaultValueDescription: false,
@@ -40297,6 +40389,7 @@ var ts;
40297
40389
  type: "boolean",
40298
40390
  affectsSemanticDiagnostics: true,
40299
40391
  affectsEmit: true,
40392
+ affectsMultiFileEmitBuildInfo: true,
40300
40393
  category: ts.Diagnostics.Language_and_Environment,
40301
40394
  description: ts.Diagnostics.Emit_ECMAScript_standard_compliant_class_fields,
40302
40395
  defaultValueDescription: ts.Diagnostics.true_for_ES2022_and_above_including_ESNext
@@ -40305,6 +40398,7 @@ var ts;
40305
40398
  name: "preserveValueImports",
40306
40399
  type: "boolean",
40307
40400
  affectsEmit: true,
40401
+ affectsMultiFileEmitBuildInfo: true,
40308
40402
  category: ts.Diagnostics.Emit,
40309
40403
  description: ts.Diagnostics.Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed,
40310
40404
  defaultValueDescription: false,
@@ -40348,6 +40442,8 @@ var ts;
40348
40442
  /* @internal */
40349
40443
  ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
40350
40444
  /* @internal */
40445
+ ts.affectsDeclarationPathOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsDeclarationPath; });
40446
+ /* @internal */
40351
40447
  ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
40352
40448
  /* @internal */
40353
40449
  ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -41203,6 +41299,7 @@ var ts;
41203
41299
  return optionDefinition.type;
41204
41300
  }
41205
41301
  }
41302
+ /* @internal */
41206
41303
  function getNameOfCompilerOptionValue(value, customTypeMap) {
41207
41304
  // There is a typeMap associated with this command-line option so use it to map value back to its name
41208
41305
  return ts.forEachEntry(customTypeMap, function (mapValue, key) {
@@ -41211,6 +41308,7 @@ var ts;
41211
41308
  }
41212
41309
  });
41213
41310
  }
41311
+ ts.getNameOfCompilerOptionValue = getNameOfCompilerOptionValue;
41214
41312
  function serializeCompilerOptions(options, pathOptions) {
41215
41313
  return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
41216
41314
  }
@@ -44649,7 +44747,7 @@ var ts;
44649
44747
  return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
44650
44748
  }
44651
44749
  if (name.kind === 162 /* ComputedPropertyName */) {
44652
- var nameExpression = ts.getComputedPropertyNameExpression(name);
44750
+ var nameExpression = name.expression;
44653
44751
  // treat computed property names where expression is string/numeric literal as just string/numeric literal
44654
44752
  if (ts.isStringOrNumericLiteralLike(nameExpression)) {
44655
44753
  return ts.escapeLeadingUnderscores(nameExpression.text);
@@ -48538,6 +48636,7 @@ var ts;
48538
48636
  var keyofConstraintType = keyofStringsOnly ? stringType : stringNumberSymbolType;
48539
48637
  var numberOrBigIntType = getUnionType([numberType, bigintType]);
48540
48638
  var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
48639
+ var numericStringType = getTemplateLiteralType(["", ""], [numberType]); // The `${number}` type
48541
48640
  var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
48542
48641
  var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
48543
48642
  var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
@@ -51519,7 +51618,7 @@ var ts;
51519
51618
  }
51520
51619
  }
51521
51620
  function getExportSymbolOfValueSymbolIfExported(symbol) {
51522
- return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 ? symbol.exportSymbol : symbol);
51621
+ return getMergedSymbol(symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 && symbol.exportSymbol || symbol);
51523
51622
  }
51524
51623
  function symbolIsValue(symbol) {
51525
51624
  return !!(symbol.flags & 111551 /* Value */ || symbol.flags & 2097152 /* Alias */ && resolveAlias(symbol).flags & 111551 /* Value */ && !getTypeOnlyAliasDeclaration(symbol));
@@ -58922,7 +59021,7 @@ var ts;
58922
59021
  var typeVariable = getHomomorphicTypeVariable(type);
58923
59022
  if (typeVariable && !type.declaration.nameType) {
58924
59023
  var constraint = getConstraintOfTypeParameter(typeVariable);
58925
- if (constraint && (isArrayType(constraint) || isTupleType(constraint))) {
59024
+ if (constraint && isArrayOrTupleType(constraint)) {
58926
59025
  return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
58927
59026
  }
58928
59027
  }
@@ -59284,10 +59383,10 @@ var ts;
59284
59383
  }
59285
59384
  function isApplicableIndexType(source, target) {
59286
59385
  // A 'string' index signature applies to types assignable to 'string' or 'number', and a 'number' index
59287
- // signature applies to types assignable to 'number' and numeric string literal types.
59386
+ // signature applies to types assignable to 'number', `${number}` and numeric string literal types.
59288
59387
  return isTypeAssignableTo(source, target) ||
59289
59388
  target === stringType && isTypeAssignableTo(source, numberType) ||
59290
- target === numberType && !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value);
59389
+ target === numberType && (source === numericStringType || !!(source.flags & 128 /* StringLiteral */) && ts.isNumericLiteralName(source.value));
59291
59390
  }
59292
59391
  function getIndexInfosOfStructuredType(type) {
59293
59392
  if (type.flags & 3670016 /* StructuredType */) {
@@ -60303,6 +60402,20 @@ var ts;
60303
60402
  constraints = ts.append(constraints, constraint);
60304
60403
  }
60305
60404
  }
60405
+ // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the
60406
+ // template type XXX, K has an added constraint of number | `${number}`.
60407
+ else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 195 /* MappedType */ && node === parent.type) {
60408
+ var mappedType = getTypeFromTypeNode(parent);
60409
+ if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
60410
+ var typeParameter = getHomomorphicTypeVariable(mappedType);
60411
+ if (typeParameter) {
60412
+ var constraint = getConstraintOfTypeParameter(typeParameter);
60413
+ if (constraint && everyType(constraint, isArrayOrTupleType)) {
60414
+ constraints = ts.append(constraints, getUnionType([numberType, numericStringType]));
60415
+ }
60416
+ }
60417
+ }
60418
+ }
60306
60419
  node = parent;
60307
60420
  }
60308
60421
  return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type;
@@ -61270,7 +61383,7 @@ var ts;
61270
61383
  while (i > 0) {
61271
61384
  i--;
61272
61385
  var t = types[i];
61273
- var remove = t.flags & 4 /* String */ && includes & 128 /* StringLiteral */ ||
61386
+ var remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61274
61387
  t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61275
61388
  t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61276
61389
  t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */;
@@ -61429,7 +61542,7 @@ var ts;
61429
61542
  if (!strictNullChecks && includes & 98304 /* Nullable */) {
61430
61543
  return includes & 32768 /* Undefined */ ? undefinedType : nullType;
61431
61544
  }
61432
- if (includes & 4 /* String */ && includes & 128 /* StringLiteral */ ||
61545
+ if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ||
61433
61546
  includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ ||
61434
61547
  includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ ||
61435
61548
  includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */) {
@@ -63313,7 +63426,7 @@ var ts;
63313
63426
  if (!type.declaration.nameType) {
63314
63427
  var constraint = void 0;
63315
63428
  if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 &&
63316
- (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, ts.or(isArrayType, isTupleType))) {
63429
+ (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
63317
63430
  return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
63318
63431
  }
63319
63432
  if (isGenericTupleType(t)) {
@@ -64751,7 +64864,7 @@ var ts;
64751
64864
  }
64752
64865
  return false;
64753
64866
  }
64754
- return isTupleType(target) || isArrayType(target);
64867
+ return isArrayOrTupleType(target);
64755
64868
  }
64756
64869
  if (isReadonlyArrayType(source) && isMutableArrayOrTuple(target)) {
64757
64870
  if (reportErrors) {
@@ -64881,7 +64994,7 @@ var ts;
64881
64994
  // We suppress recursive intersection property checks because they can generate lots of work when relating
64882
64995
  // recursive intersections that are structurally similar but not exactly identical. See #37854.
64883
64996
  if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
64884
- isNonGenericObjectType(target) && !isArrayType(target) && !isTupleType(target) && source.flags & 2097152 /* Intersection */ && getApparentType(source).flags & 3670016 /* StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* NonInferrableType */); }))) {
64997
+ isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* Intersection */ && getApparentType(source).flags & 3670016 /* StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* NonInferrableType */); }))) {
64885
64998
  inPropertyCheck = true;
64886
64999
  result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* PropertyCheck */, recursionFlags);
64887
65000
  inPropertyCheck = false;
@@ -65869,7 +65982,7 @@ var ts;
65869
65982
  return varianceResult;
65870
65983
  }
65871
65984
  }
65872
- else if (isReadonlyArrayType(target) ? isArrayType(source) || isTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
65985
+ else if (isReadonlyArrayType(target) ? isArrayOrTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
65873
65986
  if (relation !== identityRelation) {
65874
65987
  return isRelatedTo(getIndexTypeOfType(source, numberType) || anyType, getIndexTypeOfType(target, numberType) || anyType, 3 /* Both */, reportErrors);
65875
65988
  }
@@ -66245,7 +66358,7 @@ var ts;
66245
66358
  }
66246
66359
  var result = -1 /* True */;
66247
66360
  if (isTupleType(target)) {
66248
- if (isArrayType(source) || isTupleType(source)) {
66361
+ if (isArrayOrTupleType(source)) {
66249
66362
  if (!target.target.readonly && (isReadonlyArrayType(source) || isTupleType(source) && source.target.readonly)) {
66250
66363
  return 0 /* False */;
66251
66364
  }
@@ -67206,6 +67319,9 @@ var ts;
67206
67319
  function isReadonlyArrayType(type) {
67207
67320
  return !!(ts.getObjectFlags(type) & 4 /* Reference */) && type.target === globalReadonlyArrayType;
67208
67321
  }
67322
+ function isArrayOrTupleType(type) {
67323
+ return isArrayType(type) || isTupleType(type);
67324
+ }
67209
67325
  function isMutableArrayOrTuple(type) {
67210
67326
  return isArrayType(type) && !isReadonlyArrayType(type) || isTupleType(type) && !type.target.readonly;
67211
67327
  }
@@ -67657,7 +67773,7 @@ var ts;
67657
67773
  else if (type.flags & 2097152 /* Intersection */) {
67658
67774
  result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
67659
67775
  }
67660
- else if (isArrayType(type) || isTupleType(type)) {
67776
+ else if (isArrayOrTupleType(type)) {
67661
67777
  result = createTypeReference(type.target, ts.sameMap(getTypeArguments(type), getWidenedType));
67662
67778
  }
67663
67779
  if (result && context === undefined) {
@@ -67694,7 +67810,7 @@ var ts;
67694
67810
  }
67695
67811
  }
67696
67812
  }
67697
- if (isArrayType(type) || isTupleType(type)) {
67813
+ if (isArrayOrTupleType(type)) {
67698
67814
  for (var _b = 0, _c = getTypeArguments(type); _b < _c.length; _b++) {
67699
67815
  var t = _c[_b];
67700
67816
  if (reportWideningErrorsInType(t)) {
@@ -68755,7 +68871,7 @@ var ts;
68755
68871
  }
68756
68872
  // Infer from the members of source and target only if the two types are possibly related
68757
68873
  if (!typesDefinitelyUnrelated(source, target)) {
68758
- if (isArrayType(source) || isTupleType(source)) {
68874
+ if (isArrayOrTupleType(source)) {
68759
68875
  if (isTupleType(target)) {
68760
68876
  var sourceArity = getTypeReferenceArity(source);
68761
68877
  var targetArity = getTypeReferenceArity(target);
@@ -75776,8 +75892,14 @@ var ts;
75776
75892
  var parameterRange = hasRestParameter ? min
75777
75893
  : min < max ? min + "-" + max
75778
75894
  : min;
75779
- var error = hasRestParameter ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
75780
- : parameterRange === 1 && args.length === 0 && isPromiseResolveArityError(node) ? ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise
75895
+ var isVoidPromiseError = !hasRestParameter && parameterRange === 1 && args.length === 0 && isPromiseResolveArityError(node);
75896
+ if (isVoidPromiseError && ts.isInJSFile(node)) {
75897
+ return getDiagnosticForCallNode(node, ts.Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments);
75898
+ }
75899
+ var error = hasRestParameter
75900
+ ? ts.Diagnostics.Expected_at_least_0_arguments_but_got_1
75901
+ : isVoidPromiseError
75902
+ ? ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise
75781
75903
  : ts.Diagnostics.Expected_0_arguments_but_got_1;
75782
75904
  if (min < args.length && args.length < max) {
75783
75905
  // between min and max, but with no matching overload
@@ -110035,7 +110157,8 @@ var ts;
110035
110157
  return;
110036
110158
  }
110037
110159
  var version = ts.version; // Extracted into a const so the form is stable between namespace and module
110038
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: version }), /*writeByteOrderMark*/ false);
110160
+ var buildInfo = { bundle: bundle, program: program, version: version };
110161
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), /*writeByteOrderMark*/ false, /*sourceFiles*/ undefined, { buildInfo: buildInfo });
110039
110162
  }
110040
110163
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
110041
110164
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -110189,13 +110312,18 @@ var ts;
110189
110312
  if (sourceMapFilePath) {
110190
110313
  var sourceMap = sourceMapGenerator.toString();
110191
110314
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
110315
+ if (printer.bundleFileInfo)
110316
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
110192
110317
  }
110193
110318
  }
110194
110319
  else {
110195
110320
  writer.writeLine();
110196
110321
  }
110197
110322
  // Write the output file
110198
- ts.writeFile(host, emitterDiagnostics, jsFilePath, writer.getText(), !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110323
+ var text = writer.getText();
110324
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
110325
+ if (printer.bundleFileInfo)
110326
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
110199
110327
  // Reset state
110200
110328
  writer.clear();
110201
110329
  }
@@ -110338,34 +110466,54 @@ var ts;
110338
110466
  }
110339
110467
  /*@internal*/
110340
110468
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
110469
+ var createHash = ts.maybeBind(host, host.createHash);
110341
110470
  var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
110342
- var buildInfoText = host.readFile(ts.Debug.checkDefined(buildInfoPath));
110343
- if (!buildInfoText)
110471
+ var buildInfo;
110472
+ if (host.getBuildInfo) {
110473
+ var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
110474
+ if (!hostBuildInfo)
110475
+ return buildInfoPath;
110476
+ buildInfo = hostBuildInfo;
110477
+ }
110478
+ else {
110479
+ var buildInfoText = host.readFile(buildInfoPath);
110480
+ if (!buildInfoText)
110481
+ return buildInfoPath;
110482
+ buildInfo = getBuildInfo(buildInfoText);
110483
+ }
110484
+ if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
110344
110485
  return buildInfoPath;
110345
110486
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
110346
110487
  if (!jsFileText)
110347
110488
  return jsFilePath;
110489
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
110490
+ return jsFilePath;
110348
110491
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
110349
110492
  // error if no source map or for now if inline sourcemap
110350
110493
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
110351
110494
  return sourceMapFilePath || "inline sourcemap decoding";
110495
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
110496
+ return sourceMapFilePath;
110352
110497
  // read declaration text
110353
110498
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
110354
110499
  if (declarationFilePath && !declarationText)
110355
110500
  return declarationFilePath;
110501
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
110502
+ return declarationFilePath;
110356
110503
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
110357
110504
  // error if no source map or for now if inline sourcemap
110358
110505
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
110359
110506
  return declarationMapPath || "inline sourcemap decoding";
110360
- var buildInfo = getBuildInfo(buildInfoText);
110361
- if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
110362
- return buildInfoPath;
110507
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
110508
+ return declarationMapPath;
110363
110509
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
110364
110510
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
110365
110511
  /*onlyOwnText*/ true);
110366
110512
  var outputFiles = [];
110367
110513
  var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
110368
110514
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
110515
+ var changedDtsText;
110516
+ var changedDtsData;
110369
110517
  var emitHost = {
110370
110518
  getPrependNodes: ts.memoize(function () { return __spreadArray(__spreadArray([], prependNodes, true), [ownPrependInput], false); }),
110371
110519
  getCanonicalFileName: host.getCanonicalFileName,
@@ -110381,7 +110529,7 @@ var ts;
110381
110529
  getResolvedProjectReferenceToRedirect: ts.returnUndefined,
110382
110530
  getProjectReferenceRedirect: ts.returnUndefined,
110383
110531
  isSourceOfProjectReferenceRedirect: ts.returnFalse,
110384
- writeFile: function (name, text, writeByteOrderMark) {
110532
+ writeFile: function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) {
110385
110533
  switch (name) {
110386
110534
  case jsFilePath:
110387
110535
  if (jsFileText === text)
@@ -110392,8 +110540,13 @@ var ts;
110392
110540
  return;
110393
110541
  break;
110394
110542
  case buildInfoPath:
110395
- var newBuildInfo = getBuildInfo(text);
110543
+ var newBuildInfo = data.buildInfo;
110396
110544
  newBuildInfo.program = buildInfo.program;
110545
+ if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
110546
+ // Update the output signature
110547
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
110548
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
110549
+ }
110397
110550
  // Update sourceFileInfo
110398
110551
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
110399
110552
  newBuildInfo.bundle.js.sources = js.sources;
@@ -110401,11 +110554,13 @@ var ts;
110401
110554
  newBuildInfo.bundle.dts.sources = dts.sources;
110402
110555
  }
110403
110556
  newBuildInfo.bundle.sourceFiles = sourceFiles;
110404
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark });
110557
+ outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
110405
110558
  return;
110406
110559
  case declarationFilePath:
110407
110560
  if (declarationText === text)
110408
110561
  return;
110562
+ changedDtsText = text;
110563
+ changedDtsData = data;
110409
110564
  break;
110410
110565
  case declarationMapPath:
110411
110566
  if (declarationMapText === text)
@@ -110424,6 +110579,7 @@ var ts;
110424
110579
  getSourceFileFromReference: ts.returnUndefined,
110425
110580
  redirectTargetsMap: ts.createMultiMap(),
110426
110581
  getFileIncludeReasons: ts.notImplemented,
110582
+ createHash: createHash,
110427
110583
  };
110428
110584
  emitFiles(ts.notImplementedResolver, emitHost,
110429
110585
  /*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
@@ -115508,12 +115664,10 @@ var ts;
115508
115664
  }
115509
115665
  ts.createCompilerHost = createCompilerHost;
115510
115666
  /*@internal*/
115511
- // TODO(shkamat): update this after reworking ts build API
115512
115667
  function createCompilerHostWorker(options, setParentNodes, system) {
115513
115668
  if (system === void 0) { system = ts.sys; }
115514
115669
  var existingDirectories = new ts.Map();
115515
115670
  var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
115516
- var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash;
115517
115671
  function getSourceFile(fileName, languageVersionOrOptions, onError) {
115518
115672
  var text;
115519
115673
  try {
@@ -115546,7 +115700,7 @@ var ts;
115546
115700
  // NOTE: If patchWriteFileEnsuringDirectory has been called,
115547
115701
  // the system.writeFile will do its own directory creation and
115548
115702
  // the ensureDirectoriesExist call will always be redundant.
115549
- ts.writeFileEnsuringDirectories(fileName, data, writeByteOrderMark, function (path, data, writeByteOrderMark) { return writeFileWorker(path, data, writeByteOrderMark); }, function (path) { return (compilerHost.createDirectory || system.createDirectory)(path); }, function (path) { return directoryExists(path); });
115703
+ ts.writeFileEnsuringDirectories(fileName, data, writeByteOrderMark, function (path, data, writeByteOrderMark) { return system.writeFile(path, data, writeByteOrderMark); }, function (path) { return (compilerHost.createDirectory || system.createDirectory)(path); }, function (path) { return directoryExists(path); });
115550
115704
  ts.performance.mark("afterIOWrite");
115551
115705
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
115552
115706
  }
@@ -115556,35 +115710,6 @@ var ts;
115556
115710
  }
115557
115711
  }
115558
115712
  }
115559
- var outputFingerprints;
115560
- function writeFileWorker(fileName, data, writeByteOrderMark) {
115561
- if (!ts.isWatchSet(options) || !system.getModifiedTime) {
115562
- system.writeFile(fileName, data, writeByteOrderMark);
115563
- return;
115564
- }
115565
- if (!outputFingerprints) {
115566
- outputFingerprints = new ts.Map();
115567
- }
115568
- var hash = computeHash(data);
115569
- var mtimeBefore = system.getModifiedTime(fileName);
115570
- if (mtimeBefore) {
115571
- var fingerprint = outputFingerprints.get(fileName);
115572
- // If output has not been changed, and the file has no external modification
115573
- if (fingerprint &&
115574
- fingerprint.byteOrderMark === writeByteOrderMark &&
115575
- fingerprint.hash === hash &&
115576
- fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
115577
- return;
115578
- }
115579
- }
115580
- system.writeFile(fileName, data, writeByteOrderMark);
115581
- var mtimeAfter = system.getModifiedTime(fileName) || ts.missingFileModifiedTime;
115582
- outputFingerprints.set(fileName, {
115583
- hash: hash,
115584
- byteOrderMark: writeByteOrderMark,
115585
- mtime: mtimeAfter
115586
- });
115587
- }
115588
115713
  function getDefaultLibLocation() {
115589
115714
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
115590
115715
  }
@@ -117136,6 +117261,7 @@ var ts;
117136
117261
  getSourceFileFromReference: function (file, ref) { return program.getSourceFileFromReference(file, ref); },
117137
117262
  redirectTargetsMap: redirectTargetsMap,
117138
117263
  getFileIncludeReasons: program.getFileIncludeReasons,
117264
+ createHash: ts.maybeBind(host, host.createHash),
117139
117265
  };
117140
117266
  }
117141
117267
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -119249,13 +119375,9 @@ var ts;
119249
119375
  function createManyToManyPathMap() {
119250
119376
  function create(forward, reverse, deleted) {
119251
119377
  var map = {
119252
- clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
119253
- forEach: function (fn) { return forward.forEach(fn); },
119254
119378
  getKeys: function (v) { return reverse.get(v); },
119255
119379
  getValues: function (k) { return forward.get(k); },
119256
- hasKey: function (k) { return forward.has(k); },
119257
119380
  keys: function () { return forward.keys(); },
119258
- deletedKeys: function () { return deleted; },
119259
119381
  deleteKey: function (k) {
119260
119382
  (deleted || (deleted = new ts.Set())).add(k);
119261
119383
  var set = forward.get(k);
@@ -119282,11 +119404,6 @@ var ts;
119282
119404
  });
119283
119405
  return map;
119284
119406
  },
119285
- clear: function () {
119286
- forward.clear();
119287
- reverse.clear();
119288
- deleted === null || deleted === void 0 ? void 0 : deleted.clear();
119289
- }
119290
119407
  };
119291
119408
  return map;
119292
119409
  }
@@ -119414,18 +119531,21 @@ var ts;
119414
119531
  * Creates the state of file references and signature for the new program from oldState if it is safe
119415
119532
  */
119416
119533
  function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119534
+ var _a, _b, _c;
119417
119535
  var fileInfos = new ts.Map();
119418
119536
  var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
119419
119537
  var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
119420
- var hasCalledUpdateShapeSignature = new ts.Set();
119421
119538
  var useOldState = canReuseOldState(referencedMap, oldState);
119422
119539
  // Ensure source files have parent pointers set
119423
119540
  newProgram.getTypeChecker();
119424
119541
  // Create the reference map, and set the file infos
119425
- for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
119426
- var sourceFile = _a[_i];
119542
+ for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
119543
+ var sourceFile = _d[_i];
119427
119544
  var version_2 = ts.Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
119428
- var oldInfo = useOldState ? oldState.fileInfos.get(sourceFile.resolvedPath) : undefined;
119545
+ var oldUncommitedSignature = useOldState ? (_a = oldState.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(sourceFile.resolvedPath) : undefined;
119546
+ var signature = oldUncommitedSignature === undefined ?
119547
+ useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) === null || _b === void 0 ? void 0 : _b.signature : undefined :
119548
+ oldUncommitedSignature || undefined;
119429
119549
  if (referencedMap) {
119430
119550
  var newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
119431
119551
  if (newReferences) {
@@ -119433,19 +119553,26 @@ var ts;
119433
119553
  }
119434
119554
  // Copy old visible to outside files map
119435
119555
  if (useOldState) {
119436
- var exportedModules = oldState.exportedModulesMap.getValues(sourceFile.resolvedPath);
119556
+ var oldUncommitedExportedModules = (_c = oldState.oldExportedModulesMap) === null || _c === void 0 ? void 0 : _c.get(sourceFile.resolvedPath);
119557
+ var exportedModules = oldUncommitedExportedModules === undefined ?
119558
+ oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) :
119559
+ oldUncommitedExportedModules || undefined;
119437
119560
  if (exportedModules) {
119438
119561
  exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119439
119562
  }
119440
119563
  }
119441
119564
  }
119442
- fileInfos.set(sourceFile.resolvedPath, { version: version_2, signature: oldInfo && oldInfo.signature, affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined, impliedFormat: sourceFile.impliedNodeFormat });
119565
+ fileInfos.set(sourceFile.resolvedPath, {
119566
+ version: version_2,
119567
+ signature: signature,
119568
+ affectsGlobalScope: isFileAffectingGlobalScope(sourceFile) || undefined,
119569
+ impliedFormat: sourceFile.impliedNodeFormat
119570
+ });
119443
119571
  }
119444
119572
  return {
119445
119573
  fileInfos: fileInfos,
119446
119574
  referencedMap: referencedMap,
119447
119575
  exportedModulesMap: exportedModulesMap,
119448
- hasCalledUpdateShapeSignature: hasCalledUpdateShapeSignature,
119449
119576
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
119450
119577
  };
119451
119578
  }
@@ -119459,71 +119586,42 @@ var ts;
119459
119586
  }
119460
119587
  BuilderState.releaseCache = releaseCache;
119461
119588
  /**
119462
- * Creates a clone of the state
119589
+ * Gets the files affected by the path from the program
119463
119590
  */
119464
- function clone(state) {
119591
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
119465
119592
  var _a, _b;
119466
- // Dont need to backup allFiles info since its cache anyway
119467
- return {
119468
- fileInfos: new ts.Map(state.fileInfos),
119469
- referencedMap: (_a = state.referencedMap) === null || _a === void 0 ? void 0 : _a.clone(),
119470
- exportedModulesMap: (_b = state.exportedModulesMap) === null || _b === void 0 ? void 0 : _b.clone(),
119471
- hasCalledUpdateShapeSignature: new ts.Set(state.hasCalledUpdateShapeSignature),
119472
- useFileVersionAsSignature: state.useFileVersionAsSignature,
119473
- };
119593
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
119594
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
119595
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119596
+ return result;
119474
119597
  }
119475
- BuilderState.clone = clone;
119476
- /**
119477
- * Gets the files affected by the path from the program
119478
- */
119479
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, cacheToUpdateSignature, exportedModulesMapCache) {
119480
- // Since the operation could be cancelled, the signatures are always stored in the cache
119481
- // They will be committed once it is safe to use them
119482
- // eg when calling this api from tsserver, if there is no cancellation of the operation
119483
- // In the other cases the affected files signatures are committed only after the iteration through the result is complete
119484
- var signatureCache = cacheToUpdateSignature || new ts.Map();
119598
+ BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119599
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
119485
119600
  var sourceFile = programOfThisState.getSourceFileByPath(path);
119486
119601
  if (!sourceFile) {
119487
119602
  return ts.emptyArray;
119488
119603
  }
119489
- if (!updateShapeSignature(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache)) {
119604
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
119490
119605
  return [sourceFile];
119491
119606
  }
119492
- var result = (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, signatureCache, cancellationToken, computeHash, exportedModulesMapCache);
119493
- if (!cacheToUpdateSignature) {
119494
- // Commit all the signatures in the signature cache
119495
- updateSignaturesFromCache(state, signatureCache);
119496
- }
119497
- return result;
119607
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
119498
119608
  }
119499
- BuilderState.getFilesAffectedBy = getFilesAffectedBy;
119500
- /**
119501
- * Updates the signatures from the cache into state's fileinfo signatures
119502
- * This should be called whenever it is safe to commit the state of the builder
119503
- */
119504
- function updateSignaturesFromCache(state, signatureCache) {
119505
- signatureCache.forEach(function (signature, path) { return updateSignatureOfFile(state, signature, path); });
119506
- }
119507
- BuilderState.updateSignaturesFromCache = updateSignaturesFromCache;
119609
+ BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
119508
119610
  function updateSignatureOfFile(state, signature, path) {
119509
119611
  state.fileInfos.get(path).signature = signature;
119510
- state.hasCalledUpdateShapeSignature.add(path);
119612
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
119511
119613
  }
119512
119614
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
119513
119615
  /**
119514
119616
  * Returns if the shape of the signature has changed since last emit
119515
119617
  */
119516
- function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) {
119618
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
119619
+ var _a;
119517
119620
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
119518
- ts.Debug.assert(!!sourceFile);
119519
- ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
119520
119621
  // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
119521
- if (state.hasCalledUpdateShapeSignature.has(sourceFile.resolvedPath) || cacheToUpdateSignature.has(sourceFile.resolvedPath)) {
119622
+ if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
119522
119623
  return false;
119523
- }
119524
119624
  var info = state.fileInfos.get(sourceFile.resolvedPath);
119525
- if (!info)
119526
- return ts.Debug.fail();
119527
119625
  var prevSignature = info.signature;
119528
119626
  var latestSignature;
119529
119627
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
@@ -119534,45 +119632,55 @@ var ts;
119534
119632
  var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
119535
119633
  if (firstDts_1) {
119536
119634
  ts.Debug.assert(ts.isDeclarationFileName(firstDts_1.name), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
119537
- latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
119538
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119539
- updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
119635
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
119636
+ if (latestSignature !== prevSignature) {
119637
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
119540
119638
  }
119541
119639
  }
119542
119640
  }
119543
119641
  // Default is to use file version as signature
119544
119642
  if (latestSignature === undefined) {
119545
119643
  latestSignature = sourceFile.version;
119546
- if (exportedModulesMapCache && latestSignature !== prevSignature) {
119644
+ if (state.exportedModulesMap && latestSignature !== prevSignature) {
119645
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119547
119646
  // All the references in this file are exported
119548
119647
  var references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : undefined;
119549
119648
  if (references) {
119550
- exportedModulesMapCache.set(sourceFile.resolvedPath, references);
119649
+ state.exportedModulesMap.set(sourceFile.resolvedPath, references);
119551
119650
  }
119552
119651
  else {
119553
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119652
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119554
119653
  }
119555
119654
  }
119556
119655
  }
119557
- cacheToUpdateSignature.set(sourceFile.resolvedPath, latestSignature);
119656
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(sourceFile.resolvedPath, prevSignature || false);
119657
+ (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(sourceFile.resolvedPath);
119658
+ info.signature = latestSignature;
119558
119659
  return latestSignature !== prevSignature;
119559
119660
  }
119560
119661
  BuilderState.updateShapeSignature = updateShapeSignature;
119662
+ function computeSignature(text, computeHash) {
119663
+ return (computeHash || ts.generateDjb2Hash)(text);
119664
+ }
119665
+ BuilderState.computeSignature = computeSignature;
119561
119666
  /**
119562
119667
  * Coverts the declaration emit result into exported modules map
119563
119668
  */
119564
- function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
119669
+ function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
119670
+ if (!state.exportedModulesMap)
119671
+ return;
119672
+ (state.oldExportedModulesMap || (state.oldExportedModulesMap = new ts.Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
119565
119673
  if (!exportedModulesFromDeclarationEmit) {
119566
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119674
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119567
119675
  return;
119568
119676
  }
119569
119677
  var exportedModules;
119570
119678
  exportedModulesFromDeclarationEmit.forEach(function (symbol) { return addExportedModule(getReferencedFilesFromImportedModuleSymbol(symbol)); });
119571
119679
  if (exportedModules) {
119572
- exportedModulesMapCache.set(sourceFile.resolvedPath, exportedModules);
119680
+ state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
119573
119681
  }
119574
119682
  else {
119575
- exportedModulesMapCache.deleteKey(sourceFile.resolvedPath);
119683
+ state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
119576
119684
  }
119577
119685
  function addExportedModule(exportedModulePaths) {
119578
119686
  if (exportedModulePaths === null || exportedModulePaths === void 0 ? void 0 : exportedModulePaths.length) {
@@ -119584,19 +119692,6 @@ var ts;
119584
119692
  }
119585
119693
  }
119586
119694
  BuilderState.updateExportedModules = updateExportedModules;
119587
- /**
119588
- * Updates the exported modules from cache into state's exported modules map
119589
- * This should be called whenever it is safe to commit the state of the builder
119590
- */
119591
- function updateExportedFilesMapFromCache(state, exportedModulesMapCache) {
119592
- var _a;
119593
- if (exportedModulesMapCache) {
119594
- ts.Debug.assert(!!state.exportedModulesMap);
119595
- (_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
119596
- exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
119597
- }
119598
- }
119599
- BuilderState.updateExportedFilesMapFromCache = updateExportedFilesMapFromCache;
119600
119695
  /**
119601
119696
  * Get all the dependencies of the sourceFile
119602
119697
  */
@@ -119717,7 +119812,7 @@ var ts;
119717
119812
  /**
119718
119813
  * When program emits modular code, gets the files affected by the sourceFile whose shape has changed
119719
119814
  */
119720
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache) {
119815
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
119721
119816
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
119722
119817
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
119723
119818
  }
@@ -119737,7 +119832,7 @@ var ts;
119737
119832
  if (!seenFileNamesMap.has(currentPath)) {
119738
119833
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
119739
119834
  seenFileNamesMap.set(currentPath, currentSourceFile);
119740
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache)) {
119835
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
119741
119836
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
119742
119837
  }
119743
119838
  }
@@ -119763,32 +119858,33 @@ var ts;
119763
119858
  * Create the state so that we can iterate on changedFiles/affected files
119764
119859
  */
119765
119860
  function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
119861
+ var _a, _b;
119766
119862
  var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
119767
119863
  state.program = newProgram;
119768
119864
  var compilerOptions = newProgram.getCompilerOptions();
119769
119865
  state.compilerOptions = compilerOptions;
119866
+ var outFilePath = ts.outFile(compilerOptions);
119770
119867
  // With --out or --outFile, any change affects all semantic diagnostics so no need to cache them
119771
- if (!ts.outFile(compilerOptions)) {
119868
+ if (!outFilePath) {
119772
119869
  state.semanticDiagnosticsPerFile = new ts.Map();
119773
119870
  }
119871
+ else if (compilerOptions.composite && (oldState === null || oldState === void 0 ? void 0 : oldState.outSignature) && outFilePath === ts.outFile(oldState === null || oldState === void 0 ? void 0 : oldState.compilerOptions)) {
119872
+ state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
119873
+ }
119774
119874
  state.changedFilesSet = new ts.Set();
119875
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
119775
119876
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
119776
119877
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
119777
119878
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
119778
119879
  !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
119880
+ var canCopyEmitSignatures = compilerOptions.composite &&
119881
+ (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
119882
+ !outFilePath &&
119883
+ !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions);
119779
119884
  if (useOldState) {
119780
- // Verify the sanity of old state
119781
- if (!oldState.currentChangedFilePath) {
119782
- var affectedSignatures = oldState.currentAffectedFilesSignatures;
119783
- ts.Debug.assert(!oldState.affectedFiles && (!affectedSignatures || !affectedSignatures.size), "Cannot reuse if only few affected files of currentChangedFile were iterated");
119784
- }
119785
- var changedFilesSet = oldState.changedFilesSet;
119786
- if (canCopySemanticDiagnostics) {
119787
- ts.Debug.assert(!changedFilesSet || !ts.forEachKey(changedFilesSet, function (path) { return oldState.semanticDiagnosticsPerFile.has(path); }), "Semantic diagnostics shouldnt be available for changed files");
119788
- }
119789
119885
  // Copy old state's changed files set
119790
- changedFilesSet === null || changedFilesSet === void 0 ? void 0 : changedFilesSet.forEach(function (value) { return state.changedFilesSet.add(value); });
119791
- if (!ts.outFile(compilerOptions) && oldState.affectedFilesPendingEmit) {
119886
+ (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
119887
+ if (!outFilePath && oldState.affectedFilesPendingEmit) {
119792
119888
  state.affectedFilesPendingEmit = oldState.affectedFilesPendingEmit.slice();
119793
119889
  state.affectedFilesPendingEmitKind = oldState.affectedFilesPendingEmitKind && new ts.Map(oldState.affectedFilesPendingEmitKind);
119794
119890
  state.affectedFilesPendingEmitIndex = oldState.affectedFilesPendingEmitIndex;
@@ -119809,6 +119905,8 @@ var ts;
119809
119905
  !(oldInfo = oldState.fileInfos.get(sourceFilePath)) ||
119810
119906
  // versions dont match
119811
119907
  oldInfo.version !== info.version ||
119908
+ // Implied formats dont match
119909
+ oldInfo.impliedFormat !== info.impliedFormat ||
119812
119910
  // Referenced files changed
119813
119911
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) ||
119814
119912
  // Referenced file was deleted in the new program
@@ -119832,27 +119930,25 @@ var ts;
119832
119930
  state.semanticDiagnosticsFromOldState.add(sourceFilePath);
119833
119931
  }
119834
119932
  }
119933
+ if (canCopyEmitSignatures) {
119934
+ var oldEmitSignature = oldState.emitSignatures.get(sourceFilePath);
119935
+ if (oldEmitSignature)
119936
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(sourceFilePath, oldEmitSignature);
119937
+ }
119835
119938
  });
119836
119939
  // If the global file is removed, add all files as changed
119837
119940
  if (useOldState && ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) { return info.affectsGlobalScope && !state.fileInfos.has(sourceFilePath); })) {
119838
119941
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, newProgram, /*firstSourceFile*/ undefined)
119839
119942
  .forEach(function (file) { return state.changedFilesSet.add(file.resolvedPath); });
119840
119943
  }
119841
- else if (oldCompilerOptions && !ts.outFile(compilerOptions) && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119944
+ else if (oldCompilerOptions && !outFilePath && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
119842
119945
  // Add all files to affectedFilesPendingEmit since emit changed
119843
119946
  newProgram.getSourceFiles().forEach(function (f) { return addToAffectedFilesPendingEmit(state, f.resolvedPath, 1 /* Full */); });
119844
119947
  ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
119845
119948
  state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
119846
119949
  }
119847
- if (useOldState) {
119848
- // Any time the interpretation of a source file changes, mark it as changed
119849
- ts.forEachEntry(oldState.fileInfos, function (info, sourceFilePath) {
119850
- if (state.fileInfos.has(sourceFilePath) && state.fileInfos.get(sourceFilePath).impliedFormat !== info.impliedFormat) {
119851
- state.changedFilesSet.add(sourceFilePath);
119852
- }
119853
- });
119854
- }
119855
- state.buildInfoEmitPending = !!state.changedFilesSet.size;
119950
+ // Since old states change files set is copied, any additional change means we would need to emit build info
119951
+ state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
119856
119952
  return state;
119857
119953
  }
119858
119954
  function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
@@ -119888,30 +119984,35 @@ var ts;
119888
119984
  ts.BuilderState.releaseCache(state);
119889
119985
  state.program = undefined;
119890
119986
  }
119891
- /**
119892
- * Creates a clone of the state
119893
- */
119894
- function cloneBuilderProgramState(state) {
119895
- var _a;
119896
- var newState = ts.BuilderState.clone(state);
119897
- newState.semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile && new ts.Map(state.semanticDiagnosticsPerFile);
119898
- newState.changedFilesSet = new ts.Set(state.changedFilesSet);
119899
- newState.affectedFiles = state.affectedFiles;
119900
- newState.affectedFilesIndex = state.affectedFilesIndex;
119901
- newState.currentChangedFilePath = state.currentChangedFilePath;
119902
- newState.currentAffectedFilesSignatures = state.currentAffectedFilesSignatures && new ts.Map(state.currentAffectedFilesSignatures);
119903
- newState.currentAffectedFilesExportedModulesMap = (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clone();
119904
- newState.seenAffectedFiles = state.seenAffectedFiles && new ts.Set(state.seenAffectedFiles);
119905
- newState.cleanedDiagnosticsOfLibFiles = state.cleanedDiagnosticsOfLibFiles;
119906
- newState.semanticDiagnosticsFromOldState = state.semanticDiagnosticsFromOldState && new ts.Set(state.semanticDiagnosticsFromOldState);
119907
- newState.program = state.program;
119908
- newState.compilerOptions = state.compilerOptions;
119909
- newState.affectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
119910
- newState.affectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
119911
- newState.affectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
119912
- newState.seenEmittedFiles = state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles);
119913
- newState.programEmitComplete = state.programEmitComplete;
119914
- return newState;
119987
+ function backupEmitBuilderProgramState(state) {
119988
+ var outFilePath = ts.outFile(state.compilerOptions);
119989
+ // Only in --out changeFileSet is kept around till emit
119990
+ ts.Debug.assert(!state.changedFilesSet.size || outFilePath);
119991
+ return {
119992
+ affectedFilesPendingEmit: state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice(),
119993
+ affectedFilesPendingEmitKind: state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind),
119994
+ affectedFilesPendingEmitIndex: state.affectedFilesPendingEmitIndex,
119995
+ seenEmittedFiles: state.seenEmittedFiles && new ts.Map(state.seenEmittedFiles),
119996
+ programEmitComplete: state.programEmitComplete,
119997
+ emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
119998
+ outSignature: state.outSignature,
119999
+ dtsChangeTime: state.dtsChangeTime,
120000
+ hasChangedEmitSignature: state.hasChangedEmitSignature,
120001
+ changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
120002
+ };
120003
+ }
120004
+ function restoreEmitBuilderProgramState(state, backupEmitState) {
120005
+ state.affectedFilesPendingEmit = backupEmitState.affectedFilesPendingEmit;
120006
+ state.affectedFilesPendingEmitKind = backupEmitState.affectedFilesPendingEmitKind;
120007
+ state.affectedFilesPendingEmitIndex = backupEmitState.affectedFilesPendingEmitIndex;
120008
+ state.seenEmittedFiles = backupEmitState.seenEmittedFiles;
120009
+ state.programEmitComplete = backupEmitState.programEmitComplete;
120010
+ state.emitSignatures = backupEmitState.emitSignatures;
120011
+ state.outSignature = backupEmitState.outSignature;
120012
+ state.dtsChangeTime = backupEmitState.dtsChangeTime;
120013
+ state.hasChangedEmitSignature = backupEmitState.hasChangedEmitSignature;
120014
+ if (backupEmitState.changedFilesSet)
120015
+ state.changedFilesSet = backupEmitState.changedFilesSet;
119915
120016
  }
119916
120017
  /**
119917
120018
  * Verifies that source file is ok to be used in calls that arent handled by next
@@ -119926,7 +120027,7 @@ var ts;
119926
120027
  * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
119927
120028
  */
119928
120029
  function getNextAffectedFile(state, cancellationToken, computeHash, host) {
119929
- var _a;
120030
+ var _a, _b;
119930
120031
  while (true) {
119931
120032
  var affectedFiles = state.affectedFiles;
119932
120033
  if (affectedFiles) {
@@ -119946,10 +120047,8 @@ var ts;
119946
120047
  state.changedFilesSet.delete(state.currentChangedFilePath);
119947
120048
  state.currentChangedFilePath = undefined;
119948
120049
  // Commit the changes in file signature
119949
- ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
119950
- state.currentAffectedFilesSignatures.clear();
119951
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
119952
- (_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
120050
+ (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
120051
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
119953
120052
  state.affectedFiles = undefined;
119954
120053
  }
119955
120054
  // Get next changed file
@@ -119967,12 +120066,7 @@ var ts;
119967
120066
  return program;
119968
120067
  }
119969
120068
  // Get next batch of affected files
119970
- if (!state.currentAffectedFilesSignatures)
119971
- state.currentAffectedFilesSignatures = new ts.Map();
119972
- if (state.exportedModulesMap) {
119973
- state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap());
119974
- }
119975
- state.affectedFiles = ts.BuilderState.getFilesAffectedBy(state, program, nextKey.value, cancellationToken, computeHash, state.currentAffectedFilesSignatures, state.currentAffectedFilesExportedModulesMap);
120069
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
119976
120070
  state.currentChangedFilePath = nextKey.value;
119977
120071
  state.affectedFilesIndex = 0;
119978
120072
  if (!state.seenAffectedFiles)
@@ -120024,7 +120118,6 @@ var ts;
120024
120118
  * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
120025
120119
  */
120026
120120
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120027
- var _a;
120028
120121
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
120029
120122
  // If affected files is everything except default library, then nothing more to do
120030
120123
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
@@ -120032,10 +120125,9 @@ var ts;
120032
120125
  // When a change affects the global scope, all files are considered to be affected without updating their signature
120033
120126
  // That means when affected file is handled, its signature can be out of date
120034
120127
  // To avoid this, ensure that we update the signature for any affected file in this scenario.
120035
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
120128
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
120036
120129
  return;
120037
120130
  }
120038
- 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);
120039
120131
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
120040
120132
  return;
120041
120133
  handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
@@ -120055,7 +120147,7 @@ var ts;
120055
120147
  // This ensures that we dont later during incremental builds considering wrong signature.
120056
120148
  // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
120057
120149
  // But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
120058
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
120150
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
120059
120151
  // If not dts emit, nothing more to do
120060
120152
  if (ts.getEmitDeclarations(state.compilerOptions)) {
120061
120153
  addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
@@ -120076,27 +120168,10 @@ var ts;
120076
120168
  return !state.semanticDiagnosticsFromOldState.size;
120077
120169
  }
120078
120170
  function isChangedSignature(state, path) {
120079
- var newSignature = ts.Debug.checkDefined(state.currentAffectedFilesSignatures).get(path);
120080
- var oldSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120171
+ var oldSignature = ts.Debug.checkDefined(state.oldSignatures).get(path) || undefined;
120172
+ var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
120081
120173
  return newSignature !== oldSignature;
120082
120174
  }
120083
- function forEachKeyOfExportedModulesMap(state, filePath, fn) {
120084
- // Go through exported modules from cache first
120085
- var keys = state.currentAffectedFilesExportedModulesMap.getKeys(filePath);
120086
- var result = keys && ts.forEachKey(keys, fn);
120087
- if (result)
120088
- return result;
120089
- // If exported from path is not from cache and exported modules has path, all files referencing file exported from are affected
120090
- keys = state.exportedModulesMap.getKeys(filePath);
120091
- return keys && ts.forEachKey(keys, function (exportedFromPath) {
120092
- var _a;
120093
- // If the cache had an updated value, skip
120094
- return !state.currentAffectedFilesExportedModulesMap.hasKey(exportedFromPath) &&
120095
- !((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(exportedFromPath)) ?
120096
- fn(exportedFromPath) :
120097
- undefined;
120098
- });
120099
- }
120100
120175
  function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
120101
120176
  var _a;
120102
120177
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
@@ -120111,6 +120186,7 @@ var ts;
120111
120186
  * Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
120112
120187
  */
120113
120188
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
120189
+ var _a;
120114
120190
  // If there was change in signature (dts output) for the changed file,
120115
120191
  // then only we need to handle pending file emit
120116
120192
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
@@ -120137,11 +120213,10 @@ var ts;
120137
120213
  }
120138
120214
  }
120139
120215
  }
120140
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120141
120216
  var seenFileAndExportsOfFile = new ts.Set();
120142
120217
  // Go through exported modules from cache first
120143
120218
  // If exported modules has path, all files referencing file exported from are affected
120144
- forEachKeyOfExportedModulesMap(state, affectedFile.resolvedPath, function (exportedFromPath) {
120219
+ (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120145
120220
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
120146
120221
  return true;
120147
120222
  var references = state.referencedMap.getKeys(exportedFromPath);
@@ -120155,19 +120230,18 @@ var ts;
120155
120230
  * return true when all work is done and we can exit handling dts emit and semantic diagnostics
120156
120231
  */
120157
120232
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
120158
- var _a;
120233
+ var _a, _b;
120159
120234
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
120160
120235
  return undefined;
120161
120236
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
120162
120237
  return true;
120163
120238
  handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
120164
- ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
120165
120239
  // If exported modules has path, all files referencing file exported from are affected
120166
- forEachKeyOfExportedModulesMap(state, filePath, function (exportedFromPath) {
120240
+ (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
120167
120241
  return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
120168
120242
  });
120169
120243
  // Remove diagnostics of files that import this file (without going to exports of referencing files)
120170
- (_a = state.referencedMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (referencingFilePath) {
120244
+ (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
120171
120245
  return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120172
120246
  handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
120173
120247
  state, referencingFilePath, cancellationToken, computeHash, host);
@@ -120188,12 +120262,13 @@ var ts;
120188
120262
  }
120189
120263
  else {
120190
120264
  state.seenAffectedFiles.add(affected.resolvedPath);
120265
+ // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted
120266
+ state.buildInfoEmitPending = true;
120191
120267
  if (emitKind !== undefined) {
120192
120268
  (state.seenEmittedFiles || (state.seenEmittedFiles = new ts.Map())).set(affected.resolvedPath, emitKind);
120193
120269
  }
120194
120270
  if (isPendingEmit) {
120195
120271
  state.affectedFilesPendingEmitIndex++;
120196
- state.buildInfoEmitPending = true;
120197
120272
  }
120198
120273
  else {
120199
120274
  state.affectedFilesIndex++;
@@ -120244,22 +120319,43 @@ var ts;
120244
120319
  /**
120245
120320
  * Gets the program information to be emitted in buildInfo so that we can use it to create new program
120246
120321
  */
120247
- function getProgramBuildInfo(state, getCanonicalFileName) {
120248
- if (ts.outFile(state.compilerOptions))
120249
- return undefined;
120322
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
120323
+ var outFilePath = ts.outFile(state.compilerOptions);
120324
+ if (outFilePath && !state.compilerOptions.composite)
120325
+ return;
120250
120326
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
120251
120327
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
120328
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
120329
+ if (outFilePath) {
120330
+ var result_15 = {
120331
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
120332
+ outSignature: state.outSignature,
120333
+ dtsChangeTime: state.dtsChangeTime,
120334
+ };
120335
+ return result_15;
120336
+ }
120252
120337
  var fileNames = [];
120253
120338
  var fileNameToFileId = new ts.Map();
120254
120339
  var fileIdsList;
120255
120340
  var fileNamesToFileIdListId;
120341
+ var emitSignatures;
120256
120342
  var fileInfos = ts.arrayFrom(state.fileInfos.entries(), function (_a) {
120343
+ var _b, _c;
120257
120344
  var key = _a[0], value = _a[1];
120258
120345
  // Ensure fileId
120259
120346
  var fileId = toFileId(key);
120260
120347
  ts.Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
120261
- var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
120262
- var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
120348
+ var oldSignature = (_b = state.oldSignatures) === null || _b === void 0 ? void 0 : _b.get(key);
120349
+ var actualSignature = oldSignature !== undefined ? oldSignature || undefined : value.signature;
120350
+ if (state.compilerOptions.composite) {
120351
+ var file = state.program.getSourceFileByPath(key);
120352
+ if (!ts.isJsonSourceFile(file) && ts.sourceFileMayBeEmitted(file, state.program)) {
120353
+ var emitSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(key);
120354
+ if (emitSignature !== actualSignature) {
120355
+ (emitSignatures || (emitSignatures = [])).push(emitSignature === undefined ? fileId : [fileId, emitSignature]);
120356
+ }
120357
+ }
120358
+ }
120263
120359
  return value.version === actualSignature ?
120264
120360
  value.affectsGlobalScope || value.impliedFormat ?
120265
120361
  // If file version is same as signature, dont serialize signature
@@ -120267,11 +120363,11 @@ var ts;
120267
120363
  // If file info only contains version and signature and both are same we can just write string
120268
120364
  value.version :
120269
120365
  actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
120270
- signature === undefined ?
120366
+ oldSignature === undefined ?
120271
120367
  // If we havent computed signature, use fileInfo as is
120272
120368
  value :
120273
120369
  // Serialize fileInfo with new updated signature
120274
- { version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120370
+ { version: value.version, signature: actualSignature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
120275
120371
  // Signature of the FileInfo is undefined, serialize it as false
120276
120372
  { version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
120277
120373
  });
@@ -120286,17 +120382,13 @@ var ts;
120286
120382
  if (state.exportedModulesMap) {
120287
120383
  exportedModulesMap = ts.mapDefined(ts.arrayFrom(state.exportedModulesMap.keys()).sort(ts.compareStringsCaseSensitive), function (key) {
120288
120384
  var _a;
120289
- if (state.currentAffectedFilesExportedModulesMap) {
120290
- if ((_a = state.currentAffectedFilesExportedModulesMap.deletedKeys()) === null || _a === void 0 ? void 0 : _a.has(key)) {
120291
- return undefined;
120292
- }
120293
- var newValue = state.currentAffectedFilesExportedModulesMap.getValues(key);
120294
- if (newValue) {
120295
- return [toFileId(key), toFileIdListId(newValue)];
120296
- }
120297
- }
120385
+ var oldValue = (_a = state.oldExportedModulesMap) === null || _a === void 0 ? void 0 : _a.get(key);
120298
120386
  // Not in temporary cache, use existing value
120299
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120387
+ if (oldValue === undefined)
120388
+ return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120389
+ if (oldValue)
120390
+ return [toFileId(key), toFileIdListId(oldValue)];
120391
+ return undefined;
120300
120392
  });
120301
120393
  }
120302
120394
  var semanticDiagnosticsPerFile;
@@ -120307,9 +120399,7 @@ var ts;
120307
120399
  (semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
120308
120400
  [
120309
120401
  toFileId(key),
120310
- state.hasReusableDiagnostic ?
120311
- value :
120312
- convertToReusableDiagnostics(value, relativeToBuildInfo)
120402
+ convertToReusableDiagnostics(value, relativeToBuildInfo)
120313
120403
  ] :
120314
120404
  toFileId(key));
120315
120405
  }
@@ -120324,16 +120414,27 @@ var ts;
120324
120414
  }
120325
120415
  }
120326
120416
  }
120327
- return {
120417
+ var changeFileSet;
120418
+ if (state.changedFilesSet.size) {
120419
+ for (var _d = 0, _e = ts.arrayFrom(state.changedFilesSet.keys()).sort(ts.compareStringsCaseSensitive); _d < _e.length; _d++) {
120420
+ var path = _e[_d];
120421
+ (changeFileSet || (changeFileSet = [])).push(toFileId(path));
120422
+ }
120423
+ }
120424
+ var result = {
120328
120425
  fileNames: fileNames,
120329
120426
  fileInfos: fileInfos,
120330
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, relativeToBuildInfoEnsuringAbsolutePath),
120427
+ options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
120331
120428
  fileIdsList: fileIdsList,
120332
120429
  referencedMap: referencedMap,
120333
120430
  exportedModulesMap: exportedModulesMap,
120334
120431
  semanticDiagnosticsPerFile: semanticDiagnosticsPerFile,
120335
120432
  affectedFilesPendingEmit: affectedFilesPendingEmit,
120433
+ changeFileSet: changeFileSet,
120434
+ emitSignatures: emitSignatures,
120435
+ dtsChangeTime: state.dtsChangeTime,
120336
120436
  };
120437
+ return result;
120337
120438
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
120338
120439
  return relativeToBuildInfo(ts.getNormalizedAbsolutePath(path, currentDirectory));
120339
120440
  }
@@ -120358,24 +120459,18 @@ var ts;
120358
120459
  }
120359
120460
  return fileIdListId;
120360
120461
  }
120361
- }
120362
- function convertToProgramBuildInfoCompilerOptions(options, relativeToBuildInfo) {
120363
- var result;
120364
- var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120365
- for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120366
- var name = _a[_i];
120367
- var optionKey = name.toLowerCase();
120368
- var optionInfo = optionsNameMap.get(optionKey);
120369
- if ((optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsEmit) || (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsSemanticDiagnostics) ||
120370
- // We need to store `strict`, even though it won't be examined directly, so that the
120371
- // flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
120372
- optionKey === "strict" ||
120373
- // We need to store these to determine whether `lib` files need to be rechecked.
120374
- optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
120375
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfo);
120462
+ function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
120463
+ var result;
120464
+ var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
120465
+ for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
120466
+ var name = _a[_i];
120467
+ var optionInfo = optionsNameMap.get(name.toLowerCase());
120468
+ if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
120469
+ (result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
120470
+ }
120376
120471
  }
120472
+ return result;
120377
120473
  }
120378
- return result;
120379
120474
  }
120380
120475
  function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
120381
120476
  if (option) {
@@ -120449,6 +120544,10 @@ var ts;
120449
120544
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
120450
120545
  }
120451
120546
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
120547
+ function computeSignature(text, data, computeHash) {
120548
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
120549
+ }
120550
+ ts.computeSignature = computeSignature;
120452
120551
  function createBuilderProgram(kind, _a) {
120453
120552
  var newProgram = _a.newProgram, host = _a.host, oldProgram = _a.oldProgram, configFileParsingDiagnostics = _a.configFileParsingDiagnostics;
120454
120553
  // Return same program if underlying program doesnt change
@@ -120467,8 +120566,8 @@ var ts;
120467
120566
  */
120468
120567
  var computeHash = ts.maybeBind(host, host.createHash);
120469
120568
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
120470
- var backupState;
120471
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
120569
+ var backupEmitState;
120570
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
120472
120571
  // To ensure that we arent storing any references to old program or new program without state
120473
120572
  newProgram = undefined; // TODO: GH#18217
120474
120573
  oldProgram = undefined;
@@ -120476,20 +120575,20 @@ var ts;
120476
120575
  var getState = function () { return state; };
120477
120576
  var builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
120478
120577
  builderProgram.getState = getState;
120479
- builderProgram.backupState = function () {
120480
- ts.Debug.assert(backupState === undefined);
120481
- backupState = cloneBuilderProgramState(state);
120578
+ builderProgram.backupEmitState = function () {
120579
+ ts.Debug.assert(backupEmitState === undefined);
120580
+ backupEmitState = backupEmitBuilderProgramState(state);
120482
120581
  };
120483
- builderProgram.restoreState = function () {
120484
- state = ts.Debug.checkDefined(backupState);
120485
- backupState = undefined;
120582
+ builderProgram.restoreEmitState = function () {
120583
+ restoreEmitBuilderProgramState(state, ts.Debug.checkDefined(backupEmitState));
120584
+ backupEmitState = undefined;
120486
120585
  };
120487
120586
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
120488
120587
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
120489
120588
  builderProgram.emit = emit;
120490
120589
  builderProgram.releaseProgram = function () {
120491
120590
  releaseCache(state);
120492
- backupState = undefined;
120591
+ backupEmitState = undefined;
120493
120592
  };
120494
120593
  if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
120495
120594
  builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
@@ -120548,35 +120647,59 @@ var ts;
120548
120647
  return toAffectedFileEmitResult(state,
120549
120648
  // When whole program is affected, do emit only once (eg when --out or --outFile is specified)
120550
120649
  // Otherwise just affected file
120551
- ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, affected !== state.program && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120552
- getWriteFileUpdatingSignatureCallback(writeFile) :
120650
+ ts.Debug.checkDefined(state.program).emit(affected === state.program ? undefined : affected, ts.getEmitDeclarations(state.compilerOptions) ?
120651
+ getWriteFileCallback(writeFile, customTransformers) :
120553
120652
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles || emitKind === 0 /* DtsOnly */, customTransformers), affected, emitKind, isPendingEmitFile);
120554
120653
  }
120555
- function getWriteFileUpdatingSignatureCallback(writeFile) {
120654
+ function getWriteFileCallback(writeFile, customTransformers) {
120556
120655
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
120557
- var _a;
120656
+ var _a, _b, _c;
120558
120657
  if (ts.isDeclarationFileName(fileName)) {
120559
- ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120560
- var file = sourceFiles[0];
120561
- var info = state.fileInfos.get(file.resolvedPath);
120562
- var signature = ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath)) || info.signature;
120563
- if (signature === file.version) {
120564
- var newSignature = (computeHash || ts.generateDjb2Hash)((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text);
120565
- if (newSignature !== file.version) { // Update it
120566
- if (host.storeFilesChangingSignatureDuringEmit)
120567
- (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120568
- if (state.exportedModulesMap)
120569
- ts.BuilderState.updateExportedModules(file, file.exportedModulesFromDeclarationEmit, state.currentAffectedFilesExportedModulesMap || (state.currentAffectedFilesExportedModulesMap = ts.BuilderState.createManyToManyPathMap()));
120570
- if (state.affectedFiles && state.affectedFilesIndex < state.affectedFiles.length) {
120571
- state.currentAffectedFilesSignatures.set(file.resolvedPath, newSignature);
120658
+ if (!ts.outFile(state.compilerOptions)) {
120659
+ ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
120660
+ var newSignature = void 0;
120661
+ if (!customTransformers) {
120662
+ var file = sourceFiles[0];
120663
+ var info = state.fileInfos.get(file.resolvedPath);
120664
+ if (info.signature === file.version) {
120665
+ newSignature = computeSignature(text, data, computeHash);
120666
+ if (newSignature !== file.version) { // Update it
120667
+ if (host.storeFilesChangingSignatureDuringEmit)
120668
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
120669
+ if (state.exportedModulesMap)
120670
+ ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
120671
+ if (state.affectedFiles) {
120672
+ // Keep old signature so we know what to undo if cancellation happens
120673
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
120674
+ if (existing === undefined)
120675
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
120676
+ info.signature = newSignature;
120677
+ }
120678
+ else {
120679
+ // These are directly commited
120680
+ info.signature = newSignature;
120681
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
120682
+ }
120683
+ }
120572
120684
  }
120573
- else {
120574
- info.signature = newSignature;
120575
- if (state.exportedModulesMap)
120576
- ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
120685
+ }
120686
+ if (state.compilerOptions.composite) {
120687
+ var filePath = sourceFiles[0].resolvedPath;
120688
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
120689
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
120690
+ if (newSignature !== oldSignature) {
120691
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
120692
+ state.hasChangedEmitSignature = true;
120577
120693
  }
120578
120694
  }
120579
120695
  }
120696
+ else if (state.compilerOptions.composite) {
120697
+ var newSignature = computeSignature(text, data, computeHash);
120698
+ if (newSignature !== state.outSignature) {
120699
+ state.outSignature = newSignature;
120700
+ state.hasChangedEmitSignature = true;
120701
+ }
120702
+ }
120580
120703
  }
120581
120704
  if (writeFile)
120582
120705
  writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
@@ -120641,8 +120764,8 @@ var ts;
120641
120764
  }
120642
120765
  }
120643
120766
  }
120644
- return ts.Debug.checkDefined(state.program).emit(targetSourceFile, !ts.outFile(state.compilerOptions) && ts.getEmitDeclarations(state.compilerOptions) && !customTransformers ?
120645
- getWriteFileUpdatingSignatureCallback(writeFile) :
120767
+ return ts.Debug.checkDefined(state.program).emit(targetSourceFile, ts.getEmitDeclarations(state.compilerOptions) ?
120768
+ getWriteFileCallback(writeFile, customTransformers) :
120646
120769
  writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
120647
120770
  }
120648
120771
  /**
@@ -120731,14 +120854,28 @@ var ts;
120731
120854
  { version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
120732
120855
  }
120733
120856
  ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
120734
- function createBuildProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
120735
- var _a;
120857
+ function createBuilderProgramUsingProgramBuildInfo(programFromBuildInfo, buildInfoPath, host) {
120858
+ var _a, _b, _c, _d, _e;
120736
120859
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
120737
120860
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
120738
- var filePaths = program.fileNames.map(toPath);
120739
- var filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120861
+ var program = programFromBuildInfo;
120862
+ var filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
120863
+ var filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
120740
120864
  var fileInfos = new ts.Map();
120741
- program.fileInfos.forEach(function (fileInfo, index) { return fileInfos.set(toFilePath(index + 1), toBuilderStateFileInfo(fileInfo)); });
120865
+ var emitSignatures = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
120866
+ (_d = program.fileInfos) === null || _d === void 0 ? void 0 : _d.forEach(function (fileInfo, index) {
120867
+ var path = toFilePath(index + 1);
120868
+ var stateFileInfo = toBuilderStateFileInfo(fileInfo);
120869
+ fileInfos.set(path, stateFileInfo);
120870
+ if (emitSignatures && stateFileInfo.signature)
120871
+ emitSignatures.set(path, stateFileInfo.signature);
120872
+ });
120873
+ (_e = program.emitSignatures) === null || _e === void 0 ? void 0 : _e.forEach(function (value) {
120874
+ if (ts.isNumber(value))
120875
+ emitSignatures.delete(toFilePath(value));
120876
+ else
120877
+ emitSignatures.set(toFilePath(value[0]), value[1]);
120878
+ });
120742
120879
  var state = {
120743
120880
  fileInfos: fileInfos,
120744
120881
  compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
@@ -120749,11 +120886,15 @@ var ts;
120749
120886
  affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
120750
120887
  affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
120751
120888
  affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
120889
+ changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
120890
+ dtsChangeTime: program.dtsChangeTime,
120891
+ emitSignatures: (emitSignatures === null || emitSignatures === void 0 ? void 0 : emitSignatures.size) ? emitSignatures : undefined,
120892
+ outSignature: program.outSignature,
120752
120893
  };
120753
120894
  return {
120754
120895
  getState: function () { return state; },
120755
- backupState: ts.noop,
120756
- restoreState: ts.noop,
120896
+ backupEmitState: ts.noop,
120897
+ restoreEmitState: ts.noop,
120757
120898
  getProgram: ts.notImplemented,
120758
120899
  getProgramOrUndefined: ts.returnUndefined,
120759
120900
  releaseProgram: ts.noop,
@@ -120798,12 +120939,12 @@ var ts;
120798
120939
  return map;
120799
120940
  }
120800
120941
  }
120801
- ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
120942
+ ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
120802
120943
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
120803
120944
  return {
120804
120945
  getState: ts.notImplemented,
120805
- backupState: ts.noop,
120806
- restoreState: ts.noop,
120946
+ backupEmitState: ts.noop,
120947
+ restoreEmitState: ts.noop,
120807
120948
  getProgram: getProgram,
120808
120949
  getProgramOrUndefined: function () { return getState().program; },
120809
120950
  releaseProgram: function () { return getState().program = undefined; },
@@ -121919,9 +122060,9 @@ var ts;
121919
122060
  if (!preferSymlinks) {
121920
122061
  // Symlinks inside ignored paths are already filtered out of the symlink cache,
121921
122062
  // so we only need to remove them from the realpath filenames.
121922
- var result_15 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
121923
- if (result_15)
121924
- return result_15;
122063
+ var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
122064
+ if (result_16)
122065
+ return result_16;
121925
122066
  }
121926
122067
  var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
121927
122068
  var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
@@ -121941,10 +122082,10 @@ var ts;
121941
122082
  for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
121942
122083
  var symlinkDirectory = symlinkDirectories_1[_i];
121943
122084
  var option = ts.resolvePath(symlinkDirectory, relative);
121944
- var result_16 = cb(option, target === referenceRedirect);
122085
+ var result_17 = cb(option, target === referenceRedirect);
121945
122086
  shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
121946
- if (result_16)
121947
- return result_16;
122087
+ if (result_17)
122088
+ return result_17;
121948
122089
  }
121949
122090
  });
121950
122091
  });
@@ -122836,6 +122977,7 @@ var ts;
122836
122977
  readDirectory: ts.maybeBind(host, host.readDirectory),
122837
122978
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
122838
122979
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
122980
+ now: ts.maybeBind(host, host.now),
122839
122981
  };
122840
122982
  function writeFile(fileName, text, writeByteOrderMark, onError) {
122841
122983
  try {
@@ -122896,6 +123038,7 @@ var ts;
122896
123038
  createProgram: createProgram || ts.createEmitAndSemanticDiagnosticsBuilderProgram,
122897
123039
  disableUseFileVersionAsSignature: system.disableUseFileVersionAsSignature,
122898
123040
  storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
123041
+ now: ts.maybeBind(system, system.now),
122899
123042
  };
122900
123043
  }
122901
123044
  ts.createProgramHost = createProgramHost;
@@ -122963,20 +123106,26 @@ var ts;
122963
123106
  var ts;
122964
123107
  (function (ts) {
122965
123108
  function readBuilderProgram(compilerOptions, host) {
122966
- if (ts.outFile(compilerOptions))
122967
- return undefined;
122968
123109
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
122969
123110
  if (!buildInfoPath)
122970
123111
  return undefined;
122971
- var content = host.readFile(buildInfoPath);
122972
- if (!content)
122973
- return undefined;
122974
- var buildInfo = ts.getBuildInfo(content);
123112
+ var buildInfo;
123113
+ if (host.getBuildInfo) {
123114
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
123115
+ if (!buildInfo)
123116
+ return undefined;
123117
+ }
123118
+ else {
123119
+ var content = host.readFile(buildInfoPath);
123120
+ if (!content)
123121
+ return undefined;
123122
+ buildInfo = ts.getBuildInfo(content);
123123
+ }
122975
123124
  if (buildInfo.version !== ts.version)
122976
123125
  return undefined;
122977
123126
  if (!buildInfo.program)
122978
123127
  return undefined;
122979
- return ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
123128
+ return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
122980
123129
  }
122981
123130
  ts.readBuilderProgram = readBuilderProgram;
122982
123131
  function createIncrementalCompilerHost(options, system) {
@@ -122985,6 +123134,7 @@ var ts;
122985
123134
  host.createHash = ts.maybeBind(system, system.createHash);
122986
123135
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
122987
123136
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
123137
+ host.now = ts.maybeBind(system, system.now);
122988
123138
  ts.setGetSourceFileAsHashVersioned(host, system);
122989
123139
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
122990
123140
  return host;
@@ -123719,14 +123869,16 @@ var ts;
123719
123869
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
123720
123870
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
123721
123871
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
123722
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
123723
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
123724
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
123725
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
123872
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
123873
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
123874
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
123875
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
123876
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
123726
123877
  /**
123727
123878
  * Projects with no outputs (i.e. "solution" files)
123728
123879
  */
123729
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
123880
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 12] = "ContainerOnly";
123881
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 13] = "ForceBuild";
123730
123882
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
123731
123883
  function resolveConfigFileProjectName(project) {
123732
123884
  if (ts.fileExtensionIs(project, ".json" /* Json */)) {
@@ -123771,9 +123923,11 @@ var ts;
123771
123923
  function getOrCreateValueMapFromConfigFileMap(configFileMap, resolved) {
123772
123924
  return getOrCreateValueFromConfigFileMap(configFileMap, resolved, function () { return new ts.Map(); });
123773
123925
  }
123774
- function newer(date1, date2) {
123775
- return date2 > date1 ? date2 : date1;
123926
+ /*@internal*/
123927
+ function getCurrentTime(host) {
123928
+ return host.now ? host.now() : new Date();
123776
123929
  }
123930
+ ts.getCurrentTime = getCurrentTime;
123777
123931
  /*@internal*/
123778
123932
  function isCircularBuildOrder(buildOrder) {
123779
123933
  return !!buildOrder && !!buildOrder.buildOrder;
@@ -123863,6 +124017,7 @@ var ts;
123863
124017
  return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
123864
124018
  };
123865
124019
  }
124020
+ compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
123866
124021
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
123867
124022
  var state = {
123868
124023
  host: host,
@@ -123879,8 +124034,9 @@ var ts;
123879
124034
  resolvedConfigFilePaths: new ts.Map(),
123880
124035
  configFileCache: new ts.Map(),
123881
124036
  projectStatus: new ts.Map(),
123882
- buildInfoChecked: new ts.Map(),
123883
124037
  extendedConfigCache: new ts.Map(),
124038
+ buildInfoCache: new ts.Map(),
124039
+ outputTimeStamps: new ts.Map(),
123884
124040
  builderPrograms: new ts.Map(),
123885
124041
  diagnostics: new ts.Map(),
123886
124042
  projectPendingBuild: new ts.Map(),
@@ -123904,6 +124060,7 @@ var ts;
123904
124060
  allWatchedConfigFiles: new ts.Map(),
123905
124061
  allWatchedExtendedConfigFiles: new ts.Map(),
123906
124062
  allWatchedPackageJsonFiles: new ts.Map(),
124063
+ filesWatched: new ts.Map(),
123907
124064
  lastCachedPackageJsonLookups: new ts.Map(),
123908
124065
  timerToBuildInvalidatedProject: undefined,
123909
124066
  reportFileChangeDetected: false,
@@ -124010,11 +124167,12 @@ var ts;
124010
124167
  // Config file cache
124011
124168
  ts.mutateMapSkippingNewValues(state.configFileCache, currentProjects, noopOnDelete);
124012
124169
  ts.mutateMapSkippingNewValues(state.projectStatus, currentProjects, noopOnDelete);
124013
- ts.mutateMapSkippingNewValues(state.buildInfoChecked, currentProjects, noopOnDelete);
124014
124170
  ts.mutateMapSkippingNewValues(state.builderPrograms, currentProjects, noopOnDelete);
124015
124171
  ts.mutateMapSkippingNewValues(state.diagnostics, currentProjects, noopOnDelete);
124016
124172
  ts.mutateMapSkippingNewValues(state.projectPendingBuild, currentProjects, noopOnDelete);
124017
124173
  ts.mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124174
+ ts.mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124175
+ ts.mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124018
124176
  // Remove watches for the program no longer in the solution
124019
124177
  if (state.watch) {
124020
124178
  ts.mutateMapSkippingNewValues(state.allWatchedConfigFiles, currentProjects, { onDeleteValue: ts.closeFileWatcher });
@@ -124305,21 +124463,21 @@ var ts;
124305
124463
  }
124306
124464
  function emit(writeFileCallback, cancellationToken, customTransformers) {
124307
124465
  var _a;
124308
- var _b, _c;
124466
+ var _b, _c, _d;
124309
124467
  ts.Debug.assertIsDefined(program);
124310
124468
  ts.Debug.assert(step === BuildStep.Emit);
124311
124469
  // Before emitting lets backup state, so we can revert it back if there are declaration errors to handle emit and declaration errors correctly
124312
- program.backupState();
124470
+ program.backupEmitState();
124313
124471
  var declDiagnostics;
124314
124472
  var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
124315
124473
  var outputFiles = [];
124316
124474
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics,
124317
124475
  /*write*/ undefined,
124318
- /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, cancellationToken,
124476
+ /*reportSummary*/ undefined, function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark, buildInfo: data === null || data === void 0 ? void 0 : data.buildInfo }); }, cancellationToken,
124319
124477
  /*emitOnlyDts*/ false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
124320
124478
  // Don't emit .d.ts if there are decl file errors
124321
124479
  if (declDiagnostics) {
124322
- program.restoreState();
124480
+ program.restoreEmitState();
124323
124481
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
124324
124482
  return {
124325
124483
  emitSkipped: true,
@@ -124329,37 +124487,43 @@ var ts;
124329
124487
  // Actual Emit
124330
124488
  var host = state.host, compilerHost = state.compilerHost;
124331
124489
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124332
- var newestDeclarationFileContentChangedTime = minimumDate;
124333
- var anyDtsChanged = false;
124490
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
124334
124491
  var emitterDiagnostics = ts.createDiagnosticCollection();
124335
124492
  var emittedOutputs = new ts.Map();
124493
+ var options = program.getCompilerOptions();
124494
+ var isIncremental = ts.isIncrementalCompilation(options);
124495
+ var outputTimeStampMap;
124496
+ var now;
124336
124497
  outputFiles.forEach(function (_a) {
124337
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124338
- var priorChangeTime;
124339
- if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
124340
- // Check for unchanged .d.ts files
124341
- if (host.fileExists(name) && state.readFileWithCache(name) === text) {
124342
- priorChangeTime = host.getModifiedTime(name);
124343
- }
124344
- else {
124498
+ var _b, _c;
124499
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124500
+ var path = toPath(state, name);
124501
+ emittedOutputs.set(toPath(state, name), name);
124502
+ if (buildInfo) {
124503
+ setBuildInfo(state, buildInfo, projectPath, options);
124504
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124345
124505
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124346
- anyDtsChanged = true;
124347
124506
  }
124348
124507
  }
124349
- emittedOutputs.set(toPath(state, name), name);
124350
124508
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124351
- if (priorChangeTime !== undefined) {
124352
- newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
124509
+ if (!isIncremental && state.watch) {
124510
+ (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
124353
124511
  }
124354
124512
  });
124355
- finishEmit(emitterDiagnostics, emittedOutputs, newestDeclarationFileContentChangedTime,
124356
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ anyDtsChanged, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124513
+ finishEmit(emitterDiagnostics, emittedOutputs, outputFiles.length ? outputFiles[0].name : ts.getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()), resultFlags);
124357
124514
  return emitResult;
124358
124515
  }
124359
124516
  function emitBuildInfo(writeFileCallback, cancellationToken) {
124360
124517
  ts.Debug.assertIsDefined(program);
124361
124518
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
124362
- var emitResult = program.emitBuildInfo(writeFileCallback, cancellationToken);
124519
+ var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
124520
+ if (data === null || data === void 0 ? void 0 : data.buildInfo)
124521
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
124522
+ if (writeFileCallback)
124523
+ writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
124524
+ else
124525
+ state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
124526
+ }, cancellationToken);
124363
124527
  if (emitResult.diagnostics.length) {
124364
124528
  reportErrors(state, emitResult.diagnostics);
124365
124529
  state.diagnostics.set(projectPath, __spreadArray(__spreadArray([], state.diagnostics.get(projectPath), true), emitResult.diagnostics, true));
@@ -124372,7 +124536,7 @@ var ts;
124372
124536
  step = BuildStep.QueueReferencingProjects;
124373
124537
  return emitResult;
124374
124538
  }
124375
- function finishEmit(emitterDiagnostics, emittedOutputs, priorNewestUpdateTime, newestDeclarationFileContentChangedTimeIsMaximumDate, oldestOutputFileName, resultFlags) {
124539
+ function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
124376
124540
  var _a;
124377
124541
  var emitDiagnostics = emitterDiagnostics.getDiagnostics();
124378
124542
  if (emitDiagnostics.length) {
@@ -124383,13 +124547,11 @@ var ts;
124383
124547
  emittedOutputs.forEach(function (name) { return listEmittedFile(state, config, name); });
124384
124548
  }
124385
124549
  // Update time stamps for rest of the outputs
124386
- var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(state, config, priorNewestUpdateTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124550
+ updateOutputTimestampsWorker(state, config, projectPath, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
124387
124551
  state.diagnostics.delete(projectPath);
124388
124552
  state.projectStatus.set(projectPath, {
124389
124553
  type: ts.UpToDateStatusType.UpToDate,
124390
- newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTimeIsMaximumDate ?
124391
- maximumDate :
124392
- newestDeclarationFileContentChangedTime,
124554
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
124393
124555
  oldestOutputFileName: oldestOutputFileName
124394
124556
  });
124395
124557
  afterProgramDone(state, program, config);
@@ -124424,13 +124586,21 @@ var ts;
124424
124586
  ts.Debug.assert(!!outputFiles.length);
124425
124587
  var emitterDiagnostics = ts.createDiagnosticCollection();
124426
124588
  var emittedOutputs = new ts.Map();
124589
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
124590
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
124427
124591
  outputFiles.forEach(function (_a) {
124428
- var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
124592
+ var _b, _c;
124593
+ var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
124429
124594
  emittedOutputs.set(toPath(state, name), name);
124595
+ if (buildInfo) {
124596
+ setBuildInfo(state, buildInfo, projectPath, config.options);
124597
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
124598
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
124599
+ }
124600
+ }
124430
124601
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
124431
124602
  });
124432
- var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, minimumDate,
124433
- /*newestDeclarationFileContentChangedTimeIsMaximumDate*/ false, outputFiles[0].name, BuildResultFlags.DeclarationOutputUnchanged);
124603
+ var emitDiagnostics = finishEmit(emitterDiagnostics, emittedOutputs, outputFiles[0].name, resultFlags);
124434
124604
  return { emitSkipped: false, diagnostics: emitDiagnostics };
124435
124605
  }
124436
124606
  function executeSteps(till, cancellationToken, writeFile, customTransformers) {
@@ -124592,7 +124762,7 @@ var ts;
124592
124762
  state.projectCompilerOptions = state.baseCompilerOptions;
124593
124763
  }
124594
124764
  function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
124595
- var canEmitBuildInfo = !(buildResult & BuildResultFlags.SyntaxErrors) && program && !ts.outFile(program.getCompilerOptions());
124765
+ var canEmitBuildInfo = program && !ts.outFile(program.getCompilerOptions());
124596
124766
  reportAndStoreErrors(state, resolvedPath, diagnostics);
124597
124767
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
124598
124768
  if (canEmitBuildInfo)
@@ -124600,9 +124770,95 @@ var ts;
124600
124770
  afterProgramDone(state, program, config);
124601
124771
  return { buildResult: buildResult, step: BuildStep.QueueReferencingProjects };
124602
124772
  }
124773
+ function isFileWatcherWithModifiedTime(value) {
124774
+ return !!value.watcher;
124775
+ }
124776
+ function getModifiedTime(state, fileName) {
124777
+ var path = toPath(state, fileName);
124778
+ var existing = state.filesWatched.get(path);
124779
+ if (state.watch && !!existing) {
124780
+ if (!isFileWatcherWithModifiedTime(existing))
124781
+ return existing;
124782
+ if (existing.modifiedTime)
124783
+ return existing.modifiedTime;
124784
+ }
124785
+ var result = ts.getModifiedTime(state.host, fileName);
124786
+ if (state.watch) {
124787
+ if (existing)
124788
+ existing.modifiedTime = result;
124789
+ else
124790
+ state.filesWatched.set(path, result);
124791
+ }
124792
+ return result;
124793
+ }
124794
+ function watchFile(state, file, callback, pollingInterval, options, watchType, project) {
124795
+ var path = toPath(state, file);
124796
+ var existing = state.filesWatched.get(path);
124797
+ if (existing && isFileWatcherWithModifiedTime(existing)) {
124798
+ existing.callbacks.push(callback);
124799
+ }
124800
+ else {
124801
+ var watcher = state.watchFile(file, function (fileName, eventKind, modifiedTime) {
124802
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124803
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124804
+ existing.modifiedTime = modifiedTime;
124805
+ existing.callbacks.forEach(function (cb) { return cb(fileName, eventKind, modifiedTime); });
124806
+ }, pollingInterval, options, watchType, project);
124807
+ state.filesWatched.set(path, { callbacks: [callback], watcher: watcher, modifiedTime: existing });
124808
+ }
124809
+ return {
124810
+ close: function () {
124811
+ var existing = ts.Debug.checkDefined(state.filesWatched.get(path));
124812
+ ts.Debug.assert(isFileWatcherWithModifiedTime(existing));
124813
+ if (existing.callbacks.length === 1) {
124814
+ state.filesWatched.delete(path);
124815
+ ts.closeFileWatcherOf(existing);
124816
+ }
124817
+ else {
124818
+ ts.unorderedRemoveItem(existing.callbacks, callback);
124819
+ }
124820
+ }
124821
+ };
124822
+ }
124823
+ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
124824
+ if (!state.watch)
124825
+ return undefined;
124826
+ var result = state.outputTimeStamps.get(resolvedConfigFilePath);
124827
+ if (!result)
124828
+ state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
124829
+ return result;
124830
+ }
124831
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
124832
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
124833
+ var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
124834
+ if (existing) {
124835
+ existing.buildInfo = buildInfo;
124836
+ existing.modifiedTime = getCurrentTime(state.host);
124837
+ }
124838
+ else {
124839
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
124840
+ }
124841
+ }
124842
+ function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
124843
+ var path = toPath(state, buildInfoPath);
124844
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
124845
+ return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
124846
+ }
124847
+ function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
124848
+ var path = toPath(state, buildInfoPath);
124849
+ var existing = state.buildInfoCache.get(resolvedConfigPath);
124850
+ if (existing !== undefined && existing.path === path) {
124851
+ return existing.buildInfo || undefined;
124852
+ }
124853
+ var value = state.readFileWithCache(buildInfoPath);
124854
+ var buildInfo = value ? ts.getBuildInfo(value) : undefined;
124855
+ ts.Debug.assert(modifiedTime || !buildInfo);
124856
+ state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
124857
+ return buildInfo;
124858
+ }
124603
124859
  function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName) {
124604
124860
  // Check tsconfig time
124605
- var tsconfigTime = ts.getModifiedTime(state.host, configFile);
124861
+ var tsconfigTime = getModifiedTime(state, configFile);
124606
124862
  if (oldestOutputFileTime < tsconfigTime) {
124607
124863
  return {
124608
124864
  type: ts.UpToDateStatusType.OutOfDateWithSelf,
@@ -124612,88 +124868,24 @@ var ts;
124612
124868
  }
124613
124869
  }
124614
124870
  function getUpToDateStatusWorker(state, project, resolvedPath) {
124615
- var force = !!state.options.force;
124616
- var newestInputFileName = undefined;
124617
- var newestInputFileTime = minimumDate;
124618
- var host = state.host;
124619
- // Get timestamps of input files
124620
- for (var _i = 0, _a = project.fileNames; _i < _a.length; _i++) {
124621
- var inputFile = _a[_i];
124622
- if (!host.fileExists(inputFile)) {
124623
- return {
124624
- type: ts.UpToDateStatusType.Unbuildable,
124625
- reason: inputFile + " does not exist"
124626
- };
124627
- }
124628
- if (!force) {
124629
- var inputTime = ts.getModifiedTime(host, inputFile);
124630
- if (inputTime > newestInputFileTime) {
124631
- newestInputFileName = inputFile;
124632
- newestInputFileTime = inputTime;
124633
- }
124634
- }
124635
- }
124871
+ var _a, _b, _c;
124636
124872
  // Container if no files are specified in the project
124637
124873
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
124638
124874
  return {
124639
124875
  type: ts.UpToDateStatusType.ContainerOnly
124640
124876
  };
124641
124877
  }
124642
- // Collect the expected outputs of this project
124643
- var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124644
- // Now see if all outputs are newer than the newest input
124645
- var oldestOutputFileName = "(none)";
124646
- var oldestOutputFileTime = maximumDate;
124647
- var newestOutputFileName = "(none)";
124648
- var newestOutputFileTime = minimumDate;
124649
- var missingOutputFileName;
124650
- var newestDeclarationFileContentChangedTime = minimumDate;
124651
- var isOutOfDateWithInputs = false;
124652
- if (!force) {
124653
- for (var _b = 0, outputs_1 = outputs; _b < outputs_1.length; _b++) {
124654
- var output = outputs_1[_b];
124655
- // Output is missing; can stop checking
124656
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124657
- if (!host.fileExists(output)) {
124658
- missingOutputFileName = output;
124659
- break;
124660
- }
124661
- var outputTime = ts.getModifiedTime(host, output);
124662
- if (outputTime < oldestOutputFileTime) {
124663
- oldestOutputFileTime = outputTime;
124664
- oldestOutputFileName = output;
124665
- }
124666
- // If an output is older than the newest input, we can stop checking
124667
- // Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
124668
- if (outputTime < newestInputFileTime) {
124669
- isOutOfDateWithInputs = true;
124670
- break;
124671
- }
124672
- if (outputTime > newestOutputFileTime) {
124673
- newestOutputFileTime = outputTime;
124674
- newestOutputFileName = output;
124675
- }
124676
- // Keep track of when the most recent time a .d.ts file was changed.
124677
- // In addition to file timestamps, we also keep track of when a .d.ts file
124678
- // had its file touched but not had its contents changed - this allows us
124679
- // to skip a downstream typecheck
124680
- if (ts.isDeclarationFileName(output)) {
124681
- var outputModifiedTime = ts.getModifiedTime(host, output);
124682
- newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
124683
- }
124684
- }
124685
- }
124686
- var pseudoUpToDate = false;
124687
- var usesPrepend = false;
124688
- var upstreamChangedProject;
124878
+ // Fast check to see if reference projects are buildable
124879
+ var referenceStatuses;
124880
+ var force = !!state.options.force;
124689
124881
  if (project.projectReferences) {
124690
124882
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
124691
- for (var _c = 0, _d = project.projectReferences; _c < _d.length; _c++) {
124692
- var ref = _d[_c];
124693
- usesPrepend = usesPrepend || !!(ref.prepend);
124883
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
124884
+ var ref = _d[_i];
124694
124885
  var resolvedRef = ts.resolveProjectReferencePath(ref);
124695
124886
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
124696
- var refStatus = getUpToDateStatus(state, parseConfigFile(state, resolvedRef, resolvedRefPath), resolvedRefPath);
124887
+ var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
124888
+ var refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
124697
124889
  // Its a circular reference ignore the status of this project
124698
124890
  if (refStatus.type === ts.UpToDateStatusType.ComputingUpstream ||
124699
124891
  refStatus.type === ts.UpToDateStatusType.ContainerOnly) { // Container only ignore this project
@@ -124715,75 +124907,170 @@ var ts;
124715
124907
  upstreamProjectName: ref.path
124716
124908
  };
124717
124909
  }
124718
- // Check oldest output file name only if there is no missing output file name
124719
- // (a check we will have skipped if this is a forced build)
124720
- if (!force && !missingOutputFileName) {
124721
- // If the upstream project's newest file is older than our oldest output, we
124722
- // can't be out of date because of it
124723
- if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
124724
- continue;
124725
- }
124726
- // If the upstream project has only change .d.ts files, and we've built
124727
- // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
124728
- if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
124729
- pseudoUpToDate = true;
124730
- upstreamChangedProject = ref.path;
124731
- continue;
124732
- }
124733
- // We have an output older than an upstream output - we are out of date
124734
- ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
124910
+ if (!force)
124911
+ (referenceStatuses || (referenceStatuses = [])).push({ ref: ref, refStatus: refStatus, resolvedRefPath: resolvedRefPath, resolvedConfig: resolvedConfig });
124912
+ }
124913
+ }
124914
+ if (force)
124915
+ return { type: ts.UpToDateStatusType.ForceBuild };
124916
+ // Check buildinfo first
124917
+ var host = state.host;
124918
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124919
+ var oldestOutputFileName = "(none)";
124920
+ var oldestOutputFileTime = maximumDate;
124921
+ var buildInfoTime;
124922
+ var newestDeclarationFileContentChangedTime;
124923
+ if (buildInfoPath) {
124924
+ var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
124925
+ buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
124926
+ if (buildInfoTime === ts.missingFileModifiedTime) {
124927
+ if (!buildInfoCacheEntry_1) {
124928
+ state.buildInfoCache.set(resolvedPath, {
124929
+ path: toPath(state, buildInfoPath),
124930
+ buildInfo: false,
124931
+ modifiedTime: buildInfoTime
124932
+ });
124933
+ }
124934
+ return {
124935
+ type: ts.UpToDateStatusType.OutputMissing,
124936
+ missingOutputFileName: buildInfoPath
124937
+ };
124938
+ }
124939
+ var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
124940
+ if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
124941
+ return {
124942
+ type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124943
+ version: buildInfo.version
124944
+ };
124945
+ }
124946
+ if (buildInfo.program) {
124947
+ if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
124948
+ (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) {
124735
124949
  return {
124736
- type: ts.UpToDateStatusType.OutOfDateWithUpstream,
124737
- outOfDateOutputFileName: oldestOutputFileName,
124738
- newerProjectName: ref.path
124950
+ type: ts.UpToDateStatusType.OutOfDateBuildInfo,
124951
+ buildInfoFile: buildInfoPath
124739
124952
  };
124740
124953
  }
124741
124954
  }
124955
+ oldestOutputFileTime = buildInfoTime;
124956
+ oldestOutputFileName = buildInfoPath;
124957
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
124742
124958
  }
124743
- if (missingOutputFileName !== undefined) {
124744
- return {
124745
- type: ts.UpToDateStatusType.OutputMissing,
124746
- missingOutputFileName: missingOutputFileName
124747
- };
124959
+ // Check input files
124960
+ var newestInputFileName = undefined;
124961
+ var newestInputFileTime = minimumDate;
124962
+ // Get timestamps of input files
124963
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
124964
+ var inputFile = _f[_e];
124965
+ var inputTime = getModifiedTime(state, inputFile);
124966
+ if (inputTime === ts.missingFileModifiedTime) {
124967
+ return {
124968
+ type: ts.UpToDateStatusType.Unbuildable,
124969
+ reason: inputFile + " does not exist"
124970
+ };
124971
+ }
124972
+ // If an buildInfo is older than the newest input, we can stop checking
124973
+ if (buildInfoTime && buildInfoTime < inputTime) {
124974
+ return {
124975
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
124976
+ outOfDateOutputFileName: buildInfoPath,
124977
+ newerInputFileName: inputFile
124978
+ };
124979
+ }
124980
+ if (inputTime > newestInputFileTime) {
124981
+ newestInputFileName = inputFile;
124982
+ newestInputFileTime = inputTime;
124983
+ }
124748
124984
  }
124749
- if (isOutOfDateWithInputs) {
124750
- return {
124751
- type: ts.UpToDateStatusType.OutOfDateWithSelf,
124752
- outOfDateOutputFileName: oldestOutputFileName,
124753
- newerInputFileName: newestInputFileName
124754
- };
124985
+ // Now see if all outputs are newer than the newest input
124986
+ // Dont check output timestamps if we have buildinfo telling us output is uptodate
124987
+ if (!buildInfoPath) {
124988
+ // Collect the expected outputs of this project
124989
+ var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
124990
+ var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
124991
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
124992
+ var output = outputs_1[_g];
124993
+ var path = toPath(state, output);
124994
+ // Output is missing; can stop checking
124995
+ var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
124996
+ if (!outputTime) {
124997
+ outputTime = ts.getModifiedTime(state.host, output);
124998
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.set(path, outputTime);
124999
+ }
125000
+ if (outputTime === ts.missingFileModifiedTime) {
125001
+ return {
125002
+ type: ts.UpToDateStatusType.OutputMissing,
125003
+ missingOutputFileName: output
125004
+ };
125005
+ }
125006
+ if (outputTime < oldestOutputFileTime) {
125007
+ oldestOutputFileTime = outputTime;
125008
+ oldestOutputFileName = output;
125009
+ }
125010
+ // If an output is older than the newest input, we can stop checking
125011
+ if (outputTime < newestInputFileTime) {
125012
+ return {
125013
+ type: ts.UpToDateStatusType.OutOfDateWithSelf,
125014
+ outOfDateOutputFileName: oldestOutputFileName,
125015
+ newerInputFileName: newestInputFileName
125016
+ };
125017
+ }
125018
+ }
124755
125019
  }
124756
- else {
124757
- // Check tsconfig time
124758
- var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
124759
- if (configStatus)
124760
- return configStatus;
124761
- // Check extended config time
124762
- var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
124763
- if (extendedConfigStatus)
124764
- return extendedConfigStatus;
124765
- // Check package file time
124766
- var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
124767
- var path = _a[0];
124768
- return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
124769
- });
124770
- if (dependentPackageFileStatus)
124771
- return dependentPackageFileStatus;
124772
- }
124773
- if (!force && !state.buildInfoChecked.has(resolvedPath)) {
124774
- state.buildInfoChecked.set(resolvedPath, true);
124775
- var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(project.options);
124776
- if (buildInfoPath) {
124777
- var value = state.readFileWithCache(buildInfoPath);
124778
- var buildInfo = value && ts.getBuildInfo(value);
124779
- if (buildInfo && (buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
125020
+ var seenRefs = buildInfoPath ? new ts.Set() : undefined;
125021
+ var buildInfoCacheEntry = state.buildInfoCache.get(resolvedPath);
125022
+ seenRefs === null || seenRefs === void 0 ? void 0 : seenRefs.add(resolvedPath);
125023
+ var pseudoUpToDate = false;
125024
+ var usesPrepend = false;
125025
+ var upstreamChangedProject;
125026
+ if (referenceStatuses) {
125027
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
125028
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
125029
+ usesPrepend = usesPrepend || !!(ref.prepend);
125030
+ // If the upstream project's newest file is older than our oldest output, we
125031
+ // can't be out of date because of it
125032
+ if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
125033
+ continue;
125034
+ }
125035
+ // Check if tsbuildinfo path is shared, then we need to rebuild
125036
+ if (buildInfoCacheEntry && hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath)) {
124780
125037
  return {
124781
- type: ts.UpToDateStatusType.TsVersionOutputOfDate,
124782
- version: buildInfo.version
125038
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125039
+ outOfDateOutputFileName: buildInfoPath,
125040
+ newerProjectName: ref.path
124783
125041
  };
124784
125042
  }
125043
+ // If the upstream project has only change .d.ts files, and we've built
125044
+ // *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
125045
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
125046
+ pseudoUpToDate = true;
125047
+ upstreamChangedProject = ref.path;
125048
+ continue;
125049
+ }
125050
+ // We have an output older than an upstream output - we are out of date
125051
+ ts.Debug.assert(oldestOutputFileName !== undefined, "Should have an oldest output filename here");
125052
+ return {
125053
+ type: ts.UpToDateStatusType.OutOfDateWithUpstream,
125054
+ outOfDateOutputFileName: oldestOutputFileName,
125055
+ newerProjectName: ref.path
125056
+ };
124785
125057
  }
124786
125058
  }
125059
+ // Check tsconfig time
125060
+ var configStatus = checkConfigFileUpToDateStatus(state, project.options.configFilePath, oldestOutputFileTime, oldestOutputFileName);
125061
+ if (configStatus)
125062
+ return configStatus;
125063
+ // Check extended config time
125064
+ var extendedConfigStatus = ts.forEach(project.options.configFile.extendedSourceFiles || ts.emptyArray, function (configFile) { return checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName); });
125065
+ if (extendedConfigStatus)
125066
+ return extendedConfigStatus;
125067
+ // Check package file time
125068
+ var dependentPackageFileStatus = ts.forEach(state.lastCachedPackageJsonLookups.get(resolvedPath) || ts.emptyArray, function (_a) {
125069
+ var path = _a[0];
125070
+ return checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName);
125071
+ });
125072
+ if (dependentPackageFileStatus)
125073
+ return dependentPackageFileStatus;
124787
125074
  if (usesPrepend && pseudoUpToDate) {
124788
125075
  return {
124789
125076
  type: ts.UpToDateStatusType.OutOfDateWithPrepend,
@@ -124796,12 +125083,30 @@ var ts;
124796
125083
  type: pseudoUpToDate ? ts.UpToDateStatusType.UpToDateWithUpstreamTypes : ts.UpToDateStatusType.UpToDate,
124797
125084
  newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
124798
125085
  newestInputFileTime: newestInputFileTime,
124799
- newestOutputFileTime: newestOutputFileTime,
124800
125086
  newestInputFileName: newestInputFileName,
124801
- newestOutputFileName: newestOutputFileName,
124802
125087
  oldestOutputFileName: oldestOutputFileName
124803
125088
  };
124804
125089
  }
125090
+ function hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig, resolvedRefPath) {
125091
+ if (seenRefs.has(resolvedRefPath))
125092
+ return false;
125093
+ seenRefs.add(resolvedRefPath);
125094
+ var refBuildInfo = state.buildInfoCache.get(resolvedRefPath);
125095
+ if (refBuildInfo.path === buildInfoCacheEntry.path)
125096
+ return true;
125097
+ if (resolvedConfig.projectReferences) {
125098
+ // Check references
125099
+ for (var _i = 0, _a = resolvedConfig.projectReferences; _i < _a.length; _i++) {
125100
+ var ref = _a[_i];
125101
+ var resolvedRef = ts.resolveProjectReferencePath(ref);
125102
+ var resolvedRefPath_1 = toResolvedConfigFilePath(state, resolvedRef);
125103
+ var resolvedConfig_1 = parseConfigFile(state, resolvedRef, resolvedRefPath_1);
125104
+ if (hasSameBuildInfo(state, buildInfoCacheEntry, seenRefs, resolvedConfig_1, resolvedRefPath_1))
125105
+ return true;
125106
+ }
125107
+ }
125108
+ return false;
125109
+ }
124805
125110
  function getUpToDateStatus(state, project, resolvedPath) {
124806
125111
  if (project === undefined) {
124807
125112
  return { type: ts.UpToDateStatusType.Unbuildable, reason: "File deleted mid-build" };
@@ -124814,39 +125119,65 @@ var ts;
124814
125119
  state.projectStatus.set(resolvedPath, actual);
124815
125120
  return actual;
124816
125121
  }
124817
- function updateOutputTimestampsWorker(state, proj, priorNewestUpdateTime, verboseMessage, skipOutputs) {
125122
+ function updateOutputTimestampsWorker(state, proj, projectPath, verboseMessage, skipOutputs) {
124818
125123
  if (proj.options.noEmit)
124819
- return priorNewestUpdateTime;
125124
+ return;
125125
+ var now;
125126
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(proj.options);
125127
+ if (buildInfoPath) {
125128
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(toPath(state, buildInfoPath)))) {
125129
+ if (!!state.options.verbose)
125130
+ reportStatus(state, verboseMessage, proj.options.configFilePath);
125131
+ state.host.setModifiedTime(buildInfoPath, now = getCurrentTime(state.host));
125132
+ getBuildInfoCacheEntry(state, buildInfoPath, projectPath).modifiedTime = now;
125133
+ }
125134
+ state.outputTimeStamps.delete(projectPath);
125135
+ return;
125136
+ }
124820
125137
  var host = state.host;
124821
125138
  var outputs = ts.getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
125139
+ var outputTimeStampMap = getOutputTimeStampMap(state, projectPath);
125140
+ var modifiedOutputs = outputTimeStampMap ? new ts.Set() : undefined;
124822
125141
  if (!skipOutputs || outputs.length !== skipOutputs.size) {
124823
125142
  var reportVerbose = !!state.options.verbose;
124824
- var now = host.now ? host.now() : new Date();
124825
125143
  for (var _i = 0, outputs_2 = outputs; _i < outputs_2.length; _i++) {
124826
125144
  var file = outputs_2[_i];
124827
- if (skipOutputs && skipOutputs.has(toPath(state, file))) {
125145
+ var path = toPath(state, file);
125146
+ if (skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(path))
124828
125147
  continue;
124829
- }
124830
125148
  if (reportVerbose) {
124831
125149
  reportVerbose = false;
124832
125150
  reportStatus(state, verboseMessage, proj.options.configFilePath);
124833
125151
  }
124834
- if (ts.isDeclarationFileName(file)) {
124835
- priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
125152
+ host.setModifiedTime(file, now || (now = getCurrentTime(state.host)));
125153
+ if (outputTimeStampMap) {
125154
+ outputTimeStampMap.set(path, now);
125155
+ modifiedOutputs.add(path);
124836
125156
  }
124837
- host.setModifiedTime(file, now);
124838
125157
  }
124839
125158
  }
124840
- return priorNewestUpdateTime;
125159
+ // Clear out timestamps not in output list any more
125160
+ outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.forEach(function (_value, key) {
125161
+ if (!(skipOutputs === null || skipOutputs === void 0 ? void 0 : skipOutputs.has(key)) && !modifiedOutputs.has(key))
125162
+ outputTimeStampMap.delete(key);
125163
+ });
125164
+ }
125165
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
125166
+ var _a;
125167
+ if (!options.composite)
125168
+ return undefined;
125169
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
125170
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, /*modifiedTime*/ undefined);
125171
+ return ((_a = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.program) === null || _a === void 0 ? void 0 : _a.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
124841
125172
  }
124842
125173
  function updateOutputTimestamps(state, proj, resolvedPath) {
124843
125174
  if (state.options.dry) {
124844
125175
  return reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath);
124845
125176
  }
124846
- var priorNewestUpdateTime = updateOutputTimestampsWorker(state, proj, minimumDate, ts.Diagnostics.Updating_output_timestamps_of_project_0);
125177
+ updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
124847
125178
  state.projectStatus.set(resolvedPath, {
124848
125179
  type: ts.UpToDateStatusType.UpToDate,
124849
- newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
125180
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
124850
125181
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
124851
125182
  });
124852
125183
  }
@@ -125039,12 +125370,10 @@ var ts;
125039
125370
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
125040
125371
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
125041
125372
  return;
125042
- state.allWatchedConfigFiles.set(resolvedPath, state.watchFile(resolved, function () {
125043
- invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full);
125044
- }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125373
+ state.allWatchedConfigFiles.set(resolvedPath, watchFile(state, resolved, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved));
125045
125374
  }
125046
125375
  function watchExtendedConfigFiles(state, resolvedPath, parsed) {
125047
- ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () {
125376
+ ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(state, extendedConfigFileName, function () {
125048
125377
  var _a;
125049
125378
  return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) {
125050
125379
  return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full);
@@ -125076,7 +125405,7 @@ var ts;
125076
125405
  if (!state.watch)
125077
125406
  return;
125078
125407
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedInputFiles, resolvedPath), ts.arrayToMap(parsed.fileNames, function (fileName) { return toPath(state, fileName); }), {
125079
- createNewValue: function (_path, input) { return state.watchFile(input, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.Low, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.SourceFile, resolved); },
125408
+ createNewValue: function (_path, input) { return watchFile(state, input, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.Low, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.SourceFile, resolved); },
125080
125409
  onDeleteValue: ts.closeFileWatcher,
125081
125410
  });
125082
125411
  }
@@ -125084,7 +125413,7 @@ var ts;
125084
125413
  if (!state.watch || !state.lastCachedPackageJsonLookups)
125085
125414
  return;
125086
125415
  ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
125087
- createNewValue: function (path, _input) { return state.watchFile(path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
125416
+ createNewValue: function (path, _input) { return watchFile(state, path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Full); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
125088
125417
  onDeleteValue: ts.closeFileWatcher,
125089
125418
  });
125090
125419
  }
@@ -125216,19 +125545,18 @@ var ts;
125216
125545
  }
125217
125546
  }
125218
125547
  function reportUpToDateStatus(state, configFileName, status) {
125219
- if (state.options.force && (status.type === ts.UpToDateStatusType.UpToDate || status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes)) {
125220
- return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125221
- }
125222
125548
  switch (status.type) {
125223
125549
  case ts.UpToDateStatusType.OutOfDateWithSelf:
125224
- return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerInputFileName));
125550
+ return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerInputFileName));
125225
125551
  case ts.UpToDateStatusType.OutOfDateWithUpstream:
125226
- return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName));
125552
+ return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName));
125227
125553
  case ts.UpToDateStatusType.OutputMissing:
125228
125554
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName));
125555
+ case ts.UpToDateStatusType.OutOfDateBuildInfo:
125556
+ return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_are_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile));
125229
125557
  case ts.UpToDateStatusType.UpToDate:
125230
125558
  if (status.newestInputFileTime !== undefined) {
125231
- return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, relName(state, configFileName), relName(state, status.newestInputFileName || ""), relName(state, status.oldestOutputFileName || ""));
125559
+ return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2, relName(state, configFileName), relName(state, status.newestInputFileName || ""), relName(state, status.oldestOutputFileName || ""));
125232
125560
  }
125233
125561
  // Don't report anything for "up to date because it was already built" -- too verbose
125234
125562
  break;
@@ -125246,6 +125574,8 @@ var ts;
125246
125574
  return reportStatus(state, ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(state, configFileName), status.reason);
125247
125575
  case ts.UpToDateStatusType.TsVersionOutputOfDate:
125248
125576
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2, relName(state, configFileName), status.version, ts.version);
125577
+ case ts.UpToDateStatusType.ForceBuild:
125578
+ return reportStatus(state, ts.Diagnostics.Project_0_is_being_forcibly_rebuilt, relName(state, configFileName));
125249
125579
  case ts.UpToDateStatusType.ContainerOnly:
125250
125580
  // Don't report status on "solution" projects
125251
125581
  // falls through
@@ -158548,6 +158878,7 @@ var ts;
158548
158878
  var fixName = "addVoidToPromise";
158549
158879
  var fixId = "addVoidToPromise";
158550
158880
  var errorCodes = [
158881
+ ts.Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,
158551
158882
  ts.Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
158552
158883
  ];
158553
158884
  codefix.registerCodeFix({